I want that when you change the suplier in the Purchas Order, automatically change the description of the products in the order lines, meeting the code and the name of that supplier if it is specified in the product. The problem is that this code changes everything to the first value. What can I do to go line by line checking the product name and not putting all time the same
@api.onchange('partner_id')
def _onchange_partner_id(self):
for order in self:
product_lang = self.product_id.with_context(
lang=self.partner_id.lang,
partner_id=self.partner_id.id,
)
self.name = product_lang.display_name
if product_lang.description_purchase:
self.name += '\n' + product_lang.description_purchase
for line in order.order_line:
line.name = self.name
Hi bro,
I edited my answer to match your odoo version V12, its right here :
https://www.odoo.com/fr_FR/forum/aide-1/question/change-products-when-supplier-is-changed-160405#answer-160425