Přejít na obsah
Menu
You need to be registered to interact with the community.
This question has been flagged
1 Odpovědět
647 Zobrazení

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
Zrušit
Nejlepší odpověď

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
Zrušit
Related Posts Odpovědi Zobrazení Aktivita
1
kvě 24
1090
0
dub 24
1219
0
dub 24
1160
0
dub 24
915
0
led 24
31