What is 'states' used in the following definition in the class AccountInvoice?
partner_bank_id = fields.Many2one('res.partner.bank', string='Bank Account',
help='Bank Account Number to which the invoice will be paid. A Company bank account if this is a Customer Invoice or Vendor Refund, otherwise a Partner bank account number.',
readonly=True, states={'draft': [('readonly', False)]})
As I understand the field must be readonly except when the field 'states' is equal to 'draft' but this class has not got the field 'states'. Or am I wrong?
And I want to change partner_bank_id field of account.invoice to be writable but it does not work, the field stays the same.
# -*- coding: utf-8 -*-
from openerp import api, fields, models, _
class AccountInvoice(models.Model):
_inherit = "account.invoice"
partner_bank_id = fields.Many2one('res.partner.bank', string='Account',readonly=False)
partner_bank_id is invisible on the form.
Are you sure you don't want to modify the journal_id field?
I added it to my form and want to edit.
Thanks a lot to for help.
Sorry I am not sure I am seeing the whole picture. What functionality are you trying to achieve? Is it the ability to add a bank account to a partner via the invoice form or is it the ability to select the bank account for a partner from multiple configured?
Also, what does the view definition look like? Perhaps you have the partner_bank_id field twice?
I want to choose the bank account to print it in an invoice.
Yeh, the partner_bank_id field is already in the invoice_supplier_form on 'other info' page.
Fields don't work correctly if they are visible more than once on a form. Have you tried to show the field only once?
Everything works perfectly. Thanks.