diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-22 10:53:16 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2024-10-22 10:53:16 +0700 |
| commit | c99e4d67c037a781b79e0ed198899d5f5c4a153b (patch) | |
| tree | ba853abbadfaffdba872b36f1ed35ab2f4c657da | |
| parent | 81d6d5550737af445900199afd6edf5824bd03e2 (diff) | |
cr vendor approval
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 891482cb..1ad08154 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -873,17 +873,16 @@ class SaleOrder(models.Model): }).send() def validate_different_vendor(self): - if self.vendor_approval_id and self.vendor_approval: - return False - - different_vendor = self.order_line.filtered(lambda l: l.vendor_id and l.vendor_md_id and l.vendor_id.id != l.vendor_md_id.id) - if self.vendor_approval_id and self.vendor_approval_id.state == 'draft': raise UserError('SO ini sedang dalam review Vendor Approval') if self.vendor_approval_id and self.vendor_approval_id.state == 'cancel': raise UserError('Vendor Approval SO ini Di Reject') + if self.vendor_approval_id and self.vendor_approval_id.state == 'done': + return False + + different_vendor = self.order_line.filtered(lambda l: l.vendor_id and l.vendor_md_id and l.vendor_id.id != l.vendor_md_id.id) if different_vendor: vendor_approval = self.env['vendor.approval'].create({ 'order_id': self.id, |
