forked from Yaltik/golem
[IMP]GOLEM Activities and Sessions enhancements
This commit is contained in:
parent
e67e2e8b5e
commit
86d725737c
@ -24,6 +24,7 @@ class GolemActivity(models.Model):
|
||||
_inherit = 'mail.thread'
|
||||
|
||||
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 for the activity.')
|
||||
note = fields.Text('Note')
|
||||
|
@ -36,6 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</div>
|
||||
<group>
|
||||
<field name="season_id" />
|
||||
<field name="default_code" />
|
||||
</group>
|
||||
<group string="Details">
|
||||
<group>
|
||||
|
@ -61,6 +61,7 @@ class GolemActivitySession(models.Model):
|
||||
_description = 'GOLEM Activities Sessions'
|
||||
_inherit = 'mail.thread'
|
||||
_inherits = {'product.template': 'product_id'}
|
||||
_rec_name = 'session_name'
|
||||
|
||||
product_id = fields.Many2one('product.template', required=True,
|
||||
ondelete='cascade')
|
||||
@ -112,6 +113,8 @@ class GolemActivitySession(models.Model):
|
||||
for s in self:
|
||||
if not s.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:
|
||||
s.animator_id = s.activity_id.animator_id
|
||||
|
||||
@ -160,8 +163,8 @@ class GolemActivitySession(models.Model):
|
||||
def onchange_hour_start(self):
|
||||
""" Sets end hour to start hour if no start hour """
|
||||
for s in self:
|
||||
if not s.hour_end:
|
||||
s.hour_end = s.hour_start
|
||||
if s.hour_start and not s.hour_end:
|
||||
s.hour_end = s.hour_start + 1
|
||||
|
||||
@api.constrains('hour_start', 'hour_end')
|
||||
def _check_hour_period(self):
|
||||
@ -215,5 +218,3 @@ class GolemActivitySession(models.Model):
|
||||
if v.is_overbooked and (v.places_overbooked <= v.places):
|
||||
emsg = _('Overbooked places cannot be inferior than places')
|
||||
raise models.ValidationError(emsg)
|
||||
|
||||
note = fields.Text('Note')
|
||||
|
@ -72,7 +72,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
<page string="Members">
|
||||
<group>
|
||||
<field name="places_remain" readonly="True" />
|
||||
<field name="member_ids" />
|
||||
<field name="member_ids"
|
||||
context="{'search_default_season_default': True}" />
|
||||
</group>
|
||||
</page>
|
||||
<page string="Service">
|
||||
@ -90,9 +91,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Note">
|
||||
<field name="note" />
|
||||
</page>
|
||||
</notebook>
|
||||
</sheet>
|
||||
<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_used" invisible="True" />
|
||||
<field name="places_min" invislbe="True" />
|
||||
<field name="list_price" sum="True" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
Loading…
Reference in New Issue
Block a user