2
0

account_lock_date_update: add tax_lock_date

Improve some strings. Simplify menu entry string.
Update tests for tax_lock_date.
This commit is contained in:
Alexis de Lattre 2021-11-18 19:14:45 +01:00 committed by syera bonneaux
parent bef11da3cb
commit 82a859e1c9
5 changed files with 33 additions and 14 deletions

View File

@ -1,2 +1,2 @@
Allow an Account adviser to update locking date without having
Allow an Account adviser to update locking dates without having
access to all technical settings.

View File

@ -1,4 +1,4 @@
To use this module, you need to be a Billing Administrator and go to:
* Invoicing -> Accounting -> Actions -> Update accounting lock dates
* Change values and click on update button
* Change values and click on **Update** button

View File

@ -28,7 +28,11 @@ class TestAccountLockDateUpdate(TransactionCase):
.create({"company_id": self.company.id})
)
wizard.write(
{"period_lock_date": "2000-02-01", "fiscalyear_lock_date": "2000-01-01"}
{
"period_lock_date": "2000-02-01",
"fiscalyear_lock_date": "2000-01-01",
"tax_lock_date": "2000-01-01",
}
)
wizard.with_user(self.demo_user.id).execute()
self.assertEqual(
@ -37,3 +41,6 @@ class TestAccountLockDateUpdate(TransactionCase):
self.assertEqual(
fields.Date.to_string(self.company.fiscalyear_lock_date), "2000-01-01"
)
self.assertEqual(
fields.Date.to_string(self.company.tax_lock_date), "2000-01-01"
)

View File

@ -17,11 +17,16 @@ class AccountUpdateLockDate(models.TransientModel):
"open fiscal year, for example.",
)
fiscalyear_lock_date = fields.Date(
string="Lock Date",
string="Lock Date for All Users",
help="No users, including Advisers, can edit accounts prior to and "
"inclusive of this date. Use it for fiscal year locking for "
"example.",
)
tax_lock_date = fields.Date(
string="Tax Lock Date",
help="No users can edit journal entries related to a tax prior and "
"inclusive of this date.",
)
@api.model
def default_get(self, field_list):
@ -32,6 +37,7 @@ class AccountUpdateLockDate(models.TransientModel):
"company_id": company.id,
"period_lock_date": company.period_lock_date,
"fiscalyear_lock_date": company.fiscalyear_lock_date,
"tax_lock_date": company.tax_lock_date,
}
)
return res
@ -49,5 +55,6 @@ class AccountUpdateLockDate(models.TransientModel):
{
"period_lock_date": self.period_lock_date,
"fiscalyear_lock_date": self.fiscalyear_lock_date,
"tax_lock_date": self.tax_lock_date,
}
)

View File

@ -9,16 +9,21 @@
<field name="model">account.update.lock_date</field>
<field name="arch" type="xml">
<form>
<header />
<sheet>
<group id="main">
<group id="main-left">
<field name="company_id" invisible="1" />
<field name="period_lock_date" />
</group>
<group id="main-right">
<field name="fiscalyear_lock_date" />
</group>
<field
name="tax_lock_date"
options="{'datepicker': {'warn_future': true}}"
/>
<field
name="period_lock_date"
options="{'datepicker': {'warn_future': true}}"
/>
<field
name="fiscalyear_lock_date"
options="{'datepicker': {'warn_future': true}}"
/>
</group>
</sheet>
<footer>
@ -34,13 +39,13 @@
</field>
</record>
<record id="account_update_lock_date_act_window" model="ir.actions.act_window">
<field name="name">Update accounting lock dates</field>
<field name="name">Update Lock Dates</field>
<field name="res_model">account.update.lock_date</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="account_update_lock_date_menu" model="ir.ui.menu">
<field name="name">Update accounting lock dates</field>
<field name="name">Update Lock Dates</field>
<field name="parent_id" ref="account.menu_finance_entries_actions" />
<field name="action" ref="account_update_lock_date_act_window" />
<field name="sequence" eval="70" />