Add many2one fields coworker1 and 2. and relation

This commit is contained in:
michel 2017-11-16 16:37:46 +01:00
parent f0d5897b15
commit 704ac03ca9
3 changed files with 54 additions and 12 deletions

View File

@ -10,4 +10,14 @@ class CoworkerRelation(models.Model):
_description = 'relation model definition' _description = 'relation model definition'
_order = 'id asc' _order = 'id asc'
titre = fields.Char() name = fields.Char()
coworker1 = fields.Many2one(
'coworking.coworker', 'Coworker', index=True, required=True,
domain="[('coworker_type', 'in', ['staffer', 'member', 'worker', 'volunteer', 'visitor'])]"
)
coworker2 = fields.Many2one(
'coworking.coworker', 'Coworker', index=True, required=True,
domain="[('coworker_type', 'in', ['staffer', 'member', 'worker', 'volunteer', 'visitor'])]"
)
relation = fields.Char(index=True, required=True)

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- Form -->
<record id="view_form_coworker" model="ir.ui.view">
<field name="name">Coworker Form adaptations</field>
<field name="model">coworking.coworker</field>
<field name="inherit_id" ref ="coworking_coworker.view_form_coworker" />
<field name="arch" type="xml">
<notebook position="inside">
<page string="Events" name="Events">
<group name="events">
<field name="manager_event_ids"
context="{'default_manager_id': active_id}" />
<field name="event_ids" />
<field name="events_coworker_count" />
</group>
</page>
</notebook>
</field>
</record>
</odoo>

View File

@ -6,11 +6,19 @@
<field name="name">Relation Form</field> <field name="name">Relation Form</field>
<field name="model">coworking.relation</field> <field name="model">coworking.relation</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="relation"> <form string="event">
<sheet> <sheet>
<field name="title" /> <group name="group_top">
<group name="group_left">
<field name="coworker1" />
<field name="coworker2" />
<field name="relation" />
</group>
</group>
</sheet> </sheet>
</form> </form>
</field> </field>
</record> </record>
</odoo> </odoo>