[FIX] sale_crm: avoid displaying archived records in quotation
Before this commit, when the user created a new quotation from
Contact->Opportunity-> ("New Quotation" or "Quotations/orders widget
button", archived records could be added to the quotation
(e.g. ,product, taxes...) because the context was set to
active_test = false. After this commit, the context is configured back
to active_test = true when creating a quotation from opportunity.
opw-3802796
closes odoo/odoo#161087
X-original-commit: 3085c3b24bef719c3cf63ec9d3b5a7d7b2a34037
Signed-off-by: Djamel Touati (otd) <otd@odoo.com>
Signed-off-by: Thibault Delavallee (tde) <tde@openerp.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, fields, models
|
||||
from odoo.osv import expression
|
||||
|
||||
|
||||
|
||||
class Partner(models.Model):
|
||||
@@ -67,9 +69,10 @@ class Partner(models.Model):
|
||||
This function returns an action that displays the opportunities from partner.
|
||||
'''
|
||||
action = self.env['ir.actions.act_window']._for_xml_id('crm.crm_lead_opportunities')
|
||||
action['context'] = {'active_test': False}
|
||||
action['context'] = {}
|
||||
if self.is_company:
|
||||
action['domain'] = [('partner_id.commercial_partner_id', '=', self.id)]
|
||||
else:
|
||||
action['domain'] = [('partner_id', '=', self.id)]
|
||||
action['domain'] = expression.AND([action['domain'], [('active', 'in', [True, False])]])
|
||||
return action
|
||||
|
||||
@@ -39,7 +39,6 @@ class CrmLead(models.Model):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("sale_crm.sale_action_quotations_new")
|
||||
action['context'] = self._prepare_opportunity_quotation_context()
|
||||
action['context']['search_default_opportunity_id'] = self.id
|
||||
action['context']['active_test'] = True
|
||||
return action
|
||||
|
||||
def action_view_sale_quotation(self):
|
||||
|
||||
Reference in New Issue
Block a user