summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/commision.py16
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml2
2 files changed, 12 insertions, 6 deletions
diff --git a/indoteknik_custom/models/commision.py b/indoteknik_custom/models/commision.py
index 32e81b9a..bd4c06a4 100644
--- a/indoteknik_custom/models/commision.py
+++ b/indoteknik_custom/models/commision.py
@@ -1,8 +1,10 @@
from odoo import models, api, fields, _
from odoo.exceptions import UserError
from datetime import datetime
+# import datetime
import logging
from terbilang import Terbilang
+import pytz
_logger = logging.getLogger(__name__)
@@ -301,30 +303,34 @@ class CustomerCommision(models.Model):
return result
def action_confirm_customer_commision(self):
- now = datetime.utcnow()
+ jakarta_tz = pytz.timezone('Asia/Jakarta')
+ now = datetime.now(jakarta_tz)
+
+ now_naive = now.replace(tzinfo=None)
+
if not self.status or self.status == 'draft':
self.status = 'pengajuan1'
elif self.status == 'pengajuan1' and self.env.user.is_sales_manager:
self.status = 'pengajuan2'
self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name
- self.date_approved_sales = now
+ self.date_approved_sales = now_naive
self.position_sales = 'Sales Manager'
elif self.status == 'pengajuan2' and self.env.user.id == 19:
self.status = 'pengajuan3'
self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name
- self.date_approved_marketing = now
+ self.date_approved_marketing = now_naive
self.position_marketing = 'Marketing Manager'
elif self.status == 'pengajuan3' and self.env.user.is_leader:
self.status = 'pengajuan4'
self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name
- self.date_approved_pimpinan = now
+ self.date_approved_pimpinan = now_naive
self.position_pimpinan = 'Pimpinan'
elif self.status == 'pengajuan4' and self.env.user.id == 1272:
for line in self.commision_lines:
line.invoice_id.is_customer_commision = True
self.status = 'approved'
self.approved_by = (self.approved_by + ', ' if self.approved_by else '') + self.env.user.name
- self.date_approved_accounting = now
+ self.date_approved_accounting = now_naive
self.position_accounting = 'Accounting'
else:
raise UserError('Harus di approved oleh yang bersangkutan')
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index d6ad2408..920268bc 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -140,7 +140,7 @@
</field>
<field name="order_line" position="attributes">
- <attribute name="attrs">{'readonly': ['|', ('state', 'in', ['done', 'cancel']), ('has_active_invoice', '=', True)]}</attribute>
+ <attribute name="attrs">{'readonly': ['|', ('state', 'in', ['purchase', 'done', 'cancel']), ('has_active_invoice', '=', True)]}</attribute>
</field>
<xpath expr="//form/sheet/notebook/page/field[@name='order_line']/tree/field[@name='price_unit']" position="attributes">