Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
5456 Vizualizări

Hii,

I have a custom field added in the header of the account.invoice. I have added the same custom filed to account.invoice.line.
When I create an Invoice directly or from PO I assign a value to this field.
How to pass custom field value to from invoice header to all lines?

I have done it  overriding write() and onchage() methods but no luck on create() method. 

How to pass it by overriding create() method.

I am doing it the following way but not working...

@api.model
def create(self, values):
result = super(FFTAccountInvoice, self).create(values)
     values.update({'invoice_line_ids': [(0, 0, {'shipment_id': result['shipment_id'].id})]})
     return result



Imagine profil
Abandonează
Autor Cel mai bun răspuns

The requirement can be achieved by overriding create() and write() methods, or even field onchage() method.
But I have done it by Related field as following and it is working fine with me..

class TTAccountInvoiceLine(models.Model):
_inherit = 'account.invoice.line'
    shipment_id = fields.Many2one('purchase.shipment', string='Shipment', related='invoice_id.shipment_id', store=True)

 in account.invoice i have custom filed shipment_id. So related='invoice_id.shipment_id'.

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
2
sept. 24
11081
1
iun. 23
2144
1
apr. 23
11201
1
iun. 22
2476
0
mar. 22
2