[IMP]GOLEM Activities and Sessions enhancements

This commit is contained in:
Fabien Bourgeois 2016-07-11 17:01:06 +02:00
parent e67e2e8b5e
commit 86d725737c
4 changed files with 10 additions and 8 deletions

View File

@ -24,6 +24,7 @@ class GolemActivity(models.Model):
_inherit = 'mail.thread' _inherit = 'mail.thread'
name = fields.Char('Name', index=True, required=True) name = fields.Char('Name', index=True, required=True)
default_code = fields.Char('Internal Reference', index=True)
image = fields.Binary('Image', help='This field holds the image used as ' image = fields.Binary('Image', help='This field holds the image used as '
'image for the activity.') 'image for the activity.')
note = fields.Text('Note') note = fields.Text('Note')

View File

@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</div> </div>
<group> <group>
<field name="season_id" /> <field name="season_id" />
<field name="default_code" />
</group> </group>
<group string="Details"> <group string="Details">
<group> <group>

View File

@ -61,6 +61,7 @@ class GolemActivitySession(models.Model):
_description = 'GOLEM Activities Sessions' _description = 'GOLEM Activities Sessions'
_inherit = 'mail.thread' _inherit = 'mail.thread'
_inherits = {'product.template': 'product_id'} _inherits = {'product.template': 'product_id'}
_rec_name = 'session_name'
product_id = fields.Many2one('product.template', required=True, product_id = fields.Many2one('product.template', required=True,
ondelete='cascade') ondelete='cascade')
@ -112,6 +113,8 @@ class GolemActivitySession(models.Model):
for s in self: for s in self:
if not s.name: if not s.name:
s.name = s.activity_id.name s.name = s.activity_id.name
if not s.default_code:
s.default_code = s.activity_id.default_code
if not s.animator_id: if not s.animator_id:
s.animator_id = s.activity_id.animator_id s.animator_id = s.activity_id.animator_id
@ -160,8 +163,8 @@ class GolemActivitySession(models.Model):
def onchange_hour_start(self): def onchange_hour_start(self):
""" Sets end hour to start hour if no start hour """ """ Sets end hour to start hour if no start hour """
for s in self: for s in self:
if not s.hour_end: if s.hour_start and not s.hour_end:
s.hour_end = s.hour_start s.hour_end = s.hour_start + 1
@api.constrains('hour_start', 'hour_end') @api.constrains('hour_start', 'hour_end')
def _check_hour_period(self): def _check_hour_period(self):
@ -215,5 +218,3 @@ class GolemActivitySession(models.Model):
if v.is_overbooked and (v.places_overbooked <= v.places): if v.is_overbooked and (v.places_overbooked <= v.places):
emsg = _('Overbooked places cannot be inferior than places') emsg = _('Overbooked places cannot be inferior than places')
raise models.ValidationError(emsg) raise models.ValidationError(emsg)
note = fields.Text('Note')

View File

@ -72,7 +72,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<page string="Members"> <page string="Members">
<group> <group>
<field name="places_remain" readonly="True" /> <field name="places_remain" readonly="True" />
<field name="member_ids" /> <field name="member_ids"
context="{'search_default_season_default': True}" />
</group> </group>
</page> </page>
<page string="Service"> <page string="Service">
@ -90,9 +91,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</group> </group>
</group> </group>
</page> </page>
<page string="Note">
<field name="note" />
</page>
</notebook> </notebook>
</sheet> </sheet>
<div class="oe_chatter"> <div class="oe_chatter">
@ -123,6 +121,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<field name="places_remain" string="Remain" /> <field name="places_remain" string="Remain" />
<field name="places_used" invisible="True" /> <field name="places_used" invisible="True" />
<field name="places_min" invislbe="True" /> <field name="places_min" invislbe="True" />
<field name="list_price" sum="True" />
</tree> </tree>
</field> </field>
</record> </record>