From 0ffc512e1a1ae709544dd7661ec779a1a5621d1d Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 28 Mar 2024 14:33:30 +0700 Subject: Add vendor id by sql in purchasing job view --- indoteknik_custom/models/purchasing_job.py | 52 ++++++++++++++++-------------- indoteknik_custom/views/purchasing_job.xml | 1 + 2 files changed, 28 insertions(+), 25 deletions(-) diff --git a/indoteknik_custom/models/purchasing_job.py b/indoteknik_custom/models/purchasing_job.py index 1c74f0e9..ac9ea272 100644 --- a/indoteknik_custom/models/purchasing_job.py +++ b/indoteknik_custom/models/purchasing_job.py @@ -10,9 +10,8 @@ class PurchasingJob(models.Model): _auto = False _rec_name = 'product_id' - id = fields.Integer() product_id = fields.Many2one('product.product', string="Product") - vendor_id = fields.Many2one('res.partner', string="Vendor", compute='compute_vendor_id') + vendor_id = fields.Many2one('res.partner', string="Vendor") brand = fields.Char(string='Brand') item_code = fields.Char(string='Item Code') product = fields.Char(string='Product Name') @@ -25,38 +24,41 @@ class PurchasingJob(models.Model): ('apo', 'APO') ], string='APO?') - def compute_vendor_id(self): - for sale in self: - domain = [ - ('product_id', '=', sale.product_id.id) - ] - sales = self.env['v.sales.outstanding'].search(domain) - - vendor_id = False - - if sales: - vendor_id = sales[0].sale_line_id.vendor_id.id - - sale.vendor_id = vendor_id - def init(self): tools.drop_view_if_exists(self.env.cr, self._table) self.env.cr.execute(""" CREATE OR REPLACE VIEW %s AS ( SELECT - pmp.product_id as id, - pmp.product_id, - pmp.brand, - pmp.item_code, - pmp.product, - pmp.onhand, - pmp.incoming, - pmp.outgoing, + pmp.product_id AS id, + pmp.product_id, + sub.vendor_id, + pmp.brand, + pmp.item_code, + pmp.product, + MAX(pmp.onhand) AS onhand, + MAX(pmp.incoming) AS incoming, + MAX(pmp.outgoing) AS outgoing, pmp.action, - pjs.status_apo AS status_apo + MAX(pjs.status_apo) AS status_apo FROM v_procurement_monitoring_by_product pmp LEFT JOIN purchasing_job_state pjs ON pjs.purchasing_job_id = pmp.product_id + LEFT JOIN ( + SELECT + vso.product_id, + rp.id AS vendor_id + FROM v_sales_outstanding vso + LEFT JOIN sale_order_line sol ON sol.id = vso.sale_line_id + LEFT JOIN res_partner rp ON rp.id = sol.vendor_id + ) AS sub ON sub.product_id = pmp.product_id WHERE pmp.action = 'kurang' + AND sub.vendor_id <> 1 + GROUP BY + pmp.product_id, + pmp.brand, + pmp.item_code, + pmp.product, + pmp.action, + sub.vendor_id ) """ % self._table) diff --git a/indoteknik_custom/views/purchasing_job.xml b/indoteknik_custom/views/purchasing_job.xml index c439dc8f..c307ce11 100644 --- a/indoteknik_custom/views/purchasing_job.xml +++ b/indoteknik_custom/views/purchasing_job.xml @@ -53,6 +53,7 @@ + -- cgit v1.2.3 From 3397a2eca0f0480e9dd77e26c75a4f9cff57091b Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 28 Mar 2024 14:40:33 +0700 Subject: Update watermark logo in product image --- indoteknik_api/controllers/controller.py | 2 +- .../static/src/images/logo-indoteknik-link.png | Bin 0 -> 9388 bytes 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 indoteknik_api/static/src/images/logo-indoteknik-link.png diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py index c4f323fe..32f591a1 100644 --- a/indoteknik_api/controllers/controller.py +++ b/indoteknik_api/controllers/controller.py @@ -214,7 +214,7 @@ class Controller(http.Controller): if not image: return '' LOGO_FILENAME = { - '1': 'logo-indoteknik-gray.png', + '1': 'logo-indoteknik-link.png', '2': 'logo-indoteknik.png' } diff --git a/indoteknik_api/static/src/images/logo-indoteknik-link.png b/indoteknik_api/static/src/images/logo-indoteknik-link.png new file mode 100644 index 00000000..c3c5d85d Binary files /dev/null and b/indoteknik_api/static/src/images/logo-indoteknik-link.png differ -- cgit v1.2.3 From aad5e88a2cf02443377fb15eab509e3532509b32 Mon Sep 17 00:00:00 2001 From: Rafi Zadanly Date: Thu, 28 Mar 2024 15:44:50 +0700 Subject: Update watermark image --- indoteknik_api/controllers/controller.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/indoteknik_api/controllers/controller.py b/indoteknik_api/controllers/controller.py index 32f591a1..c6458628 100644 --- a/indoteknik_api/controllers/controller.py +++ b/indoteknik_api/controllers/controller.py @@ -214,8 +214,8 @@ class Controller(http.Controller): if not image: return '' LOGO_FILENAME = { - '1': 'logo-indoteknik-link.png', - '2': 'logo-indoteknik.png' + '1': 'logo-indoteknik-gray.png', + '2': 'logo-indoteknik-link.png' } logo_path = get_module_resource('indoteknik_api', 'static', 'src', 'images', LOGO_FILENAME.get(version)) @@ -242,12 +242,6 @@ class Controller(http.Controller): new_img.paste(img, (paste_x, paste_y), img) if version == '2': - logo__footer_path = get_module_resource('indoteknik_api', 'static', 'src', 'images', 'logo-indoteknik-footer.png') - logo_footer_img = Image.open(logo__footer_path).convert('RGBA') - logo_footer_img.thumbnail((img_width, img_height // 1)) - logo_footer_w, logo_footer_h = logo_footer_img.size - new_img.paste(logo_footer_img, (0, img_height - logo_footer_h), logo_footer_img) - logo_img_w = img_width // 1.8 logo_img_h = img_height // 1.8 -- cgit v1.2.3