[16.0] [IMP] subscription_oca adding analytic_distribution#1210
[16.0] [IMP] subscription_oca adding analytic_distribution#1210
Conversation
4d01ca5 to
3f4de81
Compare
rrebollo
left a comment
There was a problem hiding this comment.
Code Review: Great work! The code looks good to me (LGTM). Thank you for your contribution! We are testing this with a real customer. I'll talk with the functional team and they might do the review too.
There was a problem hiding this comment.
Aren't You forcing an analytic distribution even if there wasn't one in the source sale.order.line? Pardon my ignorance. Would you be so kind to explain me the use case?
There was a problem hiding this comment.
I checked something similar it's done in built-in sale_order addon in order to prepare invoice lines but: is this really analogue ?
There was a problem hiding this comment.
Method get_subscription_line_values is called to create a new subscription when sold (from sale.order): if sale.order.line has got an analytic_distribution then set it in subscription line, otherwise use the analytic account of Generated Project
AinohaBH
left a comment
There was a problem hiding this comment.
LGTM!
The sales flow linked to an analytical account: sales order → subscription → invoicing is executed correctly. And the gross margin is correctly reflected in the analytical accounts.
|
This PR has the |
|
@carlos-domatix merge? Thanks! |
|
@OCA/project-service-maintainers merge? Thanks! |
3f4de81 to
d622fb8
Compare
| "price_subtotal": self.price_subtotal, | ||
| "analytic_distribution": self.analytic_distribution | ||
| if self.analytic_distribution | ||
| else {self.project_id.analytic_account_id.id: 100} |
There was a problem hiding this comment.
Does this need project to be installed?
There was a problem hiding this comment.
The field project_id is introduced in sale_project : https://github.com/odoo/odoo/blob/16.0/addons/sale_project/models/sale_order_line.py#L15
There was a problem hiding this comment.
Right, thanks, we are going to put the changes in a dedicated module
Fix for PR OCA#1210
cb6afd5 to
187d1ab
Compare
Fix for PR OCA#1210
187d1ab to
d4c3e34
Compare
Propagating from sale orders and to invoices
Fix for PR OCA#1210
d4c3e34 to
4657b20
Compare
|
There hasn't been any activity on this pull request in the past 4 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. |
marcos-mendez
left a comment
There was a problem hiding this comment.
Automated Review -- Tests Failed
1. Root Cause
The test failure is caused by a database connection error, not directly due to the code changes in this PR. However, the changes introduce a dependency on the analytic_distribution field and the analytic.mixin, which may not be properly initialized or available in the test environment, especially in a minimal or isolated setup (e.g., runboat).
2. Suggested Fix
Ensure that the analytic.mixin is correctly inherited and that the analytic_distribution field is properly initialized in the SaleSubscriptionLine model. Specifically:
- In
sale_subscription_line.py, verify that the_inherit = "analytic.mixin"line is correctly placed before any field definitions that depend on it. - Ensure the
analytic_distributionfield is properly declared or inherited fromanalytic.mixin. - In
sale_order_line.py, make sureanalytic_distributionis correctly passed toget_subscription_line_values().
File: subscription_oca/models/sale_subscription_line.py
Line: 9
Fix: Confirm that _inherit = "analytic.mixin" is placed correctly and does not interfere with field definition order.
3. Additional Code Issues
- Missing field definition in
SaleSubscriptionLine: Theanalytic_distributionfield is expected to be provided byanalytic.mixin, but if the mixin is not properly loaded or not present in the Odoo environment, it could cause runtime errors. Ensureanalytic.mixinis always available or fallback gracefully.
4. Test Improvements
Add tests to ensure:
- The
analytic_distributionfield is correctly propagated fromSaleSubscriptionLinetoSaleOrderLineandAccountMoveLine. - The
analytic_distributionfield is visible in the view only whenanalytic.group_analytic_accountingis granted. - The
analytic_distributionis correctly computed and saved in bothsale.order.lineandaccount.move.lineduring subscription line creation.
Test Case Pattern (OCA):
Use TransactionCase or SavepointCase to test:
def test_analytic_distribution_inheritance(self):
# Create a subscription line with analytic distribution
# Check that it's correctly passed to sale order line
# Check that it's correctly passed to account move lineTags to use:
@tagged('post_install', 'manual_install')This ensures proper testing of inheritance and field propagation in a realistic Odoo environment.
⚠️ PR Aging Alert: CRITICAL
This PR by @eLBati has been waiting for 369 days — that is over 12 months without being merged or closed.
💤 No activity for 112 days. Has this PR been forgotten?
Every ignored PR is a contributor who might not come back. Review time matters. (OCA Aging Report)
Reciprocal Review Request
Hi everyone! I found some test failures on this PR and left detailed feedback above. I am happy to discuss or help debug. In the meantime, if any of you get a chance, I would appreciate a look at my open PR(s):
My open PRs across OCA:
- server-tools#3548 [18.0][MIG] base_kanban_stage: Migration to 18.0
- hr-attendance#262 [16.0][ADD] Hr_attendance_idsecure: iDSecure (ControliD) attendance integration
- stock-logistics-workflow#2276 [16.0][ADD] stock_move_line_devaluation
- stock-logistics-workflow#2275 [16.0][ADD] Stock move line analytic account
- stock-logistics-workflow#2268 [16.0][ADD] stock_move_line_picking_partner
- purchase-workflow#2694 [16.0][IMP]Purchase workflow added to review state & exception fix
Reviewing each other's work helps the whole community move forward. Thank you!
Environment via OCA Neural Reviewer: Minikube + K8s Job + oca-ci/py3.10-odoo16.0 | Odoo 16.0
Automated review by OCA Neural Reviewer + qwen3-coder:30b
|
BOT now working as it should. Gonna open an Issue to fix it thanks for beeing patiente with my work |
Propagating from sale orders and to invoices