[IMP] "website_crm" compatible with Multi-Website

This commit is contained in:
Kaushal Prajapati 2017-12-25 10:36:47 +05:30 committed by Siddharth Bhalgami
parent 6a35afc191
commit 5c7099863d
5 changed files with 38 additions and 0 deletions

View File

@ -10,6 +10,7 @@
'depends': ['website_form', 'website_partner', 'crm'],
'data': [
'data/website_crm_data.xml',
'views/crm_lead_view.xml',
'views/website_crm_templates.xml',
'views/res_config_settings_views.xml',
],

View File

@ -15,6 +15,7 @@
'name',
'partner_name',
'phone',
'website_id',
]"/>
</function>
</data>

View File

@ -7,6 +7,8 @@ from flectra import fields, models
class Lead(models.Model):
_inherit = 'crm.lead'
website_id = fields.Many2one('website', string="Website")
def website_form_input_filter(self, request, values):
values['medium_id'] = values.get('medium_id') or \
self.default_get(['medium_id']).get('medium_id') or \

View File

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<flectra>
<record id="crm_case_form_view_leads_inherit" model="ir.ui.view">
<field name="name">crm.lead.form.lead.inherit</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_case_form_view_leads"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='source_id']" position="after">
<field name="website_id"/>
</xpath>
</field>
</record>
<record id="view_crm_case_leads_filter_inherit" model="ir.ui.view">
<field name="name">crm.lead.search.lead</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.view_crm_case_leads_filter"/>
<field name="arch" type="xml">
<xpath expr="//group[last()]" position="after">
<filter name="website_id" string="Website"
context="{'group_by':'website_id'}"/>
</xpath>
</field>
</record>
</flectra>

View File

@ -46,6 +46,15 @@
<span id="o_website_form_result"></span>
</div>
</div>
<div class="form-group form-field o_website_form_required">
<label class="col-md-3 col-sm-4 control-label hidden" for="name">
Website
</label>
<div class="col-md-7 col-sm-8">
<input type="hidden" class="form-control o_website_form_input"
name="website_id" t-att-value="website.id"/>
</div>
</div>
</form>
</div>
</xpath>