-
-
Notifications
You must be signed in to change notification settings - Fork 770
[19.0][MIG] account_invoice_section_sale_order: Migration to 19.0 #2185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 19.0
Are you sure you want to change the base?
[19.0][MIG] account_invoice_section_sale_order: Migration to 19.0 #2185
Conversation
Description from the readme : When invoicing multiple sale orders at the same time, sale orders may be grouped by customer into a single invoice. Unfortunately when this happens, it is hard to know which invoice line belongs to which sale order. This module helps by grouping invoicing lines into sections with the name of the targeted sale order. This is only done when an invoice targets multiple sale order.
The function signature as changed in v14
[UPD] Update account_invoice_section_sale_order.pot [UPD] README.rst
Translated using Weblate (Spanish) Currently translated at 100.0% (1 of 1 strings) Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_section_sale_order Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_section_sale_order/es/
Refactor preparation of sections Refactor to allow different section grouping Add field to allow different possibilities of grouping invoice lines from sale order
…on tests
In OCA repo, now we have this error:
Traceback (most recent call last):
File "/__w/account-invoicing/account-invoicing/account_invoice_section_sale_order/tests/test_invoice_group_by_sale_order.py", line 109, in test_create_invoice
self.assertEqual(line.name, result[line.sequence][0])
KeyError: 1
Currently translated at 100.0% (18 of 18 strings) Translation: account-invoicing-17.0/account-invoicing-17.0-account_invoice_section_sale_order Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-17-0/account-invoicing-17-0-account_invoice_section_sale_order/it/
the `sale.order._create_invoices() method does not only requires `create` access to the `account.move` and `account.move.line` models. Because we're actually sorting lines after the creating, it requires `read` access to sort, and `write` access to modify their sequence. This is problematic when interracting with other modules like `invoice_mode_at_shipping` where stock users are the ones to create invoices. This commit adds a few `sudo()` in the code, in order to avoid granting `read` and `write` access to users that shouldn't be allowed to read and write invoices.
81d353b to
0fccec7
Compare
663b2e9 to
dd00400
Compare
luisDIXMIT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on runboat and LGTM! As an improvement, the explanation of the grouping name expression should be more detailed about how it must be set or validated more strictly in order to avoid this error (I set the string "Group" in the naming scheme).
Odoo Server Error
Occured on oca-account-invoicing-19-0-pr2185-dd0040017254.runboat.odoo-community.org on model sale.advance.payment.inv on 2025-12-09 07:27:17 GMT
Traceback (most recent call last):
File "/opt/odoo/odoo/tools/safe_eval.py", line 397, in safe_eval
return unsafe_eval(c, globals_dict, None)
File "", line 1, in
NameError: name 'Group' is not defined
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/opt/odoo/odoo/http.py", line 2275, in _serve_db
return service_model.retrying(serve_func, env=self.env)
File "/opt/odoo/odoo/service/model.py", line 184, in retrying
result = func()
File "/opt/odoo/odoo/http.py", line 2330, in _serve_ir_http
response = self.dispatcher.dispatch(rule.endpoint, args)
File "/opt/odoo/odoo/http.py", line 2545, in dispatch
result = self.request.registry['ir.http']._dispatch(endpoint)
File "/opt/odoo/odoo/addons/base/models/ir_http.py", line 355, in _dispatch
result = endpoint(**request.params)
File "/opt/odoo/odoo/http.py", line 788, in route_wrapper
result = endpoint(self, *args, **params_ok)
File "/opt/odoo/addons/web/controllers/dataset.py", line 38, in call_button
action = call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo/service/model.py", line 93, in call_kw
result = method(recs, *args, **kwargs)
File "/opt/odoo/addons/sale/wizard/sale_make_invoice_advance.py", line 123, in create_invoices
invoices = self._create_invoices(self.sale_order_ids)
File "/opt/odoo/addons/sale/wizard/sale_make_invoice_advance.py", line 141, in _create_invoices
return sale_orders._create_invoices(final=self.deduct_down_payments, grouped=not self.consolidated_billing)
File "/mnt/data/odoo-addons-dir/account_invoice_section_sale_order/models/sale_order.py", line 43, in _create_invoices
"name": group._get_invoice_section_name(),
File "/mnt/data/odoo-addons-dir/account_invoice_section_sale_order/models/sale_order.py", line 79, in _get_invoice_section_name
return safe_eval(naming_scheme, {"object": self, "time": time})
File "/opt/odoo/odoo/tools/safe_eval.py", line 403, in safe_eval
raise ValueError('%r while evaluating\n%r' % (e, expr))
ValueError: NameError("name 'Group' is not defined") while evaluating
'Group'
The above server error caused the following client error:
RPC_ERROR: Odoo Server Error
RPC_ERROR
at makeErrorFromResponse (http://oca-account-invoicing-19-0-pr2185-dd0040017254.runboat.odoo-community.org/web/assets/a683405/web.assets_web.min.js:3186:165)
at XMLHttpRequest. (http://oca-account-invoicing-19-0-pr2185-dd0040017254.runboat.odoo-community.org/web/assets/a683405/web.assets_web.min.js:3192:13)
yankinmax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Technical review
No description provided.