[FIX] base: res.partner.bank sequence
`res.partner.bank` is ordered by sequence, but: - there is no default value - there is no widget handle to set it Therefore, methods such as `_get_partner_bank_id` might retrieve an unexpected value. To avoid this: - we fallback to sort by ID - we add a default value - we add the widget handle opw-1948964 closes odoo/odoo#32300 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com>
This commit is contained in:
@@ -57,7 +57,7 @@ class ResPartnerBank(models.Model):
|
||||
_name = 'res.partner.bank'
|
||||
_rec_name = 'acc_number'
|
||||
_description = 'Bank Accounts'
|
||||
_order = 'sequence'
|
||||
_order = 'sequence, id'
|
||||
|
||||
acc_type = fields.Char(compute='_compute_acc_type', help='Bank account type, inferred from account number')
|
||||
acc_number = fields.Char('Account Number', required=True)
|
||||
@@ -66,7 +66,7 @@ class ResPartnerBank(models.Model):
|
||||
bank_id = fields.Many2one('res.bank', string='Bank')
|
||||
bank_name = fields.Char(related='bank_id.name')
|
||||
bank_bic = fields.Char(related='bank_id.bic')
|
||||
sequence = fields.Integer()
|
||||
sequence = fields.Integer(default=10)
|
||||
currency_id = fields.Many2one('res.currency', string='Currency')
|
||||
company_id = fields.Many2one('res.company', 'Company', default=lambda self: self.env.user.company_id, ondelete='cascade')
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<form string="Bank account">
|
||||
<group col="4">
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="acc_number"/>
|
||||
<field name="bank_id"/>
|
||||
<field name="currency_id" groups="base.group_multi_currency" options="{'no_create': True}"/>
|
||||
@@ -77,7 +78,7 @@
|
||||
<field name="model">res.partner.bank</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Bank Accounts">
|
||||
<field name="sequence" invisible="1"/>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="acc_number"/>
|
||||
<field name="bank_name"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
|
||||
Reference in New Issue
Block a user