summaryrefslogtreecommitdiff
path: root/indoteknik_custom/models/purchase_pricelist.py
diff options
context:
space:
mode:
authorIT Fixcomart <it@fixcomart.co.id>2025-05-23 02:11:28 +0000
committerIT Fixcomart <it@fixcomart.co.id>2025-05-23 02:11:28 +0000
commit957004adc73e524667800457f3db9fb6793edeac (patch)
tree1824b9ee589f2b54657ab75f539b2f7d02224e7c /indoteknik_custom/models/purchase_pricelist.py
parent92b6da28414fed56732f86e1f04ea2fac3464d7d (diff)
parent558130bbf48c33ddfa6080450c80bc8801a570f0 (diff)
Merged in CR/form-merchant (pull request #310)odoo-production
odoo quotation view & merchant view
Diffstat (limited to 'indoteknik_custom/models/purchase_pricelist.py')
-rwxr-xr-xindoteknik_custom/models/purchase_pricelist.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_pricelist.py b/indoteknik_custom/models/purchase_pricelist.py
index e5b35d7f..dd680f4d 100755
--- a/indoteknik_custom/models/purchase_pricelist.py
+++ b/indoteknik_custom/models/purchase_pricelist.py
@@ -83,6 +83,15 @@ class PurchasePricelist(models.Model):
massage="Ada duplikat product dan vendor, berikut data yang anda duplikat : \n" + str(existing_purchase.product_id.name) + " - " + str(existing_purchase.vendor_id.name) + " - " + str(existing_purchase.product_price)
if existing_purchase:
raise UserError(massage)
+
+ def sync_pricelist_item_promo(self, product):
+ pricelist_product = self.env['product.pricelist.item'].search([('product_id', '=', product.id), ('pricelist_id', '=', 17022)])
+ for pricelist in pricelist_product:
+ if pricelist.fixed_price == 0:
+ flashsale = self.env['product.pricelist.item'].search([('product_id', '=', product.id), ('pricelist_id.is_flash_sale', '=', True)])
+ if flashsale:
+ flashsale.fixed_price = 0
+ return
def action_calculate_pricelist(self):
MAX_PRICELIST = 10
@@ -94,6 +103,8 @@ class PurchasePricelist(models.Model):
records = self.env['purchase.pricelist'].browse(active_ids)
price_group = self.env['price.group'].collect_price_group()
for rec in records:
+ if rec.include_price == 0:
+ rec.sync_pricelist_item_promo(rec.product_id)
product_group = rec.product_id.product_tmpl_id.x_manufacture.pricing_group or None
price_incl = rec.include_price