diff options
| author | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-01 00:50:26 +0700 |
|---|---|---|
| committer | Azka Nathan <darizkyfaz@gmail.com> | 2026-01-01 00:50:26 +0700 |
| commit | 7f75982f2db861e381d418e3dd4311b503a34070 (patch) | |
| tree | add96cb994366737ababc94d29fee10eed53622f /fixco_custom/models | |
| parent | aaaf75e4f4c62b7481c354456909e958d1631379 (diff) | |
push fix webhook ginee to detail order
Diffstat (limited to 'fixco_custom/models')
| -rw-r--r-- | fixco_custom/models/automatic_purchase.py | 12 | ||||
| -rwxr-xr-x | fixco_custom/models/detail_order.py | 9 | ||||
| -rwxr-xr-x | fixco_custom/models/product_product.py | 16 | ||||
| -rw-r--r-- | fixco_custom/models/purchase_order_line.py | 10 | ||||
| -rw-r--r-- | fixco_custom/models/reordering_rule.py | 9 | ||||
| -rwxr-xr-x | fixco_custom/models/webhook_ginee.py | 6 |
6 files changed, 29 insertions, 33 deletions
diff --git a/fixco_custom/models/automatic_purchase.py b/fixco_custom/models/automatic_purchase.py index e2b132d..a268938 100644 --- a/fixco_custom/models/automatic_purchase.py +++ b/fixco_custom/models/automatic_purchase.py @@ -327,13 +327,13 @@ class AutomaticPurchaseLine(models.Model): self.taxes_id = manage_stock.vendor_id.tax_id.id self.partner_id = manage_stock.vendor_id.id - pricelist = self.env['purchase.pricelist'].search([ - ('product_id', '=', self.product_id.id), - ('vendor_id', '=', manage_stock.vendor_id.id) - ], limit=1) + # pricelist = self.env['purchase.pricelist'].search([ + # ('product_id', '=', self.product_id.id), + # ('vendor_id', '=', manage_stock.vendor_id.id) + # ], limit=1) - if pricelist: - self.price = pricelist.price + # if pricelist: + # self.price = pricelist.price def compute_qty_available(self): for line in self: diff --git a/fixco_custom/models/detail_order.py b/fixco_custom/models/detail_order.py index f72e56c..3e2a6d8 100755 --- a/fixco_custom/models/detail_order.py +++ b/fixco_custom/models/detail_order.py @@ -61,14 +61,12 @@ class DetailOrder(models.Model): raise UserError(_("Error extracting order ID: %s") % str(e)) def process_queue_item(self, limit=100): - now = time.strftime('%Y-%m-%d %H:%M:%S') - if now < '2025-12-31 23:59:59': - return - domain = [('execute_status', '=', False)] + domain = [('create_date', '>', '2025-12-31 23:59:59')] records = self.search(domain, order='create_date asc', limit=limit) for rec in records: rec.execute_queue() + def execute_queue(self): try: order_id = self.get_order_id() @@ -135,9 +133,6 @@ class DetailOrder(models.Model): raise UserError(_("Error extracting order ID: %s") % str(e)) def process_queue_item_detail(self, limit=100): - now = time.strftime('%Y-%m-%d %H:%M:%S') - if now < '2025-12-31 23:59:59': - return domain = [ ('execute_status', '=', 'detail_order'), '!', diff --git a/fixco_custom/models/product_product.py b/fixco_custom/models/product_product.py index fe5e098..b0ad7b9 100755 --- a/fixco_custom/models/product_product.py +++ b/fixco_custom/models/product_product.py @@ -17,7 +17,7 @@ class ProductProduct(models.Model): qty_pcs_box = fields.Float("Pcs Box") barcode_box = fields.Char("Barcode Box") qr_code_variant = fields.Binary("QR Code Variant", compute='_compute_qr_code_variant') - qty_multiple = fields.Float('Minimum Beli') + # qty_multiple = fields.Float('Minimum Beli') brand_id = fields.Many2one('brands', string='Brand', required=True) product_public_category_id = fields.Many2one('product.public.category', string='Public Categories') categ_id = fields.Many2one('product.category', string='Category', required=False) @@ -37,13 +37,13 @@ class ProductProduct(models.Model): } } - def check_multiple_qty(self, other_qty): - if self.qty_multiple > 0 and other_qty > 0: - multiple = self.qty_multiple - if other_qty % multiple != 0: - return True - else: - return False + # def check_multiple_qty(self, other_qty): + # if self.qty_multiple > 0 and other_qty > 0: + # multiple = self.qty_multiple + # if other_qty % multiple != 0: + # return True + # else: + # return False @api.constrains('name', 'default_code') def constrains_product_type(self): diff --git a/fixco_custom/models/purchase_order_line.py b/fixco_custom/models/purchase_order_line.py index 9d73192..53a5eba 100644 --- a/fixco_custom/models/purchase_order_line.py +++ b/fixco_custom/models/purchase_order_line.py @@ -47,11 +47,11 @@ class PurchaseOrderLine(models.Model): line.original_price_unit = line.price_unit line.original_price_subtotal = line.original_price_unit * line.product_qty - @api.constrains('product_qty', 'product_id') - def constrains_product_qty(self): - for line in self: - if line.product_id.check_multiple_qty(line.product_qty) == True: - raise UserError(f'Qty Product {line.product_id.display_name} tidak sesuai dengan kelipatan {line.product_id.qty_multiple}') + # @api.constrains('product_qty', 'product_id') + # def constrains_product_qty(self): + # for line in self: + # if line.product_id.check_multiple_qty(line.product_qty) == True: + # raise UserError(f'Qty Product {line.product_id.display_name} tidak sesuai dengan kelipatan {line.product_id.qty_multiple}') @api.depends('price_unit', 'product_qty', 'discount') diff --git a/fixco_custom/models/reordering_rule.py b/fixco_custom/models/reordering_rule.py index 787875b..107d40b 100644 --- a/fixco_custom/models/reordering_rule.py +++ b/fixco_custom/models/reordering_rule.py @@ -42,11 +42,14 @@ class ReorderingRule(models.Model): qty_purchase = max(qty_purchase, 0.0) - pricelist = self.env['purchase.pricelist'].search([ - ('product_id', '=', stock.product_id.id), - ('vendor_id', '=', stock.vendor_id.id) + pricelist = self.env['product.supplierinfo'].search([ + ('product_tmpl_id', '=', stock.product_id.product_tmpl_id.id), + ('name', '=', stock.vendor_id.id) ], limit=1) + if not pricelist: + raise UserError("No pricelist found for product %s and vendor %s" % (stock.product_id.name, stock.vendor_id.name)) + price = pricelist.price if pricelist else 0.0 subtotal = qty_purchase * price diff --git a/fixco_custom/models/webhook_ginee.py b/fixco_custom/models/webhook_ginee.py index 8bb4973..86d8b80 100755 --- a/fixco_custom/models/webhook_ginee.py +++ b/fixco_custom/models/webhook_ginee.py @@ -31,14 +31,12 @@ class WebhookGinee(models.Model): # rec.execute_queue() def process_queue_item(self, limit=100): - now = time.strftime('%Y-%m-%d %H:%M:%S') - if now < '2025-12-31 23:59:59': - return - domain = [('execute_status', '=', False)] + domain = [('create_date', '>', '2025-12-31 23:59:59')] records = self.search(domain, order='create_date asc', limit=limit) for rec in records: rec.execute_queue() + def execute_queue(self): detail_order = self.env['detail.order'].create({ 'json_ginee': self.json_ginee, |
