Graph et pivot

This commit is contained in:
michel 2017-11-28 11:01:28 +01:00
parent cb9bf0e328
commit 83c684ff7d
2 changed files with 24 additions and 3 deletions

View File

@ -10,6 +10,8 @@ class ResPartner(models.Model):
_inherit = 'res.partner' _inherit = 'res.partner'
is_coworker = fields.Selection([('is_coworker', 'Coworker')]) is_coworker = fields.Selection([('is_coworker', 'Coworker')])
# coworker_count = fields.Integer('Number of coworker',
# compute='_compute_coworker_count')
company_ids = fields.One2many( company_ids = fields.One2many(
@ -29,6 +31,13 @@ class ResPartner(models.Model):
full_contact_adress = fields.Char(compute='_compute_full_contact_adress') full_contact_adress = fields.Char(compute='_compute_full_contact_adress')
# @api.depends('is_coworker')
# def _compute_coworker_count(self):
# """ Computes number of coworker """
# for res_partner in self:
# if res_partner.partner_id is self.is_coworker():
# self.coworker_count = len(res_partner.partner_id)
@api.depends('street', 'zip', 'city') @api.depends('street', 'zip', 'city')
def _compute_full_contact_adress(self): def _compute_full_contact_adress(self):
"""Concatènation de l'adresse si les chanps street, czip et city sont renseignés""" """Concatènation de l'adresse si les chanps street, czip et city sont renseignés"""

View File

@ -66,12 +66,12 @@
</field> </field>
</record> </record>
<!-- Calendar --> <!-- Calendar -->
<act_window id="contacts.action_contacts" name="Contacts" <act_window id="contacts.action_contacts" name="Contacts"
res_model="res.partner" view_mode="calendar" /> res_model="res.partner" view_mode="calendar,graph" />
<record id="view_calendar_res_partner" model="ir.ui.view"> <record id="view_calendar_res_partner" model="ir.ui.view">
<field name="name">res.partner.calendar.inherit</field> <field name="name">res.partner.calendar</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<calendar date_start="contact_date" <calendar date_start="contact_date"
@ -81,4 +81,16 @@
</field> </field>
</record> </record>
<!-- Graph -->
<record id="view_graph_res_partner" model="ir.ui.view">
<field name="name">res.partner.graph</field>
<field name="model">res.partner</field>
<field name="arch" type="xml">
<graph type="bar">
<field name="is_coworker" />
<field name="is_coworker" type="measure" />
</graph>
</field>
</record>
</odoo> </odoo>