summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAzka Nathan <darizkyfaz@gmail.com>2026-01-01 00:50:26 +0700
committerAzka Nathan <darizkyfaz@gmail.com>2026-01-01 00:50:26 +0700
commit7f75982f2db861e381d418e3dd4311b503a34070 (patch)
treeadd96cb994366737ababc94d29fee10eed53622f
parentaaaf75e4f4c62b7481c354456909e958d1631379 (diff)
push fix webhook ginee to detail order
-rw-r--r--fixco_custom/models/automatic_purchase.py12
-rwxr-xr-xfixco_custom/models/detail_order.py9
-rwxr-xr-xfixco_custom/models/product_product.py16
-rw-r--r--fixco_custom/models/purchase_order_line.py10
-rw-r--r--fixco_custom/models/reordering_rule.py9
-rwxr-xr-xfixco_custom/models/webhook_ginee.py6
-rwxr-xr-xfixco_custom/views/product_product.xml3
-rw-r--r--fixco_custom/views/purchase_pricelist.xml19
8 files changed, 48 insertions, 36 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,
diff --git a/fixco_custom/views/product_product.xml b/fixco_custom/views/product_product.xml
index 52945eb..3e29707 100755
--- a/fixco_custom/views/product_product.xml
+++ b/fixco_custom/views/product_product.xml
@@ -19,9 +19,6 @@
<field name="qr_code_variant" widget="image" readonly="True"/>
<field name="product_public_category_id"/>
</field>
- <field name="uom_po_id" position="after">
- <field name="qty_multiple" />
- </field>
<notebook position="inside">
<page string="Bundling">
<field name="bundling_line_ids"/>
diff --git a/fixco_custom/views/purchase_pricelist.xml b/fixco_custom/views/purchase_pricelist.xml
index dd4f6ea..b4e70f6 100644
--- a/fixco_custom/views/purchase_pricelist.xml
+++ b/fixco_custom/views/purchase_pricelist.xml
@@ -35,4 +35,23 @@
</field>
</record>
+ <record id="purchase_pricelist_action" model="ir.actions.act_window">
+ <field name="name">Purchase Pricelist</field>
+ <field name="type">ir.actions.act_window</field>
+ <field name="res_model">purchase.pricelist</field>
+ <field name="view_mode">tree,form</field>
+ <field name="help" type="html">
+ <p class="o_view_nocontent_smiling_face">
+ Add Purchase Pricelist!
+ </p>
+ </field>
+ </record>
+
+ <menuitem
+ id="menu_purchase_pricelist"
+ name="Purchase Pricelist"
+ parent="purchase.menu_purchase_products"
+ sequence="3"
+ action="purchase_pricelist_action"
+ />
</odoo> \ No newline at end of file