Skip to content

Commit

Permalink
Merge pull request #48 from Escodoo/14.0-fix-egd_analytic_custom
Browse files Browse the repository at this point in the history
[14.0][FIX][egd_analytic_custom][egd_purchase_request_custom]: fix blanket order search
  • Loading branch information
marcelsavegnago authored Apr 15, 2024
2 parents 709ca87 + 96a22d4 commit 3c829bb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion egd_analytic_custom/models/account_analytic_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _compute_egd_target_value(self):
blanket_order = record.env["sale.blanket.order"].search(
[("analytic_account_id", "=", account_analytic.id)],
limit=1,
order="write_date desc",
order="create_date asc",
)
if blanket_order:
product = blanket_order.egd_order_product_ids.search(
Expand Down
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 3c829bb

Please sign in to comment.