-
-
Notifications
You must be signed in to change notification settings - Fork 688
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
[17.0][MIG] account_invoice_pricelist: Migration to 17.0 #1619
[17.0][MIG] account_invoice_pricelist: Migration to 17.0 #1619
Conversation
OCA Transbot updated translations from Transifex OCA Transbot updated translations from Transifex
Currently translated at 100,0% (5 of 5 strings) Translation: account-invoicing-11.0/account-invoicing-11.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-11-0/account-invoicing-11-0-account_invoice_pricelist/de/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_pricelist/
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_pricelist/fr/
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_pricelist/pt_BR/
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_pricelist/es_CL/
Currently translated at 100.0% (5 of 5 strings) Translation: account-invoicing-12.0/account-invoicing-12.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-12-0/account-invoicing-12-0-account_invoice_pricelist/hr/
Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: account-invoicing-16.0/account-invoicing-16.0-account_invoice_pricelist Translate-URL: https://translation.odoo-community.org/projects/account-invoicing-16-0/account-invoicing-16-0-account_invoice_pricelist/
2c5c7fe
to
14fa4cb
Compare
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.
Working correctly, checked in runboat
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.
Works, tested on Runboat
This PR has the |
I've been having some issues installing this PR alongside From my digging the problem seems to be that in this commit odoo/odoo@83c5257 the way pricelists work in 17.0 was altered to not be required and to use the company's currency if it isn't set. This is causing the demo sales/invoices to have EUR currency and then error in the But the reason this only happens in 17.0 is due to aforementioned commit, it removes the basic "Public Pricelist", which is what would be the default computed EUR pricelist in previous versions (I checked on 16.0). Since this no longer exists, it can only default to USD. This is the simple pre_init_hook I added locally that fixes the issue Patch
diff --git a/account_invoice_pricelist/__init__.py b/account_invoice_pricelist/__init__.py
index 0650744..548c73e 100644
--- a/account_invoice_pricelist/__init__.py
+++ b/account_invoice_pricelist/__init__.py
@@ -1 +1,2 @@
+from .hooks import pre_init_hook
from . import models
diff --git a/account_invoice_pricelist/__manifest__.py b/account_invoice_pricelist/__manifest__.py
index 7e365ba..b30a7cf 100644
--- a/account_invoice_pricelist/__manifest__.py
+++ b/account_invoice_pricelist/__manifest__.py
@@ -11,4 +11,5 @@
"depends": ["account", "sale_management"],
"data": ["views/account_invoice_view.xml"],
"installable": True,
+ "pre_init_hook": "pre_init_hook",
}
diff --git a/account_invoice_pricelist/hooks.py b/account_invoice_pricelist/hooks.py
new file mode 100644
index 0000000..ce5fe6a
--- /dev/null
+++ b/account_invoice_pricelist/hooks.py
@@ -0,0 +1,15 @@
+# Copyright 2024 Studio73 - Ethan Hildick <[email protected]>
+# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
+
+from odoo.tools.sql import column_exists, create_column
+
+
+def pre_init_hook(env):
+ cr = env.cr
+ # Speed up the installation of the module on an existing Odoo instance
+ # by not computing the pricelist for every invoice. Also avoids
+ # a possible computation error of
+ # computing all pricelists -> _check_currency constraint error before the
+ # currency can recompute itself
+ if not column_exists(cr, "account_move", "pricelist_id"):
+ create_column(cr, "account_move", "pricelist_id", "int4") |
@peluko00 sorry for the long message but could you add this hook to the migration? |
b4a2915
to
ea9c746
Compare
ea9c746
to
365a034
Compare
Thanks for the fix! Can you review now please |
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 👍
Can you please cherry-pick #1751 ? 🙏 |
I'll merge this and cherry-pick #1751 in a new PR |
/ocabot merge nobump |
What a great day to merge this nice PR. Let's do it! |
Congratulations, your PR was merged at b6d8fdc. Thanks a lot for contributing to OCA. ❤️ |
@grindtildeath I created the PR here: #1806 |
Module migrated to version 17.0
cc https://github.com/APSL 148829
@miquelalzanillas @lbarry-apsl @javierobcn @mpascuall please review