ADD tree,search, group. Order model, order tree.

This commit is contained in:
michel 2017-11-06 14:35:02 +01:00
parent 28d2f09121
commit 5c4c8ca532
2 changed files with 45 additions and 1 deletions

View File

@ -8,6 +8,7 @@ class Coworker(models.Model):
""" Coworker model """ """ Coworker model """
_name = 'coworking.coworker' _name = 'coworking.coworker'
_description = 'Coworker model definition' _description = 'Coworker model definition'
_order = 'id desc'
name = fields.Char(required=True) name = fields.Char(required=True)
firstname = fields.Char('First name', required=True) firstname = fields.Char('First name', required=True)

View File

@ -35,11 +35,13 @@
</form> </form>
</field> </field>
</record> </record>
<record id="view_tree_coworker" model="ir.ui.view"> <record id="view_tree_coworker" model="ir.ui.view">
<field name="name">Coworker Tree</field> <field name="name">Coworker Tree</field>
<field name="model">coworking.coworker</field> <field name="model">coworking.coworker</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<tree> <tree default_order="name asc, firstname asc">
<field name="name" /> <field name="name" />
<field name="firstname" /> <field name="firstname" />
<field name="company_name" /> <field name="company_name" />
@ -48,4 +50,45 @@
</tree> </tree>
</field> </field>
</record> </record>
<record id="view_search_coworker" model="ir.ui.view">
<field name="name">Coworker Search</field>
<field name="model">coworking.coworker</field>
<field name="arch" type="xml">
<search>
<field name="contact_date" />
<field name="name" />
<field name="firstname" />
<field name="company_name" />
<field name="gsm" />
<field name="email" />
<filter name="individual" string="Individual"
domain="[('company_name','=',False)]" />
<filter name="in_compagny" string="in_compagny"
domain="[('company_name','!=',False)]" />
<separator />
<filter name="is_savoyar" string="Is_savoyar"
domain="[('postal_code','=like','73___')]" />
<filter name="meet_of_2017" string="Meet_of_2017"
domain="[('contact_date','like','2017')]" />
<filter name="group_city" string="Group city"
context="{'group_by': 'city'}" />
<filter name="group_month" string="Group month"
context="{'group_by': 'contact_date'}" />
<filter name="group_years" string="Group years"
context="{'group_by': 'contact_date:year'}" />
</search>
</field>
</record>
</odoo> </odoo>