diff options
| author | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-03 15:28:40 +0700 |
|---|---|---|
| committer | Rafi Zadanly <zadanlyr@gmail.com> | 2023-04-03 15:28:40 +0700 |
| commit | d14835853441ededd858a188c96208d39dbfdb20 (patch) | |
| tree | 37b3f9e0c26c6ef6e07ed631404b100b890ea337 | |
| parent | 760830d22f2e060e4038c3a06515f920ea251abd (diff) | |
| parent | 260ba347c21b906972c14d834aa8d97c4e9f26f6 (diff) | |
Merge branch 'release' of bitbucket.org:altafixco/indoteknik-addons into release
| -rw-r--r-- | indoteknik_custom/models/automatic_purchase.py | 6 | ||||
| -rwxr-xr-x | indoteknik_custom/models/crm_lead.py | 9 |
2 files changed, 12 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, 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 |
