[19.0][MIG] product_sequence: Migration to 19.0 - #2369
Conversation
… reference. The reference (default code) is unique (SQL constraint) and required.
… each product without default_code
some minor reformatting in the process
Version numbers should only have 2 digits.
Squashed administrative commits: * Added german translation * Add bug tracker link on README.rst Co-authored-by: Malte Jacobi <malte.jacobi@htwsaar.de> Co-authored-by: Yannick Vaucher <yannick.vaucher@camptocamp.com>
Add pre_init_hook to manually set nulls and '/' default codes to a unique code to greenify branch add pragma to pre_init method as it must have completed successfully if module installs
* Migration to v11 * Support sequence by Product Category
Squashed administrative commits: * remove obsolete .pot files [ci skip] * [UPD] Update product_sequence.pot Co-authored-by: Stéphane Bidoul (ACSONE) <stephane.bidoul@acsone.eu> Co-authored-by: oca-travis <oca+oca-travis@odoo-community.org>
Squashed administrative commits: * [UPD] Update product_sequence.pot * Update translation files Co-authored-by: oca-travis <oca+oca-travis@odoo-community.org> Co-authored-by: OCA Transbot <transbot@odoo-community.org>
… dictionary values contains the default_code key.
Squashed administrative commits: * [UPD] Update product_sequence.pot * Update translation files * Translated using Weblate (German) * pre-commit update * Translated using Weblate (French) Co-authored-by: oca-travis <oca+oca-travis@odoo-community.org> Co-authored-by: OCA Transbot <transbot@odoo-community.org> Co-authored-by: Ben Brich <b.brich@humanilog.org> Co-authored-by: OCA-git-bot <oca-git-bot@odoo-community.org> Co-authored-by: c2cdidier <didier.donze@camptocamp.com>
[UPD] Update product_sequence.pot [UPD] README.rst
…settings for the prefix. [UPD] Update product_sequence.pot [UPD] README.rst product_sequence 14.0.2.0.1 Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-14.0/product-attribute-14.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_sequence/ Translated using Weblate (Dutch) Currently translated at 100.0% (18 of 18 strings) Translation: product-attribute-14.0/product-attribute-14.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-14-0/product-attribute-14-0-product_sequence/nl/
[UPD] Update product_sequence.pot [UPD] README.rst product_sequence 16.0.1.0.1 Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/ Translated using Weblate (German) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/de/
…nd product.category product_sequence 16.0.1.0.2 [UPD] Update product_sequence.pot Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/
[UPD] README.rst product_sequence 16.0.2.0.0 Translated using Weblate (Italian) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/it/ Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/pt_BR/ Translated using Weblate (Spanish) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/es/ [UPD] README.rst Update translation files Updated by "Update PO files to match POT (msgmerge)" hook in Weblate. Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/
- Switch to setUpClass for avoiding repeat the same setup for each test. - Include context keys for avoiding mail operations overhead.
Translated using Weblate (Italian) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/it/ Translated using Weblate (Italian) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/it/ Translated using Weblate (Italian) Currently translated at 100.0% (16 of 16 strings) Translation: product-attribute-16.0/product-attribute-16.0-product_sequence Translate-URL: https://translation.odoo-community.org/projects/product-attribute-16-0/product-attribute-16-0-product_sequence/it/
Squashed administrative commits: * [UPD] Update product_sequence.pot * [BOT] post-merge updates Co-authored-by: oca-ci <oca-ci@odoo-community.org> Co-authored-by: OCA-git-bot <oca-git-bot@odoo-community.org>
Squashed administrative commits: * [UPD] Update product_sequence.pot * [BOT] post-merge updates * Added translation using Weblate (Slovak) * Translated using Weblate (Slovak) Co-authored-by: oca-ci <oca-ci@odoo-community.org> Co-authored-by: OCA-git-bot <oca-git-bot@odoo-community.org> Co-authored-by: Jan Prokop <jprokop@jackie.sk>
Disable 2 test that were making branch to fail, not easy solution has been found, so diasable for now.
Squashed administrative commits: * [BOT] post-merge updates * Translated using Weblate (Turkish) * Translated using Weblate (Croatian) * Translated using Weblate (Catalan) * Translated using Weblate (Turkish) Co-authored-by: OCA-git-bot <oca-git-bot@odoo-community.org> Co-authored-by: Betül Öğmen <betulo@eska.biz> Co-authored-by: Ana Matulin <ana@uvid.hr> Co-authored-by: Ricard <ricard.calvo@forgeflow.com>
Since there is already a module that makes the field mandatory, such as product_code_mandatory, adding this requirement at the database level, in my opinion, goes beyond the scope of this module.
Squashed administrative commits: * Translated using Weblate (Slovenian) * [BOT] post-merge updates Co-authored-by: Matjaz Mozetic <matjaz@luxim.si> Co-authored-by: OCA-git-bot <oca-git-bot@odoo-community.org>
- Bump manifest version to 19.0.1.0.0. - Adapt test_product_category_sequence: since 19.0 product.category is no longer a required field on product.template, so a product without a category now falls back on the default sequence instead of always having a category set. (cherry picked from commit cb70b43) Co-authored-by: bosd <ebo@stefcy.com>
Replace the legacy OCA icon by the current one, as already used by other addons in this repository.
Add demo data illustrating the three ways an internal reference is assigned by this module: * Floor Lamp (category "Lamps", prefix LAMP) -> LAMP00001 * Desk Lamp (category "Desk Lamps", no prefix, parent "Lamps") -> LAMP00002 * Office Chair (category "Furniture", prefix FURN) -> FURN00001 * Extension Cord (no category) -> PR/00001, the default product sequence The parent category fallback is enabled on the main company so that the "Desk Lamps" case is actually demonstrated. Because of that, test_product_parent_category_sequence now disables the setting explicitly instead of relying on the ambient company configuration. Since 19.0 Odoo does not load demo data by default, so the new tests load the demo files themselves when they are missing. That way the demo data is checked on the CI too, instead of silently skipping.
Since Odoo 14 (odoo/odoo#38303) copying a product.product does not copy the variant: the template is copied instead and its first variant is returned. That variant is built by _create_variant_ids without any reference, so it gets a brand new sequence number and the default_code put in `default` by copy() was silently dropped: * copying PROD02 gave PR/00007 instead of PROD02-copy; * product.copy({"default_code": "REF"}) ignored "REF" altogether. This is why the two copy tests had to be disabled in 63a0f5b "[FIX] product_sequence: disable test". Restore the reference on the new variant after the copy and re-enable both tests. Also add tests for a copy without source reference and for the multi variant case, where the reference stays on the variant and is not pushed up to the template.
981de95 to
bef3c3b
Compare
|
Pushed a follow-up to get Codecov green. Two things came out of it: 1. The demo tests no longer skip. Since 19.0 Odoo does not load demo data by default, so the CI databases have none and the tests were skipped there. They now load the demo files themselves via 2. Since odoo/odoo#38303 (14.0), copying a
The override now restores the requested reference on the new variant after the copy, and both tests are re-enabled. Added tests for the no-source-reference case (copy just gets a new sequence number, no @NICO-SOLUTIONS if you would rather have a copy always take a fresh sequence number instead of the |
@bosd From my point of view, a copied product should receive a fresh sequence number instead of keeping the I can see the benefit of the However, I would not expect the This is just my perspective though; I won´t make this decision alone. I am happy to follow the consensus of the maintainers/contributors here. If there are other advantages of keeping the If this is handled in a separate follow-up PR, that is also fine for me. However, I think we should define a clear approach for this scenario. I'll review the code once I find some time. |
Supersedes #2127.
Migration of
product_sequenceto 19.0, redone from scratch with the standardOCA migration procedure. The 19.0 migration commit of @fd-oerp is cherry-picked
(with
-x) so their authorship and work are preserved, and they have been addedto
readme/CONTRIBUTORS.md.Why redo it
several
[MIG]/[IMP]commits ended up carrying the bodies of unrelated.pot/README/Weblate commits, blurring the attribution of the real changes.18.0, so it did not carry[IMP] product_sequence: default_code shouldn't be mandatorynor the Turkish,Croatian, Catalan and Slovenian translations that landed on
18.0since.Migration changes
test_product_category_sequence: since 19.0,categ_idis no longer requiredon
product.template, soassertTrue(product_4.categ_id)no longer holds.Rather than dropping the case (as [19.0][MIG] product_sequence: Migration to 19.0 #2127 did), it now asserts what the module
actually guarantees: a product without category falls back on the default
product sequence.
On top of the plain migration
New OCA icon (
[IMP] product_sequence: use the new OCA icon), the onealready used by other addons of this repository.
Demo data (
[ADD] product_sequence: demo data), illustrating the threeways a reference is assigned:
LAMP)LAMP00001LAMP00002FURN)FURN00001PR/00001The parent-category fallback is enabled on the main company so the Desk Lamp
case is actually demonstrated;
test_product_parent_category_sequencetherefore now disables that setting explicitly instead of relying on the
ambient company configuration.
Three tests assert the demo references. They skip when the database has no
demo data, which is the case on the CI since Odoo 19.0 does not load demo data
by default.
@fd-oerp thanks for the original migration.
the history rework could not be done as a review suggestion. @NICO-SOLUTIONS the
copy()discussion from #2127 is deliberately left out of this PR to keep themigration reviewable; happy to open a follow-up for it.