summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models
diff options
context:
space:
mode:
Diffstat (limited to 'indoteknik_custom/models')
-rw-r--r--indoteknik_custom/models/voucher.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/indoteknik_custom/models/voucher.py b/indoteknik_custom/models/voucher.py
index 839a5d47..b3a55499 100644
--- a/indoteknik_custom/models/voucher.py
+++ b/indoteknik_custom/models/voucher.py
@@ -40,11 +40,12 @@ class Voucher(models.Model):
order_ids = fields.One2many('sale.order', 'voucher_id', string='Order')
limit = fields.Integer(string='Limit', help='Voucher limit by sale order. Masukan 0 untuk tanpa limit')
manufacture_ids = fields.Many2many('x_manufactures', string='Brands', help='Voucher appplied only for brand')
+ excl_pricelist_ids = fields.Many2many('product.pricelist', string='Excluded Pricelists', help='Hide voucher from selected exclude pricelist')
@api.constrains('description')
def _check_description_length(self):
for record in self:
- if len(record.description) > 120:
+ if record.description and len(record.description) > 120:
raise ValidationError('Description cannot exceed 120 characters')
def _compute_display_name(self):
@@ -71,7 +72,8 @@ class Voucher(models.Model):
'min_purchase_amount': self.min_purchase_amount,
'max_discount_amount': max_discount_amount,
'manufacture_names': ", ".join([x.x_name for x in self.manufacture_ids]),
- 'manufacture_ids': [x.id for x in self.manufacture_ids]
+ 'manufacture_ids': [x.id for x in self.manufacture_ids],
+ 'excl_pricelist_ids': [x.id for x in self.excl_pricelist_ids],
}
return data