From 690903a2cc7a83e8ec2453a703241539016036b6 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Fri, 31 Mar 2023 14:01:14 +0700 Subject: change from qty onhand to qty available --- indoteknik_custom/models/automatic_purchase.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/indoteknik_custom/models/automatic_purchase.py b/indoteknik_custom/models/automatic_purchase.py index e28f71f5..ca6b38ba 100644 --- a/indoteknik_custom/models/automatic_purchase.py +++ b/indoteknik_custom/models/automatic_purchase.py @@ -75,9 +75,9 @@ class AutomaticPurchase(models.Model): count = 0 for point in orderpoints: # _logger.info('test %s' % point.product_id.name) - if point.product_id.qty_available > point.product_min_qty: + if point.product_id.virtual_available > point.product_min_qty: continue - qty_purchase = point.product_max_qty - point.product_id.qty_available + qty_purchase = point.product_max_qty - point.product_id.virtual_available po_line = self.env['purchase.order.line'].search([('product_id', '=', point.product_id.id), ('order_id.state', '=', 'done')], limit=1) if self.vendor_id: @@ -97,7 +97,7 @@ class AutomaticPurchase(models.Model): 'qty_purchase': qty_purchase, 'qty_min': point.product_min_qty, 'qty_max': point.product_max_qty, - 'qty_available': point.product_id.qty_available, + 'qty_available': point.product_id.virtual_available, # 'partner_id': po_line.order_id.partner_id.id, # 'last_price': po_line.price_unit, 'partner_id': vendor_id, -- cgit v1.2.3 From 260ba347c21b906972c14d834aa8d97c4e9f26f6 Mon Sep 17 00:00:00 2001 From: stephanchrst Date: Mon, 3 Apr 2023 11:24:47 +0700 Subject: bug fix sales person in leads --- indoteknik_custom/models/crm_lead.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/indoteknik_custom/models/crm_lead.py b/indoteknik_custom/models/crm_lead.py index be4bbf5d..74b4796a 100755 --- a/indoteknik_custom/models/crm_lead.py +++ b/indoteknik_custom/models/crm_lead.py @@ -54,3 +54,12 @@ class CrmLead(models.Model): if tag.name.lower() in lead.body_html_lead.lower(): input_tags.append(tag.id) lead.tag_ids = input_tags + + if not lead.partner_id: + continue + + if lead.partner_id.parent_id: + salesperson_id = lead.partner_id.parent_id.user_id + else: + salesperson_id = lead.partner_id.user_id + lead.user_id = salesperson_id -- cgit v1.2.3