Tower: unpublish om_fiscal_year — remove source from 19.0 branch
This commit is contained in:
@@ -1 +0,0 @@
|
||||
from . import change_lock_date
|
||||
@@ -1,60 +0,0 @@
|
||||
from odoo import models, fields, api, SUPERUSER_ID, _
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class ChangeLockDate(models.TransientModel):
|
||||
_name = 'change.lock.date'
|
||||
_description = 'Change Lock Date'
|
||||
|
||||
@api.model
|
||||
def default_get(self, vals):
|
||||
res = super(ChangeLockDate, self).default_get(vals)
|
||||
company_rec = self.env.user.company_id
|
||||
res.update({
|
||||
'company_id': company_rec.id,
|
||||
'hard_lock_date': company_rec.hard_lock_date,
|
||||
'fiscalyear_lock_date': company_rec.fiscalyear_lock_date,
|
||||
'purchase_lock_date': company_rec.purchase_lock_date,
|
||||
'sale_lock_date': company_rec.sale_lock_date,
|
||||
'tax_lock_date': company_rec.tax_lock_date,
|
||||
})
|
||||
return res
|
||||
|
||||
company_id = fields.Many2one(
|
||||
'res.company', string="Company",
|
||||
required=True, default=lambda self: self.env.user.company_id
|
||||
)
|
||||
tax_lock_date = fields.Date(
|
||||
string="Tax Return Lock Date",
|
||||
help="No users can edit journal entries related to a tax prior and inclusive of this date.")
|
||||
sale_lock_date = fields.Date(
|
||||
string='Sales Lock Date',
|
||||
help='Prevents creation and modification of entries in sales journals up to the defined date inclusive.'
|
||||
)
|
||||
purchase_lock_date = fields.Date(
|
||||
string='Purchase Lock date',
|
||||
help='Prevents creation and modification of entries in purchase journals up to the defined date inclusive.'
|
||||
)
|
||||
hard_lock_date = fields.Date(
|
||||
string='Hard Lock Date',
|
||||
help='Like the "Global Lock Date", but no exceptions are possible.'
|
||||
)
|
||||
fiscalyear_lock_date = fields.Date(
|
||||
string='Lock Date for All Users',
|
||||
default=lambda self: self.env.user.company_id.fiscalyear_lock_date,
|
||||
help='No users, including Advisers, can edit accounts prior to and inclusive of '
|
||||
'this date. Use it for fiscal year locking.'
|
||||
)
|
||||
|
||||
def update_lock_date(self):
|
||||
self.ensure_one()
|
||||
has_manager_group = self.env.user.has_group('account.group_account_manager')
|
||||
if not (has_manager_group or self.env.uid == SUPERUSER_ID):
|
||||
raise UserError(_("You Are Not Allowed To Perform This Operation"))
|
||||
self.company_id.sudo().write({
|
||||
'hard_lock_date': self.hard_lock_date,
|
||||
'fiscalyear_lock_date': self.fiscalyear_lock_date,
|
||||
'purchase_lock_date': self.purchase_lock_date,
|
||||
'sale_lock_date': self.sale_lock_date,
|
||||
'tax_lock_date': self.tax_lock_date,
|
||||
})
|
||||
@@ -1,50 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
|
||||
<record id="view_change_lock_date" model="ir.ui.view">
|
||||
<field name="name">change.lock.date.form</field>
|
||||
<field name="model">change.lock.date</field>
|
||||
<field name="arch" type="xml">
|
||||
<form>
|
||||
<sheet>
|
||||
<group>
|
||||
<group string="Management Closing">
|
||||
<field name="company_id"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
groups="base.group_multi_company"/>
|
||||
<field name="sale_lock_date"/>
|
||||
<field name="purchase_lock_date"/>
|
||||
<field name="tax_lock_date"/>
|
||||
</group>
|
||||
<group string="Account Period Closing">
|
||||
<field name="fiscalyear_lock_date"/>
|
||||
<field name="hard_lock_date"/>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
<footer>
|
||||
<button string="Save" name="update_lock_date" type="object" class="btn-primary"/>
|
||||
<button string="Cancel" class="btn-secondary" special="cancel"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_change_lock_date" model="ir.actions.act_window">
|
||||
<field name="name">Lock your Fiscal Period</field>
|
||||
<field name="res_model">change.lock.date</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_change_lock_date"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_action_change_lock_date"
|
||||
name="Lock Dates"
|
||||
action="action_view_change_lock_date"
|
||||
parent="account.menu_finance_entries"
|
||||
sequence="100"
|
||||
groups="account.group_account_manager"/>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user