Skip to content

Commit

Permalink
shopinvader_product_alias: improve view
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienbeau committed Aug 22, 2023
1 parent e485c73 commit fbc6ad9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
3 changes: 3 additions & 0 deletions shopinvader_product_alias/models/product_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@ class ProductAlias(models.Model):

product_tmpl_id = fields.Many2one(
"product.template",
required=True,
)

name = fields.Char(
string="Name",
required=True,
)

attribute_value_ids = fields.Many2many(
"product.attribute.value",
string="Attribute Values",
domain="[('id', 'in', available_attribute_value_ids)]",
required=True,
)

available_attribute_value_ids = fields.Many2many(
Expand Down
18 changes: 11 additions & 7 deletions shopinvader_product_alias/views/product_template.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,28 @@
@author Kévin Roche <[email protected]>
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo>
<record id="product_template_form" model="ir.ui.view">
<record id="product_template_form_view" model="ir.ui.view">
<field name="model">product.template</field>
<field name="inherit_id" ref="shopinvader.view_product_template_form" />
<field name="inherit_id" ref="product.product_template_form_view" />
<field name="arch" type="xml">
<group name="shopinvader_options" position="after">
<group name="shopinvader_alias" string="Aliases">
<xpath expr="/form/sheet/notebook" position="inside">
<page
name="Alias"
string="Alias"
attrs="{'invisible': [('product_variant_count', '&lt;=', 1)]}"
>
<field
name="product_alias_ids"
context="{'default_product_tmpl_id': active_id}"
>
<tree editable="bottom">
<field name="name" />
<field name="attribute_value_ids" widget="many2many_tags" />
<field name="available_attribute_value_ids" invisible="1"/>
<field name="available_attribute_value_ids" invisible="1" />
</tree>
</field>
</group>
</group>
</page>
</xpath>
</field>
</record>
</odoo>

0 comments on commit fbc6ad9

Please sign in to comment.