-
-
Notifications
You must be signed in to change notification settings - Fork 537
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
[15.0][MIG] contract: Migration to version 15.0 #738
Conversation
Bug description --------------- `account.analytic.contract.line` inherits `account.analytic.invoice.line` `account.analytic.invoice.line` defines field `analytic_account_id`: - comodel='account.analytic.account' `account.analytic.contract.line` redefines field `analytic_account_id`: - comodel='account.analytic.contract' On attempt to extend `account.analytic.invoice.line` model adding field that depends on `analytic_account_id.date_start` Odoo fails to update, because it adds this field to `account.analytic.contract.line` through inheritance, and `account.analytic.contract` model have no this field. What is done ------------ Change inheritance order: - `account.analytic.invoice.line` inherits `account.analytic.contract.line` - no file renames at this stage (this wil be done in next commit)
contract/data/mail_template.xml
Outdated
@@ -1,96 +1,92 @@ | |||
<?xml version="1.0" encoding="utf-8" ?> | |||
<odoo noupdate="1"> | |||
<odoo noupdate="0"> |
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.
I find this dangerous... a subsequent module upgrade will wipe manual changes to the template.
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.
Thanks, it did this during dev to test the mail template changes more easily and forgot to put it back.
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.
Well. This should be a migration. I'm not sure about the best way do do this.
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.
Are you worried about the upgrade from v14 to v15? Then, indeed, it's more complex than I first thought.
Anyway, I think we should keep the noupdate=1
because that it is the expected behavior.
Then we could have a migration script to force the update, because anyway any old templates from an older major version of Odoo wouldn't work. But is such a migration script from one major version to another meant to be here, in this repo? It has been discussed few months back (without conclusion so far I think).
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.
Yes, the usual flow is to let them noupdate=1 always, and add a migration script that loads the changes in this kind of templates and delete translations. Example:
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.
Thanks for sharing the examples @pedrobaeza .
@@ -17,7 +17,7 @@ def to_date(date): | |||
return fields.Date.to_date(date) | |||
|
|||
|
|||
class TestContractBase(common.SavepointCase): | |||
class TestContractBase(common.TransactionCase): |
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.
Why this change?
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.
SavepointCase is deprecated:
https://github.com/odoo/odoo/blob/15.0/odoo/tests/common.py#L742
"Deprecated class SavepointCase has been merged into TransactionCase",
Note that pre-commit is red. |
Thanks @dreispt . I will submit a new version tomorrow. Hopefully this will be merged during the OCA days :) |
@dreispt @pedrobaeza I finalized the changes. Hopefully, next time you only need to ask me to rebase ;) |
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.
LGTM, but would like confirmation from Pedro that the template migration looks good
In previous commit changed inheritance order of 'account.analytic.*.line' models, thus classes and models were renamed. This commit only renames files to temporary names. This commit does not change file contents. [UPD] Update contract.pot
Runbot URL in old README.rst pointed to 10.0 runbot, fixed by upgrading template
Currently translated at 96.0% (96 of 100 strings) Translation: contract-11.0/contract-11.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-contract/nl/
Currently translated at 53.0% (53 of 100 strings) Translation: contract-11.0/contract-11.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-contract/de/
[UPD] Update contract.pot
Currently translated at 75.0% (75 of 100 strings) Translation: contract-11.0/contract-11.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-contract/de/ [UPD] README.rst
Currently translated at 98.0% (98 of 100 strings) Translation: contract-11.0/contract-11.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-contract/es/
Currently translated at 10.0% (10 of 100 strings) Translation: contract-11.0/contract-11.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-contract/pt_PT/
The test as it was, leaves to the demo pricelist the control on the price of the product, so other modules that modifies this pricelist will make the test to fail. This is the minimum change needed for avoiding the problem.
- Module: contract - Summary: several terms where not translated to Spanish.
Currently translated at 99.0% (99 of 100 strings) Translation: contract-12.0/contract-12.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract/de/
Updated by Update PO files to match POT (msgmerge) hook in Weblate.
Currently translated at 100.0% (109 of 109 strings) Translation: contract-12.0/contract-12.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract/es/
Currently translated at 100.0% (109 of 109 strings) Translation: contract-12.0/contract-12.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract/gl/
… contract modification mail. [UPD] Update contract.pot
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/
Currently translated at 100.0% (306 of 306 strings) Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/es_AR/ [UPD] Update contract.pot
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/
Currently translated at 100.0% (307 of 307 strings) Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/es_AR/
It seems that having several fields returned by `Form` as `False` that are related to one2many inverse field, makes Odoo ORM mad, and get to an unbalanced move when generating the invoice. Cleaning these values assures to work without problems. Not able to provide a regression test, as I don't get to reproduce the conditions to happen in test environment, but the patch is safe and harmless anyways. TT30842
Currently translated at 72.9% (224 of 307 strings) Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/tr/
In v13, the `user_id` field is a related field to `invoice_user_id`, that defaults to the environment user (`self.env.user`). Therefore, if we try to create an invoice just by passing `user_id`, it would be overwritten by the default computation of `invoice_user_id`. This fixes it by passing the correct field and data. TT31715
Currently translated at 98.3% (302 of 307 strings) Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/ca/
Currently translated at 80.4% (247 of 307 strings) Translation: contract-14.0/contract-14.0-contract Translate-URL: https://translation.odoo-community.org/projects/contract-14-0/contract-14-0-contract/pt/
Most changes are related to the switch from jinja to qweb in mail templates. Also included: - convert deprecated onchange that returns a domain and other deprecation warnings (see below) - Add migration scripts from version 14.0 (force the update of the mail templates) - Fix warnings from pre-commit checks Fixes depreciation warnings: - onchange method ContractAbstractContractLine._onchange_product_id returned a domain, this is deprecated - SavepointCase is deprecated: https://github.com/odoo/odoo/blob/15.0/odoo/tests/common.py#L742 - assertDictContainsSubset: According to: https://stackoverflow.com/questions/20050913/python-unittests-assertdictcontainssubset-recommended-alternative
1993a72
to
119b5b6
Compare
@pedrobaeza If you want to review, the rebase is complete. (it's not the place to discuss this, but I find it a bit "over-demanding" to ask contributor of migration to squash historical commits from the previous versions). I am fine with it, but I guess it is something to consider to facilitate the on-boarding of new contributors. Runbot still fails but I think it is with know issues:
|
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.
[Not a maintainer] [Figured how to Review now :)] Tested on clean VM all seems to work only thing that flagged in my logs was:
2021-11-18 09:24:40,145 2940 INFO odoo odoo.addons.base.models.ir_module: python external dependency on 'dateutil' does not appear to be a valid PyPI package. Using a PyPI package name is recommended.
Which I believe to not be a migration issue but a dependency issue in general. Putting it on my production instance until the merge goes through. Thanks @jcdrubay
/ocabot merge nobump |
On my way to merge this fine PR! |
Congratulations, your PR was merged at 06e41e5. Thanks a lot for contributing to OCA. ❤️ |
Fixes deprecation warnings
includes migration scripts to upgrade from v14:
To test
Output