[IMP] crm_iap_lead(_website): improve field naming
Purpose is to somehow clean naming of fields. Task ID 2196182 PR #44662 Upgrade PR odoo/upgrade#973
This commit is contained in:
@@ -42,7 +42,7 @@ class CRMLeadMiningRequest(models.Model):
|
|||||||
user_id = fields.Many2one('res.users', string='Salesperson')
|
user_id = fields.Many2one('res.users', string='Salesperson')
|
||||||
tag_ids = fields.Many2many('crm.tag', string='Tags')
|
tag_ids = fields.Many2many('crm.tag', string='Tags')
|
||||||
lead_ids = fields.One2many('crm.lead', 'lead_mining_request_id', string='Generated Lead / Opportunity')
|
lead_ids = fields.One2many('crm.lead', 'lead_mining_request_id', string='Generated Lead / Opportunity')
|
||||||
leads_count = fields.Integer(compute='_compute_leads_count', string='Number of Generated Leads')
|
lead_count = fields.Integer(compute='_compute_lead_count', string='Number of Generated Leads')
|
||||||
|
|
||||||
# Company Criteria Filter
|
# Company Criteria Filter
|
||||||
filter_on_size = fields.Boolean(string='Filter on Size', default=False)
|
filter_on_size = fields.Boolean(string='Filter on Size', default=False)
|
||||||
@@ -74,8 +74,8 @@ class CRMLeadMiningRequest(models.Model):
|
|||||||
record.lead_credits = _('%d credits will be consumed to find %d companies.') % (company_credits, record.lead_number)
|
record.lead_credits = _('%d credits will be consumed to find %d companies.') % (company_credits, record.lead_number)
|
||||||
record.lead_total_credits = _("This makes a total of %d credits for this request.") % (total_contact_credits + company_credits)
|
record.lead_total_credits = _("This makes a total of %d credits for this request.") % (total_contact_credits + company_credits)
|
||||||
|
|
||||||
@api.depends('lead_ids')
|
@api.depends('lead_ids.lead_mining_request_id')
|
||||||
def _compute_leads_count(self):
|
def _compute_lead_count(self):
|
||||||
if self.ids:
|
if self.ids:
|
||||||
leads_data = self.env['crm.lead'].read_group(
|
leads_data = self.env['crm.lead'].read_group(
|
||||||
[('lead_mining_request_id', 'in', self.ids)],
|
[('lead_mining_request_id', 'in', self.ids)],
|
||||||
@@ -86,7 +86,7 @@ class CRMLeadMiningRequest(models.Model):
|
|||||||
(m['lead_mining_request_id'][0], m['lead_mining_request_id_count'])
|
(m['lead_mining_request_id'][0], m['lead_mining_request_id_count'])
|
||||||
for m in leads_data)
|
for m in leads_data)
|
||||||
for request in self:
|
for request in self:
|
||||||
request.leads_count = mapped_data.get(request.id, 0)
|
request.lead_count = mapped_data.get(request.id, 0)
|
||||||
|
|
||||||
@api.onchange('lead_number')
|
@api.onchange('lead_number')
|
||||||
def _onchange_lead_number(self):
|
def _onchange_lead_number(self):
|
||||||
|
|||||||
@@ -19,14 +19,14 @@
|
|||||||
<button name="action_get_opportunity_action" class="oe_stat_button" type="object" icon="fa-handshake-o"
|
<button name="action_get_opportunity_action" class="oe_stat_button" type="object" icon="fa-handshake-o"
|
||||||
attrs="{'invisible': ['|', ('lead_type', '!=', 'opportunity'), ('state', '!=' , 'done')]}">
|
attrs="{'invisible': ['|', ('lead_type', '!=', 'opportunity'), ('state', '!=' , 'done')]}">
|
||||||
<div class="o_stat_info">
|
<div class="o_stat_info">
|
||||||
<field name="leads_count"/>
|
<field name="lead_count"/>
|
||||||
<span class="o_stat_text">Opportunities</span>
|
<span class="o_stat_text">Opportunities</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button name="action_get_lead_action" class="oe_stat_button" type="object" icon="fa-handshake-o" groups="crm.group_use_lead"
|
<button name="action_get_lead_action" class="oe_stat_button" type="object" icon="fa-handshake-o" groups="crm.group_use_lead"
|
||||||
attrs="{'invisible': ['|', ('lead_type', '!=', 'lead'), ('state', '!=' , 'done')]}">
|
attrs="{'invisible': ['|', ('lead_type', '!=', 'lead'), ('state', '!=' , 'done')]}">
|
||||||
<div class="o_stat_info">
|
<div class="o_stat_info">
|
||||||
<field name="leads_count"/>
|
<field name="lead_count"/>
|
||||||
<span class="o_stat_text">Leads</span>
|
<span class="o_stat_text">Leads</span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ class CRMRevealRule(models.Model):
|
|||||||
user_id = fields.Many2one('res.users', string='Salesperson')
|
user_id = fields.Many2one('res.users', string='Salesperson')
|
||||||
priority = fields.Selection(crm_stage.AVAILABLE_PRIORITIES, string='Priority')
|
priority = fields.Selection(crm_stage.AVAILABLE_PRIORITIES, string='Priority')
|
||||||
lead_ids = fields.One2many('crm.lead', 'reveal_rule_id', string='Generated Lead / Opportunity')
|
lead_ids = fields.One2many('crm.lead', 'reveal_rule_id', string='Generated Lead / Opportunity')
|
||||||
leads_count = fields.Integer(compute='_compute_leads_count', string='Number of Generated Leads')
|
lead_count = fields.Integer(compute='_compute_lead_count', string='Number of Generated Leads')
|
||||||
opportunity_count = fields.Integer(compute='_compute_leads_count', string='Number of Generated Opportunity')
|
opportunity_count = fields.Integer(compute='_compute_leads_count', string='Number of Generated Opportunity')
|
||||||
|
|
||||||
# This limits the number of extra contact.
|
# This limits the number of extra contact.
|
||||||
@@ -101,7 +101,7 @@ class CRMRevealRule(models.Model):
|
|||||||
self.clear_caches() # Clear the cache in order to recompute _get_active_rules
|
self.clear_caches() # Clear the cache in order to recompute _get_active_rules
|
||||||
return super(CRMRevealRule, self).unlink()
|
return super(CRMRevealRule, self).unlink()
|
||||||
|
|
||||||
def _compute_leads_count(self):
|
def _compute_lead_count(self):
|
||||||
leads = self.env['crm.lead'].read_group([
|
leads = self.env['crm.lead'].read_group([
|
||||||
('reveal_rule_id', 'in', self.ids)
|
('reveal_rule_id', 'in', self.ids)
|
||||||
], fields=['reveal_rule_id', 'type'], groupby=['reveal_rule_id', 'type'], lazy=False)
|
], fields=['reveal_rule_id', 'type'], groupby=['reveal_rule_id', 'type'], lazy=False)
|
||||||
|
|||||||
@@ -13,9 +13,9 @@
|
|||||||
<span class="o_stat_text"> Opportunities </span>
|
<span class="o_stat_text"> Opportunities </span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
<button name="action_get_lead_tree_view" class="oe_stat_button" type="object" icon="fa-handshake-o" groups="crm.group_use_lead" attrs="{'invisible': [('lead_type', '!=', 'lead'), ('leads_count', '=' , 0)]}">
|
<button name="action_get_lead_tree_view" class="oe_stat_button" type="object" icon="fa-handshake-o" groups="crm.group_use_lead" attrs="{'invisible': [('lead_type', '!=', 'lead'), ('lead_count', '=' , 0)]}">
|
||||||
<div class="o_stat_info">
|
<div class="o_stat_info">
|
||||||
<field name="leads_count"/>
|
<field name="lead_count"/>
|
||||||
<span class="o_stat_text"> Leads </span>
|
<span class="o_stat_text"> Leads </span>
|
||||||
</div>
|
</div>
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user