Skip to content

Commit

Permalink
[16.0] purchase_packaging_default: default packaging return first pac…
Browse files Browse the repository at this point in the history
…kaging with purchase=True
  • Loading branch information
cyrilmanuel committed Jun 20, 2024
1 parent 2104054 commit 7d4740a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion purchase_packaging_default/models/purchase_order_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ class PurchaseOrderLine(models.Model):
def _get_default_packaging(self):
"""From product get 1st packaging found ordered by sequence"""
product_template = self.product_id.product_tmpl_id
return fields.first(product_template.packaging_ids)
breakpoint()
return fields.first(
product_template.packaging_ids.filtered(lambda p: p.purchase)
)

@api.onchange("product_id")
def _onchange_product_id(self):
Expand Down

0 comments on commit 7d4740a

Please sign in to comment.