diff options
| author | it-fixcomart <it@fixcomart.co.id> | 2024-11-18 11:09:12 +0700 |
|---|---|---|
| committer | it-fixcomart <it@fixcomart.co.id> | 2024-11-18 11:09:12 +0700 |
| commit | 899c9eea89b4745d76bf19e201f81b2b091dba34 (patch) | |
| tree | 2c9eda33c394bcac61c7ba331de043ca294c81c5 | |
| parent | c11d6c564db098b3553893406e9f59bbef029feb (diff) | |
| parent | 34c6611b059cf6ea79bb78e359b973719848f09b (diff) | |
Merge branch 'production' into CR/website-improvment
| -rwxr-xr-x | indoteknik_custom/models/sale_order.py | 4 | ||||
| -rw-r--r-- | indoteknik_custom/models/stock_picking.py | 7 | ||||
| -rw-r--r-- | indoteknik_custom/models/vendor_approval.py | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 21f83521..3d91ba91 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -748,7 +748,7 @@ class SaleOrder(models.Model): raise UserError("Salesperson sudah tidak aktif, mohon diisi yang benar pada data SO dan Contact") def sale_order_approve(self): - if self.validate_different_vendor() and not self.vendor_approval and not self.vendor_approval_id: + if self.validate_different_vendor() and not self.vendor_approval: return self._create_notification_action('Notification', 'Terdapat Vendor yang berbeda dengan MD Vendor') self.check_due() @@ -925,7 +925,7 @@ class SaleOrder(models.Model): def action_confirm(self): for order in self: - if self.validate_different_vendor() and not self.vendor_approval and not self.vendor_approval_id: + if self.validate_different_vendor() and not self.vendor_approval: return self._create_notification_action('Notification', 'Terdapat Vendor yang berbeda dengan MD Vendor') order.check_data_real_delivery_address() diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 68e94ef7..430c54f3 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -196,7 +196,8 @@ class StockPicking(models.Model): @api.constrains('driver_departure_date') def constrains_driver_departure_date(self): - self.date_doc_kirim = self.driver_departure_date + if not self.date_doc_kirim: + self.date_doc_kirim = self.driver_departure_date @api.constrains('arrival_time') def constrains_arrival_time(self): @@ -450,6 +451,8 @@ class StockPicking(models.Model): 'picking_ids': [x.id for x in self] } return action + elif not self.env.user.id in [3988, 3401, 20] and 'Return of' in self.origin: + raise UserError('Harus Purchasing yang Ask Return') else: raise UserError('Harus Sales Admin yang Ask Return') elif self.picking_type_code == 'incoming': @@ -459,6 +462,8 @@ class StockPicking(models.Model): 'picking_ids': [x.id for x in self] } return action + elif not self.env.user.has_group('indoteknik_custom.group_role_purchasing') and 'Return of' in self.origin: + raise UserError('Harus Sales Admin yang Ask Return') else: raise UserError('Harus Purchasing yang Ask Return') diff --git a/indoteknik_custom/models/vendor_approval.py b/indoteknik_custom/models/vendor_approval.py index bcc5d3ea..56b81a37 100644 --- a/indoteknik_custom/models/vendor_approval.py +++ b/indoteknik_custom/models/vendor_approval.py @@ -32,7 +32,7 @@ class VendorApproval(models.Model): self.order_id.vendor_approval = True message = "Vendor Approval approved by %s" % (self.env.user.name) self.order_id.message_post(body=message) - if not self.order_id.due_id: + if not self.order_id.due_id and self.order_id.state == 'draft': self.order_id.action_confirm() def action_reject(self): |
