[ADD]GOLEM Session Registration subscription form member view to new system ok

This commit is contained in:
Fabien Bourgeois 2016-09-16 08:41:41 +02:00
parent c1568a15af
commit aa11f6d09f
3 changed files with 45 additions and 10 deletions

View File

@ -15,7 +15,7 @@
# you should have received a copy of the gnu affero general public license
# along with this program. if not, see <http://www.gnu.org/licenses/>.
from openerp import models, fields
from openerp import models, fields, api
class GolemMember(models.Model):
@ -40,3 +40,17 @@ class GolemActivitySessionRegistration(models.Model):
ondelete='set null')
season_id = fields.Many2one(string='Season',
related='session_id.season_id')
season_default_id = fields.Many2one('golem.season', 'Default season',
compute='_compute_season_default')
@api.one
@api.depends('session_id')
def _compute_season_default(self):
""" Compute default season """
domain = [('is_default', '=', True)]
self.season_default_id = self.env['golem.season'].search(domain).id
# if 'default_season_id' not in self.env.context:
# ctx = self.env.context.copy()
# ctx.update({'default_season_id': self._default_season()})
# self.with_context(ctx)

View File

@ -17,6 +17,24 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
-->
<openerp>
<data>
<!-- Form -->
<record id="registration_form" model="ir.ui.view">
<field name="name">Session registration form</field>
<field name="model">golem.activity.session.registration</field>
<field name="arch" type="xml">
<form>
<sheet>
<group string="Subscription">
<field name="member_id" invisible="1" />
<field name="session_id" />
<field name="season_id" />
</group>
</sheet>
</form>
</field>
</record>
<!-- Tree -->
<record id="registration_tree" model="ir.ui.view">
<field name="name">Session registration list</field>
@ -31,13 +49,16 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
</tree>
</field>
</record>
<!-- Search -->
<!-- Action -->
<record id="registration_action_list" model="ir.actions.act_window">
<field name="name">GOLEM Activity Session Registration List</field>
<field name="res_model">golem.activity.session.registration</field>
<field name="view_mode">tree</field>
</record>
<!-- Menu -->
<menuitem id="registration_menu_list" name="Session registrations"
parent="golem_activity.activity_menu" action="registration_action_list"

View File

@ -27,17 +27,17 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
<page name="other_page" position="before">
<page name="sessions" string="Activities">
<p>Default season activities</p>
<field name="activity_session_registration_ids">
<tree>
<field name="season_id" />
<field name="member_id" />
<field name="session_id" />
<field name="invoice_id" />
<field name="invoice_line_id" />
<field name="activity_session_registration_ids"
context="{'default_member_id': active_id}">
<tree editable="top">
<field name="season_default_id" invisible="1" />
<field name="session_id"
domain="[('season_id', '=', season_default_id)]" />
<field name="season_id" readonly="1" />
<field name="member_id" readonly="1" />
<field name="invoice_id" readonly="1" />
</tree>
</field>
<!--<field name="activity_session_ids"
context="{'search_default_season_default': True}" />-->
</page>
</page>
</field>