[Contact-date for all] [Sup xpath to search view] [add search group by month and year for all]

This commit is contained in:
michel 2017-11-28 14:47:23 +01:00
parent 2ce2c58a82
commit affa853857
2 changed files with 20 additions and 16 deletions

View File

@ -10,8 +10,8 @@ class ResPartner(models.Model):
_inherit = 'res.partner'
is_coworker = fields.Boolean('Coworker', default=False)
# coworker_count = fields.Integer('Number of coworker',
# compute='_compute_coworker_count')
coworker_count = fields.Integer('Number of coworker',
compute='_compute_coworker_count')
company_ids = fields.One2many(
@ -34,9 +34,8 @@ class ResPartner(models.Model):
@api.depends('is_coworker')
def _compute_coworker_count(self):
""" Computes number of coworker """
for res_partner in self:
if self.is_coworker():
self.coworker_count = len(self.is_coworker)
for coworker in self:
coworker.coworker_count = len(coworker.coworker_type)
@api.depends('street', 'zip', 'city')
def _compute_full_contact_adress(self):

View File

@ -11,8 +11,7 @@
<field name="is_coworker" />
<field name="coworker_type"
attrs="{'invisible': [('is_coworker','=', False)]}" />
<field name="contact_date"
attrs="{'invisible': [('is_coworker','=', False)]}"/>
<field name="contact_date" />
</field>
<field name="email" position="after">
<field name="url" />
@ -42,11 +41,16 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref ="base.view_res_partner_filter" />
<field name="arch" type="xml">
<xpath expr="//search" position="inside">
<search position="inside">
<filter name="is_coworker" string="Coworker"
domain="[('is_coworker','!=',False)]" />
</xpath>
domain="[('is_coworker','=',True)]" />
<separator />
<filter name="group_month" string="Month"
context="{'group_by': 'contact_date:month'}" />
<filter name="group_year" string="Year"
context="{'group_by': 'contact_date:year'}" />
</search>
</field>
</record>
@ -73,7 +77,7 @@
<!-- Calendar -->
<act_window id="contacts.action_contacts" name="Contacts"
res_model="res.partner" view_mode="kanban,form,calendar,graph" />
res_model="res.partner" view_mode="kanban,form,calendar,graph,pivot" />
<record id="view_calendar_res_partner" model="ir.ui.view">
<field name="name">res.partner.calendar</field>
@ -93,20 +97,21 @@
<field name="arch" type="xml">
<graph type="bar">
<field name="is_coworker" />
<field name="is_coworker" type="measure" />
</graph>
</field>
</record>
<!-- <record id="view_pivot_res_partner" model="ir.ui.view">
<record id="view_pivot_res_partner" model="ir.ui.view">
<field name="name">res.partner.pivot</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<pivot>
<field name="is_coworker" type="col" />
<field name="user_id" />
<field name="date_deadline" interval="week" />
<field name="effort_estimate" type="measure" />
<field name="contact_date" interval="week" />
</pivot>
</field>
</record>
-->
</odoo>