I am using Odoo v8.
I have a situation in a services company where the final cost of providing a service may not be known until after the Invoice has been issued (validated) and sometimes it will have been paid.
An estimate of the cost price can be entered on the Sales Order Line. I have written a module to pass the Cost Price (price_unit) field to the Invoice Line on creation of the Invoice. Cost Price is editable whilst the Invoice is in “Draft” state. Once the Invoice is validated, none of the Invoice Line is editable. I need to make a change which will allow just my new Cost Price field to remain editable.
I can see in account_invoice.py that the invoice line is treated as one field which is only editable in the draft status :-
invoice_line = fields.One2many('account.invoice.line', 'invoice_id', string='Invoice Lines',
readonly=True, states={'draft': [('readonly', False)]}, copy=True)
So my question is how can I allow editing of an individual field on the invoice line with any status?