[IMP]CRM Action : smart button now have draft / total actions
This commit is contained in:
parent
60e997ee61
commit
7d2a6bac07
@ -18,7 +18,7 @@
|
|||||||
{
|
{
|
||||||
'name': 'CRM Actions',
|
'name': 'CRM Actions',
|
||||||
'summary': 'Action management, instead of new activity, in CRM',
|
'summary': 'Action management, instead of new activity, in CRM',
|
||||||
'version': '10.0.1.2.4',
|
'version': '10.0.1.2.5',
|
||||||
'category': 'Sales',
|
'category': 'Sales',
|
||||||
'author': 'Fabien BOURGEOIS - Yaltik',
|
'author': 'Fabien BOURGEOIS - Yaltik',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 10.0\n"
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2017-11-23 06:29+0000\n"
|
"POT-Creation-Date: 2017-11-24 04:34+0000\n"
|
||||||
"PO-Revision-Date: 2017-11-23 06:29+0000\n"
|
"PO-Revision-Date: 2017-11-24 04:34+0000\n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -29,6 +29,8 @@ msgstr "Types d'action"
|
|||||||
|
|
||||||
#. module: yaltik_crm_action
|
#. module: yaltik_crm_action
|
||||||
#: model:ir.model.fields,field_description:yaltik_crm_action.field_crm_lead_action_count
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_crm_lead_action_count
|
||||||
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_res_partner_action_count
|
||||||
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_res_users_action_count
|
||||||
msgid "Action count"
|
msgid "Action count"
|
||||||
msgstr "Nombre d'actions"
|
msgstr "Nombre d'actions"
|
||||||
|
|
||||||
@ -41,6 +43,7 @@ msgstr "Nombre d'actions"
|
|||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_action_form
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_action_form
|
||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_leads_inherit_crm_action
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_leads_inherit_crm_action
|
||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_oppor_inherit_crm_action
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_oppor_inherit_crm_action
|
||||||
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_view_partners_form_inherit_yaltik_crm_action
|
||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr "Actions"
|
msgstr "Actions"
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: Odoo Server 10.0\n"
|
"Project-Id-Version: Odoo Server 10.0\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2017-11-23 06:29+0000\n"
|
"POT-Creation-Date: 2017-11-24 04:33+0000\n"
|
||||||
"PO-Revision-Date: 2017-11-23 06:29+0000\n"
|
"PO-Revision-Date: 2017-11-24 04:33+0000\n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@ -28,6 +28,8 @@ msgstr ""
|
|||||||
|
|
||||||
#. module: yaltik_crm_action
|
#. module: yaltik_crm_action
|
||||||
#: model:ir.model.fields,field_description:yaltik_crm_action.field_crm_lead_action_count
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_crm_lead_action_count
|
||||||
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_res_partner_action_count
|
||||||
|
#: model:ir.model.fields,field_description:yaltik_crm_action.field_res_users_action_count
|
||||||
msgid "Action count"
|
msgid "Action count"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -40,6 +42,7 @@ msgstr ""
|
|||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_action_form
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_action_form
|
||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_leads_inherit_crm_action
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_leads_inherit_crm_action
|
||||||
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_oppor_inherit_crm_action
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_case_form_view_oppor_inherit_crm_action
|
||||||
|
#: model:ir.ui.view,arch_db:yaltik_crm_action.crm_view_partners_form_inherit_yaltik_crm_action
|
||||||
msgid "Actions"
|
msgid "Actions"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
@ -25,10 +25,10 @@ class CrmLead(models.Model):
|
|||||||
""" CRM Lead adaptations """
|
""" CRM Lead adaptations """
|
||||||
_inherit = 'crm.lead'
|
_inherit = 'crm.lead'
|
||||||
|
|
||||||
action_count = fields.Integer(compute='_compute_action_count')
|
action_count = fields.Char(compute='_compute_action_count')
|
||||||
action_ids = fields.One2many('crm.action', 'lead_id', string='Actions')
|
action_ids = fields.One2many('crm.action', 'lead_id', string='Actions')
|
||||||
next_action_id = fields.Many2one('crm.action', string='Next Action',
|
next_action_id = fields.Many2one('crm.action', string='Next Action',
|
||||||
compute='compute_next_action', store=True)
|
compute='_compute_next_action', store=True)
|
||||||
next_action_date = fields.Datetime(related='next_action_id.date', store=True)
|
next_action_date = fields.Datetime(related='next_action_id.date', store=True)
|
||||||
next_action_title = fields.Char(related='next_action_id.display_name', store=True)
|
next_action_title = fields.Char(related='next_action_id.display_name', store=True)
|
||||||
|
|
||||||
@ -36,10 +36,13 @@ class CrmLead(models.Model):
|
|||||||
def _compute_action_count(self):
|
def _compute_action_count(self):
|
||||||
""" Count actions """
|
""" Count actions """
|
||||||
for lead in self:
|
for lead in self:
|
||||||
lead.action_count = len(lead.action_ids)
|
action_count = len(lead.action_ids)
|
||||||
|
draft_count = len(lead.action_ids.filtered(
|
||||||
|
lambda self: self.state == 'draft'))
|
||||||
|
lead.action_count = u'{} / {}'.format(draft_count, action_count)
|
||||||
|
|
||||||
@api.depends('action_ids.date', 'action_ids.display_name', 'action_ids.state')
|
@api.depends('action_ids.date', 'action_ids.display_name', 'action_ids.state')
|
||||||
def compute_next_action(self):
|
def _compute_next_action(self):
|
||||||
""" Computes next action """
|
""" Computes next action """
|
||||||
for lead in self:
|
for lead in self:
|
||||||
domain = ['&', ('lead_id', '=', lead.id), ('state', '=', 'draft')]
|
domain = ['&', ('lead_id', '=', lead.id), ('state', '=', 'draft')]
|
||||||
|
@ -18,14 +18,22 @@
|
|||||||
|
|
||||||
""" Partner adaptations """
|
""" Partner adaptations """
|
||||||
|
|
||||||
from odoo import models, api
|
from odoo import models, fields, api
|
||||||
|
|
||||||
class ResPartner(models.Model):
|
class ResPartner(models.Model):
|
||||||
""" Partner adaptations """
|
""" Partner adaptations """
|
||||||
_inherit = 'res.partner'
|
_inherit = 'res.partner'
|
||||||
|
|
||||||
|
action_count = fields.Char(compute='_compute_action_count')
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def _compute_activities_count(self):
|
def _compute_action_count(self):
|
||||||
for partner in self:
|
for partner in self:
|
||||||
domain = [('partner_id', '=', partner.id)]
|
domain = [('partner_id', '=', partner.id)]
|
||||||
partner.activities_count = self.env['crm.action'].search_count(domain)
|
action_count = self.env['crm.action'].search_count(domain)
|
||||||
|
if action_count:
|
||||||
|
domain.append(('state', '=', 'draft'))
|
||||||
|
draft_count = self.env['crm.action'].search_count(domain)
|
||||||
|
else:
|
||||||
|
draft_count = 0
|
||||||
|
partner.action_count = u'{} / {}'.format(draft_count, action_count)
|
||||||
|
@ -20,6 +20,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<odoo>
|
<odoo>
|
||||||
<data>
|
<data>
|
||||||
|
|
||||||
|
<!-- Form -->
|
||||||
|
<record id="crm_view_partners_form_inherit_yaltik_crm_action"
|
||||||
|
model="ir.ui.view">
|
||||||
|
<field name="name">CRM Partner form adaptations</field>
|
||||||
|
<field name="model">res.partner</field>
|
||||||
|
<field name="inherit_id" ref="crm.view_partners_form_crm1" />
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<button icon="fa-clock-o" position="replace">
|
||||||
|
<button class="oe_stat_button" type="action"
|
||||||
|
name="%(crm.crm_activity_report_action_tree)d" icon="fa-clock-o">
|
||||||
|
<field string="Actions" name="action_count" widget="statinfo" />
|
||||||
|
</button>
|
||||||
|
</button>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
<!-- Overwrite actity opening -->
|
<!-- Overwrite actity opening -->
|
||||||
<record id="crm.crm_activity_report_action_tree"
|
<record id="crm.crm_activity_report_action_tree"
|
||||||
model="ir.actions.act_window">
|
model="ir.actions.act_window">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user