From 5ddda2a380e9aeaf63241e8f6b1c35e3005a3468 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 23 Oct 2023 15:36:50 +0700 Subject: Add action on sync by solr flag --- indoteknik_custom/models/solr/product_product.py | 1 + indoteknik_custom/models/solr/product_template.py | 1 + 2 files changed, 2 insertions(+) diff --git a/indoteknik_custom/models/solr/product_product.py b/indoteknik_custom/models/solr/product_product.py index 85c94741..03eaaf13 100644 --- a/indoteknik_custom/models/solr/product_product.py +++ b/indoteknik_custom/models/solr/product_product.py @@ -25,6 +25,7 @@ class ProductProduct(models.Model): def variant_solr_flag_to_solr(self, limit=500): variant_products = self.search([('solr_flag', '=', 2)], limit=limit) for product in variant_products: + product.product_tmpl_id._create_solr_queue('_sync_product_template_to_solr') product.product_tmpl_id._create_solr_queue('_sync_price_to_solr') product.solr_flag = 1 diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 25d7d4b8..2bbcab9c 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -36,6 +36,7 @@ class ProductTemplate(models.Model): def solr_flag_to_solr(self, limit=500): template_products = self.search([('solr_flag', '=', 2)], limit=limit) for product in template_products: + product._create_solr_queue('_sync_product_template_to_solr') product._create_solr_queue('_sync_price_to_solr') product.solr_flag = 1 -- cgit v1.2.3 From c35137e5a43afeb6a45b7f213f9ab40afb75fb4c Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 23 Oct 2023 19:06:32 +0700 Subject: change logic of valid purchase pricelist in sales order --- indoteknik_custom/models/sale_order_line.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index d0985de5..748153ad 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -72,21 +72,33 @@ class SaleOrderLine(models.Model): cost = self.product_id.standard_price self.purchase_price = cost else: + # purchase_price = self.env['purchase.pricelist'].search( + # [('vendor_id', '=', self.vendor_id.id), ('product_id', '=', self.product_id.id)], limit=1) purchase_price = self.env['purchase.pricelist'].search( - [('vendor_id', '=', self.vendor_id.id), ('product_id', '=', self.product_id.id)], limit=1) - self.purchase_price = purchase_price.product_price + [('vendor_id', '=', self.vendor_id.id), ('product_id', '=', self.product_id.id)], + limit=1, order='count_trx_po desc, count_trx_po_vendor desc') + self.purchase_price = self._get_valid_purchase_price(purchase_price) self.purchase_tax_id = 22 + def _get_valid_purchase_price(self, purchase_price): + p_price = 0 + if purchase_price.system_price > 0 and purchase_price.product_price > 0: + if purchase_price.human_last_update > purchase_price.system_last_update: + p_price = purchase_price.product_price + else: + p_price = purchase_price.system_price + return p_price + @api.onchange('product_id') def product_id_change(self): super(SaleOrderLine, self).product_id_change() for line in self: if line.product_id and line.product_id.type == 'product': purchase_price = self.env['purchase.pricelist'].search( - [('product_id', '=', self.product_id.id)], limit=1, order='product_price ASC') + [('product_id', '=', self.product_id.id)], limit=1, order='count_trx_po desc, count_trx_po_vendor desc') line.vendor_id = purchase_price.vendor_id line.tax_id = line.order_id.sales_tax_id - line.purchase_price = purchase_price.product_price + line.purchase_price = self._get_valid_purchase_price(purchase_price) def compute_delivery_amt_line(self): for line in self: -- cgit v1.2.3 From 8cba1eaa340eb0c6b264672b0a47dc1628c2eb04 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 25 Oct 2023 14:05:01 +0700 Subject: initial commit for split automatic purchase --- indoteknik_custom/__manifest__.py | 1 + indoteknik_custom/models/__init__.py | 3 ++- indoteknik_custom/models/automatic_purchase.py | 10 ++++++++-- indoteknik_custom/models/stock_warehouse_orderpoint.py | 10 ++++++++++ indoteknik_custom/models/x_manufactures.py | 2 ++ indoteknik_custom/views/automatic_purchase.xml | 2 ++ indoteknik_custom/views/stock_warehouse_orderpoint.xml | 15 +++++++++++++++ indoteknik_custom/views/x_manufactures.xml | 2 ++ 8 files changed, 42 insertions(+), 3 deletions(-) create mode 100644 indoteknik_custom/models/stock_warehouse_orderpoint.py create mode 100644 indoteknik_custom/views/stock_warehouse_orderpoint.xml diff --git a/indoteknik_custom/__manifest__.py b/indoteknik_custom/__manifest__.py index 23abc084..3bc4be60 100755 --- a/indoteknik_custom/__manifest__.py +++ b/indoteknik_custom/__manifest__.py @@ -99,6 +99,7 @@ 'views/quotation_so_multi_update.xml', 'views/stock_move_line.xml', 'views/product_monitoring.xml', + 'views/stock_warehouse_orderpoint.xml', 'report/report.xml', 'report/report_banner_banner.xml', 'report/report_banner_banner2.xml', diff --git a/indoteknik_custom/models/__init__.py b/indoteknik_custom/models/__init__.py index 1133c3e7..6a5eac00 100755 --- a/indoteknik_custom/models/__init__.py +++ b/indoteknik_custom/models/__init__.py @@ -89,4 +89,5 @@ from . import stock_scheduler_compute from . import promotion from . import sale_orders_multi_update from . import quotation_so_multi_update -from . import product_monitoring \ No newline at end of file +from . import product_monitoring +from . import stock_warehouse_orderpoint diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index 990d3cc5..f81ecdcc 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -17,6 +17,7 @@ class AutomaticPurchase(models.Model): is_po = fields.Boolean(string='Is PO') purchase_match = fields.One2many('automatic.purchase.match', 'automatic_purchase_id', string='Matches', auto_join=True) vendor_id = fields.Many2one('res.partner', string='Vendor', help='boleh kosong, jika diisi, maka hanya keluar data untuk vendor tersebut') + responsible_id = fields.Many2one('res.users', string='Responsible', required=True) def create_po_from_automatic_purchase(self): if not self.purchase_lines: @@ -87,7 +88,8 @@ class AutomaticPurchase(models.Model): raise UserError('Sudah digenerate sebelumnya, hapus line terlebih dahulu') query = [ - ('product_min_qty', '>', 0) + ('product_min_qty', '>', 0), + ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id) ] orderpoints = self.env['stock.warehouse.orderpoint'].search(query) count = 0 @@ -101,10 +103,14 @@ class AutomaticPurchase(models.Model): if self.vendor_id: purchase_price = self.env['purchase.pricelist'].search([ ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), ('vendor_id', '=', self.vendor_id.id) ], order='product_price asc', limit=1) else: - purchase_price = self.env['purchase.pricelist'].search([('product_id', '=', point.product_id.id)], order='product_price asc', limit=1) + purchase_price = self.env['purchase.pricelist'].search([ + ('product_id', '=', point.product_id.id), + # ('product_id.x_manufacture.user_id.id', '=', self.responsible_id.id), + ], order='product_price asc', limit=1) vendor_id = purchase_price.vendor_id.id price = purchase_price.product_price or 0 diff --git a/indoteknik_custom/models/stock_warehouse_orderpoint.py b/indoteknik_custom/models/stock_warehouse_orderpoint.py new file mode 100644 index 00000000..277c8dc3 --- /dev/null +++ b/indoteknik_custom/models/stock_warehouse_orderpoint.py @@ -0,0 +1,10 @@ +from odoo import fields, models, api, _ + +class StockWarehouseOrderpoint(models.Model): + _inherit = 'stock.warehouse.orderpoint' + + responsible_id = fields.Many2one('res.users', string='Responsible', compute='_compute_responsible') + + def _compute_responsible(self): + for stock in self: + stock.responsible_id = stock.product_id.x_manufacture.user_id diff --git a/indoteknik_custom/models/x_manufactures.py b/indoteknik_custom/models/x_manufactures.py index e48a5367..abedf0cf 100755 --- a/indoteknik_custom/models/x_manufactures.py +++ b/indoteknik_custom/models/x_manufactures.py @@ -47,6 +47,8 @@ class XManufactures(models.Model): parent_id = fields.Many2one('x_manufactures', string='Parent', help='Parent Brand tersebut') category_ids = fields.Many2many('product.public.category', string='Category', help='Brand tsb memiliki Category apa saja') vendor_ids = fields.Many2many('res.partner', string='Vendor', compute='_compute_vendor_ids') + # user_id = fields.Many2one('res.users', string='Responsible', domain="['|'('id', '=', 19), ('id', '=', 6)]", help="Siapa yang bertanggung jawab") + user_id = fields.Many2one('res.users', string='Responsible', help="Siapa yang bertanggung jawab") def _compute_vendor_ids(self): for manufacture in self: diff --git a/indoteknik_custom/views/automatic_purchase.xml b/indoteknik_custom/views/automatic_purchase.xml index 49751f4e..0478304e 100644 --- a/indoteknik_custom/views/automatic_purchase.xml +++ b/indoteknik_custom/views/automatic_purchase.xml @@ -10,6 +10,7 @@ + @@ -57,6 +58,7 @@ + diff --git a/indoteknik_custom/views/stock_warehouse_orderpoint.xml b/indoteknik_custom/views/stock_warehouse_orderpoint.xml new file mode 100644 index 00000000..038b09cc --- /dev/null +++ b/indoteknik_custom/views/stock_warehouse_orderpoint.xml @@ -0,0 +1,15 @@ + + + + + stock.warehouse.orderpoint.tree + stock.warehouse.orderpoint + + + + + + + + + \ No newline at end of file diff --git a/indoteknik_custom/views/x_manufactures.xml b/indoteknik_custom/views/x_manufactures.xml index f68a0e00..d413be12 100755 --- a/indoteknik_custom/views/x_manufactures.xml +++ b/indoteknik_custom/views/x_manufactures.xml @@ -24,6 +24,7 @@ + @@ -46,6 +47,7 @@ + -- cgit v1.2.3 From 9292b2e0865500077281e2c410d264011b9a65da Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Wed, 25 Oct 2023 15:56:56 +0700 Subject: add date if all line in delivery order reserved --- indoteknik_custom/models/sale_order.py | 38 +++++++++++++++++++++++++++++++ indoteknik_custom/models/stock_picking.py | 6 +++++ indoteknik_custom/views/stock_picking.xml | 1 + 3 files changed, 45 insertions(+) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9324930e..9da6d9fb 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -1,5 +1,6 @@ from odoo import fields, models, api, _ from odoo.exceptions import UserError +from datetime import datetime import logging, random, string, requests, math, json, re _logger = logging.getLogger(__name__) @@ -81,6 +82,16 @@ class SaleOrder(models.Model): email = fields.Char(string='Email') picking_iu_id = fields.Many2one('stock.picking', 'Picking IU') helper_by_id = fields.Many2one('res.users', 'Helper By') + picking_ids = fields.Many2many('stock.picking', string='Pickings', compute='_get_pickings', readonly=True, copy=False, search="_search_picking_ids") + + def _get_pickings(self): + state = ['assigned'] + for order in self: + pickings = self.env['stock.picking'].search([ + ('sale_id.id', '=', order.id), + ('state', 'in', state) + ]) + order.picking_ids = pickings @api.model def action_multi_update_state(self): @@ -193,8 +204,35 @@ class SaleOrder(models.Model): sale.so_status = 'sebagian' else: sale.so_status = 'menunggu' + + for picking in sale.picking_ids: + sum_qty_pick = sum(move_line.product_uom_qty for move_line in picking.move_ids_without_package) + sum_qty_reserved = sum(move_line.product_uom_qty for move_line in picking.move_line_ids_without_package) + if sum_qty_pick == sum_qty_reserved: + current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') + picking.date_reserved = current_time + else: + picking.date_reserved = '' + _logger.info('Calculate SO Status %s' % sale.id) + def _search_picking_ids(self, operator, value): + if operator == 'in' and value: + self.env.cr.execute(""" + SELECT array_agg(so.sale_id) + FROM stock_picking so + WHERE + so.sale_id is not null and so.id = ANY(%s) + """, (list(value),)) + so_ids = self.env.cr.fetchone()[0] or [] + return [('id', 'in', so_ids)] + elif operator == '=' and not value: + order_ids = self._search([ + ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')) + ]) + return [('id', 'not in', order_ids)] + return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] + @api.onchange('partner_shipping_id') def onchange_partner_shipping(self): self.real_shipping_id = self.partner_shipping_id diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index 626e842d..a5e533b1 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1,6 +1,7 @@ from odoo import fields, models, api, _ from odoo.exceptions import AccessError, UserError, ValidationError from odoo.tools.float_utils import float_is_zero +from datetime import datetime from itertools import groupby import pytz, datetime @@ -74,6 +75,7 @@ class StockPicking(models.Model): purchase_representative_id = fields.Many2one('res.users', related='move_lines.purchase_line_id.order_id.user_id', string="Purchase Representative", readonly=True) carrier_id = fields.Many2one('delivery.carrier', string='Shipping Method') shipping_status = fields.Char(string='Shipping Status', compute="_compute_shipping_status") + date_reserved = fields.Datetime(string="Date Reserved", help='Tanggal ter-reserved semua barang nya') def _compute_shipping_status(self): for rec in self: @@ -309,6 +311,10 @@ class StockPicking(models.Model): if product: product.product_tmpl_id._create_solr_queue('_sync_product_stock_to_solr') + if not self.date_reserved: + current_time = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S') + self.date_reserved = current_time + res = super(StockPicking, self).button_validate() self.calculate_line_no() return res diff --git a/indoteknik_custom/views/stock_picking.xml b/indoteknik_custom/views/stock_picking.xml index 3702dcf8..b0932d5a 100644 --- a/indoteknik_custom/views/stock_picking.xml +++ b/indoteknik_custom/views/stock_picking.xml @@ -72,6 +72,7 @@ /> + Date: Thu, 26 Oct 2023 11:09:33 +0700 Subject: fix bug in sale order while compute date reserved --- indoteknik_custom/models/sale_order.py | 56 ++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/indoteknik_custom/models/sale_order.py b/indoteknik_custom/models/sale_order.py index 9da6d9fb..cc6941a9 100755 --- a/indoteknik_custom/models/sale_order.py +++ b/indoteknik_custom/models/sale_order.py @@ -82,16 +82,16 @@ class SaleOrder(models.Model): email = fields.Char(string='Email') picking_iu_id = fields.Many2one('stock.picking', 'Picking IU') helper_by_id = fields.Many2one('res.users', 'Helper By') - picking_ids = fields.Many2many('stock.picking', string='Pickings', compute='_get_pickings', readonly=True, copy=False, search="_search_picking_ids") + # picking_ids = fields.Many2many('stock.picking', string='Pickings', compute='_get_pickings', readonly=True, copy=False, search="_search_picking_ids") - def _get_pickings(self): - state = ['assigned'] - for order in self: - pickings = self.env['stock.picking'].search([ - ('sale_id.id', '=', order.id), - ('state', 'in', state) - ]) - order.picking_ids = pickings + # def _get_pickings(self): + # state = ['assigned'] + # for order in self: + # pickings = self.env['stock.picking'].search([ + # ('sale_id.id', '=', order.id), + # ('state', 'in', state) + # ]) + # order.picking_ids = pickings @api.model def action_multi_update_state(self): @@ -208,30 +208,34 @@ class SaleOrder(models.Model): for picking in sale.picking_ids: sum_qty_pick = sum(move_line.product_uom_qty for move_line in picking.move_ids_without_package) sum_qty_reserved = sum(move_line.product_uom_qty for move_line in picking.move_line_ids_without_package) - if sum_qty_pick == sum_qty_reserved: + if picking.state == 'done': + continue + elif sum_qty_pick == sum_qty_reserved and not picking.date_reserved:# baru ke reserved current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') picking.date_reserved = current_time + elif sum_qty_pick == sum_qty_reserved:# sudah ada data reserved + picking.date_reserved = picking.date_reserved else: picking.date_reserved = '' _logger.info('Calculate SO Status %s' % sale.id) - def _search_picking_ids(self, operator, value): - if operator == 'in' and value: - self.env.cr.execute(""" - SELECT array_agg(so.sale_id) - FROM stock_picking so - WHERE - so.sale_id is not null and so.id = ANY(%s) - """, (list(value),)) - so_ids = self.env.cr.fetchone()[0] or [] - return [('id', 'in', so_ids)] - elif operator == '=' and not value: - order_ids = self._search([ - ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')) - ]) - return [('id', 'not in', order_ids)] - return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] + # def _search_picking_ids(self, operator, value): + # if operator == 'in' and value: + # self.env.cr.execute(""" + # SELECT array_agg(so.sale_id) + # FROM stock_picking so + # WHERE + # so.sale_id is not null and so.id = ANY(%s) + # """, (list(value),)) + # so_ids = self.env.cr.fetchone()[0] or [] + # return [('id', 'in', so_ids)] + # elif operator == '=' and not value: + # order_ids = self._search([ + # ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')) + # ]) + # return [('id', 'not in', order_ids)] + # return ['&', ('order_line.invoice_lines.move_id.move_type', 'in', ('out_invoice', 'out_refund')), ('order_line.invoice_lines.move_id', operator, value)] @api.onchange('partner_shipping_id') def onchange_partner_shipping(self): -- cgit v1.2.3 From 0037ab8019daad5c1cfccd0007284c54b5c22253 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 26 Oct 2023 11:56:16 +0700 Subject: add indent tab in purchase order --- indoteknik_custom/models/purchase_order.py | 1 + indoteknik_custom/views/purchase_order.xml | 19 +++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/indoteknik_custom/models/purchase_order.py b/indoteknik_custom/models/purchase_order.py index d62d7b1e..f9cd7f5b 100755 --- a/indoteknik_custom/models/purchase_order.py +++ b/indoteknik_custom/models/purchase_order.py @@ -48,6 +48,7 @@ class PurchaseOrder(models.Model): note_description = fields.Char(string='Note', 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) def _compute_has_active_invoice(self): for order in self: diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml index d564f260..8f7ea6df 100755 --- a/indoteknik_custom/views/purchase_order.xml +++ b/indoteknik_custom/views/purchase_order.xml @@ -79,6 +79,7 @@ + @@ -96,6 +97,12 @@ {'readonly': [], 'required': True} + + + + + + @@ -165,4 +172,16 @@ True + + + purchase.order.line.indent.tree + purchase.order.line + + + + + + + + \ No newline at end of file -- cgit v1.2.3 From 6777edb758fb29981a0baac663b1388a820cded8 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 26 Oct 2023 15:54:47 +0700 Subject: bug fix get purchase price in sales order --- indoteknik_custom/models/sale_order_line.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/indoteknik_custom/models/sale_order_line.py b/indoteknik_custom/models/sale_order_line.py index 748153ad..eda003c7 100644 --- a/indoteknik_custom/models/sale_order_line.py +++ b/indoteknik_custom/models/sale_order_line.py @@ -87,6 +87,10 @@ class SaleOrderLine(models.Model): p_price = purchase_price.product_price else: p_price = purchase_price.system_price + elif purchase_price.system_price > 0 and purchase_price.product_price == 0: + p_price = purchase_price.system_price + elif purchase_price.system_price == 0 and purchase_price.product_price > 0: + p_price = purchase_price.product_price return p_price @api.onchange('product_id') -- cgit v1.2.3 From 5bb681f2975a3fb38fcd87c89f72d18c6e794170 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Sat, 28 Oct 2023 10:07:00 +0700 Subject: Bug fix condition sync product price to solr --- indoteknik_custom/models/solr/product_template.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/solr/product_template.py b/indoteknik_custom/models/solr/product_template.py index 2bbcab9c..648a0625 100644 --- a/indoteknik_custom/models/solr/product_template.py +++ b/indoteknik_custom/models/solr/product_template.py @@ -137,7 +137,7 @@ class ProductTemplate(models.Model): price_tier = price_doc.get(f"{price_tier_key}_f", 0) # When price tier is 0 or variant_price less than price tier then use variant price - if price_tier == 0 or variant_price < price_tier: + if price_tier == 0 or (variant_price < price_tier and variant_price > 0): price_doc[f"{discount_tier_key}_f"] = variant_discount price_doc[f"{price_tier_key}_f"] = variant_price -- cgit v1.2.3 From c114fc17c7502174415c4e4bf1e7f8e24a46998c Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Mon, 30 Oct 2023 08:59:11 +0700 Subject: Change name manufacture on solr to lowercase --- indoteknik_custom/models/solr/x_manufactures.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/solr/x_manufactures.py b/indoteknik_custom/models/solr/x_manufactures.py index 375b7708..98b1d01d 100644 --- a/indoteknik_custom/models/solr/x_manufactures.py +++ b/indoteknik_custom/models/solr/x_manufactures.py @@ -40,7 +40,7 @@ class XManufactures(models.Model): document.update({ 'id': brands.id, 'display_name_s': brands.display_name, - 'name_s': brands.x_name, + 'name_s': brands.x_name.lower(), 'sequence_i': brands.sequence or '', 'negara_asal_s': brands.x_negara_asal or '', 'short_desc_s': brands.x_short_desc or '', -- cgit v1.2.3 From 9530cc0c2ba6a15300799cf7e14b6dc1b04daa37 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 30 Oct 2023 11:37:11 +0700 Subject: move status invoice to bottom in sales monitoring detail --- indoteknik_custom/models/sale_monitoring_detail.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_monitoring_detail.py b/indoteknik_custom/models/sale_monitoring_detail.py index dc4caa14..43b0b063 100755 --- a/indoteknik_custom/models/sale_monitoring_detail.py +++ b/indoteknik_custom/models/sale_monitoring_detail.py @@ -31,12 +31,12 @@ class SaleMonitoringDetail(models.Model): SELECT *, CASE - when qty_so_invoiced = qty_so then 'Invoiced' when qty_so_delivered = qty_so then 'Delivered' when qty_reserved >= qty_so then 'Siap kirim' when qty_po + qty_reserved - qty_po_received < qty_so then 'Belum/Kurang PO' when qty_po_received = 0 then 'Belum terima' when qty_po_received < qty_po then 'Terima sebagian' + when qty_so_invoiced = qty_so then 'Invoiced' END AS status FROM ( -- cgit v1.2.3 From d426ff142df8b5778398e3b460ff03d02d9e368a Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 30 Oct 2023 11:38:13 +0700 Subject: move status invoiced to bottom in sale monitoring header only --- indoteknik_custom/models/sale_monitoring.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/indoteknik_custom/models/sale_monitoring.py b/indoteknik_custom/models/sale_monitoring.py index cfbe6d78..107d5296 100755 --- a/indoteknik_custom/models/sale_monitoring.py +++ b/indoteknik_custom/models/sale_monitoring.py @@ -81,12 +81,12 @@ class SaleMonitoring(models.Model): SUM(smd.qty_so_invoiced) AS qty_so_invoiced, sum(smd.qty_reserved) as qty_reserved, CASE - when sum(qty_so_invoiced) = sum(qty_so) then 'Invoiced' when sum(qty_so_delivered) = sum(qty_so) then 'Delivered' when sum(qty_reserved) >= sum(qty_so) then 'Siap kirim' when sum(qty_po) + sum(qty_reserved) - sum(qty_po_received) < sum(qty_so) then 'Belum/Kurang PO' when sum(qty_po_received) = 0 then 'Belum terima' when sum(qty_po_received) < sum(qty_po) then 'Terima sebagian' + when sum(qty_so_invoiced) = sum(qty_so) then 'Invoiced' END AS status, get_po_number(smd.sale_order_id) as po_number FROM sale_monitoring_detail smd -- cgit v1.2.3 From f8fc4ac3557bf5a74f49ea79b178b29ff5684815 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Wed, 1 Nov 2023 11:00:34 +0700 Subject: Add digital invoice tax field on partner --- indoteknik_custom/models/res_partner.py | 1 + indoteknik_custom/views/res_partner.xml | 1 + 2 files changed, 2 insertions(+) diff --git a/indoteknik_custom/models/res_partner.py b/indoteknik_custom/models/res_partner.py index bc2a24b1..2983ca45 100644 --- a/indoteknik_custom/models/res_partner.py +++ b/indoteknik_custom/models/res_partner.py @@ -19,6 +19,7 @@ class ResPartner(models.Model): ]) sppkp = fields.Char(string="SPPKP") counter = fields.Integer(string="Counter", default=0) + digital_invoice_tax = fields.Boolean(string="Digital Invoice & Faktur Pajak") def get_child_ids(self): partner = self.env['res.partner'].search([('id', '=', self.id)], limit=1) diff --git a/indoteknik_custom/views/res_partner.xml b/indoteknik_custom/views/res_partner.xml index d609fdd5..ef4898d0 100644 --- a/indoteknik_custom/views/res_partner.xml +++ b/indoteknik_custom/views/res_partner.xml @@ -14,6 +14,7 @@ + -- cgit v1.2.3 From 6b49797aca36574497f93a06f8e1c0622e5ad009 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Thu, 2 Nov 2023 15:40:43 +0700 Subject: add field kind of sparepart and accesories in product template --- indoteknik_custom/models/product_template.py | 4 ++++ indoteknik_custom/views/product_template.xml | 1 + 2 files changed, 5 insertions(+) diff --git a/indoteknik_custom/models/product_template.py b/indoteknik_custom/models/product_template.py index 10d109fb..d1de2221 100755 --- a/indoteknik_custom/models/product_template.py +++ b/indoteknik_custom/models/product_template.py @@ -53,6 +53,10 @@ class ProductTemplate(models.Model): seq_new_product = fields.Integer(string='Seq New Product', help='Urutan Sequence New Product') is_edited = fields.Boolean(string='Is Edited') qty_sold = fields.Float(string='Sold Quantity', compute='_get_qty_sold') + kind_of = fields.Selection([ + ('sp', 'Spare Part'), + ('acc', 'Accessories') + ], string='Kind of', copy=False) def _get_qty_sold(self): for rec in self: diff --git a/indoteknik_custom/views/product_template.xml b/indoteknik_custom/views/product_template.xml index 6fdb5e8f..92d2191e 100755 --- a/indoteknik_custom/views/product_template.xml +++ b/indoteknik_custom/views/product_template.xml @@ -10,6 +10,7 @@ + -- cgit v1.2.3