[IMP] purchase_stock: use PO description on receipts
In order to easily compare delivery slip from vendor and receipt, vendor product name and reference should be visible on the receipt operations. The receipt description was just the name of the product before, it is now taking the same description as the PO line, using vendor product name and reference if it exists. Task ID-2411544 closes odoo/odoo#62967 Signed-off-by: William Henrotin <Whenrow@users.noreply.github.com>
This commit is contained in:
@@ -430,9 +430,6 @@ class PurchaseOrderLine(models.Model):
|
||||
def _prepare_stock_move_vals(self, picking, price_unit, product_uom_qty, product_uom):
|
||||
self.ensure_one()
|
||||
product = self.product_id.with_context(lang=self.order_id.dest_address_id.lang or self.env.user.lang)
|
||||
description_picking = product._get_description(self.order_id.picking_type_id)
|
||||
if self.product_description_variants:
|
||||
description_picking += self.product_description_variants
|
||||
date_planned = self.date_planned or self.order_id.date_planned
|
||||
return {
|
||||
# truncate to 2000 to avoid triggering index limit error
|
||||
@@ -453,7 +450,7 @@ class PurchaseOrderLine(models.Model):
|
||||
'picking_type_id': self.order_id.picking_type_id.id,
|
||||
'group_id': self.order_id.group_id.id,
|
||||
'origin': self.order_id.name,
|
||||
'description_picking': description_picking,
|
||||
'description_picking': product.description_pickingin or self.name,
|
||||
'propagate_cancel': self.propagate_cancel,
|
||||
'route_ids': self.order_id.picking_type_id.warehouse_id and [(6, 0, [x.id for x in self.order_id.picking_type_id.warehouse_id.route_ids])] or [],
|
||||
'warehouse_id': self.order_id.picking_type_id.warehouse_id.id,
|
||||
|
||||
@@ -268,8 +268,8 @@ class TestPurchaseLeadTime(PurchaseTestCommon):
|
||||
self.assertEqual(purchase_order.order_line.filtered(lambda x: x.product_qty == 10).name, t_shirt.display_name + "\n" + order_line_description + "Color (Green)", 'wrong description in po lines')
|
||||
|
||||
purchase_order.button_confirm()
|
||||
self.assertEqual(purchase_order.picking_ids[0].move_ids_without_package.filtered(lambda x: x.product_uom_qty == 15).description_picking, order_line_description + "Color (Red)", 'wrong description in picking')
|
||||
self.assertEqual(purchase_order.picking_ids[0].move_ids_without_package.filtered(lambda x: x.product_uom_qty == 10).description_picking, order_line_description + "Color (Green)", 'wrong description in picking')
|
||||
self.assertEqual(purchase_order.picking_ids[0].move_ids_without_package.filtered(lambda x: x.product_uom_qty == 15).description_picking, t_shirt.display_name + "\n" + order_line_description + "Color (Red)", 'wrong description in picking')
|
||||
self.assertEqual(purchase_order.picking_ids[0].move_ids_without_package.filtered(lambda x: x.product_uom_qty == 10).description_picking, t_shirt.display_name + "\n" + order_line_description + "Color (Green)", 'wrong description in picking')
|
||||
|
||||
def test_reordering_days_to_purchase(self):
|
||||
company = self.env.ref('base.main_company')
|
||||
|
||||
Reference in New Issue
Block a user