From 5006bd2c6cbf09d9f46624b6087cb72702f1ac52 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 19 Jun 2023 16:54:00 +0700 Subject: Bug fix synchronize order line on purchase --- indoteknik_custom/models/purchase_order.py | 31 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index df1ecf14..13ff2931 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -151,23 +151,20 @@ class PurchaseOrder(models.Model): self.order_line.unlink() for order_line in self.sale_order_id.order_line: if order_line.product_id.id and order_line.product_id.id not in products_exception: - for order_line in self.sale_order_id.order_line: - if not order_line.product_id: - continue - qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty - - suggest = 'harus beli' - if qty_available > order_line.product_qty: - suggest = 'masih cukup' - values = { - 'order_id': self.id, - 'product_id': order_line.product_id.id, - 'name': order_line.product_id.display_name, - 'product_qty': order_line.product_qty, - 'qty_available_store': qty_available, - 'suggest': suggest, - } - self.env['purchase.order.line'].create(values) + qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty + + suggest = 'harus beli' + if qty_available > order_line.product_qty: + suggest = 'masih cukup' + values = { + 'order_id': self.id, + 'product_id': order_line.product_id.id, + 'name': order_line.product_id.display_name, + 'product_qty': order_line.product_qty, + 'qty_available_store': qty_available, + 'suggest': suggest, + } + self.order_line.create(values) def compute_count_line_product(self): for order in self: -- cgit v1.2.3 From a3e6d8b8fa284f8f07d815c14c8e547321161261 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 20 Jun 2023 14:06:29 +0700 Subject: add qty available bandengan and suggest in requisition --- indoteknik_custom/models/requisition.py | 12 +++++++++++- indoteknik_custom/views/requisition.xml | 2 ++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/indoteknik_custom/models/requisition.py b/indoteknik_custom/models/requisition.py index c1af4784..9ae6fb3e 100644 --- a/indoteknik_custom/models/requisition.py +++ b/indoteknik_custom/models/requisition.py @@ -44,6 +44,12 @@ class Requisition(models.Model): purchase_price = 0 vendor_id = 0 + # get qty available bandengan + qty_available = order_line.product_id.qty_onhand_bandengan + order_line.product_id.qty_incoming_bandengan - order_line.product_id.outgoing_qty + suggest = 'harus beli' + if qty_available > order_line.product_qty: + suggest = 'masih cukup' + purchase_pricelist = self.env['purchase.pricelist'].search([ ('product_id.id', '=', order_line.product_id.id), ('vendor_id.id', '=', 5571) @@ -78,7 +84,9 @@ class Requisition(models.Model): 'tax_id': order_line.purchase_tax_id.id, 'price_unit': purchase_price, 'subtotal': purchase_price * order_line.product_uom_qty, - 'source': source + 'source': source, + 'qty_available_store': qty_available, + 'suggest': suggest, }]) count+=1 _logger.info('Create Requisition %s' % order_line.product_id.name) @@ -171,6 +179,8 @@ class RequisitionLine(models.Model): current_po_id = fields.Many2one('purchase.order', string='Current') current_po_line_id = fields.Many2one('purchase.order.line', string='Current Line') source = fields.Char(string='Source', help='data harga diambil darimana') + qty_available_store = fields.Float(string='Available') + suggest = fields.Char(string='Suggest') class RequisitionPurchaseMatch(models.Model): _name = 'requisition.purchase.match' diff --git a/indoteknik_custom/views/requisition.xml b/indoteknik_custom/views/requisition.xml index 29b3a852..9e9440d8 100644 --- a/indoteknik_custom/views/requisition.xml +++ b/indoteknik_custom/views/requisition.xml @@ -27,6 +27,8 @@ + + -- cgit v1.2.3 From 45583fb16a83602bea6c02711bfd947f7a402265 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Tue, 20 Jun 2023 15:09:34 +0700 Subject: add note in product sales order for sales monitoring, and add tracking in midtrans status --- indoteknik_custom/models/sale_monitoring_detail.py | 4 +++- indoteknik_custom/models/sale_order.py | 3 ++- indoteknik_custom/views/sale_monitoring_detail.xml | 2 ++ indoteknik_custom/views/sale_order.xml | 1 + 4 files changed, 8 insertions(+), 2 deletions(-) diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index 2bcda50c..43a8aeb0 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -22,6 +22,7 @@ class SaleMonitoringDetail(models.Model): date_order = fields.Datetime(string="Date Order") status = fields.Char(string="Status") qty_reserved = fields.Integer(string="Qty Reserved") + note = fields.Char(string="Note") def init(self): tools.drop_view_if_exists(self.env.cr, self._table) @@ -52,7 +53,8 @@ class SaleMonitoringDetail(models.Model): so.date_order AS date_order, get_qty_po(so.id, sol.product_id) AS qty_po, get_qty_received(so.id, sol.product_id) AS qty_po_received, - get_qty_reserved(so.id, sol.product_id) as qty_reserved + get_qty_reserved(so.id, sol.product_id) as qty_reserved, + sol.note_procurement as note FROM sale_order so JOIN sale_order_line sol ON sol.order_id = so.id JOIN product_product p ON p.id = sol.product_id diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 5293b0fb..0c631761 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -70,7 +70,7 @@ class SaleOrder(models.Model): ('partial_refund', 'Partial Refund'), ('partial_chargeback', 'Partial Chargeback'), ('authorize', 'Authorize'), - ], string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle') + ], tracking=True, string='Payment Status', help='Payment Gateway Status / Midtrans / Web, https://docs.midtrans.com/en/after-payment/status-cycle') date_doc_kirim = fields.Datetime(string='Tanggal Kirim di SJ', help="Tanggal Kirim di cetakan SJ yang terakhir, tidak berpengaruh ke Accounting") payment_type = fields.Char(string='Payment Type', help='Jenis pembayaran dengan Midtrans') gross_amount = fields.Float(string='Gross Amount', help='Jumlah pembayaran yang dilakukan dengan Midtrans') @@ -459,6 +459,7 @@ 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") def compute_item_margin(self): for line in self: diff --git a/indoteknik_custom/views/sale_monitoring_detail.xml b/indoteknik_custom/views/sale_monitoring_detail.xml index 824e65e8..ce5b8e9b 100755 --- a/indoteknik_custom/views/sale_monitoring_detail.xml +++ b/indoteknik_custom/views/sale_monitoring_detail.xml @@ -23,6 +23,7 @@ decoration-success="status == 'Siap kirim'" decoration-info="status == 'Delivered' or status == 'Invoiced'" /> + @@ -46,6 +47,7 @@ decoration-success="status == 'Siap kirim'" decoration-info="status == 'Delivered' or status == 'Invoiced'" /> + diff --git a/indoteknik_custom/views/sale_order.xml b/indoteknik_custom/views/sale_order.xml index b160d9b1..ea84eb00 100755 --- a/indoteknik_custom/views/sale_order.xml +++ b/indoteknik_custom/views/sale_order.xml @@ -61,6 +61,7 @@ "/> + -- cgit v1.2.3