diff options
| author | Victor Feyens <vfe@odoo.com> | 2019-10-11 11:30:40 +0000 |
|---|---|---|
| committer | Raphael Collet <rco@odoo.com> | 2019-11-18 12:25:05 +0000 |
| commit | 9215e73fa229d64167de076ef0a288dd8d89a2cc (patch) | |
| tree | e116014058d6649f26de2149e589819178952015 /addons/product_margin | |
| parent | 3455d02189ef8879c8e7f331d159bbd3c1c7b949 (diff) | |
[IMP] * : replace with_context(force_company=c) by with_company(c)
Diffstat (limited to 'addons/product_margin')
| -rw-r--r-- | addons/product_margin/models/product_product.py | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/addons/product_margin/models/product_product.py b/addons/product_margin/models/product_product.py index 252dd42727e..3f5c607c987 100644 --- a/addons/product_margin/models/product_product.py +++ b/addons/product_margin/models/product_product.py @@ -100,10 +100,7 @@ class ProductProduct(models.Model): elif invoice_state == 'draft_open_paid': states = ('posted', 'draft') invoice_payment_states = ('not_paid', 'paid') - if "force_company" in self.env.context: - company_id = self.env.context['force_company'] - else: - company_id = self.env.company.id + company_id = self.env.company.id #Cost price is calculated afterwards as it is a property self.env['account.move.line'].flush(['price_unit', 'quantity', 'balance', 'product_id', 'display_type']) @@ -141,8 +138,6 @@ class ProductProduct(models.Model): res[val.id]['turnover'] = result[2] and -result[2] or 0.0 res[val.id]['sale_expected'] = result[3] and result[3] or 0.0 res[val.id]['sales_gap'] = res[val.id]['sale_expected'] - res[val.id]['turnover'] - ctx = self.env.context.copy() - ctx['force_company'] = company_id invoice_types = ('in_invoice', 'out_refund') self.env.cr.execute(sqlstr, (val.id, states, invoice_payment_states, invoice_types, date_from, date_to, company_id)) result = self.env.cr.fetchall()[0] |
