[FIX][IMP] account: set invoice_warn as non required
When reinitializing modules it is impossible to create partners if account is installed because invoice_warn field has a required column but no default value if the module does not depend from account. Use case is trying to run test_mail tests with account installed. As this field is not business critical it is now not required. As there is a default value behavior should not change for users.
This commit is contained in:
@@ -662,7 +662,7 @@ class AccountInvoice(models.Model):
|
||||
# If partner has no warning, check its company
|
||||
if p.invoice_warn == 'no-message' and p.parent_id:
|
||||
p = p.parent_id
|
||||
if p.invoice_warn != 'no-message':
|
||||
if p.invoice_warn and p.invoice_warn != 'no-message':
|
||||
# Block if partner only has warning but parent company is blocked
|
||||
if p.invoice_warn != 'block' and p.parent_id and p.parent_id.invoice_warn == 'block':
|
||||
p = p.parent_id
|
||||
|
||||
@@ -414,7 +414,7 @@ class ResPartner(models.Model):
|
||||
contract_ids = fields.One2many('account.analytic.account', 'partner_id', string='Contracts', readonly=True)
|
||||
bank_account_count = fields.Integer(compute='_compute_bank_count', string="Bank")
|
||||
trust = fields.Selection([('good', 'Good Debtor'), ('normal', 'Normal Debtor'), ('bad', 'Bad Debtor')], string='Degree of trust you have in this debtor', default='normal', company_dependent=True)
|
||||
invoice_warn = fields.Selection(WARNING_MESSAGE, 'Invoice', help=WARNING_HELP, required=True, default="no-message")
|
||||
invoice_warn = fields.Selection(WARNING_MESSAGE, 'Invoice', help=WARNING_HELP, default="no-message")
|
||||
invoice_warn_msg = fields.Text('Message for Invoice')
|
||||
|
||||
@api.multi
|
||||
|
||||
@@ -151,7 +151,7 @@
|
||||
<separator string="Warning on the Invoice" colspan="4"/>
|
||||
<field name="invoice_warn" nolabel="1" />
|
||||
<field name="invoice_warn_msg" colspan="3" nolabel="1"
|
||||
attrs="{'required':[('invoice_warn','!=','no-message')],'readonly':[('invoice_warn','=','no-message')]}"/>
|
||||
attrs="{'required':[('invoice_warn', '!=', False), ('invoice_warn','!=','no-message')],'readonly':[('invoice_warn','=','no-message')]}"/>
|
||||
</group>
|
||||
</page>
|
||||
</field>
|
||||
|
||||
Reference in New Issue
Block a user