This commit is contained in:
michel 2017-11-24 16:25:14 +01:00
parent 2eea737322
commit 61274df36d
3 changed files with 31 additions and 10 deletions

View File

@ -8,7 +8,8 @@ from odoo.exceptions import ValidationError
class ResPartner(models.Model):
""" Coworker model """
_inherit = 'res.partner'
name = fields.Char(required=True)
company_ids = fields.One2many(
string="Company",
comodel_name="res.partner",
@ -24,3 +25,25 @@ class ResPartner(models.Model):
email = fields.Char()
url = fields.Char('URL')
comment = fields.Text()
job = fields.Char()
contact_date = fields.Date(default=fields.Date.context_today)
coworker_type = fields.Selection([('staffer', 'Staffer'),
('worker', 'Worker'), ('member', 'Member'),
('volunteer', 'Volunteer'),
('visitor', 'Visitor')])
company_name = fields.Char('Company')
job = fields.Char()
url = fields.Char('URL')
@api.constrains('contact_date')
def _check_contact_date(self):
"""Test si la modification de la date n'est pas superieur à la date du jour"""
if self.contact_date > fields.Date.context_today(self):
raise ValidationError(_('Date most be equal of inferior to to day'))

View File

@ -8,16 +8,16 @@
<field name="inherit_id" ref ="base.view_partner_form" />
<field name="arch" type="xml">
<form string="Partners">
<sheet>
<group name="group_top">
<group name="group_left">
<field name="name" />
<field name="comment" />
</group>
<notebook position="inside">
<page string="Events" name="Events">
<group name="events">
<field name="job" />
</group>
</page>
</notebook>
</group>
</sheet>
</form>
</field>
</record>

View File

@ -1,7 +1,6 @@
<?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>
@ -20,5 +19,4 @@
</notebook>
</field>
</record>
</odoo>