Skip to content
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

[14.0][MIG] product_analytic: Migration to 14.0 #375

Closed
wants to merge 31 commits into from

Conversation

Reyes4711-S73
Copy link

Standard migration to 14.0

alexis-via and others added 30 commits May 13, 2021 12:22
* OCA fixes
* Analytic account creating invoice lines
* Tests

product_analytic: Add Antiun to authors
… to the one _get_product_accounts() of the account module

product_analytic: add demo data
Add modules product_analytic_pos and product_analytic_purchase
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-11.0/account-analytic-11.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-11-0/account-analytic-11-0-product_analytic/ar/
Currently translated at 100,0% (5 of 5 strings)

Translation: account-analytic-11.0/account-analytic-11.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-11-0/account-analytic-11-0-product_analytic/ca/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/pt_BR/
Currently translated at 60.0% (3 of 5 strings)

Translation: account-analytic-12.0/account-analytic-12.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-12-0/account-analytic-12-0-product_analytic/fi/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/pt_BR/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/ca/
Currently translated at 100.0% (5 of 5 strings)

Translation: account-analytic-13.0/account-analytic-13.0-product_analytic
Translate-URL: https://translation.odoo-community.org/projects/account-analytic-13-0/account-analytic-13-0-product_analytic/es/
@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
inv_type = self.env.context.get("inv_type", "out_invoice")
Copy link
Member

Choose a reason for hiding this comment

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

In v14 this context is always false, leading to setting by default the product's income analytic account in all the new account.move.line. It seems better to use directly the account.move's move_type

Suggested change
inv_type = self.env.context.get("inv_type", "out_invoice")
inv_type = self.env["account.move"].browse([vals.get("move_id")]).move_type

inv_type = self.env.context.get("inv_type", "out_invoice")
if (
vals.get("product_id")
and inv_type
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
and inv_type
and inv_type != "entry"

It looks better to avoid adding defautl analytic.account on new internal account.move.line...

@Reyes4711-S73 Reyes4711-S73 force-pushed the 14.0-mig-product_analytic branch from 82b7659 to b3c2263 Compare June 1, 2021 06:11
@Reyes4711-S73
Copy link
Author

Thank you for your review @clementmbr. I did your changes. Is possible you could review and approve this Pull request?

@billyang001
Copy link

In v14 ,An error occurred.
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/src/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/opt/odoo/src/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/src/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/src/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/src/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/src/odoo/http.py", line 912, in call
return self.method(*args, **kw)
File "/opt/odoo/src/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/src/addons/web/controllers/main.py", line 1389, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/src/addons/web/controllers/main.py", line 1381, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/src/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/src/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/opt/odoo/src/odoo/models.py", line 3009, in read
raise ValueError("Invalid field %r on model %r" % (name, self._name))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/odoo/src/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/src/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Invalid field 'hide_picking_type' on model 'stock.picking'

@Reyes4711-S73
Copy link
Author

@billyang001 this field is added in the stock.picking model in the stock module from odoo. This module doesn't need this module to works correctly, so you must install stock module to solve your problem

Copy link
Member

@Du-ma Du-ma left a comment

Choose a reason for hiding this comment

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

LGTM

@rousseldenis
Copy link
Contributor

@Reyes4711 Could you rebase ?

@rousseldenis rousseldenis mentioned this pull request Oct 21, 2021
1 task
@rousseldenis
Copy link
Contributor

rousseldenis commented Oct 21, 2021

@Reyes4711 @Du-ma I've done another PR based on this with some enhancments. If you can review and accept closing this one.

@Reyes4711-S73 Reyes4711-S73 deleted the 14.0-mig-product_analytic branch November 2, 2021 10:48
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.