From 475173ec46981926aa90e99f796e38ef1d46b61e Mon Sep 17 00:00:00 2001 From: Azka Nathan Date: Wed, 30 Apr 2025 10:15:35 +0700 Subject: sequence pricelist and fix bug validation invoice date and date doc kirim --- indoteknik_api/models/product_pricelist.py | 3 +-- indoteknik_custom/models/product_pricelist.py | 1 + indoteknik_custom/models/stock_picking.py | 2 +- indoteknik_custom/views/product_pricelist.xml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/indoteknik_api/models/product_pricelist.py b/indoteknik_api/models/product_pricelist.py index 3ba38940..e0debf38 100644 --- a/indoteknik_api/models/product_pricelist.py +++ b/indoteknik_api/models/product_pricelist.py @@ -106,14 +106,13 @@ class ProductPricelist(models.Model): else: is_show_program = False - current_time = datetime.now().strftime('%Y-%m-%d %H:%M:%S') pricelist = self.search([ ('is_flash_sale', '=', True), ('is_show_program', '=', is_show_program), ('start_date', '<=', current_time), ('end_date', '>=', current_time) - ], order='start_date asc') + ], order='number asc') return pricelist def is_flash_sale_product(self, product_id: int): diff --git a/indoteknik_custom/models/product_pricelist.py b/indoteknik_custom/models/product_pricelist.py index c299ff2f..ea3ee6cf 100644 --- a/indoteknik_custom/models/product_pricelist.py +++ b/indoteknik_custom/models/product_pricelist.py @@ -17,6 +17,7 @@ class ProductPricelist(models.Model): ], string='Flash Sale Option') banner_top = fields.Binary(string='Banner Top') flashsale_tag = fields.Char(string='Flash Sale Tag') + number = fields.Integer(string='Sequence') def _check_end_date_and_update_solr(self): today = datetime.utcnow().date() diff --git a/indoteknik_custom/models/stock_picking.py b/indoteknik_custom/models/stock_picking.py index d2b1b9f2..0b688fab 100644 --- a/indoteknik_custom/models/stock_picking.py +++ b/indoteknik_custom/models/stock_picking.py @@ -1187,7 +1187,7 @@ class StockPicking(models.Model): if picking.picking_type_code != 'outgoing' or 'BU/OUT/' not in picking.name or picking.partner_id.id == 96868: continue - invoice = self.env['account.move'].search([('sale_id', '=', picking.sale_id.id)], limit=1) + invoice = self.env['account.move'].search([('sale_id', '=', picking.sale_id.id), ('state','not in',['draft','cancel'])], limit=1) if not invoice: continue diff --git a/indoteknik_custom/views/product_pricelist.xml b/indoteknik_custom/views/product_pricelist.xml index 6eff0153..3c2b8b8d 100644 --- a/indoteknik_custom/views/product_pricelist.xml +++ b/indoteknik_custom/views/product_pricelist.xml @@ -20,6 +20,7 @@ + -- cgit v1.2.3