[FIX] stock: Display translated picking description in delivery slip
Issue - Install English and French languages - Create a customer contact and assign french as his language - Create a product with correct names in both languages. For example 'French product name' and 'English product name' for easy reference. - Create an inventory transfer with the french customer as contact - Add the product that you created - Print > Delivery Slip The report will show in the lines: """ French product name English product name """ Cause Getting product description without checking partner language. Solution If partner is set, get product description with partner language in context. opw-2280490 closes odoo/odoo#54061 X-original-commit: cebe2cf57e68e2d1d54cd442aff6ba7d9554d043 Signed-off-by: Nicolas Martinelli (nim) <nim@odoo.com> Signed-off-by: bon-odoo <nboulif@users.noreply.github.com>
This commit is contained in:
@@ -450,7 +450,8 @@ class PurchaseOrderLine(models.Model):
|
||||
|
||||
def _prepare_stock_move_vals(self, picking, price_unit, product_uom_qty, product_uom):
|
||||
self.ensure_one()
|
||||
description_picking = self.product_id._get_description(self.order_id.picking_type_id)
|
||||
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
|
||||
return {
|
||||
|
||||
@@ -182,7 +182,8 @@ class StockMove(models.Model):
|
||||
@api.onchange('product_id', 'picking_type_id')
|
||||
def onchange_product(self):
|
||||
if self.product_id:
|
||||
self.description_picking = self.product_id._get_description(self.picking_type_id)
|
||||
product = self.product_id.with_context(lang=self.picking_id.partner_id.lang or self.env.user.lang)
|
||||
self.description_picking = product._get_description(self.picking_type_id)
|
||||
|
||||
@api.depends('has_tracking', 'picking_type_id.use_create_lots', 'picking_type_id.use_existing_lots', 'state')
|
||||
def _compute_display_assign_serial(self):
|
||||
|
||||
@@ -116,7 +116,8 @@ class StockMoveLine(models.Model):
|
||||
if not self.id and self.user_has_groups('stock.group_stock_multi_locations'):
|
||||
self.location_dest_id = self.location_dest_id._get_putaway_strategy(self.product_id) or self.location_dest_id
|
||||
if self.picking_id:
|
||||
self.description_picking = self.product_id._get_description(self.picking_id.picking_type_id)
|
||||
product = self.product_id.with_context(lang=self.picking_id.partner_id.lang or self.env.user.lang)
|
||||
self.description_picking = product._get_description(self.picking_id.picking_type_id)
|
||||
self.lots_visible = self.product_id.tracking != 'none'
|
||||
if not self.product_uom_id or self.product_uom_id.category_id != self.product_id.uom_id.category_id:
|
||||
if self.move_id.product_uom:
|
||||
|
||||
@@ -283,6 +283,9 @@ class StockRule(models.Model):
|
||||
date_expected = fields.Datetime.to_string(
|
||||
fields.Datetime.from_string(values['date_planned']) - relativedelta(days=self.delay or 0)
|
||||
)
|
||||
partner = self.partner_address_id or (values.get('group_id', False) and values['group_id'].partner_id)
|
||||
if partner:
|
||||
product_id = product_id.with_context(lang=partner.lang or self.env.user.lang)
|
||||
picking_description = product_id._get_description(self.picking_type_id)
|
||||
if values.get('product_description_variants'):
|
||||
picking_description += values['product_description_variants']
|
||||
@@ -300,7 +303,7 @@ class StockRule(models.Model):
|
||||
'product_id': product_id.id,
|
||||
'product_uom': product_uom.id,
|
||||
'product_uom_qty': qty_left,
|
||||
'partner_id': self.partner_address_id.id or (values.get('group_id', False) and values['group_id'].partner_id.id) or False,
|
||||
'partner_id': partner.id if partner else False,
|
||||
'location_id': self.location_src_id.id,
|
||||
'location_dest_id': location_id.id,
|
||||
'move_dest_ids': move_dest_ids,
|
||||
|
||||
Reference in New Issue
Block a user