Skip to content

[ADD] account_perf_obligation_sale_qty_delivered - #79

Open
baimont wants to merge 1 commit into
18.0from
bai_delivery_dates
Open

[ADD] account_perf_obligation_sale_qty_delivered#79
baimont wants to merge 1 commit into
18.0from
bai_delivery_dates

Conversation

@baimont

@baimont baimont commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@baimont baimont self-assigned this Jul 23, 2026
@baimont
baimont marked this pull request as draft July 23, 2026 13:21
@codecov-commenter

codecov-commenter commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.23077% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 96.76%. Comparing base (a2ba19d) to head (b4a3a22).

Files with missing lines Patch % Lines
...ation_sale_qty_delivered/models/sale_order_line.py 88.46% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             18.0      #79      +/-   ##
==========================================
- Coverage   96.80%   96.76%   -0.05%     
==========================================
  Files          80       85       +5     
  Lines        3223     3275      +52     
  Branches      169      174       +5     
==========================================
+ Hits         3120     3169      +49     
- Misses         71       72       +1     
- Partials       32       34       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@baimont
baimont force-pushed the bai_delivery_dates branch from f734845 to 115f014 Compare July 28, 2026 15:50
@baimont
baimont marked this pull request as ready for review July 28, 2026 16:08
@baimont
baimont force-pushed the bai_delivery_dates branch from 115f014 to 660b62c Compare July 29, 2026 07:04
@baimont
baimont requested a review from sbidoul July 29, 2026 07:21
return base_line["tax_details"]["raw_total_excluded_currency"]

@api.constrains("qty_delivered")
def _check_perf_obligation_over_delivery(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is this method called?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not the right question. it's a constrains, so the right question is: when is this method called: when qty_delivered changes

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤦

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But but, a constraint is not supposed to have side effects.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that is, if you use them as intended: just to check and raise. as of now, in the account-performance-obligation project, we use them as intended. but we often use them, in other projects, as a shortcut for create and write override

here I could adapt and use the write only I guess

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but we often use them, in other projects, as a shortcut for create and write override

😱

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I adapted with create and write overrides

Comment thread account_perf_obligation_sale_qty_delivered/readme/CONTEXT.md Outdated
Comment thread account_perf_obligation_sale_qty_delivered/readme/CONTEXT.md Outdated
self.env["account.tax"]._add_tax_details_in_base_line(
base_line, self.company_id
)
return base_line["tax_details"]["raw_total_excluded_currency"]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this field name raw_total_excluded_currency, can you confirm that excluded means "tax excluded", and currency means company currency? Because the perf obligation amount is (currently) tax excluded, and in company currency.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In sale module (sale.order.line._compute_amount), price_subtotal is computed directly using raw_total_excluded_currency:
line.price_subtotal = base_line['tax_details']['raw_total_excluded_currency']
Since _get_perf_obligation_amount() in account_perf_obligation_sale returns self.price_subtotal (which is in the sale order currency), using raw_total_excluded_currency maintains consistency with the account_perf_obligation_sale module.

excluded means "tax excluded" yes
but currency does not mean company currency, it means the record currency

@baimont
baimont force-pushed the bai_delivery_dates branch from 660b62c to 6af3baf Compare July 29, 2026 08:28
@baimont
baimont force-pushed the bai_delivery_dates branch from 6af3baf to b4a3a22 Compare July 29, 2026 08:56
@baimont
baimont requested a review from sbidoul July 29, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants