account_usability: Add constraint on account.journal

reconcile=False by default on suspense account.
This commit is contained in:
Alexis de Lattre
2022-07-01 08:41:56 +02:00
parent 6f27b13bf9
commit 627c5980c9
2 changed files with 6 additions and 1 deletions

View File

@@ -21,6 +21,11 @@ class AccountJournal(models.Model):
'account.account.type',
default=lambda self: self.env.ref('account.data_account_type_current_assets').id)
# SQL constraint in the 'account' module: unique(code, name, company_id) !!!
_sql_constraints = [(
'code_unique', 'unique(code, company_id)',
'Another journal already has this code in this company!')]
@api.depends(
'name', 'currency_id', 'company_id', 'company_id.currency_id', 'code')
def name_get(self):

View File

@@ -17,7 +17,7 @@
<field name="account_type_current_assets_id" invisible="1"/>
</field>
<field name="suspense_account_id" position="attributes">
<attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>
<attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': False}</attribute>
</field>
<field name="payment_debit_account_id" position="attributes">
<attribute name="context">{'default_user_type_id': account_type_current_assets_id, 'default_reconcile': True}</attribute>