Skip to content

Commit

Permalink
[FIX] egd_purchase_request_custom: set limit to 1 in blanket order se…
Browse files Browse the repository at this point in the history
…arch
  • Loading branch information
WesleyOliveira98 committed Oct 8, 2024
1 parent 4eb4436 commit 88faaba
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions egd_purchase_request_custom/models/purchase_request_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,24 @@ def _compute_egd_target_value(self):
if record.analytic_account_id:
account_analytic = record.analytic_account_id
if account_analytic:
blanket_orders = record.env["sale.blanket.order"].search(
[("analytic_account_id", "=", account_analytic.id)]
blanket_order = record.env["sale.blanket.order"].search(
[("analytic_account_id", "=", account_analytic.id)],
limit=1,
order="create_date asc",
)
if blanket_orders:
product = blanket_orders.egd_order_product_ids.search(
if blanket_order:
product = blanket_order.egd_order_product_ids.search(
[
("product_id", "=", record.product_id.id),
("blanket_order_id", "=", blanket_orders.id),
("blanket_order_id", "=", blanket_order.id),
],
limit=1,
order="write_date desc",
)
service = blanket_orders.egd_order_service_ids.search(
service = blanket_order.egd_order_service_ids.search(
[
("product_id", "=", record.product_id.id),
("blanket_order_id", "=", blanket_orders.id),
("blanket_order_id", "=", blanket_order.id),
],
limit=1,
order="write_date desc",
Expand Down

0 comments on commit 88faaba

Please sign in to comment.