blob: 5b0d446575945a6dde743854725808323a1ffcb4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# -*- coding: utf-8 -*-
from odoo import _, api, models
class PricelistItem(models.Model):
_inherit = "product.pricelist.item"
@api.onchange('applied_on', 'product_id', 'product_tmpl_id', 'min_quantity')
def _onchange_event_sale_warning(self):
if self.min_quantity > 0:
msg = ''
if self.applied_on == '3_global' or self.applied_on == '2_product_category':
msg = _("A pricelist item with a positive min. quantity will not be applied to the event tickets products.")
elif ((self.applied_on == '1_product' and self.product_tmpl_id.event_ok) or
(self.applied_on == '0_product_variant' and self.product_id.event_ok)):
msg = _("A pricelist item with a positive min. quantity cannot be applied to this event tickets product.")
if msg:
return {'warning':
{
'title': _("Warning"),
'message': msg
}
}
|