[FIX] account: required default account on journal
The default account was marked as required in the view (bold underline) but the validation didn't happen. This made it possible to set up journals without that required field. Since owl, only the last `required` attribute is remembered, so we need to define it at least correctly on the last field declaration. Related:48ef812a63bd6b98a65fopw-3061073 closes odoo/odoo#108173 X-original-commit: 7628888d61843ed9e9b76039884572e923ba382f Signed-off-by: Nicolas Viseur (vin) <vin@odoo.com>
This commit is contained in:
@@ -28,7 +28,6 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Account Journal">
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="default_account_id" invisible="1"/>
|
||||
<field name="bank_statements_source" invisible="1"/>
|
||||
<sheet>
|
||||
<div name="button_box" class="oe_button_box">
|
||||
@@ -56,38 +55,28 @@
|
||||
<group>
|
||||
<group string="Accounting Information">
|
||||
<field name="default_account_type" invisible="1"/>
|
||||
<!-- Bank -->
|
||||
<field name="default_account_id" string="Bank Account"
|
||||
attrs="{'required': [('id', '!=', False), ('type', '=', 'bank')], 'invisible': [('type', '!=', 'bank')]}"
|
||||
<label for="default_account_id" string="Bank Account"
|
||||
attrs="{'invisible': [('type', '!=', 'bank')]}" groups="account.group_account_readonly"/>
|
||||
<label for="default_account_id" string="Cash Account"
|
||||
attrs="{'invisible': [('type', '!=', 'cash')]}" groups="account.group_account_readonly"/>
|
||||
<label for="default_account_id" string="Default Income Account"
|
||||
attrs="{'invisible': [('type', '!=', 'sale')]}" groups="account.group_account_readonly"/>
|
||||
<label for="default_account_id" string="Default Expense Account"
|
||||
attrs="{'invisible': [('type', '!=', 'purchase')]}" groups="account.group_account_readonly"/>
|
||||
<label for="default_account_id" string="Default Account"
|
||||
help="If set, this account is used to automatically balance entries."
|
||||
attrs="{'invisible': [('type', '!=', 'general')]}" groups="account.group_account_readonly"/>
|
||||
<field name="default_account_id" nolabel="1"
|
||||
attrs="{'required': ['|', '&', ('id', '!=', False), ('type', 'in', ('bank', 'cash')), ('type', 'in', ('sale', 'purchase'))],
|
||||
'invisible': [('type', '=', False)]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
<!-- Cash -->
|
||||
<field name="default_account_id" string="Cash Account"
|
||||
attrs="{'required': [('id', '!=', False), ('type', '=', 'cash')], 'invisible': [('type', '!=', 'cash')]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
|
||||
<field name="suspense_account_id"
|
||||
attrs="{'required': [('type', 'in', ('bank', 'cash'))], 'invisible': [('type', 'not in', ('bank', 'cash'))]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
<field name="profit_account_id" attrs="{'invisible': ['!', ('type', 'in', ('cash', 'bank'))]}"/>
|
||||
<field name="loss_account_id" attrs="{'invisible': ['!', ('type', 'in', ('cash', 'bank'))]}"/>
|
||||
<!-- Sales -->
|
||||
<field name="default_account_id" string="Default Income Account"
|
||||
attrs="{'required': [('type', '=', 'sale')], 'invisible': [('type', '!=', 'sale')]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
<!-- Purchase -->
|
||||
<field name="default_account_id" string="Default Expense Account"
|
||||
attrs="{'required': [('type', '=', 'purchase')], 'invisible': [('type', '!=', 'purchase')]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
<!-- Misc -->
|
||||
<field name="default_account_id" help="If set, this account is used to automatically balance entries."
|
||||
attrs="{'invisible': [('type', '!=', 'general')]}"
|
||||
options="{'no_quick_create': True}"
|
||||
groups="account.group_account_readonly"/>
|
||||
<field name="refund_sequence" attrs="{'invisible': [('type', 'not in', ['sale', 'purchase'])]}"/>
|
||||
<field name="payment_sequence" attrs="{'invisible': [('type', 'not in', ('bank', 'cash'))]}"/>
|
||||
<field name="code" placeholder="e.g. INV"/>
|
||||
|
||||
Reference in New Issue
Block a user