forked from Yaltik/golem
[IMP]GOLEM Resource : small enhancements around form and timetable model
This commit is contained in:
parent
fb89650aa1
commit
2223b88930
@ -20,7 +20,7 @@
|
||||
'name': 'GOLEM non-profit resources',
|
||||
'summary': 'GOLEM resources management',
|
||||
'description': ''' GOLEM resources management ''',
|
||||
'version': '10.0.1.2.0',
|
||||
'version': '10.0.1.3.0',
|
||||
'category': 'GOLEM',
|
||||
'author': 'Youssef El Ouahby, Fabien Bourgeois',
|
||||
'license': 'AGPL-3',
|
||||
|
@ -34,7 +34,10 @@ class GolemResource(models.Model):
|
||||
index=True, string='Resource Type')
|
||||
supervisor_id = fields.Many2one('res.partner', index=True, string='Supervisor')
|
||||
product_tmpl_id = fields.Many2one('product.template', index=True,
|
||||
string='Linked product')
|
||||
string='Linked product',
|
||||
help='A generic product can be linked, in '
|
||||
'order to sell reservations (work in '
|
||||
'progress)')
|
||||
|
||||
avaibility_start = fields.Date(required=True, string='Availibility start date')
|
||||
avaibility_stop = fields.Date(required=True, string='Availibility stop date')
|
||||
|
@ -35,12 +35,20 @@ class GolemTimetable(models.Model):
|
||||
('3', _('Thursday')),
|
||||
('4', _('Friday')),
|
||||
('5', _('Saturday')),
|
||||
('6', _('Sunday'))], copy=False)
|
||||
('6', _('Sunday'))], required=True)
|
||||
time_start = fields.Float(required=True, string='Start')
|
||||
time_stop = fields.Float(required=True, string='Stop')
|
||||
|
||||
@api.onchange('time_start')
|
||||
def onchange_time_start(self):
|
||||
""" Propose automatically stop hour after start hour had been filled """
|
||||
for line in self:
|
||||
if line.time_start and not line.time_stop:
|
||||
line.time_stop = line.time_start + 1
|
||||
|
||||
@api.constrains('time_start', 'time_stop')
|
||||
def _check_time_consistency(self):
|
||||
""" Checks time consistency """
|
||||
for timetable in self:
|
||||
if timetable.time_stop < timetable.time_start:
|
||||
raise ValidationError(_('End time should be after than start time'))
|
||||
|
@ -50,33 +50,40 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
options="{'terminology': 'archive'}" />
|
||||
</button>
|
||||
</div>
|
||||
<group colspan="2">
|
||||
<group colspan="4" col="4">
|
||||
<field name="name"/>
|
||||
<field name="validation_required"/>
|
||||
<field name="type_id"/>
|
||||
<field name="supervisor_id"/>
|
||||
<field name="product_tmpl_id"/>
|
||||
<group>
|
||||
<group>
|
||||
<field name="name" />
|
||||
<field name="type_id" />
|
||||
<field name="product_tmpl_id" options="{'no_create': true}" />
|
||||
</group>
|
||||
<field name="id" invisible="1"/>
|
||||
<group colspan="3">
|
||||
<separator string="Availibility configuration" colspan="3"/>
|
||||
<field name="avaibility_start"/>
|
||||
<field name="avaibility_stop"/>
|
||||
<group>
|
||||
<field name="validation_required" />
|
||||
<field name="supervisor_id" />
|
||||
</group>
|
||||
<label string="Please save the resource before fixing the timetable availibility" attrs="{'invisible': [('id', '!=', False)]}"/>
|
||||
<group colspan="3">
|
||||
</group>
|
||||
<group string="Availibility configuration">
|
||||
<group colspan="2">
|
||||
<field name="id" invisible="1"/>
|
||||
<field name="avaibility_start" />
|
||||
<field name="avaibility_stop" />
|
||||
</group>
|
||||
<p attrs="{'invisible': [('id', '!=', False)]}">
|
||||
Please save the resource before fixing the timetable availibility"
|
||||
</p>
|
||||
<group colspan="2">
|
||||
<field name="timetable_ids"
|
||||
context="{'default_resource_id': active_id}"
|
||||
attrs="{'readonly': [('id', '=', False)]}">
|
||||
<tree editable="bottom" >
|
||||
<field name="resource_id" invisible="1" />
|
||||
<field name="weekday" />
|
||||
<field name="time_start" widget="float_time" />
|
||||
<field name="time_stop" widget="float_time" />
|
||||
<tree editable="bottom">
|
||||
<field name="resource_id" invisible="1" />
|
||||
<field name="weekday" />
|
||||
<field name="time_start" string="Start hour"
|
||||
widget="float_time" />
|
||||
<field name="time_stop" string="Stop hour"
|
||||
widget="float_time" />
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
@ -93,6 +100,19 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<field name="type_id" />
|
||||
<field name="supervisor_id" />
|
||||
<field name="product_tmpl_id" />
|
||||
<filter name="with_validation" string="With validation"
|
||||
domain="[('validation_required', '=', True)]" />
|
||||
<filter name="without_validation" string="Without validation"
|
||||
domain="[('validation_required', '=', False)]" />
|
||||
<separator />
|
||||
<filter name="archived" string="Archived"
|
||||
domain="[('active', '=', False)]" />
|
||||
<filter name="group_type" string="Type"
|
||||
context="{'group_by': 'type_id'}"/>
|
||||
<filter name="group_supervisor" string="Supervisor"
|
||||
context="{'group_by': 'supervisor_id'}"/>
|
||||
<filter name="group_product" string="Linked product"
|
||||
context="{'group_by': 'product_tmpl_id'}"/>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
Loading…
x
Reference in New Issue
Block a user