Browse Source

[IMP] put on the waiting list

Add the possibility to put a subscription request on the waiting list.
add a waiting state the action to update the state and the related
button on the form
pull/1/head
houssine 6 years ago
parent
commit
68277e9cdb
  1. 5
      easy_my_coop/models/coop.py
  2. 3
      easy_my_coop/view/subscription_request_view.xml

5
easy_my_coop/models/coop.py

@ -125,6 +125,7 @@ class subscription_request(models.Model):
state = fields.Selection([('draft','Draft'), state = fields.Selection([('draft','Draft'),
('block','Blocked'), ('block','Blocked'),
('done','Done'), ('done','Done'),
('waiting','Waiting'),
('transfer','Transfer'), ('transfer','Transfer'),
('cancelled','Cancelled'), ('cancelled','Cancelled'),
('paid','paid')], ('paid','paid')],
@ -358,6 +359,10 @@ class subscription_request(models.Model):
@api.one @api.one
def cancel_subscription_request(self): def cancel_subscription_request(self):
self.write({'state':'cancelled'}) self.write({'state':'cancelled'})
@api.one
def put_on_waiting_list(self):
self.write({'state':'waiting'})
class share_line(models.Model): class share_line(models.Model):
_name='share.line' _name='share.line'

3
easy_my_coop/view/subscription_request_view.xml

@ -34,7 +34,8 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<form string="Subscription Requests"> <form string="Subscription Requests">
<header> <header>
<button string="Validate" type="object" name="validate_subscription_request" attrs="{'invisible':['|',('state','!=','draft'),('validated','=',False)]}"/>
<button string="Validate" type="object" name="validate_subscription_request" attrs="{'invisible':['|',('state','not in',['draft','waiting']),('validated','=',False)]}"/>
<button string="Waiting list" type="object" name="put_on_waiting_list" states="draft"/>
<button string="Cancel" type="object" name="cancel_subscription_request" states="draft,done,block" groups="easy_my_coop.group_energiris_manager"/> <button string="Cancel" type="object" name="cancel_subscription_request" states="draft,done,block" groups="easy_my_coop.group_energiris_manager"/>
<field name="state" widget="statusbar" statusbar_visible="draft,cancelled,done,failed"/> <field name="state" widget="statusbar" statusbar_visible="draft,cancelled,done,failed"/>
</header> </header>

Loading…
Cancel
Save