Skip to Content
Menú
This question has been flagged
1 Respondre
605 Vistes

Hello everyone,

I am facing an issue with Odoo version 17. The problem is related to the generation of delivery orders from sales orders. Specifically, when a product has variants, the delivery order generated by Odoo does not take into account the supplier product codes for these variants. Instead, it always uses the product code of the first variant.

This incorrect assignment of product codes is causing significant errors during order preparation, as our logistics team relies on these codes to accurately identify products.

Is there a solution or a workaround to ensure that the specific supplier product codes for variants are displayed on the picking and delivery orders?

Thank you in advance for your help!

Best regards,


Ian

Avatar
Descartar
Best Answer

Hii,

  1. Make sure supplier product codes exist for each product variant (not just on the product template) in Purchase > Products > Suppliers tab.
  2. Add this domain to the delivery order line’s product field or customize the picking report to show the variant’s default_code (which is unique per variant).
  3. For showing correct supplier product code on delivery orders:

​Create a computed field on stock.move.line to get the supplier code for the specific variant and supplier:

from odoo import models, fields, api


class StockMoveLine(models.Model):

    _inherit = 'stock.move.line'


    supplier_product_code = fields.Char(compute='_compute_supplier_product_code')


    @api.depends('product_id', 'move_id.picking_id.partner_id')

    def _compute_supplier_product_code(self):

        for line in self:

            supplier = line.move_id.picking_id.partner_id

            if line.product_id and supplier:

                info = self.env['product.supplierinfo'].search([

                    ('product_id', '=', supplier.id)

                ], limit=1)

                line.supplier_product_code = info.product_code if info else False

            else:

                line.supplier_product_code = False

Update your picking report or picking view to show supplier_product_code instead of default product code.

This will ensure the delivery order lines show the correct supplier product codes per variant.


Avatar
Descartar
Related Posts Respostes Vistes Activitat
1
de maig 24
1046
0
d’abr. 24
1196
0
d’abr. 24
1136
0
d’abr. 24
891
0
de gen. 24
31