summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_order.py
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2024-01-09 14:11:04 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2024-01-09 14:11:04 +0700
commit3615748eafd2d2cfd81f6ddc95d50a7bc347798d (patch)
tree774208714a7239c74e2133872fba43917218141a /indoteknik_custom/models/purchase_order.py
parent8be31f0f44c2fde870c7c85e27379f88e1b38d7c (diff)
ETA on sales dan purchase order
Diffstat (limited to 'indoteknik_custom/models/purchase_order.py')
-rwxr-xr-xindoteknik_custom/models/purchase_order.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py
index 6641e204..ba6b6c41 100755
--- a/indoteknik_custom/models/purchase_order.py
+++ b/indoteknik_custom/models/purchase_order.py
@@ -45,7 +45,7 @@ class PurchaseOrder(models.Model):
summary_qty_po = fields.Float('Total Qty', compute='_compute_summary_qty')
summary_qty_receipt = fields.Float('Summary Qty Receipt', compute='_compute_summary_qty')
count_line_product = fields.Float('Total Item', compute='compute_count_line_product')
- note_description = fields.Char(string='Note', help='bisa diisi sebagai informasi indent barang tertentu atau apapun')
+ note_description = fields.Char(string='Noteman', help='bisa diisi sebagai informasi indent barang tertentu atau apapun')
has_active_invoice = fields.Boolean(string='Has Active Invoice', compute='_compute_has_active_invoice')
description = fields.Char(string='Description', help='bisa diisi sebagai informasi indent barang tertentu atau apapun')
purchase_order_lines = fields.One2many('purchase.order.line', 'order_id', string='Indent', auto_join=True)
@@ -114,8 +114,9 @@ class PurchaseOrder(models.Model):
def _compute_date_planned(self):
for order in self:
if order.date_approve:
+ leadtime = order.partner_id.leadtime
current_time = order.date_approve
- delta_time = current_time + timedelta(days=2)
+ delta_time = current_time + timedelta(days=leadtime)
delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S')
order.date_planned = delta_time
else:
@@ -261,6 +262,11 @@ class PurchaseOrder(models.Model):
amount += line.price_total
order.delivery_amount = amount
+ def date_deadline_ref_date_planned(self):
+ for picking in self.picking_ids:
+ picking.scheduled_date = self.date_planned
+ picking.date_deadline = self.date_planned
+
def button_confirm(self):
res = super(PurchaseOrder, self).button_confirm()
@@ -287,10 +293,12 @@ class PurchaseOrder(models.Model):
self.calculate_line_no()
# override date planned added with two days
+ leadtime = self.partner_id.leadtime
current_time = datetime.now()
- delta_time = current_time + timedelta(days=2)
+ delta_time = current_time + timedelta(days=leadtime)
delta_time = delta_time.strftime('%Y-%m-%d %H:%M:%S')
self.date_planned = delta_time
+ self.date_deadline_ref_date_planned()
return res