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 !