Skip to content

Commit

Permalink
[16.0][IMP] base_global_discount: Add m2m to exclude products from di…
Browse files Browse the repository at this point in the history
…scount
  • Loading branch information
ferran-S73 committed May 20, 2024
1 parent 763f4e9 commit f1eb3c9
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions base_global_discount/models/global_discount.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ class GlobalDiscount(models.Model):
string="Company",
default=lambda self: self.env.company,
)
excluded_product_ids = fields.Many2many(
comodel_name="product.product",
string="Excluded Products",
help="Products that will not be affected by this discount",
)

def name_get(self):
result = []
Expand Down
11 changes: 11 additions & 0 deletions base_global_discount/views/global_discount_views.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<field name="name" />
<field name="discount" />
<field name="discount_scope" />
<field
name="excluded_product_ids"
widget="many2many_tags"
options="{'no_create': True, 'no_create_edit': True}"
optional="show"
/>
<field name="company_id" />
</tree>
</field>
Expand All @@ -25,6 +31,11 @@
<field name="discount" />
<field name="discount_scope" />
<field name="company_id" />
<field
name="excluded_product_ids"
widget="many2many_tags"
options="{'no_create': True, 'no_create_edit': True}"
/>
</group>
</sheet>
</form>
Expand Down

0 comments on commit f1eb3c9

Please sign in to comment.