diff --git a/HISTORY.rst b/HISTORY.rst index 1b6574569cd..d8743fe8b3b 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -23,6 +23,8 @@ Latest (unreleased) **Features and Improvements** * SO change validation button visibility/process given product_category +* SO & crm.lead holding_amount_currency in tree view. Can be used as measure +* Add module 'sale_company_currency' **Bugfixes** diff --git a/odoo/external-src/sale-workflow b/odoo/external-src/sale-workflow index 14391cb3932..7cb8a40b678 160000 --- a/odoo/external-src/sale-workflow +++ b/odoo/external-src/sale-workflow @@ -1 +1 @@ -Subproject commit 14391cb3932efc8d8295c37dc19200950918c271 +Subproject commit 7cb8a40b67824ce33c71c183fb65391a5b11c0fb diff --git a/odoo/local-src/specific_crm/models/crm_lead.py b/odoo/local-src/specific_crm/models/crm_lead.py index 83dbbf4e75f..9c2c9e27a5d 100644 --- a/odoo/local-src/specific_crm/models/crm_lead.py +++ b/odoo/local-src/specific_crm/models/crm_lead.py @@ -53,6 +53,20 @@ class CrmLead(models.Model): index=True, track_visibility='onchange', ) + holding_currency_id = fields.Many2one( + 'res.currency', + string='Holding Currency', + required=True, + default=lambda self: self.env.ref('base.EUR'), + readonly=True, + ) + holding_currency_amount = fields.Monetary( + string='Holding Currency Amount', + compute='_compute_holding_currency_amount', + readonly=True, + currency_field='holding_currency_id', + store=True, + ) @api.model def _message_get_auto_subscribe_fields(self, updated_fields, @@ -68,6 +82,14 @@ def _message_get_auto_subscribe_fields(self, updated_fields, auto_follow_fields=list(auto_follow_fields), ) + @api.multi + @api.depends('planned_revenue', 'holding_currency_id') + def _compute_holding_currency_amount(self): + for lead in self: + lead.holding_currency_amount = lead.company_currency.with_context( + date=lead.date_action_last).compute( + lead.planned_revenue, lead.holding_currency_id) + @api.onchange('team_id') def onchange_team_id(self): if self.team_id: diff --git a/odoo/local-src/specific_crm/views/crm_lead_view.xml b/odoo/local-src/specific_crm/views/crm_lead_view.xml index 73744f50507..459c43a9354 100644 --- a/odoo/local-src/specific_crm/views/crm_lead_view.xml +++ b/odoo/local-src/specific_crm/views/crm_lead_view.xml @@ -55,4 +55,18 @@ + + + crm.lead.tree.opportunity.holding + crm.lead + 20 + + + + + + + + + diff --git a/odoo/local-src/specific_sale/models/sale_order.py b/odoo/local-src/specific_sale/models/sale_order.py index c1e70ebc4d6..0c4c9a448f4 100644 --- a/odoo/local-src/specific_sale/models/sale_order.py +++ b/odoo/local-src/specific_sale/models/sale_order.py @@ -69,6 +69,20 @@ class SaleOrder(models.Model): compute='_compute_validation_required', readonly=True, ) + holding_currency_id = fields.Many2one( + 'res.currency', + string='Holding Currency', + required=True, + default=lambda self: self.env.ref('base.EUR'), + readonly=True, + ) + holding_currency_amount = fields.Monetary( + string='Holding Currency Amount', + compute='_compute_holding_currency_amount', + readonly=True, + currency_field='holding_currency_id', + store=True, + ) @api.model def _setup_fields(self, partial): @@ -139,6 +153,17 @@ def _compute_validation_required(self): if (cat.process_validation_required and not so.process_validation_id): so.process_validation_required = True + @api.multi + @api.depends('amount_total', 'holding_currency_id') + def _compute_holding_currency_amount(self): + for so in self: + if so.state in ('sale', 'done'): + so_date = so.confirmation_date + else: + so_date = so.date_order + so.holding_currency_amount = so.currency_id.with_context( + date=so_date).compute( + so.amount_total, so.holding_currency_id) @api.onchange('opportunity_id') def onchange_opportunity_id(self): diff --git a/odoo/local-src/specific_sale/views/sale_order_crm.xml b/odoo/local-src/specific_sale/views/sale_order_crm.xml index 2d1ed88c35a..a7a0b9d4a5f 100644 --- a/odoo/local-src/specific_sale/views/sale_order_crm.xml +++ b/odoo/local-src/specific_sale/views/sale_order_crm.xml @@ -93,6 +93,30 @@ + + sale.order.tree.holding + sale.order + + + + + + + + + + + sale.order.tree.holding + sale.order + + + + + + + + + sale.order.line hide cost sale.order diff --git a/odoo/migration.yml b/odoo/migration.yml index de9bb1fffe5..5ab3b2fb7c3 100644 --- a/odoo/migration.yml +++ b/odoo/migration.yml @@ -181,4 +181,6 @@ migration: - version: 10.0.15 addons: upgrade: + - sale_company_currency + - specific_crm - specific_sale diff --git a/odoo/pending-merges.yaml b/odoo/pending-merges.yaml index 996e5c4ba5b..38ef74e5bd8 100644 --- a/odoo/pending-merges.yaml +++ b/odoo/pending-merges.yaml @@ -23,6 +23,8 @@ - oca refs/pull/440/head # # port of account_statement_base_import # - oca refs/pull/137/head + # new module sale_company_currency + - oca refs/pull/425/head target: *default_target ./external-src/hr: remotes: