modify on benefits
This commit is contained in:
parent
39d1a17e05
commit
fe685ddc92
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -1029,6 +1029,12 @@ msgstr "الموافقة على الدخل والمصاريف"
|
|||
msgid "Accepted"
|
||||
msgstr "مقبول"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__expenses_line__state__waiting
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__salary_line__state__waiting
|
||||
msgid "Waiting"
|
||||
msgstr "في انتظار الموافقة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_benefit_zkat__account_id
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_receive_benefit_zkat__account_id
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -568,7 +568,22 @@ class GrantBenefitProfile(models.Model):
|
|||
family_approval_attachment_ids = fields.Many2many('ir.attachment', 'rel_approval_attachment','benefit_id','attachment_id',string='Family approval of transfer')
|
||||
seasonal_service_id = fields.Many2one('seasonal.service', string="Seasonal Service")
|
||||
|
||||
|
||||
def action_set_waiting_if_needed(self):
|
||||
records = self.env['grant.benefit'].browse(self._context.get('active_ids', []))
|
||||
|
||||
|
||||
for rec in records:
|
||||
if rec.salary_ids:
|
||||
for recored in rec.salary_ids:
|
||||
if recored.state not in ['accepted', 'refused']:
|
||||
recored.state = 'waiting'
|
||||
if rec.expenses_ids:
|
||||
for recorede in rec.expenses_ids:
|
||||
if recorede.state not in ['accepted', 'refused']:
|
||||
recorede.state = 'waiting'
|
||||
|
||||
|
||||
|
||||
@api.depends('request_producer')
|
||||
def _compute_request_producer_id(self):
|
||||
for rec in self:
|
||||
|
|
@ -1011,6 +1026,13 @@ class GrantBenefitProfile(models.Model):
|
|||
message = self.create_message('waiting_approve')
|
||||
self.partner_id.send_sms_notification(message, self.phone)
|
||||
for rec in self:
|
||||
if not rec.benefit_category_id and not rec.member_income:
|
||||
raise ValidationError(_("يرجى اكمال ادخال او الموافقة على القيم المرتبطة ببيانات الدخل والمرتب والالتزامات لتحديد فئة الاسرة بشكل صحيح"))
|
||||
|
||||
if rec.member_income == 0.0:
|
||||
raise ValidationError(_("يرجى اكمال ادخال او الموافقة على القيم المرتبطة ببيانات الدخل والمرتب والالتزامات لتحديد فئة الاسرة بشكل صحيح"))
|
||||
|
||||
|
||||
rec.validate_attachments()
|
||||
mother_exist = self.env["family.member"].search([('member_id_number', '=', rec.mother_id_number),('relationn.relation_type','=','mother')], limit=1)
|
||||
replacement_mother_exist = self.env["family.member"].search([('member_id_number', '=', rec.replacement_mother_id_number),('relationn.relation_type','=','replacement_mother')], limit=1)
|
||||
|
|
|
|||
|
|
@ -301,7 +301,7 @@ class Salary(models.Model):
|
|||
attach_end_date = fields.Date(string='Attach End Date')
|
||||
is_required = fields.Boolean(string='Is Required?')
|
||||
is_default = fields.Boolean(string='Is Default?')
|
||||
state = fields.Selection(string='Status',selection=[('accepted', 'Accepted'),('refused', 'Refused')])
|
||||
state = fields.Selection(string='Status',selection=[('waiting', 'Waiting'),('accepted', 'Accepted'),('refused', 'Refused')],default="waiting")
|
||||
# total_salary = fields.Float(string="Total Salary", compute='_compute_total_salary',store=True)
|
||||
|
||||
# @api.depends('salary_amount','state')
|
||||
|
|
@ -314,6 +314,20 @@ class Salary(models.Model):
|
|||
# total += rec.salary_amount
|
||||
# record.total_salary = total
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
if 'state' not in vals or vals.get('state') not in ['accepted', 'refused']:
|
||||
vals['state'] = 'waiting'
|
||||
return super(Salary, self).create(vals)
|
||||
|
||||
def write(self, vals):
|
||||
if 'state' not in vals:
|
||||
for rec in self:
|
||||
if rec.state not in ['accepted', 'refused']:
|
||||
vals['state'] = 'waiting'
|
||||
break
|
||||
return super(Salary, self).write(vals)
|
||||
|
||||
def action_accept(self):
|
||||
self.state = 'accepted'
|
||||
|
||||
|
|
@ -470,11 +484,13 @@ class ExpensesLine(models.Model):
|
|||
required=False, )
|
||||
amount = fields.Float()
|
||||
note = fields.Char()
|
||||
state = fields.Selection(string='Status', selection=[('accepted', 'Accepted'), ('refused', 'Refused')])
|
||||
state = fields.Selection(string='Status', selection=[('waiting', 'Waiting'),('accepted', 'Accepted'), ('refused', 'Refused')],default="waiting")
|
||||
|
||||
def action_accept(self):
|
||||
self.benefit_id.get_member_income()
|
||||
self.state = 'accepted'
|
||||
|
||||
|
||||
def action_refuse(self):
|
||||
self.state = 'refused'
|
||||
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
|
|
@ -127,7 +127,7 @@
|
|||
states="complete_info,edit_info"/>
|
||||
<button name="action_black_list" type="object"
|
||||
string="Black List" class="oe_highlight"
|
||||
states="waiting_approve,refused" groups="odex_benefit.group_benefit_manager,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_woman_commitee"
|
||||
states="waiting_approve" groups="odex_benefit.group_benefit_manager,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_woman_commitee"
|
||||
confirm="Are you sure you want to move to black list ?"/>
|
||||
<button name="action_suspend" type="object"
|
||||
string="Temporarily Suspended" class="oe_highlight"
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
<button name="action_edit_info" type="object"
|
||||
string="Open Edit Info" class="oe_highlight"
|
||||
groups="odex_benefit.group_benefit_edit"
|
||||
states="refused,second_approve,first_refusal"
|
||||
states="second_approve"
|
||||
confirm="Are you sure you want to open info edition !"
|
||||
/>
|
||||
<button name="create_manual_visit" type="object"
|
||||
|
|
@ -233,7 +233,8 @@
|
|||
<field name="researcher_id"
|
||||
attrs="{'required':[('state','not in',['draft'])]}" readonly="1" force_save="1"/>
|
||||
<field name="last_visit_date" readonly="1"/>
|
||||
<field name="benefit_category_id" readonly="1" force_save="1"/>
|
||||
<!-- required="1"-->
|
||||
<field name="benefit_category_id" readonly="1" force_save="1" required="1"/>
|
||||
<field name="member_income" readonly="1" force_save="1"/>
|
||||
<button name="%(odex_benefit.grant_map)d" string="Map" type="action" context="{'search_default_name': name}" icon="fa-map-marker" class="oe_highlight" attrs="{'invisible': ['|',('lat', '=', 0.0), ('lon', '=', 0.0)]}"/>
|
||||
</group>
|
||||
|
|
@ -705,7 +706,7 @@
|
|||
<field name="amount" sum="amount"/>
|
||||
<button name="action_accept" type="object" string="Accept" class="oe_highlight" attrs="{'invisible':[('state','=','accepted')]}" groups="odex_benefit.group_accept_income_and_expenses"/>
|
||||
<button name="action_refuse" type="object" string="Refuse" class="oe_highlight" attrs="{'invisible':[('state','=','refused')]}" groups="odex_benefit.group_accept_income_and_expenses"/>
|
||||
<field name="state" readonly="1" force_save="1" widget="badge" decoration-success="state in ['accepted']" decoration-danger="state in ['refused']"/>
|
||||
<field name="state" readonly="1" force_save="1" widget="badge" decoration-warning="state in ['waiting']" decoration-success="state in ['accepted']" decoration-danger="state in ['refused']"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
|
|
@ -721,7 +722,8 @@
|
|||
<field name="attach_end_date"/>
|
||||
<button name="action_accept" type="object" string="Accept" class="oe_highlight" attrs="{'invisible':[('state','=','accepted')]}" groups="odex_benefit.group_accept_income_and_expenses"/>
|
||||
<button name="action_refuse" type="object" string="Refuse" class="oe_highlight" attrs="{'invisible':[('state','=','refused')]}" groups="odex_benefit.group_accept_income_and_expenses"/>
|
||||
<field name="state" readonly="1" force_save="1" widget="badge" decoration-success="state in ['accepted']" decoration-danger="state in ['refused']"/>
|
||||
<field name="state" readonly="1" force_save="1" widget="badge" decoration-warning="state in ['waiting']" decoration-success="state in ['accepted']" decoration-danger="state in ['refused']"/>
|
||||
|
||||
<field name="is_required" invisible="1"/>
|
||||
<field name="is_default" invisible="1"/>
|
||||
</tree>
|
||||
|
|
@ -1321,5 +1323,16 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="set_lines_action" model="ir.actions.server">
|
||||
<field name="name">Update Lines State </field>
|
||||
<field name="type">ir.actions.server</field>
|
||||
<field name="model_id" ref="odex_benefit.model_grant_benefit"/>
|
||||
<field name="binding_model_id" ref="odex_benefit.model_grant_benefit"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">
|
||||
action = records.action_set_waiting_if_needed()
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue