committe v2
This commit is contained in:
parent
40c4b957de
commit
5f702296c9
|
|
@ -2777,4 +2777,11 @@ msgstr "منصرف من العهدة"
|
|||
#. module: purchase_requisition_custom
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_purchase_order__cash_advance_employee_id
|
||||
msgid "Employee Cash Spent"
|
||||
msgstr "موظف العهد"
|
||||
msgstr "موظف العهد"
|
||||
|
||||
|
||||
#. module: purchase_requisition_custom
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_committe_member__refused
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_custom.field_purchase_order__refused
|
||||
msgid "Refused "
|
||||
msgstr "رفض"
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ class PurchaseOrderCustom(models.Model):
|
|||
string="Cash Spent",
|
||||
default=False,
|
||||
)
|
||||
refused = fields.Boolean("Refused ", default=False)
|
||||
|
||||
cash_advance_employee_id = fields.Many2one(
|
||||
'hr.employee',
|
||||
|
|
@ -62,12 +63,13 @@ class PurchaseOrderCustom(models.Model):
|
|||
for po in self:
|
||||
requisition = po.requisition_id
|
||||
is_member = requisition and user in requisition.committe_members
|
||||
po.can_committee_vote = bool(
|
||||
from_committee and
|
||||
requisition and
|
||||
requisition.purchase_commitee and
|
||||
is_member
|
||||
)
|
||||
po.can_committee_vote = requisition.sent_to_commitee
|
||||
# bool(
|
||||
# from_committee and
|
||||
# requisition and
|
||||
# requisition.purchase_commitee and
|
||||
# is_member
|
||||
# )
|
||||
|
||||
@api.depends('requisition_id')
|
||||
def _compute_has_requisition(self):
|
||||
|
|
@ -819,9 +821,9 @@ class PurchaseOrderCustom(models.Model):
|
|||
rec.already_voted = True
|
||||
|
||||
def action_select(self):
|
||||
for member in self.committe_members:
|
||||
if member.user_id.id == self.env.user.id and member.select == True:
|
||||
raise ValidationError(_('You have already select this Quotation'))
|
||||
# for member in self.committe_members:
|
||||
# if member.user_id.id == self.env.user.id and member.select == True:
|
||||
# raise ValidationError(_('You have already select this Quotation'))
|
||||
self.requisition_id.actual_vote += 1
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
|
|
@ -833,10 +835,10 @@ class PurchaseOrderCustom(models.Model):
|
|||
}
|
||||
|
||||
def action_refuse(self):
|
||||
for member in self.committe_members:
|
||||
if member.user_id.id == self.env.user.id and member.select == True:
|
||||
raise ValidationError(_('You have already refused this Quotation'))
|
||||
self.requisition_id.actual_vote += 1
|
||||
# for member in self.committe_members:
|
||||
# if member.user_id.id == self.env.user.id and member.select == True:
|
||||
# raise ValidationError(_('You have already refused this Quotation'))
|
||||
self.requisition_id.actual_vote += 1
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'name': 'Refuse Reason',
|
||||
|
|
|
|||
|
|
@ -656,6 +656,7 @@ class CommitteMembers(models.Model):
|
|||
user_id = fields.Many2one('res.users', "Member Name")
|
||||
selection_reason = fields.Char("Selection Reason")
|
||||
select = fields.Boolean(string="Select")
|
||||
refused = fields.Boolean("Refused ", default=False)
|
||||
refusing_reason = fields.Char("Refusing Reason")
|
||||
|
||||
|
||||
|
|
@ -667,12 +668,25 @@ class SelectReason(models.TransientModel):
|
|||
order_id = fields.Integer("order id")
|
||||
|
||||
def action_select(self):
|
||||
self.env['committe.member'].create({
|
||||
'po_id': self.order_id,
|
||||
'user_id': self.env.user.id,
|
||||
'selection_reason': self.select_reason,
|
||||
'select': True})
|
||||
order_id = self.env['purchase.order'].browse(self.order_id)
|
||||
current_user_member = order_id.committe_members.filtered(lambda m: m.user_id.id == self.env.user.id)
|
||||
|
||||
if current_user_member:
|
||||
current_user_member.write({
|
||||
'selection_reason': self.select_reason,
|
||||
'select': True,
|
||||
'refused': False,
|
||||
'refusing_reason': False
|
||||
})
|
||||
else:
|
||||
self.env['committe.member'].create({
|
||||
'po_id': self.order_id,
|
||||
'user_id': self.env.user.id,
|
||||
'selection_reason': self.select_reason,
|
||||
'select': True,
|
||||
'refused': False
|
||||
})
|
||||
|
||||
order_id.select = True
|
||||
|
||||
|
||||
|
|
@ -687,12 +701,26 @@ class RefuseReason(models.TransientModel):
|
|||
def action_refuse(self):
|
||||
if self.order_id:
|
||||
order_id = self.env['purchase.order'].browse(self.order_id)
|
||||
order_id.select = True
|
||||
self.env['committe.member'].create({
|
||||
'po_id': self.order_id,
|
||||
'user_id': self.env.user.id,
|
||||
'refusing_reason': self.refuse_reason,
|
||||
'select': True})
|
||||
current_user_member = order_id.committe_members.filtered(lambda m: m.user_id.id == self.env.user.id)
|
||||
|
||||
if current_user_member:
|
||||
current_user_member.write({
|
||||
'refusing_reason': self.refuse_reason,
|
||||
'refused': True,
|
||||
'select': False,
|
||||
'selection_reason': False
|
||||
})
|
||||
else:
|
||||
self.env['committe.member'].create({
|
||||
'po_id': self.order_id,
|
||||
'user_id': self.env.user.id,
|
||||
'refusing_reason': self.refuse_reason,
|
||||
'refused': True,
|
||||
'select': False
|
||||
})
|
||||
|
||||
order_id.refused = True
|
||||
order_id._check_committee_rejection()
|
||||
elif self.request_id:
|
||||
request_id = self.env['purchase.request'].search([('id', '=', self.request_id)])
|
||||
request_id.select = True
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
<xpath expr="//tree" position="inside">
|
||||
<button name="rejection_committee_head" string="Reject Committee" class="oe_highlight"
|
||||
type="object" groups="purchase_requisition_custom.group_reject_purchase_committee_head"
|
||||
attrs="{'invisible':[('state','!=','wait')]}"
|
||||
attrs="{'invisible':[('state','not in', ['wait', 'send'])]}"
|
||||
/>
|
||||
</xpath>
|
||||
</field>
|
||||
|
|
|
|||
|
|
@ -181,11 +181,11 @@
|
|||
<button type="object" name="action_approve_po" string="Confirm Purchase" class="oe_highlight" invisible="1"/>
|
||||
|
||||
<button type="object" name="action_select" groups="purchase_requisition_custom.committe_member"
|
||||
attrs="{'invisible':['|', '|',('state','in',['done','purchase','waiting','cancel','rejected_by_committee']),('already_voted','=',True),('can_committee_vote', '=', False)]}"
|
||||
attrs="{'invisible':['|', ('state','in',['done','purchase','waiting','cancel']),('can_committee_vote', '=', False)]}"
|
||||
string="Select"/>
|
||||
|
||||
<button type="object" name="action_refuse" groups="purchase_requisition_custom.committe_member"
|
||||
attrs="{'invisible':['|', '|',('state','in',['done','purchase','waiting','cancel','rejected_by_committee']),('already_voted','=',True),('can_committee_vote', '=', False)]}"
|
||||
attrs="{'invisible':['|',('state','in',['done','purchase','waiting','cancel']),('can_committee_vote', '=', False)]}"
|
||||
string="Refuse"/>
|
||||
<button type="object" name="action_recommend"
|
||||
groups="purchase_requisition_custom.group_select_recommended_offer"
|
||||
|
|
@ -336,6 +336,7 @@
|
|||
<field name="user_id"/>
|
||||
<field name="selection_reason"/>
|
||||
<field name="select"/>
|
||||
<field name="refused"/>
|
||||
<field name="refusing_reason"/>
|
||||
|
||||
</tree>
|
||||
|
|
|
|||
Loading…
Reference in New Issue