Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
3148 Visualizzazioni

Hello there, 

I'm working on a mutli company environnement  , and want to be able to get a custom field from purchase order line being duplicated in the automatically generated sale order line. 

From what I can understand, I can inherit the method which is used to prepare the data, and add my custom field, but  it seems that I'm not good enough to do that.

What I have done so far is create a automatic action based upon sale order model with the following code : 


@api.model
def _prepare_sale_order_line_data(self, line, company, sale_id):
res = super(purchase_order, self)._prepare_sale_order_line_data(line, company, sale_id)
for po_line in self.order_line:
res.update({'x_studio_surcotes': po_line.x_studio_surcotes})
return res


But I've got an error when I confirm the purchase order which is supposed to generate the sale order

Am I doing it completely wrong here ? 


Thanks for your help !








Avatar
Abbandona
Post correlati Risposte Visualizzazioni Attività
2
lug 25
2397
3
lug 25
2808
1
lug 25
2017
3
nov 24
361
4
set 24
3473