Merge pull request #2771 from expsa/samir-aladawi-fix-purchase-requisition
[FIX] purchase_requisition_custom
This commit is contained in:
commit
8cc36566fe
|
|
@ -525,19 +525,19 @@ class PurchaseOrderCustom(models.Model):
|
|||
line.choosen = True
|
||||
self._amount_all()
|
||||
|
||||
@api.constrains('requisition_id', 'partner_id')
|
||||
def PreventSameVendor(self):
|
||||
"""
|
||||
Constrain to prevent the same vendor in the order for the same requisition
|
||||
"""
|
||||
orders = self.env['purchase.order'].search([
|
||||
('id', '!=', self.id),
|
||||
('requisition_id', '=', self.requisition_id.id),
|
||||
('requisition_id', '!=', False),
|
||||
('partner_id', '=', self.partner_id.id)
|
||||
])
|
||||
if len(orders) != 0:
|
||||
raise ValidationError(_("This Vendor have order before"))
|
||||
# @api.constrains('requisition_id', 'partner_id')
|
||||
# def PreventSameVendor(self):
|
||||
# """
|
||||
# Constrain to prevent the same vendor in the order for the same requisition
|
||||
# """
|
||||
# orders = self.env['purchase.order'].search([
|
||||
# ('id', '!=', self.id),
|
||||
# ('requisition_id', '=', self.requisition_id.id),
|
||||
# ('requisition_id', '!=', False),
|
||||
# ('partner_id', '=', self.partner_id.id)
|
||||
# ])
|
||||
# if len(orders) != 0:
|
||||
# raise ValidationError(_("This Vendor have order before"))
|
||||
|
||||
# test
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue