forked from Yaltik/golem
[IMP]GOLEM Activity Registration State : small enhancements
* Reload client to reflect changes after unlink registration ; * Do no show buttons until registration has been saved.
This commit is contained in:
parent
661aabcfe8
commit
18957c4568
@ -19,7 +19,7 @@
|
|||||||
'name': 'GOLEM Activity Session Member Registrations States',
|
'name': 'GOLEM Activity Session Member Registrations States',
|
||||||
'summary': 'GOLEM Activities Session Member Registration states',
|
'summary': 'GOLEM Activities Session Member Registration states',
|
||||||
'description': 'GOLEM Activities Session Member Registration states',
|
'description': 'GOLEM Activities Session Member Registration states',
|
||||||
'version': '10.0.2.2.0',
|
'version': '10.0.2.2.1',
|
||||||
'category': 'GOLEM',
|
'category': 'GOLEM',
|
||||||
'author': 'Fabien Bourgeois',
|
'author': 'Fabien Bourgeois',
|
||||||
'license': 'AGPL-3',
|
'license': 'AGPL-3',
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
""" GOLEM Activity Registration State """
|
""" GOLEM Activity Registration State """
|
||||||
|
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import UserError
|
from odoo.exceptions import UserError, ValidationError
|
||||||
|
|
||||||
class GolemMember(models.Model):
|
class GolemMember(models.Model):
|
||||||
""" GOLEM Member adaptations """
|
""" GOLEM Member adaptations """
|
||||||
@ -89,9 +89,10 @@ class GolemActivityRegistration(models.Model):
|
|||||||
def state_remove(self):
|
def state_remove(self):
|
||||||
""" Remove registrations, only if canceled """
|
""" Remove registrations, only if canceled """
|
||||||
if self.filtered(lambda r: r.state != 'canceled'):
|
if self.filtered(lambda r: r.state != 'canceled'):
|
||||||
uerr = _('You can not confirm a canceled registration.')
|
uerr = _('You can not remove a uncanceled registration.')
|
||||||
raise UserError(uerr)
|
raise UserError(uerr)
|
||||||
self.unlink()
|
self.unlink()
|
||||||
|
return {'type': 'ir.actions.client', 'tag': 'reload'}
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def write(self, values):
|
def write(self, values):
|
||||||
|
@ -45,20 +45,21 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||||||
<attribute name="delete">0</attribute>
|
<attribute name="delete">0</attribute>
|
||||||
</tree>
|
</tree>
|
||||||
<tree position="inside">
|
<tree position="inside">
|
||||||
|
<field name="id" invisible="1" />
|
||||||
<field name="state" readonly="1" />
|
<field name="state" readonly="1" />
|
||||||
<button type="object" name="state_draft" string="Reset to draft"
|
<button type="object" name="state_draft" string="Reset to draft"
|
||||||
icon="fa-arrow-up" attrs="{'invisible': [('state', '=', 'draft')]}"
|
icon="fa-arrow-up" attrs="{'invisible': ['|', ('id', '=', False), ('state', '=', 'draft')]}"
|
||||||
invisible="not context.get('action_show', 1)" />
|
invisible="not context.get('action_show', 1)" />
|
||||||
<button type="object" name="state_confirm" string="Confirm"
|
<button type="object" name="state_confirm" string="Confirm"
|
||||||
icon="fa-check" attrs="{'invisible': [('state', '!=', 'draft')]}"
|
icon="fa-check" attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'draft')]}"
|
||||||
invisible="not context.get('action_show', 1)" />
|
invisible="not context.get('action_show', 1)" />
|
||||||
<button type="object" name="state_cancel" string="Cancel"
|
<button type="object" name="state_cancel" string="Cancel"
|
||||||
icon="fa-ban" attrs="{'invisible': [('state', '=', 'canceled')]}"
|
icon="fa-ban" attrs="{'invisible': ['|', ('id', '=', False), ('state', '=', 'canceled')]}"
|
||||||
invisible="not context.get('action_show', 1)" />
|
invisible="not context.get('action_show', 1)" />
|
||||||
<button type="object" name="state_remove" string="Remove"
|
<button type="object" name="state_remove" string="Remove"
|
||||||
icon="fa-trash"
|
icon="fa-trash"
|
||||||
confirm="Are you sure you want to remove this subscription ?"
|
confirm="Are you sure you want to remove this subscription ?"
|
||||||
attrs="{'invisible': [('state', '!=', 'canceled')]}"
|
attrs="{'invisible': ['|', ('id', '=', False), ('state', '!=', 'canceled')]}"
|
||||||
invisible="not context.get('action_show', 1)" />
|
invisible="not context.get('action_show', 1)" />
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
Loading…
Reference in New Issue
Block a user