Customer to client changed

This commit is contained in:
projectsodoo 2020-12-21 12:07:38 +05:30
parent 9fcbc3e830
commit ac41b323cb
5 changed files with 56 additions and 0 deletions

View File

@ -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')

View File

@ -6,6 +6,32 @@
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="//group[@name='opportunity_partner']//field[@name='partner_id']" position="replace">
<field name="partner_id"
widget="res_partner_many2one"
string="Client"
context="{'res_partner_search_mode': type == 'opportunity' and 'customer' or False,
'default_name': contact_name or partner_name,
'default_street': street,
'default_is_company': type == 'opportunity' and contact_name == False,
'default_company_name': type == 'opportunity' and partner_name,
'default_street2': street2,
'default_city': city,
'default_title': title,
'default_state_id': state_id,
'default_zip': zip,
'default_country_id': country_id,
'default_function': function,
'default_phone': phone,
'default_mobile': mobile,
'default_email': email_from,
'default_user_id': user_id,
'default_team_id': team_id,
'default_website': website,
'show_vat': True,
}"
/>
</xpath>
<xpath expr="//group[@name='Misc']" position="after">
<group colspan="2" col="4">
<field name="lead_no"/>

View File

@ -17,6 +17,9 @@
<xpath expr="//field[@name='require_payment']" position="replace">
<field name="require_payment" invisible="1"/>
</xpath>
<xpath expr="//field[@name='payment_term_id']" position="replace">
<field name="payment_term_id" invisible="1" options="{'no_open':True,'no_create': True}"/>
</xpath>
<page name="customer_signature" position="attributes">
<attribute name='invisible'>1</attribute>
</page>

View File

@ -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

View File

@ -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')