[FIX]Yaltik CRM Action : refactoring and fixing actions opening from partners
This commit is contained in:
parent
cd76482e9e
commit
21db045488
@ -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.3.2',
|
'version': '10.0.1.3.3',
|
||||||
'category': 'Sales',
|
'category': 'Sales',
|
||||||
'author': 'Fabien BOURGEOIS - Yaltik',
|
'author': 'Fabien BOURGEOIS - Yaltik',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -45,11 +45,11 @@ class ResPartner(models.Model):
|
|||||||
partner.action_count = u'{} / {}'.format(draft_count, action_count)
|
partner.action_count = u'{} / {}'.format(draft_count, action_count)
|
||||||
|
|
||||||
|
|
||||||
@api.model
|
@api.multi
|
||||||
def partner_actions(self):
|
def partner_actions(self):
|
||||||
""" Return action for active partner and its parent and childs """
|
""" Return action for active partner and its parent and childs """
|
||||||
active_id = self._context.get('active_id')
|
self.ensure_one()
|
||||||
partner = self.env['res.partner'].browse(active_id)
|
partner = self[0]
|
||||||
parent_id = partner.parent_id.id if partner.parent_id else partner.id
|
parent_id = partner.parent_id.id if partner.parent_id else partner.id
|
||||||
domain = [('partner_id', 'child_of', parent_id)]
|
domain = [('partner_id', 'child_of', parent_id)]
|
||||||
|
|
||||||
@ -57,5 +57,6 @@ class ResPartner(models.Model):
|
|||||||
'name': _('Actions'),
|
'name': _('Actions'),
|
||||||
'view_mode': 'tree,form,calendar',
|
'view_mode': 'tree,form,calendar',
|
||||||
'res_model': 'crm.action',
|
'res_model': 'crm.action',
|
||||||
'context': {'default_partner_id': partner.id},
|
'context': {'default_partner_id': partner.id,
|
||||||
|
'search_default_partner_id': partner.id},
|
||||||
'domain': domain}
|
'domain': domain}
|
||||||
|
@ -28,8 +28,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="inherit_id" ref="crm.view_partners_form_crm1" />
|
<field name="inherit_id" ref="crm.view_partners_form_crm1" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<button icon="fa-clock-o" position="replace">
|
<button icon="fa-clock-o" position="replace">
|
||||||
<button class="oe_stat_button" type="action"
|
<button class="oe_stat_button" type="object"
|
||||||
name="%(crm.crm_activity_report_action_tree)d" icon="fa-clock-o">
|
name="partner_actions" icon="fa-clock-o">
|
||||||
<field string="Actions" name="action_count" widget="statinfo" />
|
<field string="Actions" name="action_count" widget="statinfo" />
|
||||||
</button>
|
</button>
|
||||||
</button>
|
</button>
|
||||||
@ -42,7 +42,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<field name="name">Actions</field>
|
<field name="name">Actions</field>
|
||||||
<field name="model_id" ref="model_crm_action" />
|
<field name="model_id" ref="model_crm_action" />
|
||||||
<field name="state">code</field>
|
<field name="state">code</field>
|
||||||
<field name="code">action = env['res.partner'].partner_actions()</field>
|
<field name="code">action = self.partner_actions()</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
</data>
|
</data>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user