Skip to content

Commit

Permalink
[MIG] product_variant_default_code: migrate to V17
Browse files Browse the repository at this point in the history
  • Loading branch information
astirpe committed Apr 8, 2024
1 parent aa821f8 commit 88b0bfe
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 39 deletions.
2 changes: 1 addition & 1 deletion product_variant_default_code/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
{
"name": "Product Variant Default Code",
"version": "16.0.1.1.0",
"version": "17.0.1.0.0",
"author": "AvancOSC, Shine IT, Tecnativa, Akretion, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/product-variant",
"license": "AGPL-3",
Expand Down
2 changes: 1 addition & 1 deletion product_variant_default_code/models/product.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ def create(self, vals_list):
vals["reference_mask"] = product._get_default_mask()
elif vals.get("reference_mask"):
sanitize_reference_mask(product, vals["reference_mask"])
return super(ProductTemplate, self).create(vals_list)
return super().create(vals_list)

@api.model
def _guess_main_lang(self):
Expand Down
2 changes: 2 additions & 0 deletions product_variant_default_code/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@
- David Vidal
- Pedro M. Baeza
- João Marques
- [360ERP](https://www.360erp.com):
- Andrea Stirpe
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TestVariantDefaultCode(TransactionCase):
@classmethod
def setUpClass(cls):
super(TestVariantDefaultCode, cls).setUpClass()
super().setUpClass()
cls.group_default_code = cls.env.ref(
"product_variant_default_code.group_product_default_code_manual_mask"
)
Expand Down
41 changes: 13 additions & 28 deletions product_variant_default_code/views/config_settings_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,19 @@
<field name="model">res.config.settings</field>
<field name="inherit_id" ref="base_setup.res_config_settings_view_form" />
<field name="arch" type="xml">
<xpath expr="//div[@id='user_default_rights']" position="after">
<h2>Product Variants</h2>
<div class="row mt16 o_settings_container" name="multi_company">
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="group_product_default_code_manual_mask" />
</div>
<div class="o_setting_right_pane">
<label for="group_product_default_code_manual_mask" />
<div class="text-muted">
Defines how you want to manage the Variant default.
Check this if you want to use Manual Mask.
Default: Automask
</div>
</div>
</div>
<div class="col-xs-12 col-md-6 o_setting_box">
<div class="o_setting_left_pane">
<field name="prefix_as_default_code" />
</div>
<div class="o_setting_right_pane">
<label for="prefix_as_default_code" />
<div class="text-muted">
Defines the variant "Reference Prefix" as the default reference (default_code) of the variant.
</div>
</div>
</div>
</div>
<xpath expr="//block[@id='user_default_rights']" position="after">
<block title="Product Variants" id="product_variant_default_code">
<setting
help="Defines how you want to manage the Variant default. Check this if you want to use Manual Mask. Default: Automask"
>
<field name="group_product_default_code_manual_mask" />
</setting>
<setting
help="Defines the variant 'Reference Prefix' as the default reference (default_code) of the variant."
>
<field name="prefix_as_default_code" />
</setting>
</block>
</xpath>
</field>
</record>
Expand Down
11 changes: 3 additions & 8 deletions product_variant_default_code/views/product_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,11 @@
<field name="inherit_id" ref="product.product_template_only_form_view" />
<field name="arch" type="xml">
<field name="default_code" position="after">
<field
name="code_prefix"
attrs="{'invisible':
[('attribute_line_ids', '=', [])]}"
/>
<field name="code_prefix" invisible="not attribute_line_ids" />
<field
name="reference_mask"
placeholder="[attribute3]-[attribute1]"
attrs="{'invisible':
[('attribute_line_ids', '=', [])]}"
invisible="not attribute_line_ids"
groups="product_variant_default_code.group_product_default_code_manual_mask"
/>
</field>
Expand All @@ -23,7 +18,7 @@
name="variant_default_code_error"
class="alert alert-danger alert-dismissable"
role="alert"
attrs="{'invisible':[('variant_default_code_error','=', False)]}"
invisible="not variant_default_code_error"
/>
</xpath>
</field>
Expand Down

0 comments on commit 88b0bfe

Please sign in to comment.