finalisation du smart button et contraint d'heure

This commit is contained in:
eloyoussef 2018-02-08 12:02:46 +01:00
parent 4cec863372
commit 3a42ea0a54
3 changed files with 14 additions and 8 deletions

View File

@ -24,8 +24,8 @@
'license': 'AGPL-3', 'license': 'AGPL-3',
'application': True, 'application': True,
'installable': True, 'installable': True,
'depends': ['golem_base', 'golem_activity', 'golem_season', 'depends': ['product',
'odoo_partner_merge'], ],
'data': ['views/golem_resources_views.xml', 'data': ['views/golem_resources_views.xml',
'views/golem_reservation_views.xml', 'views/golem_reservation_views.xml',
'security/ir.model.access.csv', 'security/ir.model.access.csv',

View File

@ -97,3 +97,9 @@ class GolemTimetable(models.Model):
name = fields.Many2one("golem.weekday", required=True) name = fields.Many2one("golem.weekday", required=True)
start_time = fields.Float(required=True) start_time = fields.Float(required=True)
end_time = fields.Float(required=True) end_time = fields.Float(required=True)
@api.constraint('start_time','end_time')
def _check_time_consistency(self):
for r in self:
if r.end_time < r.start_time:
raise ValidationError("End time should be higher than start time")

View File

@ -78,13 +78,13 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="model">golem.resources</field> <field name="model">golem.resources</field>
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Resource Form"> <form string="Resource Form">
<header>
<button class="oe_right oe_stat_button" name="active_change" type="object"
icon="fa-pencil-square-o" align="right">
<field name="active" widget="statinfo"/>
</button>
</header>
<sheet> <sheet>
<div class="oe_button_box" name="button_box" groups="base.group_user">
<button class="oe_stat_button" icon="fa-archive" name="active_change" type="object"
align="right">
<field name="active" widget="boolean_button" options='{"terminology": "archive"}'/>
</button>
</div>
<group colspan="2"> <group colspan="2">
<group colspan="4" col="4"> <group colspan="4" col="4">
<field name="name"/> <field name="name"/>