summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/sale_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2023-09-26 15:06:52 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2023-09-26 15:06:52 +0700
commit01f308991afffaff5eda1b758dbb98d0f3ba8396 (patch)
tree42a996176f451a3feb4bbfb2a7f8cad9849dd85e /indoteknik_custom/models/sale_order.py
parentbd8a83a76cea6ef2466c250226f7c95c38b3024c (diff)
User can't create data cab on form input, add multi update data sale order to update state and invoice_status
Diffstat (limited to 'indoteknik_custom/models/sale_order.py')
-rwxr-xr-xindoteknik_custom/models/sale_order.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py
index 2d8d97bd..13f4745d 100755
--- a/indoteknik_custom/models/sale_order.py
+++ b/indoteknik_custom/models/sale_order.py
@@ -80,6 +80,29 @@ class SaleOrder(models.Model):
estimated_arrival_days = fields.Integer('Estimated Arrival Days', default=0)
email = fields.Char(string='Email')
+ @api.model
+ def action_multi_update_state(self):
+ order_ids = self.env.context.get('active_ids', [])
+ sale_order = self.search([('id', 'in', order_ids)])
+ for sale in sale_order:
+ sale.update({
+ 'state': 'cancel',
+ })
+
+ if sale.state == 'cancel':
+ sale.update({
+ 'approval_status': False,
+ })
+
+ @api.model
+ def action_multi_update_invoice_status(self):
+ order_ids = self.env.context.get('active_ids', [])
+ sale_order = self.search([('id', 'in', order_ids)])
+ for sale in sale_order:
+ sale.update({
+ 'invoice_status': 'invoiced',
+ })
+
def _compute_purchase_total(self):
for order in self:
total = 0