update to grant cycles

This commit is contained in:
ronozoro 2024-09-11 18:43:53 -07:00
commit f23a2283d7
No known key found for this signature in database
GPG Key ID: 7C2BDED35C62C0F3
21 changed files with 665 additions and 317 deletions

View File

@ -8,7 +8,7 @@
'license': 'GPL-3',
'author': 'Expert Ltd',
'depends': ['base', 'takaful_core', 'website', 'account', 'report_xlsx', 'sale', 'product', 'stock', 'hr',
'purchase','branch'],
'purchase', 'branch'],
'data': [
'security/security_view.xml',
'security/ir.model.access.csv',
@ -40,7 +40,7 @@
'data/sequence_data.xml',
'wizards/entity_refused_wizard_view.xml',
'wizards/entity_black_list_wizard_view.xml',
'wizards/family_expense_move_wiz_view.xml',
],
'external_dependencies': {
'python': ['num2words'],

View File

@ -20,4 +20,5 @@ from . import expenses_type
from . import changes_requests
from . import education_settings
from . import hr_department
from . import account_move_line
# from . import res_config_settings

View File

@ -0,0 +1,6 @@
from odoo import models,fields
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
benefit_family_id = fields.Many2one(comodel_name='grant.benefit', string='Benefit Family')

View File

@ -27,10 +27,28 @@ class GrantBenefitProfile(models.Model):
def name_get(self):
result = []
for rec in self:
name = rec.name +" "+rec.code
name = rec.name + " " + rec.code
result.append((rec.id, name))
return result
@api.model
def name_search(self, name, args=None, operator='ilike', limit=100):
partners = self.search(['|', '|', '|', ('name', operator, name), ('phone', operator, name),
('code', operator, name), ('father_id_number', operator, name)])
return partners.name_get()
@api.model
def search(self, args, offset=0, limit=None, order=None, count=False):
if self.env.user and self.env.user.id and self.env.user.has_group("odex_benefit.group_benefit_researcher"):
args += [('researcher_id.employee_id', '=', self.env.user.employee_id.id)]
if self.env.user and self.env.user.id and (
self.env.user.has_group("odex_benefit.group_benefit_woman_commitee") or self.env.user.has_group(
"odex_benefit.group_benefit_branch_manager")):
args += [('branch_id', '=', self.env.user.employee_id.department_id.id)]
if self.env.user and self.env.user.id and self.env.user.has_group("odex_benefit.group_benefit_manager"):
args = []
return super(GrantBenefitProfile, self).search(args, offset, limit, order, count)
profile_step_count = fields.Integer()
partner_id = fields.Many2one('res.partner', string='partner', required=True, ondelete="cascade")
code = fields.Char(string="Code", copy=False, readonly=True, default=lambda x: _('New'))
@ -39,7 +57,7 @@ class GrantBenefitProfile(models.Model):
mother_status = fields.Selection(selection=[
('benefit', 'Benefit'),
('non_benefit', 'Non Benefit'),
], string='Mother Status', compute="check_mother_status", store=True,default = False)
], string='Mother Status', compute="check_mother_status", store=True, default=False)
phone2 = fields.Char(string="Phone2")
relative_phone = fields.Char(string="Relative Phone")
relative_relation = fields.Char(string="Relative Relation")
@ -76,7 +94,7 @@ class GrantBenefitProfile(models.Model):
user_id = fields.Many2one('res.users', string="User")
password = fields.Char('Password')
# Category And Family
benefit_category_id = fields.Many2one('benefit.category', string='Benefit Category',compute="get_benefit_category")
benefit_category_id = fields.Many2one('benefit.category', string='Benefit Category', compute="get_benefit_category")
family_id = fields.Many2one('benefit.family', string='Benefit Family')
# address
housing_id = fields.Many2one('benefit.housing', string='Benefit Housing')
@ -93,7 +111,7 @@ class GrantBenefitProfile(models.Model):
('villa', 'villa'),
('popular_house', 'popular house'),
('tent', 'tent'),
('Appendix', 'Appendix'), ],default='apartment')
('Appendix', 'Appendix'), ], default='apartment')
property_type = fields.Selection([
('Shared', 'Shared'),
('rent', 'rent'),
@ -101,15 +119,15 @@ class GrantBenefitProfile(models.Model):
('charitable', 'charitable'),
('housing', 'housing'), ])
location = fields.Char(string='location')
rooms_number = fields.Integer('Rooms Number',required=True)
water_bill_account_number = fields.Char(string='water Bill Account Number',)
rooms_number = fields.Integer('Rooms Number', required=True)
water_bill_account_number = fields.Char(string='water Bill Account Number', )
electricity_bill_account_number = fields.Char(string='Electricity Bill Account Number')
domestic_labor_ids = fields.Many2many('domestic.labor')
responsible = fields.Selection(string='responsible', selection=[('father', 'Father'),
('mother', 'mother'),
('other', 'other')], required=False, )
responsible_id = fields.Many2one('grant.benefit', domain="[('is_responsible','=',True)]", string='', required=False)
qr_code = fields.Binary("QR Code", attachment=True,compute='_compute_qr_code')
qr_code = fields.Binary("QR Code", attachment=True, compute='_compute_qr_code')
## car data
car_ids = fields.One2many('cars.line', 'benefit_id')
car_count = fields.Integer(compute='_onchange_car_count')
@ -131,25 +149,28 @@ class GrantBenefitProfile(models.Model):
_('Marital Status'), default='single', tracking=True)
father_birth_date = fields.Date(string="Birth Date")
father_age = fields.Integer(string="Age", compute='_compute_get_father_age')
father_country_id = fields.Many2one('res.country','Father Nationality',tracking=True)
father_country_id = fields.Many2one('res.country', 'Father Nationality', tracking=True)
father_city_id = fields.Many2one('res.country.city', string='City')
father_dead_reason = fields.Char(string='Dead Reason', required=False)
father_dead_date = fields.Date(string="Father Dead Date")
father_dead_city_id = fields.Many2one('res.country.city', string='Dead City')
father_dead_certificate = fields.Binary(attachment=True,string= 'Father Dead Certificate')
father_dead_certificate = fields.Binary(attachment=True, string='Father Dead Certificate')
# Mother's case and her data # Birth Date # Address # dead data
mother_id = fields.Many2one('grant.benefit', domain="[('benefit_type','!=','orphan'),('gender','=','female')]")
mother_name = fields.Char(string="Mother Name", tracking=True)
mother_second_name = fields.Char(string="Mother Second Name", tracking=True)
mother_third_name = fields.Char(string="Mother Third Name", tracking=True)
mother_family_name = fields.Char(string="MotherFamily Name", tracking=True)
mother_country_id = fields.Many2one('res.country','Mother Nationality',tracking=True)
mother_country_id = fields.Many2one('res.country', 'Mother Nationality', tracking=True)
mother_id_number = fields.Char(string="Id Number", tracking=True)
mother_marital = fields.Selection(
[('married', _('Married')), ('widower', _('Widower')), ('divorced', _('Divorced')),('divorced_from_another_man', _('Divorced From Another Man'))
,('prisoner', _('Prisoner')),('dead', _('Dead')),('hanging', _('Hanging'))],
[('married', _('Married')), ('widower', _('Widower')), ('divorced', _('Divorced')),
('divorced_from_another_man', _('Divorced From Another Man'))
, ('prisoner', _('Prisoner')), ('dead', _('Dead')), ('hanging', _('Hanging'))],
_('Marital Status'))
mother_location = fields.Selection([('with_husband_and_children', _('With Husband And Children')) , ('with_children', _('With Children')),('not_live_with_children', _('Not live with children'))], string='Mother Location')
mother_location = fields.Selection(
[('with_husband_and_children', _('With Husband And Children')), ('with_children', _('With Children')),
('not_live_with_children', _('Not live with children'))], string='Mother Location')
is_mother_work = fields.Boolean('Is Mother Work?')
mother_income = fields.Float("Mother Income")
mother_birth_date = fields.Date(string="Birth Date")
@ -176,22 +197,25 @@ class GrantBenefitProfile(models.Model):
# Education_data
education_status = fields.Selection(string='Education Status',
selection=[('educated', 'educated'), ('illiterate', 'illiterate')])
case_study = fields.Selection(string='Case Study', selection=[('continuous', 'continuous'),('intermittent', 'intermittent'),('graduate', 'Graduate')])
case_study = fields.Selection(string='Case Study',
selection=[('continuous', 'continuous'), ('intermittent', 'intermittent'),
('graduate', 'Graduate')])
illiterate_reason = fields.Char(string='Illiterate Reason')
education_entity = fields.Selection(string='Education Entity', selection=[('governmental', 'Governmental'),
('special', 'Special')])
last_education_entity = fields.Selection(string='Last Education Entity', selection=[('governmental', 'Governmental'),
('special', 'Special')])
entities = fields.Many2one("education.entities",string='Entity')
last_entities = fields.Many2one("education.entities",string='Last Entity')
education_levels = fields.Many2one("education.level",string='Education Levels')
last_education_levels = fields.Many2one("education.level",string='Last Education Levels')
last_education_entity = fields.Selection(string='Last Education Entity',
selection=[('governmental', 'Governmental'),
('special', 'Special')])
entities = fields.Many2one("education.entities", string='Entity')
last_entities = fields.Many2one("education.entities", string='Last Entity')
education_levels = fields.Many2one("education.level", string='Education Levels')
last_education_levels = fields.Many2one("education.level", string='Last Education Levels')
nearest_literacy_school = fields.Char(string='The Nearest Literacy School', required=False)
literacy_school_note = fields.Text(string="Literacy School Note", required=False)
classroom = fields.Many2one('education.classroom',string='Classroom')
last_classroom = fields.Many2one('education.classroom',string='Last Classroom')
degree = fields.Many2one('education.result',string='Degree')
last_degree = fields.Many2one('education.result',string='Last Degree')
classroom = fields.Many2one('education.classroom', string='Classroom')
last_classroom = fields.Many2one('education.classroom', string='Last Classroom')
degree = fields.Many2one('education.result', string='Degree')
last_degree = fields.Many2one('education.result', string='Last Degree')
percentage = fields.Float(string="Percentage%")
last_percentage = fields.Float(string="Last Percentage%")
end_date = fields.Date('End Date')
@ -241,8 +265,8 @@ class GrantBenefitProfile(models.Model):
hospital_id = fields.Many2one('hospital.hospital', string='')
hospital_attach = fields.Binary(attach=True)
diseases_type = fields.Selection(string='Diseases Type', selection=[('chronic', 'chronic'),
('psycho', 'psycho'),
('organic', 'organic')])
('psycho', 'psycho'),
('organic', 'organic')])
treatment_used = fields.Char(string='')
treatment_amount = fields.Float(string='')
is_treatment_amount_country = fields.Boolean(string='')
@ -326,20 +350,19 @@ class GrantBenefitProfile(models.Model):
('second_approve', 'Second Approved'),
('refused', 'Refused'),
('temporarily_suspended', 'Temporarily suspended'),
('suspended', 'suspended'),
('suspended_first_approve', 'Suspended First Approved'),
('suspended_second_approve', 'Suspended Second Approved'),
('not_leaving', 'Not Leaving'),
('black_list', 'Black List'),
], string='state', default="draft", tracking=True)
branch_id = fields.Many2one('hr.department', string="Branch",domain=[('is_branch','=',True)])
district_id = fields.Many2one('res.districts', string="District",domain="[('branch_id','=',branch_id)]")
attachment_ids = fields.One2many('ir.attachment','benefit_id')
family_debits_ids = fields.One2many('family.debits','benefit_id')
branch_id = fields.Many2one('hr.department', string="Branch", domain=[('is_branch', '=', True)])
district_id = fields.Many2one('res.districts', string="District", domain="[('branch_id','=',branch_id)]")
attachment_ids = fields.One2many('ir.attachment', 'benefit_id')
family_debits_ids = fields.One2many('family.debits', 'benefit_id')
researcher_id = fields.Many2one("committees.line", string="Researcher")
auto_accept_for_member = fields.Boolean(string="Auto Accept For members",default = True)
auto_accept_for_member = fields.Boolean(string="Auto Accept For members", default=True)
last_visit_date = fields.Datetime(string='Last Visit Date')
#Benefit Housing Information
# Benefit Housing Information
# housing_name = fields.Char(compute='_compute_get_name')
zip = fields.Char('Zip', change_default=True, readonly=False, store=True)
url = fields.Char()
@ -375,31 +398,54 @@ class GrantBenefitProfile(models.Model):
rooms_number = fields.Integer('Rooms Number', compute="get_rooms_total", required=True)
room_ids = fields.One2many('benefit.housing.rooms', inverse_name='housing_id')
domestic_labor_ids = fields.Many2many('domestic.labor')
request_producer = fields.Many2one("res.partner",string="Request Producer")
#Suspend
request_producer = fields.Many2one("res.partner", string="Request Producer")
# Suspend
is_excluded_suspension = fields.Boolean('Excluded from suspension?')
suspend_reason = fields.Many2one('suspend.reason',string='Suspend Reason')
suspend_reason = fields.Many2one('suspend.reason', string='Suspend Reason')
reason = fields.Text(string='Reason')
suspend_description = fields.Text(string='Suspend Description')
suspend_attachment = fields.Binary(string='Suspend Attachment',attachment = True)
suspend_type = fields.Selection(selection=[('temporarily_suspend', 'Temporarily Suspended'), ('suspend', 'Suspend')], string="Suspend Type")
suspend_attachment = fields.Binary(string='Suspend Attachment', attachment=True)
suspend_type = fields.Selection(
selection=[('temporarily_suspend', 'Temporarily Suspended'), ('suspend', 'Suspend')], string="Suspend Type")
suspend_method = fields.Selection(selection=[('manual', 'Manual'), ('auto', 'Auto')], string="Suspend Method")
family_monthly_income = fields.Float(string="Family Monthly Income",compute='_get_family_monthly_values')
family_monthly_meals = fields.Float(string="Family Monthly Meals",compute='_get_family_monthly_values')
family_monthly_clotting = fields.Float(string="Family Monthly Clotting",compute='_get_family_monthly_values')
total_family_expenses = fields.Float(string="Total Family Expenses",compute='_get_family_monthly_values')
family_monthly_income = fields.Float(string="Family Monthly Income", compute='_get_family_monthly_values')
family_monthly_meals = fields.Float(string="Family Monthly Meals", compute='_get_family_monthly_values')
family_monthly_clotting = fields.Float(string="Family Monthly Clotting", compute='_get_family_monthly_values')
total_family_expenses = fields.Float(string="Total Family Expenses", compute='_get_family_monthly_values')
total_move_lines = fields.Integer(string="Total Move Lines", compute='_get_total_move_lines')
def _get_total_move_lines(self):
for rec in self:
rec.total_move_lines = self.env['account.move.line'].search_count([
('benefit_family_id', '=', rec.id),
])
def action_open_related_move_line_records(self):
""" Opens a tree view with related records filtered by a dynamic domain """
move_lines = self.env['account.move.line'].search([
('benefit_family_id', '=', self.id),
]).ids
action = {
'type': 'ir.actions.act_window',
'name': 'Move Lines',
'res_model': 'account.move.line',
'view_mode': 'tree,form',
'domain': [('id', 'in', move_lines)],
'target': 'current',
}
return action
def _get_family_monthly_values(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
for rec in self:
total_family_members = rec.benefit_member_count
rec.family_monthly_income = total_family_members*validation_setting.cash_expense
rec.family_monthly_income = total_family_members * validation_setting.cash_expense
rec.family_monthly_meals = total_family_members * validation_setting.meal_expense
rec.family_monthly_clotting = total_family_members * validation_setting.clothing_expense
rec.total_family_expenses = rec.family_monthly_income + rec.family_monthly_meals + rec.family_monthly_clotting
def get_html(self):
for rec in self:
print(f'<iframe id="custom_src" height="500" width="500" src="{rec.url}"></iframe>')
@ -454,26 +500,26 @@ class GrantBenefitProfile(models.Model):
items_ids.append(record.id)
res['domain'] = {'items': [('room_id', 'in', items_ids)]}
return res
@api.onchange("father_id_number")
def onchange_father_id_number(self):
for rec in self:
if rec.father_id_number:
exist = self.search([('father_id_number','=',rec.father_id_number)])
exist = self.search([('father_id_number', '=', rec.father_id_number)])
if exist:
raise ValidationError(
_('The ID Number Already Exist!'))
@api.onchange("father_country_id",'mother_country_id')
@api.onchange("father_country_id", 'mother_country_id')
def onchange_father_mother_country_id(self):
res = {}
for rec in self:
if rec.father_country_id and rec.mother_country_id:
if rec.mother_country_id.code != 'SA' and rec.father_country_id.code != 'SA':
rec.mother_country_id = False
res['warning'] = {'title': _('ValidationError'),
'message': _('Non-Saudi mothers and fathers cannot register')}
return res
if rec.mother_country_id.code != 'SA' and rec.father_country_id.code != 'SA':
rec.mother_country_id = False
res['warning'] = {'title': _('ValidationError'),
'message': _('Non-Saudi mothers and fathers cannot register')}
return res
@api.onchange("mother_id_number")
def onchange_mother_id_number(self):
@ -492,6 +538,7 @@ class GrantBenefitProfile(models.Model):
if exist:
raise ValidationError(
_('The Family Bank Already Exist!'))
@api.model
def _geo_localize(self, street='', zip='', city='', state='', country=''):
geo_obj = self.env['base.geocoder']
@ -504,7 +551,7 @@ class GrantBenefitProfile(models.Model):
city=city, state=state, country=country
)
result = geo_obj.geo_find(search, force_country=country)
return result,search
return result, search
def geo_localize(self):
for location in self.with_context(lang='en_US'):
@ -535,24 +582,28 @@ class GrantBenefitProfile(models.Model):
'target': 'new',
'url': url
}
@api.depends('mother_marital','mother_income','mother_location','mother_country_id','state')
@api.depends('mother_marital', 'mother_income', 'mother_location', 'mother_country_id', 'state')
def check_mother_status(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
mini_income_for_mother = validation_setting.mini_income_for_mother
max_income_for_mother = validation_setting.max_income_for_mother
for rec in self:
rec.mother_status = False
if rec.mother_location == 'not_live_with_children' or rec.mother_marital in ['married','dead'] or (rec.mother_country_id.code != 'SA' and rec.father_country_id.code != 'SA') or rec.state == 'suspended_second_approve':
if rec.mother_location == 'not_live_with_children' or rec.mother_marital in ['married', 'dead'] or (
rec.mother_country_id.code != 'SA' and rec.father_country_id.code != 'SA') or rec.state == 'suspended_second_approve':
rec.mother_status = 'non_benefit'
elif rec.mother_marital in ['divorced_from_another_man','divorced','widower','hanging']:
if rec.is_mother_work and rec.mother_country_id.code == 'SA' or (rec.mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'):
elif rec.mother_marital in ['divorced_from_another_man', 'divorced', 'widower', 'hanging']:
if rec.is_mother_work and rec.mother_country_id.code == 'SA' or (
rec.mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'):
if mini_income_for_mother < rec.mother_income <= max_income_for_mother:
rec.mother_status = 'non_benefit'
elif rec.mother_income <= mini_income_for_mother:
rec.mother_status = 'benefit'
elif rec.mother_income > max_income_for_mother:
rec.mother_status = 'benefit'
elif not rec.is_mother_work and rec.mother_country_id.code == 'SA' or (rec.mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'):
elif not rec.is_mother_work and rec.mother_country_id.code == 'SA' or (
rec.mother_country_id.code != 'SA' and rec.father_country_id.code == 'SA'):
rec.mother_status = 'benefit'
#
@ -605,7 +656,7 @@ class GrantBenefitProfile(models.Model):
message = self.create_message('waiting_approve')
self.partner_id.send_sms_notification(message, self.phone)
for rec in self:
exist = self.env["family.member"].search([('member_id_number','=',rec.mother_id_number)],limit=1)
exist = self.env["family.member"].search([('member_id_number', '=', rec.mother_id_number)], limit=1)
if not exist:
rec.add_mother_as_member()
elif exist:
@ -619,27 +670,27 @@ class GrantBenefitProfile(models.Model):
rec.state = "first_approve"
def action_second_accepted(self):
"""Accept registration"""
for rec in self:
if not rec.user_id:
self.create_user()
"""Accept registration"""
for rec in self:
if not rec.user_id:
self.create_user()
rec.user_id.sudo().write({
'groups_id': [(3, self.env.ref('base.group_user', False).id)],
})
rec.user_id.sudo().write({
'groups_id': [(4, self.env.ref('odex_benefit.group_benefit_user', False).id)],
})
rec.user_id.sudo().write({
'groups_id': [(4, self.env.ref('base.group_portal', False).id)],
})
rec.approve_date = datetime.now()
self.sudo().send_approval_benefit_email()
partner_ids = []
for id in self.message_follower_ids.ids:
partner_ids.append(self.env['mail.followers'].search([('id', '=', id)]).partner_id)
self.state = "second_approve"
self.sudo()._send_notification(partner_ids, rec.state)
rec.user_id.sudo().write({
'groups_id': [(3, self.env.ref('base.group_user', False).id)],
})
# rec.user_id.sudo().write({
# 'groups_id': [(4, self.env.ref('odex_benefit.group_benefit_user', False).id)],
# })
rec.user_id.sudo().write({
'groups_id': [(4, self.env.ref('base.group_portal', False).id)],
})
rec.approve_date = datetime.now()
self.sudo().send_approval_benefit_email()
partner_ids = []
for id in self.message_follower_ids.ids:
partner_ids.append(self.env['mail.followers'].search([('id', '=', id)]).partner_id)
self.state = "second_approve"
self.sudo()._send_notification(partner_ids, rec.state)
# @api.multi
def action_first_refusal(self):
@ -722,6 +773,7 @@ class GrantBenefitProfile(models.Model):
def not_alive(self):
self.life = False
self.state = 'not_leaving'
def action_suspend(self):
# for rec in self:
return {
@ -733,22 +785,28 @@ class GrantBenefitProfile(models.Model):
'view_id': self.env.ref('odex_benefit.view_suspend_reason_wizard_form').id,
'target': 'new',
}
# rec.state = 'temporarily_suspended'
# rec.state = 'temporarily_suspended'
def action_suspend_first_accept(self):
for rec in self:
rec.state = 'suspended_first_approve'
def action_suspend_second_accept(self):
for rec in self:
rec.state = 'suspended_second_approve'
def action_auto_suspend(self):
obj = self.env["grant.benefit"].search([('state','=','second_approve'),('is_excluded_suspension','=',False)])
obj = self.env["grant.benefit"].search(
[('state', '=', 'second_approve'), ('is_excluded_suspension', '=', False)])
for rec in obj:
if rec.benefit_member_count == 0 and rec.state == 'second_approve':
rec.state = 'suspended_second_approve'
rec.suspend_method = 'auto'
def action_suspend_refuse(self):
for rec in self:
rec.state = 'second_approve'
# @api.multi
def action_remove_from_black_list(self):
"""Remove entity from black list"""
@ -961,6 +1019,7 @@ class GrantBenefitProfile(models.Model):
rec.total_expenses = total_expenses
else:
self.total_expenses = 0.0
def get_total_income(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
mini_income_for_mother = validation_setting.mini_income_for_mother
@ -972,7 +1031,7 @@ class GrantBenefitProfile(models.Model):
for amount in rec.salary_ids:
rec.total_income += amount.salary_amount
elif rec.mother_status == 'benefit' and not rec.salary_ids:
if rec.mother_income > mini_income_for_mother :
if rec.mother_income > mini_income_for_mother:
rec.total_income = rec.mother_income
else:
rec.total_income = 0.0
@ -987,7 +1046,6 @@ class GrantBenefitProfile(models.Model):
else:
rec.total_income = 0.0
def get_mother_name(self):
for rec in self:
name = ''
@ -996,85 +1054,87 @@ class GrantBenefitProfile(models.Model):
else:
name = name
return name
def add_mother_as_member(self):
for rec in self:
mother_name = rec.get_mother_name()
val ={
'name':mother_name,
'first_name':rec.mother_name,
'second_name':rec.mother_second_name,
'middle_name':rec.mother_third_name,
val = {
'name': mother_name,
'first_name': rec.mother_name,
'second_name': rec.mother_second_name,
'middle_name': rec.mother_third_name,
'family_name': rec.mother_family_name,
'member_id_number':rec.mother_id_number,
'birth_date':rec.mother_birth_date,
'gender':'female',
'relation':'mother',
'mother_marital':rec.mother_marital,
'mother_location':rec.mother_location,
'age':rec.mother_age,
'is_work':rec.is_mother_work,
'member_income':rec.mother_income,
'is_alhaju':rec.is_alhaju,
'is_amra':rec.is_amra,
'education_status':rec.education_status,
'case_study':rec.case_study,
'education_entity':rec.education_entity,
'last_education_entity':rec.last_education_entity,
'entities':rec.entities.id,
'last_entities':rec.last_entities.id,
'education_levels':rec.education_levels.id,
'last_education_levels':rec.last_education_levels.id,
'specialization_ids':rec.specialization_ids.id,
'last_specialization_ids':rec.last_specialization_ids.id,
'classroom':rec.classroom.id,
'last_classroom':rec.last_classroom.id,
'degree':rec.degree.id,
'last_degree':rec.last_degree.id,
'percentage':rec.percentage,
'last_percentage':rec.last_percentage,
'weak_study':rec.weak_study.ids,
'member_status':rec.mother_status
}
self.write({
'member_ids':[(0,0,val)]
})
def replace_mother_as_member(self,id):
for rec in self:
mother_name = rec.get_mother_name()
val ={
'name':mother_name,
'first_name':rec.mother_name,
'second_name':rec.mother_second_name,
'middle_name':rec.mother_third_name,
'family_name': rec.mother_family_name,
'member_id_number':rec.mother_id_number,
'birth_date':rec.mother_birth_date,
'gender':'female',
'relation':'mother',
'member_id_number': rec.mother_id_number,
'birth_date': rec.mother_birth_date,
'gender': 'female',
'relation': 'mother',
'mother_marital': rec.mother_marital,
'mother_location': rec.mother_location,
'age':rec.mother_age,
'is_work':rec.is_mother_work,
'member_income':rec.mother_income,
'is_alhaju':rec.is_alhaju,
'is_amra':rec.is_amra,
'education_status':rec.education_status,
'case_study':rec.case_study,
'education_entity':rec.education_entity,
'last_education_entity':rec.last_education_entity,
'entities':rec.entities.id,
'last_entities':rec.last_entities.id,
'education_levels':rec.education_levels.id,
'last_education_levels':rec.last_education_levels.id,
'specialization_ids':rec.specialization_ids.id,
'last_specialization_ids':rec.last_specialization_ids.id,
'classroom':rec.classroom.id,
'last_classroom':rec.last_classroom.id,
'degree':rec.degree.id,
'last_degree':rec.last_degree.id,
'percentage':rec.percentage,
'last_percentage':rec.last_percentage,
'weak_study':rec.weak_study.ids,
'age': rec.mother_age,
'is_work': rec.is_mother_work,
'member_income': rec.mother_income,
'is_alhaju': rec.is_alhaju,
'is_amra': rec.is_amra,
'education_status': rec.education_status,
'case_study': rec.case_study,
'education_entity': rec.education_entity,
'last_education_entity': rec.last_education_entity,
'entities': rec.entities.id,
'last_entities': rec.last_entities.id,
'education_levels': rec.education_levels.id,
'last_education_levels': rec.last_education_levels.id,
'specialization_ids': rec.specialization_ids.id,
'last_specialization_ids': rec.last_specialization_ids.id,
'classroom': rec.classroom.id,
'last_classroom': rec.last_classroom.id,
'degree': rec.degree.id,
'last_degree': rec.last_degree.id,
'percentage': rec.percentage,
'last_percentage': rec.last_percentage,
'weak_study': rec.weak_study.ids,
'member_status': rec.mother_status
}
self.write({
'member_ids': [(0, 0, val)]
})
def replace_mother_as_member(self, id):
for rec in self:
mother_name = rec.get_mother_name()
val = {
'name': mother_name,
'first_name': rec.mother_name,
'second_name': rec.mother_second_name,
'middle_name': rec.mother_third_name,
'family_name': rec.mother_family_name,
'member_id_number': rec.mother_id_number,
'birth_date': rec.mother_birth_date,
'gender': 'female',
'relation': 'mother',
'mother_marital': rec.mother_marital,
'mother_location': rec.mother_location,
'age': rec.mother_age,
'is_work': rec.is_mother_work,
'member_income': rec.mother_income,
'is_alhaju': rec.is_alhaju,
'is_amra': rec.is_amra,
'education_status': rec.education_status,
'case_study': rec.case_study,
'education_entity': rec.education_entity,
'last_education_entity': rec.last_education_entity,
'entities': rec.entities.id,
'last_entities': rec.last_entities.id,
'education_levels': rec.education_levels.id,
'last_education_levels': rec.last_education_levels.id,
'specialization_ids': rec.specialization_ids.id,
'last_specialization_ids': rec.last_specialization_ids.id,
'classroom': rec.classroom.id,
'last_classroom': rec.last_classroom.id,
'degree': rec.degree.id,
'last_degree': rec.last_degree.id,
'percentage': rec.percentage,
'last_percentage': rec.last_percentage,
'weak_study': rec.weak_study.ids,
'member_status': rec.mother_status
}
membr = self.member_ids.browse(id)
@ -1082,47 +1142,52 @@ class GrantBenefitProfile(models.Model):
self.write({
'member_ids': [(0, 0, val)]
})
def get_members_count(self):
for ben in self:
if ben.id:
ben.benefit_member_count = len(ben.member_ids.filtered(lambda x: x.member_status == 'benefit'))
else:
ben.benefit_member_count = 0.0
def get_non_members_count(self):
for ben in self:
if ben.id:
ben.non_member_count = len(ben.member_ids.filtered(lambda x: x.member_status == 'non_benefit'))
else:
ben.non_member_count = 0.0
@api.depends('total_income','total_expenses','family_debits_ids')
@api.depends('total_income', 'total_expenses', 'family_debits_ids')
def get_member_income(self):
validation_setting = self.env["family.validation.setting"].search([], limit=1)
max_income_for_mother = validation_setting.max_income_for_mother
total = 0
for ben in self:
if ben.mother_income >= max_income_for_mother and ben.family_debits_ids :
if ben.mother_income >= max_income_for_mother and ben.family_debits_ids:
# for loan in ben.family_debits_ids :
# total += loan.loan_remaining
family_income = ben.total_income - ben.total_expenses
elif ben.mother_income >= max_income_for_mother :
family_income = ben.total_income - ben.total_expenses
elif ben.family_debits_ids :
elif ben.mother_income >= max_income_for_mother:
family_income = ben.total_income - ben.total_expenses
elif ben.family_debits_ids:
# for loan in ben.family_debits_ids :
# total += loan.loan_remaining
family_income = ben.total_income - ben.total_expenses
else:
family_income = ben.total_income - ben.total_expenses
if ben.benefit_member_count:
if ben.benefit_member_count > 3 :
if ben.benefit_member_count > 3:
ben.member_income = family_income / ben.benefit_member_count
elif ben.benefit_member_count <=3 :
elif ben.benefit_member_count <= 3:
ben.member_income = family_income / 3
else:
ben.member_income = 0
def get_benefit_category(self):
for rec in self:
if rec.member_income:
result = self.env['benefit.category'].sudo().search([('mini_income_amount', '<=', rec.member_income),('max_income_amount', '>=', rec.member_income)])
result = self.env['benefit.category'].sudo().search(
[('mini_income_amount', '<=', rec.member_income), ('max_income_amount', '>=', rec.member_income)])
rec.benefit_category_id = result.id
else:
rec.benefit_category_id = 1
@ -1182,7 +1247,6 @@ class GrantBenefitProfile(models.Model):
else:
rec.mother_age = 0
def action_finish_edit(self):
for rec in self:
group_e = self.env.ref('odex_benefit.group_benefit_edit', False)
@ -1234,9 +1298,9 @@ class GrantBenefitProfile(models.Model):
user.sudo().write({
'groups_id': [(3, self.env.ref('base.group_user', False).id)],
})
user.sudo().write({
'groups_id': [(4, self.env.ref('odex_benefit.group_benefit_user', False).id)],
})
# user.sudo().write({
# 'groups_id': [(4, self.env.ref('odex_benefit.group_benefit_user', False).id)],
# })
user.sudo().write({
'groups_id': [(4, self.env.ref('base.group_portal', False).id)],
})
@ -1275,6 +1339,7 @@ class GrantBenefitProfile(models.Model):
if not template:
return
template.with_context(lang=self.env.user.lang).send_mail(self.id, force_send=True, raise_exception=False)
# @api.multi
def send_remove_from_black_list_email(self):
"""Send black list email when entity black list"""
@ -1284,7 +1349,7 @@ class GrantBenefitProfile(models.Model):
template.with_context(lang=self.env.user.lang).send_mail(self.id, force_send=True, raise_exception=False)
# Validation Opertaion
@api.onchange('phone', 'phone2','relative_phone','sms_phone')
@api.onchange('phone', 'phone2', 'relative_phone', 'sms_phone')
def _onchange_mobile_validation(self):
if self.phone:
if self.phone.startswith('+966'):
@ -1324,7 +1389,7 @@ class GrantBenefitProfile(models.Model):
raise ValidationError(
_('The Email Already Exist!'))
@api.onchange('mother_marital','mother_location','mother_income')
@api.onchange('mother_marital', 'mother_location', 'mother_income')
def _onchange_mother_info(self):
res = {}
for rec in self:
@ -1355,7 +1420,7 @@ class GrantBenefitProfile(models.Model):
# print("continue")
def create_scheduled_visit(self):
records = self.env["grant.benefit"].search([('state','=','approve')])
records = self.env["grant.benefit"].search([('state', '=', 'approve')])
for rec in records:
self.env['visit.location'].create({
'benefit_id': rec.id,
@ -1367,6 +1432,7 @@ class GrantBenefitProfile(models.Model):
# 'researcher_team': rec.researcher_team.id,
'state': 'draft'
})
def create_manual_visit(self):
self.env['visit.location'].create({
'benefit_id': self.id,
@ -1378,7 +1444,8 @@ class GrantBenefitProfile(models.Model):
# 'researcher_team': rec.researcher_team.id,
'state': 'draft'
})
#Notifications
# Notifications
def send_expiry_date_notification(self):
obj = self.env["grant.benefit"].search([])
for rec in obj:

View File

@ -546,6 +546,7 @@ class ResDistricts(models.Model):
name = fields.Char(string="Name")
branch_id = fields.Many2one("hr.department", string="Branch",domain=[('is_branch','=',True)])
meal_card = fields.Boolean(string='Meal Card')
class VisitsSettings(models.Model):
_name = 'visits.types'

View File

@ -38,6 +38,7 @@ class FamilyMemberProfile(models.Model):
birth_date = fields.Date(string="Birth Date")
age = fields.Integer(string="Age", compute='_compute_get_age_date')
is_work = fields.Boolean('Is Work?')
is_dead = fields.Boolean('Is Dead?')
member_income = fields.Float('Member Income')
is_married = fields.Boolean('Is Married?')
relation = fields.Selection(
@ -131,13 +132,39 @@ class FamilyMemberProfile(models.Model):
('not_leaving', 'Not Leaving'),
('black_list', 'Black List'),
], string='state', default="draft", tracking=True,related="benefit_id.state")
state_a = fields.Selection([
('draft', 'Draft'),
('complete_info', 'Complete Information'),
('waiting_approve', 'Waiting Approved'),
('woman_manager', 'Woman Manager'),
('researcher_team', 'Researcher Team'),
('edit_info', 'Edit Information'),
('first_refusal', 'First Refusal'),
('first_approve', 'First Approved'),
('second_approve', 'Second Approved'),
('refused', 'Refused'),
('temporarily_suspended', 'Temporarily suspended'),
('suspended', 'suspended'),
('suspended_first_approve', 'Suspended First Approved'),
('suspended_second_approve', 'Suspended Second Approved'),
('not_leaving', 'Not Leaving'),
('black_list', 'Black List'),
], string='stateA', default="draft", tracking=True)
member_status = fields.Selection(selection=[
('benefit', 'Benefit'),
('non_benefit', 'Non Benefit'),
], string='Benefit Status', compute="check_member_status",default = False)
suspend_reason = fields.Many2one('suspend.reason', string='Suspend Reason')
reason = fields.Text(string='Reason')
suspend_description = fields.Text(string='Suspend Description')
suspend_attachment = fields.Binary(string='Suspend Attachment', attachment=True)
suspend_type = fields.Selection(
selection=[('temporarily_suspend', 'Temporarily Suspended'), ('suspend', 'Suspend')], string="Suspend Type")
suspend_method = fields.Selection(selection=[('manual', 'Manual'), ('auto', 'Auto')], string="Suspend Method",default='auto')
is_member_workflow = fields.Boolean('Is Member Workflow?')
@api.depends('relation','birth_date', 'is_scientific_specialty', 'is_medical_specialty', 'has_disabilities', 'is_married',
'minor_siblings','member_income','is_married','member_location','education_status','case_study','state')
'minor_siblings','member_income','is_married','member_location','education_status','case_study','state','is_dead')
def check_member_status(self):
for rec in self:
if rec.birth_date:
@ -176,7 +203,7 @@ class FamilyMemberProfile(models.Model):
rec.member_status = 'non_benefit'
if rec.member_location in ['with_relative', 'study_outside_saudi_arabia']:
rec.member_status = 'non_benefit'
if rec.state == 'suspended_second_approve':
if rec.state == 'suspended_second_approve' or rec.is_dead == True:
rec.member_status = 'non_benefit'
elif rec.relation == 'daughter':
if rec.age < female_benefit_age and rec.is_married:
@ -206,7 +233,7 @@ class FamilyMemberProfile(models.Model):
rec.member_status = 'non_benefit'
if rec.member_location in ['with_relative', 'study_outside_saudi_arabia']:
rec.member_status = 'non_benefit'
if rec.state == 'suspended_second_approve':
if rec.state == 'suspended_second_approve' or rec.is_dead == True:
rec.member_status = 'non_benefit'
# General checks for all members
# if rec.is_work:
@ -309,6 +336,36 @@ class FamilyMemberProfile(models.Model):
'message': _('Not Benefit')}
return res
#Member Suspend Manual
def action_suspend(self):
for rec in self :
rec.is_member_workflow = True
return {
'name': _('Suspend Reason Wizard'),
'view_mode': 'form',
'view_type': 'form',
'type': 'ir.actions.act_window',
'res_model': 'suspend.reason.wizard',
'view_id': self.env.ref('odex_benefit.view_suspend_member_reason_wizard_form').id,
'target': 'new',
}
def action_suspend_first_accept(self):
for rec in self:
rec.state_a = 'suspended_first_approve'
def action_suspend_second_accept(self):
for rec in self:
rec.state_a = 'suspended_second_approve'
def action_suspend_refuse(self):
for rec in self:
rec.state_a = 'second_approve'
rec.is_member_workflow = False
# def action_auto_suspend(self):
# obj = self.env["grant.benefit"].search([('state','=','second_approve'),('is_excluded_suspension','=',False)])
# for rec in obj:
# if rec.benefit_member_count == 0 and rec.state == 'second_approve':
# rec.state = 'suspended_second_approve'
# rec.suspend_method = 'auto'
# Methods for Work flow for Member
def complete_data(self):
# message = self.create_message('complete_info')

View File

@ -4,10 +4,18 @@ class HrDepartment(models.Model):
_inherit = 'hr.department'
operation_manager_id = fields.Many2one('hr.employee', string='Operation Manager')
meal_card = fields.Boolean(string='Meal Card')
def name_get(self):
result = []
for department in self:
name = department.name
result.append((department.id, name))
return result
return result
# def name_get(self):
# result = []
# if self.env.context.get('special_display_name', True):
# for department in self:
# name = department.name
# result.append((department.id, name))
# return result
# return super(HrDepartment, self).name_get()

View File

@ -1,91 +1,90 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_benefit_record,access_benefit_record,model_grant_benefit,odex_benefit.group_benefit_user,1,0,1,0
access_benefit_edit_record,access_benefit_edit_record,model_grant_benefit,odex_benefit.group_benefit_edit,1,1,0,0
access_benefit_family_record,access_benefit_family_record,model_benefit_family,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_record_city,access_benefit_record_city,model_res_country_city,odex_benefit.group_benefit_user,1,1,0,0
access_benefit_record_reason,access_benefit_record_reason,model_entity_refuse_reason,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_domestic_labor,access_domestic_labor,model_domestic_labor,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_widow_family,access_widow_family,model_widow_family,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_divorcee_family,access_divorcee_family,model_divorcee_family,odex_benefit.group_benefit_officer,1,1,1,1
access_external_request,access_external_request,model_external_request,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_food_basket,access_benefit_food_basket,model_benefit_food_basket,odex_benefit.group_benefit_officer,1,1,1,1
access_food_basket_line,access_food_basket_line,model_food_basket_line,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_zkat,access_benefit_zkat,model_benefit_zkat,odex_benefit.group_benefit_officer,1,1,1,1
access_payment_collection_line,access_payment_collection_line,model_payment_collection_line,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_food_surplus,access_benefit_food_surplus,model_benefit_food_surplus,odex_benefit.group_benefit_officer,1,1,1,1
access_food_surplus_line,access_food_surplus_line,model_food_surplus_line,odex_benefit.group_benefit_officer,1,1,1,1
access_food_surplus_type,access_food_surplus_type,model_food_surplus_type,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_loans,access_benefit_loans,model_benefit_loans,odex_benefit.group_benefit_officer,1,1,1,1
access_appliances_furniture,access_appliances_furniture,model_appliances_furniture,odex_benefit.group_benefit_officer,1,1,1,1
access_specialization_specialization,access_specialization_specialization,model_specialization_specialization,odex_benefit.group_benefit_officer,1,1,1,1
access_sport_type,access_sport_type,model_sport_type,odex_benefit.group_benefit_officer,1,1,1,1
access_insurance_company,access_insurance_company,model_insurance_company,odex_benefit.group_benefit_officer,1,1,1,1
access_other_associations,access_other_associations,model_other_associations,odex_benefit.group_benefit_officer,1,1,1,1
access_craft_skills,access_craft_skills,model_craft_skills,odex_benefit.group_benefit_officer,1,1,1,1
access_training_inclinations,access_training_inclinations,model_training_inclinations,odex_benefit.group_benefit_officer,1,1,1,1
access_appliances_furniture_need,access_appliances_furniture_need,model_appliances_furniture_need,odex_benefit.group_benefit_officer,1,1,1,1
access_salary_line,access_salary_line,model_salary_line,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_club,access_benefit_club,model_benefit_club,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_programs,access_benefit_programs,model_benefit_programs,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_housing,access_benefit_housing,model_benefit_housing,odex_benefit.group_benefit_user,1,1,0,0
access_benefit_housing,access_benefit_housing,model_benefit_housing,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_housing_rooms,access_benefit_housing_rooms,model_benefit_housing_rooms,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_housing_rooms_items,access_benefit_housing_rooms_items,model_benefit_housing_rooms_items,odex_benefit.group_benefit_officer,1,1,1,1
access_housing_rooms_type,access_housing_rooms_type,model_housing_rooms_type,odex_benefit.group_benefit_user,1,1,1,1
access_rooms_items,access_rooms_items,model_rooms_items,odex_benefit.group_benefit_user,1,1,1,1
access_item_status,access_item_status,model_item_status,odex_benefit.group_benefit_user,1,1,1,1
access_rooms_categories,access_rooms_categories,model_rooms_categories,odex_benefit.group_benefit_user,1,1,1,1
access_housing_rooms_members,access_housing_rooms_members,model_housing_rooms_members,odex_benefit.group_benefit_user,1,1,1,1
access_item_status,access_item_status,model_item_status,odex_benefit.group_benefit_user,1,1,1,1
access_generate_reports,access_generate_reports,model_generate_reports,odex_benefit.group_benefit_user,1,1,1,1
access_food_basket_benefits_line,access_food_basket_benefits_line,model_food_basket_benefits_line,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_record_officer,access_benefit_record_officer,model_grant_benefit,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_family_record_officer,access_benefit_family_record_officer,model_benefit_family,odex_benefit.group_benefit_officer,1,1,1,1
access_benefit_record_city_officer,access_benefit_record_city_officer,model_res_country_city,odex_benefit.group_benefit_officer,1,1,1,1
access_external_benefits,access_external_benefits,model_external_benefits,odex_benefit.group_benefit_user,1,1,1,0
access_benefits_representative,access_benefits_representative,model_benefits_representative,odex_benefit.group_benefit_user,1,1,1,0
access_benefits_needs,access_benefits_needs,model_benefits_needs,odex_benefit.group_benefit_user,1,1,1,0
access_needs_payment_line,access_needs_payment_line,model_needs_payment_line,odex_benefit.group_benefit_user,1,1,1,0
access_needs_categories,access_needs_categories,model_needs_categories,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_need,access_benefit_need,model_benefit_need,odex_benefit.group_benefit_user,1,1,1,0
access_house_need,access_house_need,model_house_need,odex_benefit.group_benefit_user,1,1,1,0
access_generate_reports_log,access_generate_reports_log,model_generate_reports_log,odex_benefit.group_benefit_user,1,1,1,0
access_program_plane_line,access_program_plane_line,model_program_plane_line,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_club_activity,access_benefit_club_activity,model_benefit_club_activity,odex_benefit.group_benefit_user,1,1,1,0
access_receive_benefit_loans,access_receive_benefit_loans,model_receive_benefit_loans,odex_benefit.group_benefit_user,1,1,1,0
access_purchase_product_loan,access_purchase_product_loan,model_purchase_product_loan,odex_benefit.group_benefit_user,1,1,1,0
access_receive_food_surplus,access_receive_food_surplus,model_receive_food_surplus,odex_benefit.group_benefit_user,1,1,1,0
access_receive_appliances_furniture,access_receive_appliances_furniture,model_receive_appliances_furniture,odex_benefit.group_benefit_user,1,1,1,0
access_donations_type,access_donations_type,model_donations_type,odex_benefit.group_benefit_user,1,1,1,0
access_receive_benefit_zkat,access_receive_benefit_zkat,model_receive_benefit_zkat,odex_benefit.group_benefit_user,1,1,1,0
access_zkat_line,access_zkat_line,model_zkat_line,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_zkat_line,access_benefit_zkat_line,model_benefit_zkat_line,odex_benefit.group_benefit_user,1,1,1,0
access_receive_food_basket,access_receive_food_basket,model_receive_food_basket,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_sms_configuration,access_benefit_sms_configuration,model_benefit_sms_configuration,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_category,access_benefit_category,model_benefit_category,odex_benefit.group_benefit_user,1,1,1,1
access_sport_line,access_sport_line,model_sport_line,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_behaviors,access_benefit_behaviors,model_benefit_behaviors,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_behaviors_type,access_benefit_behaviors_type,model_benefit_behaviors_type,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_expenses,access_benefit_expenses,model_benefit_expenses,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_cloth,access_benefit_cloth,model_benefit_cloth,odex_benefit.group_benefit_user,1,1,1,0
access_cloth_type,access_cloth_type,model_cloth_type,odex_benefit.group_benefit_user,1,1,1,0
access_cloth_size,access_cloth_size,model_cloth_size,odex_benefit.group_benefit_user,1,1,1,0
access_expenses_line,access_expenses_line,model_expenses_line,odex_benefit.group_benefit_user,1,1,1,0
access_associations_line,access_associations_line,model_associations_line,odex_benefit.group_benefit_user,1,1,1,0
access_hospital_hospital,access_hospital_hospital,model_hospital_hospital,odex_benefit.group_benefit_user,1,1,1,0
access_insurance_type,access_insurance_type,model_insurance_type,odex_benefit.group_benefit_user,1,1,1,0
access_housing_need,access_housing_need,model_housing_need,odex_benefit.group_benefit_user,1,1,1,0
access_cars_line,access_cars_line,model_cars_line,odex_benefit.group_benefit_user,1,1,1,0
access_training_type,access_training_type,model_training_type,odex_benefit.group_benefit_user,1,1,1,0
access_committees_line,access_committees_line,model_committees_line,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_followers,access_benefit_followers,model_benefit_followers,odex_benefit.group_benefit_user,1,1,1,0
access_benefit_record_city_read,access_benefit_record_city_read,model_res_country_city,odex_benefit.group_benefit_user,1,0,0,0
access_res_districts,access_res_districts,model_res_districts,odex_benefit.group_benefit_user,1,1,1,1
access_benefit_record,access_benefit_record,model_grant_benefit,odex_benefit.group_benefit_researcher,1,1,1,0
access_benefit_edit_record,access_benefit_edit_record,model_grant_benefit,odex_benefit.group_benefit_woman_commitee,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager,1,1,1,1
access_benefit_family_record,access_benefit_family_record,model_benefit_family,,1,1,1,0
access_benefit_record_city,access_benefit_record_city,model_res_country_city,,1,1,0,0
access_benefit_record_reason,access_benefit_record_reason,model_entity_refuse_reason,,1,1,1,0
access_benefit_domestic_labor,access_domestic_labor,model_domestic_labor,,1,1,1,1
access_benefit_widow_family,access_widow_family,model_widow_family,,1,1,1,1
access_benefit_divorcee_family,access_divorcee_family,model_divorcee_family,,1,1,1,1
access_external_request,access_external_request,model_external_request,,1,1,1,1
access_benefit_food_basket,access_benefit_food_basket,model_benefit_food_basket,,1,1,1,1
access_food_basket_line,access_food_basket_line,model_food_basket_line,,1,1,1,1
access_benefit_zkat,access_benefit_zkat,model_benefit_zkat,,1,1,1,1
access_payment_collection_line,access_payment_collection_line,model_payment_collection_line,,1,1,1,1
access_benefit_food_surplus,access_benefit_food_surplus,model_benefit_food_surplus,,1,1,1,1
access_food_surplus_line,access_food_surplus_line,model_food_surplus_line,,1,1,1,1
access_food_surplus_type,access_food_surplus_type,model_food_surplus_type,,1,1,1,1
access_benefit_loans,access_benefit_loans,model_benefit_loans,,1,1,1,1
access_appliances_furniture,access_appliances_furniture,model_appliances_furniture,,1,1,1,1
access_specialization_specialization,access_specialization_specialization,model_specialization_specialization,,1,1,1,1
access_sport_type,access_sport_type,model_sport_type,,1,1,1,1
access_insurance_company,access_insurance_company,model_insurance_company,,1,1,1,1
access_other_associations,access_other_associations,model_other_associations,,1,1,1,1
access_craft_skills,access_craft_skills,model_craft_skills,,1,1,1,1
access_training_inclinations,access_training_inclinations,model_training_inclinations,,1,1,1,1
access_appliances_furniture_need,access_appliances_furniture_need,model_appliances_furniture_need,,1,1,1,1
access_salary_line,access_salary_line,model_salary_line,,1,1,1,1
access_benefit_club,access_benefit_club,model_benefit_club,,1,1,1,1
access_benefit_programs,access_benefit_programs,model_benefit_programs,,1,1,1,1
access_benefit_housing,access_benefit_housing,model_benefit_housing,,1,1,0,0
access_benefit_housing,access_benefit_housing,model_benefit_housing,,1,1,1,1
access_benefit_housing_rooms,access_benefit_housing_rooms,model_benefit_housing_rooms,,1,1,1,1
access_benefit_housing_rooms_items,access_benefit_housing_rooms_items,model_benefit_housing_rooms_items,,1,1,1,1
access_housing_rooms_type,access_housing_rooms_type,model_housing_rooms_type,,1,1,1,1
access_rooms_items,access_rooms_items,model_rooms_items,,1,1,1,1
access_item_status,access_item_status,model_item_status,,1,1,1,1
access_rooms_categories,access_rooms_categories,model_rooms_categories,,1,1,1,1
access_housing_rooms_members,access_housing_rooms_members,model_housing_rooms_members,,1,1,1,1
access_item_status,access_item_status,model_item_status,,1,1,1,1
access_generate_reports,access_generate_reports,model_generate_reports,,1,1,1,1
access_food_basket_benefits_line,access_food_basket_benefits_line,model_food_basket_benefits_line,,1,1,1,1
access_benefit_family_record_officer,access_benefit_family_record_officer,model_benefit_family,,1,1,1,1
access_benefit_record_city_officer,access_benefit_record_city_officer,model_res_country_city,,1,1,1,1
access_external_benefits,access_external_benefits,model_external_benefits,,1,1,1,0
access_benefits_representative,access_benefits_representative,model_benefits_representative,,1,1,1,0
access_benefits_needs,access_benefits_needs,model_benefits_needs,,1,1,1,0
access_needs_payment_line,access_needs_payment_line,model_needs_payment_line,,1,1,1,0
access_needs_categories,access_needs_categories,model_needs_categories,,1,1,1,0
access_benefit_need,access_benefit_need,model_benefit_need,,1,1,1,0
access_house_need,access_house_need,model_house_need,,1,1,1,0
access_generate_reports_log,access_generate_reports_log,model_generate_reports_log,,1,1,1,0
access_program_plane_line,access_program_plane_line,model_program_plane_line,,1,1,1,0
access_benefit_club_activity,access_benefit_club_activity,model_benefit_club_activity,,1,1,1,0
access_receive_benefit_loans,access_receive_benefit_loans,model_receive_benefit_loans,,1,1,1,0
access_purchase_product_loan,access_purchase_product_loan,model_purchase_product_loan,,1,1,1,0
access_receive_food_surplus,access_receive_food_surplus,model_receive_food_surplus,,1,1,1,0
access_receive_appliances_furniture,access_receive_appliances_furniture,model_receive_appliances_furniture,,1,1,1,0
access_donations_type,access_donations_type,model_donations_type,,1,1,1,0
access_receive_benefit_zkat,access_receive_benefit_zkat,model_receive_benefit_zkat,,1,1,1,0
access_zkat_line,access_zkat_line,model_zkat_line,,1,1,1,0
access_benefit_zkat_line,access_benefit_zkat_line,model_benefit_zkat_line,,1,1,1,0
access_receive_food_basket,access_receive_food_basket,model_receive_food_basket,,1,1,1,0
access_benefit_sms_configuration,access_benefit_sms_configuration,model_benefit_sms_configuration,,1,1,1,0
access_benefit_category,access_benefit_category,model_benefit_category,,1,1,1,1
access_sport_line,access_sport_line,model_sport_line,,1,1,1,0
access_benefit_behaviors,access_benefit_behaviors,model_benefit_behaviors,,1,1,1,0
access_benefit_behaviors_type,access_benefit_behaviors_type,model_benefit_behaviors_type,,1,1,1,0
access_benefit_expenses,access_benefit_expenses,model_benefit_expenses,,1,1,1,0
access_benefit_cloth,access_benefit_cloth,model_benefit_cloth,,1,1,1,0
access_cloth_type,access_cloth_type,model_cloth_type,,1,1,1,0
access_cloth_size,access_cloth_size,model_cloth_size,,1,1,1,0
access_expenses_line,access_expenses_line,model_expenses_line,,1,1,1,0
access_associations_line,access_associations_line,model_associations_line,,1,1,1,0
access_hospital_hospital,access_hospital_hospital,model_hospital_hospital,,1,1,1,0
access_insurance_type,access_insurance_type,model_insurance_type,,1,1,1,0
access_housing_need,access_housing_need,model_housing_need,,1,1,1,0
access_cars_line,access_cars_line,model_cars_line,,1,1,1,0
access_training_type,access_training_type,model_training_type,,1,1,1,0
access_committees_line,access_committees_line,model_committees_line,,1,1,1,0
access_benefit_followers,access_benefit_followers,model_benefit_followers,,1,1,1,0
access_benefit_record_city_read,access_benefit_record_city_read,model_res_country_city,,1,0,0,0
access_res_districts,access_res_districts,model_res_districts,,1,1,1,1
access_researcher_member_wizard,access_researcher_member_wizard,model_researcher_member_wizard,,1,1,1,1
access_researcher_family_wizard,access_researcher_family_wizard,model_researcher_family_wizard,,1,1,1,1
access_visit_location,access_visit_location,model_visit_location,odex_benefit.group_benefit_user,1,1,1,1
access_main_service,access_main_service,model_main_service,odex_benefit.group_benefit_user,1,1,1,1
access_visits_types,access_visits_types,model_visits_types,odex_benefit.group_benefit_user,1,1,1,1
access_visit_location,access_visit_location,model_visit_location,,1,1,1,1
access_main_service,access_main_service,model_main_service,,1,1,1,1
access_visits_types,access_visits_types,model_visits_types,,1,1,1,1
access_family_member,access_family_member,model_family_member,,1,1,1,1
access_member_location,access_member_location,model_member_location,,1,1,1,1
access_member_disabilities,access_member_disabilities,model_member_disabilities,,1,1,1,1

1 id id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_benefit_record access_benefit_record,access_benefit_record,model_grant_benefit,odex_benefit.group_benefit_researcher,1,1,1,0 access_benefit_record model_grant_benefit odex_benefit.group_benefit_user 1 0 1 0
3 access_benefit_edit_record access_benefit_edit_record,access_benefit_edit_record,model_grant_benefit,odex_benefit.group_benefit_woman_commitee,odex_benefit.group_benefit_branch_manager,odex_benefit.group_benefit_manager,1,1,1,1 access_benefit_edit_record model_grant_benefit odex_benefit.group_benefit_edit 1 1 0 0
4 access_benefit_family_record access_benefit_family_record,access_benefit_family_record,model_benefit_family,,1,1,1,0 access_benefit_family_record model_benefit_family odex_benefit.group_benefit_user 1 1 1 0
5 access_benefit_record_city access_benefit_record_city,access_benefit_record_city,model_res_country_city,,1,1,0,0 access_benefit_record_city model_res_country_city odex_benefit.group_benefit_user 1 1 0 0
6 access_benefit_record_reason access_benefit_record_reason,access_benefit_record_reason,model_entity_refuse_reason,,1,1,1,0 access_benefit_record_reason model_entity_refuse_reason odex_benefit.group_benefit_user 1 1 1 0
7 access_benefit_domestic_labor access_benefit_domestic_labor,access_domestic_labor,model_domestic_labor,,1,1,1,1 access_domestic_labor model_domestic_labor odex_benefit.group_benefit_officer 1 1 1 1
8 access_benefit_widow_family access_benefit_widow_family,access_widow_family,model_widow_family,,1,1,1,1 access_widow_family model_widow_family odex_benefit.group_benefit_officer 1 1 1 1
9 access_benefit_divorcee_family access_benefit_divorcee_family,access_divorcee_family,model_divorcee_family,,1,1,1,1 access_divorcee_family model_divorcee_family odex_benefit.group_benefit_officer 1 1 1 1
10 access_external_request access_external_request,access_external_request,model_external_request,,1,1,1,1 access_external_request model_external_request odex_benefit.group_benefit_officer 1 1 1 1
11 access_benefit_food_basket access_benefit_food_basket,access_benefit_food_basket,model_benefit_food_basket,,1,1,1,1 access_benefit_food_basket model_benefit_food_basket odex_benefit.group_benefit_officer 1 1 1 1
12 access_food_basket_line access_food_basket_line,access_food_basket_line,model_food_basket_line,,1,1,1,1 access_food_basket_line model_food_basket_line odex_benefit.group_benefit_officer 1 1 1 1
13 access_benefit_zkat access_benefit_zkat,access_benefit_zkat,model_benefit_zkat,,1,1,1,1 access_benefit_zkat model_benefit_zkat odex_benefit.group_benefit_officer 1 1 1 1
14 access_payment_collection_line access_payment_collection_line,access_payment_collection_line,model_payment_collection_line,,1,1,1,1 access_payment_collection_line model_payment_collection_line odex_benefit.group_benefit_officer 1 1 1 1
15 access_benefit_food_surplus access_benefit_food_surplus,access_benefit_food_surplus,model_benefit_food_surplus,,1,1,1,1 access_benefit_food_surplus model_benefit_food_surplus odex_benefit.group_benefit_officer 1 1 1 1
16 access_food_surplus_line access_food_surplus_line,access_food_surplus_line,model_food_surplus_line,,1,1,1,1 access_food_surplus_line model_food_surplus_line odex_benefit.group_benefit_officer 1 1 1 1
17 access_food_surplus_type access_food_surplus_type,access_food_surplus_type,model_food_surplus_type,,1,1,1,1 access_food_surplus_type model_food_surplus_type odex_benefit.group_benefit_officer 1 1 1 1
18 access_benefit_loans access_benefit_loans,access_benefit_loans,model_benefit_loans,,1,1,1,1 access_benefit_loans model_benefit_loans odex_benefit.group_benefit_officer 1 1 1 1
19 access_appliances_furniture access_appliances_furniture,access_appliances_furniture,model_appliances_furniture,,1,1,1,1 access_appliances_furniture model_appliances_furniture odex_benefit.group_benefit_officer 1 1 1 1
20 access_specialization_specialization access_specialization_specialization,access_specialization_specialization,model_specialization_specialization,,1,1,1,1 access_specialization_specialization model_specialization_specialization odex_benefit.group_benefit_officer 1 1 1 1
21 access_sport_type access_sport_type,access_sport_type,model_sport_type,,1,1,1,1 access_sport_type model_sport_type odex_benefit.group_benefit_officer 1 1 1 1
22 access_insurance_company access_insurance_company,access_insurance_company,model_insurance_company,,1,1,1,1 access_insurance_company model_insurance_company odex_benefit.group_benefit_officer 1 1 1 1
23 access_other_associations access_other_associations,access_other_associations,model_other_associations,,1,1,1,1 access_other_associations model_other_associations odex_benefit.group_benefit_officer 1 1 1 1
24 access_craft_skills access_craft_skills,access_craft_skills,model_craft_skills,,1,1,1,1 access_craft_skills model_craft_skills odex_benefit.group_benefit_officer 1 1 1 1
25 access_training_inclinations access_training_inclinations,access_training_inclinations,model_training_inclinations,,1,1,1,1 access_training_inclinations model_training_inclinations odex_benefit.group_benefit_officer 1 1 1 1
26 access_appliances_furniture_need access_appliances_furniture_need,access_appliances_furniture_need,model_appliances_furniture_need,,1,1,1,1 access_appliances_furniture_need model_appliances_furniture_need odex_benefit.group_benefit_officer 1 1 1 1
27 access_salary_line access_salary_line,access_salary_line,model_salary_line,,1,1,1,1 access_salary_line model_salary_line odex_benefit.group_benefit_officer 1 1 1 1
28 access_benefit_club access_benefit_club,access_benefit_club,model_benefit_club,,1,1,1,1 access_benefit_club model_benefit_club odex_benefit.group_benefit_officer 1 1 1 1
29 access_benefit_programs access_benefit_programs,access_benefit_programs,model_benefit_programs,,1,1,1,1 access_benefit_programs model_benefit_programs odex_benefit.group_benefit_officer 1 1 1 1
30 access_benefit_housing access_benefit_housing,access_benefit_housing,model_benefit_housing,,1,1,0,0 access_benefit_housing model_benefit_housing odex_benefit.group_benefit_user 1 1 0 0
31 access_benefit_housing access_benefit_housing,access_benefit_housing,model_benefit_housing,,1,1,1,1 access_benefit_housing model_benefit_housing odex_benefit.group_benefit_officer 1 1 1 1
32 access_benefit_housing_rooms access_benefit_housing_rooms,access_benefit_housing_rooms,model_benefit_housing_rooms,,1,1,1,1 access_benefit_housing_rooms model_benefit_housing_rooms odex_benefit.group_benefit_officer 1 1 1 1
33 access_benefit_housing_rooms_items access_benefit_housing_rooms_items,access_benefit_housing_rooms_items,model_benefit_housing_rooms_items,,1,1,1,1 access_benefit_housing_rooms_items model_benefit_housing_rooms_items odex_benefit.group_benefit_officer 1 1 1 1
34 access_housing_rooms_type access_housing_rooms_type,access_housing_rooms_type,model_housing_rooms_type,,1,1,1,1 access_housing_rooms_type model_housing_rooms_type odex_benefit.group_benefit_user 1 1 1 1
35 access_rooms_items access_rooms_items,access_rooms_items,model_rooms_items,,1,1,1,1 access_rooms_items model_rooms_items odex_benefit.group_benefit_user 1 1 1 1
36 access_item_status access_item_status,access_item_status,model_item_status,,1,1,1,1 access_item_status model_item_status odex_benefit.group_benefit_user 1 1 1 1
37 access_rooms_categories access_rooms_categories,access_rooms_categories,model_rooms_categories,,1,1,1,1 access_rooms_categories model_rooms_categories odex_benefit.group_benefit_user 1 1 1 1
38 access_housing_rooms_members access_housing_rooms_members,access_housing_rooms_members,model_housing_rooms_members,,1,1,1,1 access_housing_rooms_members model_housing_rooms_members odex_benefit.group_benefit_user 1 1 1 1
39 access_item_status access_item_status,access_item_status,model_item_status,,1,1,1,1 access_item_status model_item_status odex_benefit.group_benefit_user 1 1 1 1
40 access_generate_reports access_generate_reports,access_generate_reports,model_generate_reports,,1,1,1,1 access_generate_reports model_generate_reports odex_benefit.group_benefit_user 1 1 1 1
41 access_food_basket_benefits_line access_food_basket_benefits_line,access_food_basket_benefits_line,model_food_basket_benefits_line,,1,1,1,1 access_food_basket_benefits_line model_food_basket_benefits_line odex_benefit.group_benefit_officer 1 1 1 1
42 access_benefit_record_officer access_benefit_family_record_officer,access_benefit_family_record_officer,model_benefit_family,,1,1,1,1 access_benefit_record_officer model_grant_benefit odex_benefit.group_benefit_officer 1 1 1 1
43 access_benefit_family_record_officer access_benefit_record_city_officer,access_benefit_record_city_officer,model_res_country_city,,1,1,1,1 access_benefit_family_record_officer model_benefit_family odex_benefit.group_benefit_officer 1 1 1 1
44 access_benefit_record_city_officer access_external_benefits,access_external_benefits,model_external_benefits,,1,1,1,0 access_benefit_record_city_officer model_res_country_city odex_benefit.group_benefit_officer 1 1 1 1
45 access_external_benefits access_benefits_representative,access_benefits_representative,model_benefits_representative,,1,1,1,0 access_external_benefits model_external_benefits odex_benefit.group_benefit_user 1 1 1 0
46 access_benefits_representative access_benefits_needs,access_benefits_needs,model_benefits_needs,,1,1,1,0 access_benefits_representative model_benefits_representative odex_benefit.group_benefit_user 1 1 1 0
47 access_benefits_needs access_needs_payment_line,access_needs_payment_line,model_needs_payment_line,,1,1,1,0 access_benefits_needs model_benefits_needs odex_benefit.group_benefit_user 1 1 1 0
48 access_needs_payment_line access_needs_categories,access_needs_categories,model_needs_categories,,1,1,1,0 access_needs_payment_line model_needs_payment_line odex_benefit.group_benefit_user 1 1 1 0
49 access_needs_categories access_benefit_need,access_benefit_need,model_benefit_need,,1,1,1,0 access_needs_categories model_needs_categories odex_benefit.group_benefit_user 1 1 1 0
50 access_benefit_need access_house_need,access_house_need,model_house_need,,1,1,1,0 access_benefit_need model_benefit_need odex_benefit.group_benefit_user 1 1 1 0
51 access_house_need access_generate_reports_log,access_generate_reports_log,model_generate_reports_log,,1,1,1,0 access_house_need model_house_need odex_benefit.group_benefit_user 1 1 1 0
52 access_generate_reports_log access_program_plane_line,access_program_plane_line,model_program_plane_line,,1,1,1,0 access_generate_reports_log model_generate_reports_log odex_benefit.group_benefit_user 1 1 1 0
53 access_program_plane_line access_benefit_club_activity,access_benefit_club_activity,model_benefit_club_activity,,1,1,1,0 access_program_plane_line model_program_plane_line odex_benefit.group_benefit_user 1 1 1 0
54 access_benefit_club_activity access_receive_benefit_loans,access_receive_benefit_loans,model_receive_benefit_loans,,1,1,1,0 access_benefit_club_activity model_benefit_club_activity odex_benefit.group_benefit_user 1 1 1 0
55 access_receive_benefit_loans access_purchase_product_loan,access_purchase_product_loan,model_purchase_product_loan,,1,1,1,0 access_receive_benefit_loans model_receive_benefit_loans odex_benefit.group_benefit_user 1 1 1 0
56 access_purchase_product_loan access_receive_food_surplus,access_receive_food_surplus,model_receive_food_surplus,,1,1,1,0 access_purchase_product_loan model_purchase_product_loan odex_benefit.group_benefit_user 1 1 1 0
57 access_receive_food_surplus access_receive_appliances_furniture,access_receive_appliances_furniture,model_receive_appliances_furniture,,1,1,1,0 access_receive_food_surplus model_receive_food_surplus odex_benefit.group_benefit_user 1 1 1 0
58 access_receive_appliances_furniture access_donations_type,access_donations_type,model_donations_type,,1,1,1,0 access_receive_appliances_furniture model_receive_appliances_furniture odex_benefit.group_benefit_user 1 1 1 0
59 access_donations_type access_receive_benefit_zkat,access_receive_benefit_zkat,model_receive_benefit_zkat,,1,1,1,0 access_donations_type model_donations_type odex_benefit.group_benefit_user 1 1 1 0
60 access_receive_benefit_zkat access_zkat_line,access_zkat_line,model_zkat_line,,1,1,1,0 access_receive_benefit_zkat model_receive_benefit_zkat odex_benefit.group_benefit_user 1 1 1 0
61 access_zkat_line access_benefit_zkat_line,access_benefit_zkat_line,model_benefit_zkat_line,,1,1,1,0 access_zkat_line model_zkat_line odex_benefit.group_benefit_user 1 1 1 0
62 access_benefit_zkat_line access_receive_food_basket,access_receive_food_basket,model_receive_food_basket,,1,1,1,0 access_benefit_zkat_line model_benefit_zkat_line odex_benefit.group_benefit_user 1 1 1 0
63 access_receive_food_basket access_benefit_sms_configuration,access_benefit_sms_configuration,model_benefit_sms_configuration,,1,1,1,0 access_receive_food_basket model_receive_food_basket odex_benefit.group_benefit_user 1 1 1 0
64 access_benefit_sms_configuration access_benefit_category,access_benefit_category,model_benefit_category,,1,1,1,1 access_benefit_sms_configuration model_benefit_sms_configuration odex_benefit.group_benefit_user 1 1 1 0
65 access_benefit_category access_sport_line,access_sport_line,model_sport_line,,1,1,1,0 access_benefit_category model_benefit_category odex_benefit.group_benefit_user 1 1 1 1
66 access_sport_line access_benefit_behaviors,access_benefit_behaviors,model_benefit_behaviors,,1,1,1,0 access_sport_line model_sport_line odex_benefit.group_benefit_user 1 1 1 0
67 access_benefit_behaviors access_benefit_behaviors_type,access_benefit_behaviors_type,model_benefit_behaviors_type,,1,1,1,0 access_benefit_behaviors model_benefit_behaviors odex_benefit.group_benefit_user 1 1 1 0
68 access_benefit_behaviors_type access_benefit_expenses,access_benefit_expenses,model_benefit_expenses,,1,1,1,0 access_benefit_behaviors_type model_benefit_behaviors_type odex_benefit.group_benefit_user 1 1 1 0
69 access_benefit_expenses access_benefit_cloth,access_benefit_cloth,model_benefit_cloth,,1,1,1,0 access_benefit_expenses model_benefit_expenses odex_benefit.group_benefit_user 1 1 1 0
70 access_benefit_cloth access_cloth_type,access_cloth_type,model_cloth_type,,1,1,1,0 access_benefit_cloth model_benefit_cloth odex_benefit.group_benefit_user 1 1 1 0
71 access_cloth_type access_cloth_size,access_cloth_size,model_cloth_size,,1,1,1,0 access_cloth_type model_cloth_type odex_benefit.group_benefit_user 1 1 1 0
72 access_cloth_size access_expenses_line,access_expenses_line,model_expenses_line,,1,1,1,0 access_cloth_size model_cloth_size odex_benefit.group_benefit_user 1 1 1 0
73 access_expenses_line access_associations_line,access_associations_line,model_associations_line,,1,1,1,0 access_expenses_line model_expenses_line odex_benefit.group_benefit_user 1 1 1 0
74 access_associations_line access_hospital_hospital,access_hospital_hospital,model_hospital_hospital,,1,1,1,0 access_associations_line model_associations_line odex_benefit.group_benefit_user 1 1 1 0
75 access_hospital_hospital access_insurance_type,access_insurance_type,model_insurance_type,,1,1,1,0 access_hospital_hospital model_hospital_hospital odex_benefit.group_benefit_user 1 1 1 0
76 access_insurance_type access_housing_need,access_housing_need,model_housing_need,,1,1,1,0 access_insurance_type model_insurance_type odex_benefit.group_benefit_user 1 1 1 0
77 access_housing_need access_cars_line,access_cars_line,model_cars_line,,1,1,1,0 access_housing_need model_housing_need odex_benefit.group_benefit_user 1 1 1 0
78 access_cars_line access_training_type,access_training_type,model_training_type,,1,1,1,0 access_cars_line model_cars_line odex_benefit.group_benefit_user 1 1 1 0
79 access_training_type access_committees_line,access_committees_line,model_committees_line,,1,1,1,0 access_training_type model_training_type odex_benefit.group_benefit_user 1 1 1 0
80 access_committees_line access_benefit_followers,access_benefit_followers,model_benefit_followers,,1,1,1,0 access_committees_line model_committees_line odex_benefit.group_benefit_user 1 1 1 0
81 access_benefit_followers access_benefit_record_city_read,access_benefit_record_city_read,model_res_country_city,,1,0,0,0 access_benefit_followers model_benefit_followers odex_benefit.group_benefit_user 1 1 1 0
82 access_benefit_record_city_read access_res_districts,access_res_districts,model_res_districts,,1,1,1,1 access_benefit_record_city_read model_res_country_city odex_benefit.group_benefit_user 1 0 0 0
access_res_districts access_res_districts model_res_districts odex_benefit.group_benefit_user 1 1 1 1
83 access_researcher_member_wizard access_researcher_member_wizard,access_researcher_member_wizard,model_researcher_member_wizard,,1,1,1,1 access_researcher_member_wizard model_researcher_member_wizard 1 1 1 1
84 access_researcher_family_wizard access_researcher_family_wizard,access_researcher_family_wizard,model_researcher_family_wizard,,1,1,1,1 access_researcher_family_wizard model_researcher_family_wizard 1 1 1 1
85 access_visit_location access_visit_location,access_visit_location,model_visit_location,,1,1,1,1 access_visit_location model_visit_location odex_benefit.group_benefit_user 1 1 1 1
86 access_main_service access_main_service,access_main_service,model_main_service,,1,1,1,1 access_main_service model_main_service odex_benefit.group_benefit_user 1 1 1 1
87 access_visits_types access_visits_types,access_visits_types,model_visits_types,,1,1,1,1 access_visits_types model_visits_types odex_benefit.group_benefit_user 1 1 1 1
88 access_family_member access_family_member,access_family_member,model_family_member,,1,1,1,1 access_family_member model_family_member 1 1 1 1
89 access_member_location access_member_location,access_member_location,model_member_location,,1,1,1,1 access_member_location model_member_location 1 1 1 1
90 access_member_disabilities access_member_disabilities,access_member_disabilities,model_member_disabilities,,1,1,1,1 access_member_disabilities model_member_disabilities 1 1 1 1

View File

@ -1,34 +1,34 @@
<odoo>
<data noupdate="1">
<data noupdate="0">
<record model="ir.module.category" id="module_category_benefit">
<field name="name">Beneficiaries Management</field>
<field name="description">Helps you manage Beneficiaries Program</field>
<field name="sequence">1</field>
</record>
<record id="group_benefit_user" model="res.groups">
<field name="name">Beneficiaries User</field>
<field name="category_id" ref="module_category_benefit"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<!-- <field name="implied_ids" eval="[(4, ref('base.group_erp_manager'))]"/>-->
</record>
<!-- <record id="group_benefit_user" model="res.groups">-->
<!-- <field name="name">Beneficiaries User</field>-->
<!-- <field name="category_id" ref="module_category_benefit"/>-->
<!-- <field name="users" eval="[(4, ref('base.user_root'))]"/>-->
<!--&lt;!&ndash; <field name="implied_ids" eval="[(4, ref('base.group_erp_manager'))]"/>&ndash;&gt;-->
<!-- </record>-->
<record id="group_benefit_edit" model="res.groups">
<field name="name">Beneficiaries Edit User</field>
<field name="category_id" ref="module_category_benefit"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<!-- <field name="implied_ids" eval="[(4, ref('base.group_erp_manager'))]"/>-->
</record>
<record id="group_benefit_officer" model="res.groups">
<field name="name">Beneficiaries Officer</field>
<field name="category_id" ref="module_category_benefit"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="implied_ids" eval="[(4, ref('group_benefit_user')),(4, ref('group_benefit_edit'))]"/>
</record>
<!-- <record id="group_benefit_officer" model="res.groups">-->
<!-- <field name="name">Beneficiaries Officer</field>-->
<!-- <field name="category_id" ref="module_category_benefit"/>-->
<!-- <field name="users" eval="[(4, ref('base.user_root'))]"/>-->
<!-- <field name="implied_ids" eval="[(4, ref('group_benefit_user')),(4, ref('group_benefit_edit'))]"/>-->
<!-- </record>-->
<record id="group_benefit_manager" model="res.groups">
<field name="name">Beneficiaries Manager</field>
<field name="category_id" ref="module_category_benefit"/>
<field name="users" eval="[(4, ref('base.user_root'))]"/>
<field name="implied_ids" eval="[(4, ref('group_benefit_officer')),(4, ref('base.group_erp_manager'))]"/>
<field name="implied_ids" eval="[(4, ref('base.group_erp_manager'))]"/>
<field name="comment">the user will be able to approve Beneficiaries requests.</field>
</record>
<record id="group_benefit_researcher" model="res.groups">

View File

@ -660,7 +660,7 @@
action="benefit_reports_log_action"
sequence="2"/>
<menuitem id='benefit_tools' name='Tools' parent='benefits_root_menu'
sequence="8" groups="odex_benefit.group_benefit_user"/>
sequence="8"/>
<!--###########################################################-->
<!--benefit config-->

View File

@ -272,6 +272,7 @@
<group>
<field name="name"/>
<field name="branch_id"/>
<field name="meal_card"/>
</group>
</sheet>
</form>
@ -816,6 +817,7 @@
<tree string="Districts">
<field name="name"/>
<field name="branch_id"/>
<field name="meal_card"/>
</tree>
</field>
</record>

View File

@ -139,12 +139,16 @@
<button icon="fa-users">
<field string="Benefit Members Count" name="benefit_member_count" widget="statinfo"/>
</button>
<button icon="fa-users">
<field string="Non Benfit Members Count" name="non_member_count" widget="statinfo"/>
</button>
<button icon="fa-usd">
<field name="total_expenses" string="Total Expenses" widget="statinfo"/>
</button>
<button icon="fa-usd" name="action_open_related_move_line_records">
<field name="total_move_lines" string="Moves" widget="statinfo"/>
</button>
<button icon="fa-usd">
<field name="total_income" string="Total Income" widget="statinfo"/>
</button>
@ -561,8 +565,12 @@
</form>
</page>
<page string="Family Monthly salary">
<group>
<field name="family_monthly_income"/>
<field name="family_monthly_meals"/>
<field name="family_monthly_clotting"/>
<field name="total_family_expenses"/>
</group>
</page>
<page string="Family Cars">
@ -1076,5 +1084,26 @@
</form>
</field>
</record>
<odoo>
<record id="action_confirm_beneit" model="ir.actions.server">
<field name="name">Create Move</field>
<field name="model_id" ref="model_grant_benefit"/>
<field name="binding_model_id" ref="model_grant_benefit"/>
<field name="state">code</field>
<field name="code">
action = {
'type': 'ir.actions.act_window',
'name': 'Confirm Benefit',
'res_model': 'confirm.benefit.wizard',
'view_mode': 'form',
'view_type': 'form',
'target': 'new',
'context': {'active_ids': context.get('active_ids', [])},
}
</field>
</record>
</odoo>
</data>
</odoo>

View File

@ -8,7 +8,6 @@
<field name="arch" type="xml">
<xpath expr="//field[@name='manager_id']" position="after">
<field name="operation_manager_id"/>
<field name="meal_card"/>
</xpath>
</field>
</record>

View File

@ -6,6 +6,16 @@
<field name="arch" type="xml">
<form string="Family Member">
<header>
<button name="action_suspend" type="object"
string="Temporarily Suspended" class="oe_highlight"
attrs="{'invisible': ['|',('state','not in',['second_approve']),('is_member_workflow','=',True)]}"
confirm="Are you sure you want to move to Temporarily Suspended ?"/>
<button name="action_suspend_first_accept" type="object"
string="First Approve" class="oe_highlight" attrs="{'invisible': [('state_a','not in',['temporarily_suspended'])]}"/>
<button name="action_suspend_second_accept" type="object"
string="Second Approve" class="oe_highlight" attrs="{'invisible': [('state_a','not in',['suspended_first_approve'])]}"/>
<button name="action_suspend_refuse" type="object"
string="Suspend Refuse" class="oe_highlight" attrs="{'invisible': [('state_a','not in',['temporarily_suspended','suspended_first_approve'])]}"/>
<!-- <button name="action_accepted" type="object"-->
<!-- string="Accept" class="oe_highlight"-->
<!-- confirm="Are you sure you want to accept ?"-->
@ -47,9 +57,12 @@
<!-- confirm="Are you sure you want to Stop info edition !"-->
<!-- />-->
<field name="state" widget="statusbar"
statusbar_visible="draft,complete_info,waiting_approve,first_approve,second_approve,first_refusal,refused,temporarily_suspended,suspended"/>
statusbar_visible="draft,complete_info,waiting_approve,first_approve,second_approve,first_refusal,refused,temporarily_suspended" attrs="{'invisible': [('is_member_workflow','=',True)]}"/>
<field name="state_a" widget="statusbar"
statusbar_visible="draft,complete_info,waiting_approve,first_approve,second_approve,first_refusal,refused,temporarily_suspended" attrs="{'invisible': [('is_member_workflow','=',False)]}"/>
</header>
<sheet>
<field name="is_member_workflow" invisible="1"/>
<widget name="web_ribbon" title="Non Benefit Member" bg_color="bg-danger" attrs="{'invisible': ['|',('member_status', '=', False),('member_status', '!=', 'non_benefit')]}"/>
<widget name ="web_ribbon" title="Benefit Member" bg_color="bg-success" attrs="{'invisible': ['|',('member_status', '=', False),('member_status', '!=', 'benefit')]}"/>
<h1>
@ -68,6 +81,7 @@
<field name="middle_name" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}" required="1"/>
<field name="member_id_number" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}" required="1"/>
<!-- <field name="gender" required="1" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>-->
<field name="is_dead" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="member_location" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="is_work" attrs="{'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
<field name="member_income" attrs="{'required':[('is_work','=',True)],'readonly':[('state','not in',['draft','complete_info','edit_info'])]}"/>
@ -167,6 +181,19 @@
</group>
</group>
</page>
<page string="Suspend Reason" attrs="{'invisible': [('state_a', 'not in', ['temporarily_suspended','suspended_first_approve','suspended_second_approve'])]}">
<group>
<group>
<field name="suspend_reason"/>
<field name="suspend_description"/>
</group>
<group>
<field name="suspend_attachment"/>
<field name="suspend_type"/>
<field name="suspend_method" readonly="1" force_save="1"/>
</group>
</group>
</page>
<page string="Attachments">
<field name="attachment_ids" widget="one2many_list">
<tree editable="bottom">

View File

@ -3,4 +3,5 @@ from . import entity_refused_wizard
from . import entity_black_list_wizard
from . import researcher_wizard
from . import suspend_reason_wizard
from . import family_expense_move_wiz

View File

@ -96,40 +96,39 @@ class EntityRefusedReasonWizard(models.TransientModel):
partner_ids = []
for rec in self:
if rec.entity_id:
if self.env.user.has_group('odex_benefit.group_benefit_manager'):
state = "refused"
user = self.env['res.users'].search([('partner_id', '=', rec.entity_id.partner_id.id)], limit=1)
state = "refused"
user = self.env['res.users'].search([('partner_id', '=', rec.entity_id.partner_id.id)], limit=1)
refuse_reason = self.env['entity.refuse_reason'].sudo().create(
{
'name': rec.refused_reason,
'entity_id': rec.entity_id.id,
'user_id': self.env.uid,
}
)
subject = _('Benefit')
state_label = dict(rec.fields_get(allfields=['state'])['state']['selection'])[state]
body = ' '.join(
(
_(u'The Benefit record '), rec.entity_id.name, _(u' State changed to '), state_label,
u'.')).encode(
'utf-8')
partner_ids += [(6, 0, rec.entity_id.message_follower_ids.ids)]
message_vals = {
'subject': subject,
'body': body,
'partner_ids': partner_ids,
refuse_reason = self.env['entity.refuse_reason'].sudo().create(
{
'name': rec.refused_reason,
'entity_id': rec.entity_id.id,
'user_id': self.env.uid,
}
rec.entity_id.message_post(body=body, subject=subject, message_type='email')
# rec.entity_id.sudo().unlink()
if user:
user.sudo().unlink()
# rec.entity_id.partner_id.sudo().unlink()
result = rec.entity_id.sudo().write({
"state": 'refused',
"final_refusal_reason": rec.refused_reason,
})
return result
)
subject = _('Benefit')
state_label = dict(rec.fields_get(allfields=['state'])['state']['selection'])[state]
body = ' '.join(
(
_(u'The Benefit record '), rec.entity_id.name, _(u' State changed to '), state_label,
u'.')).encode(
'utf-8')
partner_ids += [(6, 0, rec.entity_id.message_follower_ids.ids)]
message_vals = {
'subject': subject,
'body': body,
'partner_ids': partner_ids,
}
rec.entity_id.message_post(body=body, subject=subject, message_type='email')
# rec.entity_id.sudo().unlink()
if user:
user.sudo().unlink()
# rec.entity_id.partner_id.sudo().unlink()
result = rec.entity_id.sudo().write({
"state": 'refused',
"final_refusal_reason": rec.refused_reason,
})
return result
# return {
# 'name': _(u'Benefit To Accept'),
# 'view_mode': 'tree,form',

View File

@ -0,0 +1,90 @@
from datetime import date
from odoo import models, fields, _
from odoo.exceptions import UserError
class ConfirmBenefitWizard(models.TransientModel):
_name = 'confirm.benefit.wizard'
_description = 'Confirm Benefit Wizard'
journal_id = fields.Many2one(comodel_name='account.journal', string="Journal", required=True)
payment_method_id = fields.Many2one(comodel_name='account.payment.method', string='Payment Type', required=True)
name = fields.Char(string="Name", default=lambda self: "Family Expense -%s" % date.today())
date = fields.Date(string="Date", default=fields.Date.context_today, required=True)
def action_confirm_selected(self):
active_ids = self.env.context.get('active_ids', [])
benefits = self.env['grant.benefit'].browse(active_ids)
if not all(benefit.state not in ('second_approve', 'temporarily_suspend', 'suspend') for benefit in benefits):
raise UserError(_("All selected benefits should be either state of "
"'second_approve','temporarily_suspend','suspend' state."))
validation_setting = self.env["family.validation.setting"].search([], limit=1)
credit_account_id = self.payment_method_id.payment_account_id.id
if benefits:
lines = []
for benefit in benefits:
lines += self._prepare_entry_lines(benefit, validation_setting, credit_account_id)
self.create_entry(self.journal_id.id, lines)
return {'type': 'ir.actions.act_window_close'}
def _prepare_entry_lines(self, benefit, validation_setting, credit_account_id):
"""Prepare debit and credit lines for a benefit"""
entry_lines = []
expense_types = [
('meal', 'family_monthly_meals', validation_setting.meal_expense_account_id.id),
('cash', 'family_monthly_income', validation_setting.cash_expense_account_id.id),
('clothing', 'family_monthly_clotting', validation_setting.clothing_expense_account_id.id),
]
for expense_type, field, debit_account_id in expense_types:
amount = getattr(benefit, field, 0.0)
if benefit.district_id.meal_card and expense_type == 'meal':
continue
if amount:
name = _("Family Expense - %s") % expense_type
entry_lines.append(self._create_debit_line(benefit, debit_account_id, amount, name))
entry_lines.append(self._create_credit_line(benefit, credit_account_id, amount, name))
return entry_lines
def _create_debit_line(self, benefit, account_id, amount, name):
"""Create a debit line"""
return (0, 0, {
'name': name,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'account_id': account_id,
'debit': amount,
'credit': 0.0,
})
def _create_credit_line(self, benefit, account_id, amount, name):
"""Create a credit line"""
return (0, 0, {
'name': name,
'benefit_family_id': benefit.id,
'partner_id': benefit.partner_id.id,
'analytic_account_id': benefit.branch_id.analytic_account_id.id,
'account_id': account_id,
'debit': 0.0,
'credit': amount,
})
def create_entry(self, journal_id, lines):
"""Create an account move entry"""
move_vals = {
'journal_id': journal_id,
'date': self.date,
'ref': self.name,
'line_ids': lines,
}
self.env['account.move'].create(move_vals)
return True

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record id="view_confirm_benefit_wizard_form" model="ir.ui.view">
<field name="name">confirm.benefit.wizard.form</field>
<field name="model">confirm.benefit.wizard</field>
<field name="arch" type="xml">
<form string="Confirm Benefit">
<group>
<field name="journal_id" required="1"/>
<field name="payment_method_id" required="1"/>
<field name="name" readonly="1"/>
<field name="date" required="1"/>
</group>
<footer>
<button string="Confirm" type="object" name="action_confirm_selected" class="oe_highlight"/>
<button string="Cancel" class="btn-default" special="cancel"/>
</footer>
</form>
</field>
</record>
</odoo>

View File

@ -33,7 +33,7 @@
<!-- <field name="selector"/>-->
<field name="benefit_id" invisible="1"/>
<!-- <field name="researcher_id" attrs="{'invisible':[('selector','=','researcher_team')]}"/>-->
<field name="researcher_team"/>
<field name="researcher_team" required="1"/>
</group>
<footer>
<button name="submit_family" type="object" string="Submit" class="oe_highlight" attrs="{'invisible':[('benefit_id','=',False)]}"/>

View File

@ -9,12 +9,18 @@ class SuspendReasonWizard(models.TransientModel):
_description = "Suspend Reason Wizard"
def _default_entity(self):
return self._context.get('active_id')
if self._context.get('active_model') == 'grant.benefit':
return self._context.get('active_id')
def _default_member(self):
if self._context.get('active_model') == 'family.member':
return self._context.get('active_id')
def _default_state(self):
return self._context.get('state')
entity_id = fields.Many2one("grant.benefit", string="Entity", default=_default_entity)
member_id = fields.Many2one("family.member", string="Member", default=_default_member)
suspend_reason = fields.Many2one('suspend.reason',string='Suspend Reason')
suspend_description = fields.Text(string='Suspend Description')
suspend_attachment = fields.Binary(string='Suspend Attachment',attachment = True)
@ -28,3 +34,12 @@ class SuspendReasonWizard(models.TransientModel):
rec.entity_id.suspend_type = rec.suspend_type
rec.entity_id.suspend_attachment = rec.suspend_attachment
rec.entity_id.suspend_method = 'manual'
def action_member_submit(self):
for rec in self:
rec.member_id.state_a = 'temporarily_suspended'
rec.member_id.suspend_reason = rec.suspend_reason
rec.member_id.suspend_description = rec.suspend_description
rec.member_id.suspend_type = rec.suspend_type
rec.member_id.suspend_attachment = rec.suspend_attachment
rec.member_id.suspend_method = 'manual'

View File

@ -27,5 +27,31 @@
</field>
</record>
<record id="view_suspend_member_reason_wizard_form" model="ir.ui.view">
<field name="name">suspend.reason.wizard.form</field>
<field name="model">suspend.reason.wizard</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<group>
<field name="suspend_reason"/>
<field name="suspend_description"/>
</group>
<group>
<field name="suspend_type"/>
<field name="suspend_attachment"/>
</group>
</group>
<footer>
<button name="action_member_submit" type="object" string="Submit" class="oe_highlight"/>
or
<button special="cancel" string="Cancel"/>
</footer>
</sheet>
</form>
</field>
</record>
</data>
</odoo>