From ac41b323cbaa93b00afe1b0e698c06dce3dbe3de Mon Sep 17 00:00:00 2001 From: projectsodoo Date: Mon, 21 Dec 2020 12:07:38 +0530 Subject: [PATCH] Customer to client changed --- cor_custom/models/crm_lead.py | 4 +++ cor_custom/views/crm_view.xml | 26 +++++++++++++++++++ cor_custom/views/sale_views.xml | 3 +++ cor_custom/wizard/__init__.py | 1 + .../wizard/crm_opportunity_to_quotation.py | 22 ++++++++++++++++ 5 files changed, 56 insertions(+) create mode 100755 cor_custom/wizard/crm_opportunity_to_quotation.py diff --git a/cor_custom/models/crm_lead.py b/cor_custom/models/crm_lead.py index 01fd8b7..19b6a5b 100755 --- a/cor_custom/models/crm_lead.py +++ b/cor_custom/models/crm_lead.py @@ -7,6 +7,10 @@ from odoo import fields, models, api class Lead(models.Model): _inherit = 'crm.lead' + partner_id = fields.Many2one( + 'res.partner', string='Client', index=True, tracking=10, + domain="['|', ('company_id', '=', False), ('company_id', '=', company_id)]", + help="Linked partner (optional). Usually created when converting the lead. You can find a partner by its Name, TIN, Email or Internal Reference.") lead_no = fields.Char(string='Lead ID') scope = fields.Char(string='Scope (NIS)') professional_support = fields.Char(string='Professional Support') diff --git a/cor_custom/views/crm_view.xml b/cor_custom/views/crm_view.xml index b70647c..7ef34d8 100755 --- a/cor_custom/views/crm_view.xml +++ b/cor_custom/views/crm_view.xml @@ -6,6 +6,32 @@ crm.lead + + + diff --git a/cor_custom/views/sale_views.xml b/cor_custom/views/sale_views.xml index 59e5b1a..3b3d554 100755 --- a/cor_custom/views/sale_views.xml +++ b/cor_custom/views/sale_views.xml @@ -17,6 +17,9 @@ + + + 1 diff --git a/cor_custom/wizard/__init__.py b/cor_custom/wizard/__init__.py index 7ff7694..169f7b9 100755 --- a/cor_custom/wizard/__init__.py +++ b/cor_custom/wizard/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import project_create_sale_order +from . import crm_opportunity_to_quotation diff --git a/cor_custom/wizard/crm_opportunity_to_quotation.py b/cor_custom/wizard/crm_opportunity_to_quotation.py new file mode 100755 index 0000000..614003d --- /dev/null +++ b/cor_custom/wizard/crm_opportunity_to_quotation.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# Part of Odoo. See LICENSE file for full copyright and licensing details. + +from odoo import api, fields, models, _ +from odoo.exceptions import UserError + + +class Opportunity2Quotation(models.TransientModel): + _inherit = 'crm.quotation.partner' + + + action = fields.Selection([ + ('create', 'Create a new client'), + ('exist', 'Link to an existing client'), + ('nothing', 'Do not link to a client') + ], string='Quotation client', required=True) + lead_id = fields.Many2one('crm.lead', "Associated Lead", required=True) + partner_id = fields.Many2one('res.partner', 'Customer') + + + +