summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indoteknik_custom/models/purchase_order_sales_match.py1
-rwxr-xr-xindoteknik_custom/models/purchase_pricelist.py11
-rwxr-xr-xindoteknik_custom/views/purchase_order.xml1
3 files changed, 13 insertions, 0 deletions
diff --git a/indoteknik_custom/models/purchase_order_sales_match.py b/indoteknik_custom/models/purchase_order_sales_match.py
index ed013dd5..0bd0092b 100644
--- a/indoteknik_custom/models/purchase_order_sales_match.py
+++ b/indoteknik_custom/models/purchase_order_sales_match.py
@@ -27,6 +27,7 @@ class PurchaseOrderSalesMatch(models.Model):
purchase_price_so = fields.Float(string='Purchase Price Sale Order', related='sale_line_id.purchase_price')
purchase_price_po = fields.Float('Purchase Price PO', compute='_compute_purchase_price_po')
purchase_line_id = fields.Many2one('purchase.order.line', string='Purchase Line', compute='_compute_purchase_line_id')
+ hold_outgoing_so = fields.Boolean(string='Hold Outgoing SO', related='sale_id.hold_outgoing')
def _compute_purchase_line_id(self):
for line in self:
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
diff --git a/indoteknik_custom/views/purchase_order.xml b/indoteknik_custom/views/purchase_order.xml
index 920268bc..b58139c6 100755
--- a/indoteknik_custom/views/purchase_order.xml
+++ b/indoteknik_custom/views/purchase_order.xml
@@ -308,6 +308,7 @@
<field name="margin_item" optional="hide"/>
<field name="delivery_amt" optional="hide"/>
<field name="margin_deduct" optional="hide"/>
+ <field name="hold_outgoing_so" optional="hide"/>
<field name="margin_so"/>
</tree>
</field>