Merge pull request #4564 from expsa/request_sic
This commit is contained in:
commit
93aefd1913
|
|
@ -495,6 +495,8 @@ class PurchaseOrderCustom(models.Model):
|
|||
|
||||
order.budget_amount = 0
|
||||
super(PurchaseOrderCustom, self).button_cancel()
|
||||
def action_to_approve(self):
|
||||
self.write({'state': 'to approve'})
|
||||
|
||||
def action_sign_purchase_orders(self):
|
||||
for rec in self:
|
||||
|
|
|
|||
|
|
@ -629,17 +629,22 @@ class CommitteeTypes(models.Model):
|
|||
@api.model
|
||||
def create(self, vals):
|
||||
res = super(CommitteeTypes, self).create(vals)
|
||||
if res.committe_head.id not in res.committe_members.ids:
|
||||
if res.committe_head and res.committe_head.id not in res.committe_members.ids:
|
||||
res.committe_members = [(4, res.committe_head.id)]
|
||||
return res
|
||||
|
||||
def write(self, vals):
|
||||
current_head = self.committe_head.id
|
||||
if 'committe_head' in vals and current_head in self.committe_members.ids:
|
||||
vals['committe_members'] = [(3, current_head), (4, vals['committe_head'])]
|
||||
for record in self:
|
||||
old_head_id = record.committe_head.id if record.committe_head else False
|
||||
new_head_id = vals.get('committe_head')
|
||||
|
||||
if new_head_id:
|
||||
if old_head_id and old_head_id in record.committe_members.ids:
|
||||
record.committe_members = [(3, old_head_id)]
|
||||
if new_head_id not in record.committe_members.ids:
|
||||
record.committe_members = [(4, new_head_id)]
|
||||
|
||||
return super(CommitteeTypes, self).write(vals)
|
||||
|
||||
|
||||
class CommitteMembers(models.Model):
|
||||
_name = "committe.member"
|
||||
_description = "committe.member"
|
||||
|
|
|
|||
|
|
@ -157,6 +157,7 @@
|
|||
<field name="hide_action_budget_button" invisible="1"/>
|
||||
<field name="requisition_state" invisible="1"/>
|
||||
<field name="requisition_type_exclusive" invisible="1"/>
|
||||
<button type="object" name="action_to_approve" class="oe_highlight" states="to approve" string="Approve"/>
|
||||
<button type="object" name="action_sign" class="oe_highlight"
|
||||
groups="purchase_requisition_custom.group_sign_purchase_order"
|
||||
attrs="{'invisible':['|',('requisition_id','=',False),
|
||||
|
|
|
|||
Loading…
Reference in New Issue