Skip to content

Commit a9adda4

Browse files
Merge PR beescoop#540 into 12.0
Signed-off-by huguesdk
2 parents 191dd65 + 1b4114a commit a9adda4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

purchase_order_generator/models/purchase_order_generator.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,19 @@ def create_purchase_order(self):
127127
for cpo_line in self.pog_line_ids:
128128
if cpo_line.purchase_quantity > 0:
129129
product = cpo_line.product_template_id.product_variant_id
130+
131+
# name definition copied from purchase/models/purchase.py:593
132+
product_lang = product.with_context(
133+
lang=purchase_order.partner_id.lang,
134+
partner_id=purchase_order.partner_id.id,
135+
)
136+
pol_name = product_lang.display_name
137+
if product_lang.description_purchase:
138+
pol_name += "\n" + product_lang.description_purchase
139+
130140
pol = self.env["purchase.order.line"].create(
131141
{
132-
"name": cpo_line.name,
142+
"name": pol_name,
133143
"product_id": product.id,
134144
"product_qty": cpo_line.purchase_quantity,
135145
"price_unit": cpo_line.product_price,
@@ -138,7 +148,6 @@ def create_purchase_order(self):
138148
"date_planned": self.date_planned,
139149
}
140150
)
141-
pol.onchange_product_id()
142151
pol.compute_taxes_id()
143152

144153
self.generated_purchase_order_ids += purchase_order

0 commit comments

Comments
 (0)