Skip to content

Commit

Permalink
Code Review
Browse files Browse the repository at this point in the history
  • Loading branch information
majouda committed Nov 4, 2024
1 parent c1019a1 commit ccfde06
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions stock_picking_product_supplier/models/stock_move_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ class StockMoveLine(models.Model):
"picking_id.partner_id", "product_id", "product_id.seller_ids.name"
)
def _compute_product_supplier_name(self):
self.write({"product_supplier_name" : False})
for line in self.filtered(
lambda l: l.picking_id
and l.picking_id.partner_id
and l.product_id.product_tmpl_id.seller_ids
):
suppliers = line.product_id.product_tmpl_id.seller_ids.filtered(
lambda l: l.name == line.picking_id.partner_id
)
if suppliers:
line.product_supplier_name = suppliers[0].name.name
for line in self:
line.product_supplier_name = False
partner = line.picking_id.partner_id
if partner and line.product_id.product_tmpl_id.seller_ids:
suppliers = line.product_id.product_tmpl_id.seller_ids.filtered(
lambda s: s.name == partner
)
if suppliers:
line.product_supplier_name = suppliers[0].name.name

0 comments on commit ccfde06

Please sign in to comment.