Browse Source

Aug 17 : [UPDT] Bug Fixed 'crm_dashboard'

pull/277/head
AjmalCybro 2 years ago
parent
commit
76aebe90d9
  1. 23
      crm_dashboard/models/crm_dashboard.py
  2. 22
      crm_dashboard/views/dashboard_view.xml

23
crm_dashboard/models/crm_dashboard.py

@ -32,23 +32,35 @@ from datetime import datetime
class CRMSalesTeam(models.Model):
"""CRMSalesTeam model extends the base crm.team model to add a field,
crm_lead_state_id, which represents the default CRM Lead stage for
leads associated with this sales team.
"""
_inherit = 'crm.team'
crm_lead_state_id = fields.Many2one("crm.stage", string="CRM Lead",
store=True)
store=True,
help="CRM Lead stage for leads "
"associated with this sales team.")
class ResUser(models.Model):
"""ResUser model extends the base res.users model to add a field 'sales'
that represents the target for the salesperson."""
_inherit = 'res.users'
sales = fields.Float(string="Target")
sales = fields.Float(string="Target", help="The target value for the "
"salesperson.")
class SalesOrder(models.Model):
_inherit = 'sale.order'
def action_confirm(self):
"""Supering the Confirm Button for Changing CRM Stage"""
"""Override the action_confirm method to change CRM Stage.
Returns:
dict: A dictionary containing the result of the original
action_confirm method."""
res = super(SalesOrder, self).action_confirm()
self.opportunity_id.stage_id = self.team_id.crm_lead_state_id
return res
@ -57,13 +69,14 @@ class SalesOrder(models.Model):
class CRMLead(models.Model):
_inherit = 'crm.lead'
crm_manager_id = fields.Many2one("res.users", string="CRM Manager",
store=True)
monthly_goal = fields.Float(string="Monthly Goal")
achievement_amount = fields.Float(string="Monthly Achievement")
@api.model
def _get_currency(self):
"""Get the currency symbol and position for the current user's company.
Returns:
list: A list containing the currency symbol and its position."""
currency_array = [self.env.user.company_id.currency_id.symbol,
self.env.user.company_id.currency_id.position]
return currency_array

22
crm_dashboard/views/dashboard_view.xml

@ -1,17 +1,5 @@
<odoo>
<data>
<record id="crm_manager_view" model="ir.ui.view">
<field name="name">crm.manager.select</field>
<field name="model">crm.lead</field>
<field name="inherit_id" ref="crm.crm_lead_view_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='company_id']"
position="after">
<field name="crm_manager_id"/>
</xpath>
</field>
</record>
<!-- Customizing CRM Team Form View -->
<record model="ir.ui.view" id="sales_team_inherit">
<field name="name">sales.team.inherit.view</field>
<field name="model">crm.team</field>
@ -22,7 +10,7 @@
</field>
</field>
</record>
<!-- Customizing User Form View -->
<record id="view_users_form_inherit" model="ir.ui.view">
<field name="name">res.users.form.inherit</field>
<field name="model">res.users</field>
@ -37,12 +25,12 @@
</xpath>
</field>
</record>
<!-- Defining CRM Dashboard Action -->
<record id="action_crm_lead_all_dashboard" model="ir.actions.client">
<field name="name">CRM</field>
<field name="tag">crm_dashboard</field>
</record>
<!-- Customizing UTM Campaign Form View -->
<record id="campaign_smart_button" model="ir.ui.view">
<field name="name">Campaign Win Lose Smart Button</field>
<field name="model">utm.campaign</field>
@ -57,9 +45,9 @@
</div>
</field>
</record>
<!-- Adding CRM Dashboard to the CRM Menu -->
<menuitem name="Dashboard" id="menu_crm_dashboard_new"
parent="crm.crm_menu_root"
sequence="0" action="action_crm_lead_all_dashboard"/>
</data>
</odoo>
Loading…
Cancel
Save