1
0
forked from Mapan/odoo17e
odoo17e-kedaikipas58/addons/stock_barcode_mrp/models/stock_picking.py
2024-12-10 09:04:09 +07:00

20 lines
683 B
Python

# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models
class StockPicking(models.Model):
_inherit = 'stock.picking'
def _get_stock_barcode_data(self):
data = super()._get_stock_barcode_data()
kit_boms = self.move_ids.bom_line_id.bom_id.filtered(lambda bom: bom.type == 'phantom')
if kit_boms:
packagings = (
kit_boms.mapped('product_id.packaging_ids') or
kit_boms.mapped('product_tmpl_id.packaging_ids')
)
data['records']['product.packaging'] += packagings.read(packagings._get_fields_stock_barcode(), load=False)
return data