initial budget + expected price constrain
This commit is contained in:
parent
3d8e983074
commit
881541105f
|
|
@ -49,7 +49,7 @@ class PurchaseRequest(models.Model):
|
|||
|
||||
def action_confirm(self):
|
||||
init_active = self.env['ir.module.module'].sudo().search([('name', '=', 'initial_engagement_budget'), ('state', '=', 'installed')], limit=1)
|
||||
init_budget = True if init_active else False
|
||||
init_budget = self.initial_engagement_activate
|
||||
if len(self.line_ids) == 0:
|
||||
raise ValidationError(_("Can't Confirm Request With No Item!"))
|
||||
if not self.department_id:
|
||||
|
|
@ -315,4 +315,10 @@ class PurchaseRequestLine(models.Model):
|
|||
if rec.qty <= 0:
|
||||
raise ValidationError(_("Item Quantity MUST be at Least ONE!"))
|
||||
|
||||
@api.constrains('expected_price')
|
||||
def expected_price_validation(self):
|
||||
for rec in self:
|
||||
if rec.request_id.initial_engagement_activate == True and rec.expected_price <= 0:
|
||||
raise ValidationError(_("Expected Price MUST be at Least ONE!"))
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue