diff options
| author | Gert Pellin <gpe@odoo.com> | 2019-06-19 14:41:18 +0000 |
|---|---|---|
| committer | Pierre Masereel <pim@odoo.com> | 2019-07-05 12:34:29 +0000 |
| commit | 3ca2842cc137747f5164f69697337205dd136f9d (patch) | |
| tree | 7d42bd8562c4595c5f5f4db06084e7de96e24d32 /addons | |
| parent | b85b584c345f8c185e40ccf52bc19bb70e6dc4c6 (diff) | |
[IMP] pos_sale: store sales team on pos order
For now the sales team is only used on the pos.config and now on the invoices generated.
When you open the sale report, you'll see the sales team of the pos.order, but in reality it is the one of the related pos config.
That means that if you change the pos team on a config. It will change the pos team of all existing order.
We should store sales team on pos order, like on invoice and sale order
TASK-ID: 2011460
closes odoo/odoo#34246
Signed-off-by: pimodoo <pimodoo@users.noreply.github.com>
Diffstat (limited to 'addons')
| -rw-r--r-- | addons/pos_sale/models/pos_order.py | 6 | ||||
| -rw-r--r-- | addons/pos_sale/report/sale_report.py | 4 |
2 files changed, 7 insertions, 3 deletions
diff --git a/addons/pos_sale/models/pos_order.py b/addons/pos_sale/models/pos_order.py index 5b9e8206e90..456c6a56a42 100644 --- a/addons/pos_sale/models/pos_order.py +++ b/addons/pos_sale/models/pos_order.py @@ -7,7 +7,11 @@ from odoo import api, fields, models class PosOrder(models.Model): _inherit = 'pos.order' + def _default_crm_team(self): + return self._default_session().config_id.crm_team_id + currency_rate = fields.Float("Currency Rate", compute='_compute_currency_rate', store=True, digits=(12, 6), readonly=True, help='The rate of the currency to the currency of rate applicable at the date of the order') + crm_team_id = fields.Many2one('crm.team', string="Sales Team", default=_default_crm_team) @api.depends('pricelist_id.currency_id', 'date_order', 'company_id') def _compute_currency_rate(self): @@ -18,5 +22,5 @@ class PosOrder(models.Model): @api.multi def _prepare_invoice(self): invoice_vals = super(PosOrder, self)._prepare_invoice() - invoice_vals['team_id'] = self.config_id.crm_team_id + invoice_vals['team_id'] = self.crm_team_id return invoice_vals diff --git a/addons/pos_sale/report/sale_report.py b/addons/pos_sale/report/sale_report.py index 561d3698095..ec2a6ee84cb 100644 --- a/addons/pos_sale/report/sale_report.py +++ b/addons/pos_sale/report/sale_report.py @@ -49,7 +49,7 @@ class SaleReport(models.Model): t.categ_id AS categ_id, pos.pricelist_id AS pricelist_id, NULL AS analytic_account_id, - config.crm_team_id AS team_id, + pos.crm_team_id AS team_id, p.product_tmpl_id, partner.country_id AS country_id, partner.industry_id AS industry_id, @@ -102,7 +102,7 @@ class SaleReport(models.Model): partner.industry_id, partner.commercial_partner_id, u.factor, - config.crm_team_id + pos.crm_team_id ''' current = '(SELECT %s FROM %s GROUP BY %s)' % (select_, from_, groupby_) |
