From a00faa739bdbd8d7750728bdfdc3926b9bf446e2 Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Fri, 13 Oct 2023 15:38:18 +0700 Subject: sale monitoring upgrade --- indoteknik_custom/models/sale_monitoring.py | 34 ++++++++++++++++++++++++++++- indoteknik_custom/models/sale_order_line.py | 8 ++++++- indoteknik_custom/views/purchase_order.xml | 2 +- indoteknik_custom/views/sale_monitoring.xml | 8 +++++-- indoteknik_custom/views/sale_order.xml | 1 + 5 files changed, 48 insertions(+), 5 deletions(-) diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index ad15e0c2..cac68b7c 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -21,9 +21,41 @@ class SaleMonitoring(models.Model): status = fields.Char(string="Status") po_number = fields.Char(string="PO Number") qty_reserved = fields.Integer(string="Qty Reserved") - note = fields.Char(string="Note", compute='compute_note') + note_so_line = fields.Selection([ + ('eta', 'ETA'), + ('info_sales', 'Info Sales'), + ('info_vendor', 'Info Vendor'), + ('penggabungan', 'Penggabungan'), + ], string="Note", compute='compute_note') + note = fields.Char(string="Note Detail", compute='compute_note_detail') + purchase_representative_id = fields.Many2one('res.users', string="Purchase Representative", readonly=True, compute='compute_purchase_representative') + + def compute_purchase_representative(self): + for sale in self: + po = self.env['purchase.order'].search([ + ('sale_order_id', '=', sale.sale_order_id.id), + ('user_id', '!=', False) + ]) + + user_id = False + + if po: + user_id = po[0].user_id + + sale.purchase_representative_id = user_id def compute_note(self): + for sale in self: + lines = self.env['sale.order.line'].search([ + ('order_id', '=', sale.sale_order_id.id), + ('note', '!=', False) + ]) + + note = ', '.join(lines.mapped('note') or ['']) + + sale.note_so_line = note + + def compute_note_detail(self): for sale in self: lines = self.env['sale.order.line'].search([ ('order_id', '=', sale.sale_order_id.id), diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 69328325..d0985de5 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -18,7 +18,13 @@ class SaleOrderLine(models.Model): delivery_amt_line = fields.Float('DeliveryAmtLine', compute='compute_delivery_amt_line') fee_third_party_line = fields.Float('FeeThirdPartyLine', compute='compute_fee_third_party_line', default=0) line_no = fields.Integer('No', default=0, copy=False) - note_procurement = fields.Char(string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") + note = fields.Selection([ + ('eta', 'ETA'), + ('info_sales', 'Info Sales'), + ('info_vendor', 'Info Vendor'), + ('penggabungan', 'Penggabungan'), + ], string='Note', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") + note_procurement = fields.Char(string='Note Detail', help="Harap diisi jika ada keterangan tambahan dari Procurement, agar dapat dimonitoring") vendor_subtotal = fields.Float(string='Vendor Subtotal', compute="_compute_vendor_subtotal") amount_voucher_disc = fields.Float(string='Voucher Discount') diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index e0ec86f9..adcaaf43 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -37,7 +37,7 @@ - + diff --git a/indoteknik_custom/views/sale_monitoring.xml b/indoteknik_custom/views/sale_monitoring.xml index 5824af6a..207277af 100755 --- a/indoteknik_custom/views/sale_monitoring.xml +++ b/indoteknik_custom/views/sale_monitoring.xml @@ -18,6 +18,7 @@ + - + + @@ -49,7 +51,8 @@ decoration-info="status == 'Delivered' or status == 'Invoiced'" /> - + + @@ -58,6 +61,7 @@ + diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index e0e9ac54..a260c68a 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -92,6 +92,7 @@ "/> + -- cgit v1.2.3