diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..f522c0579
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,127 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+.history
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+parts/
+sdist/
+wheels/
+pip-wheel-metadata/
+share/python-wheels/
+*.egg-info/
+.installed.cfg
+*.egg
+MANIFEST
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.nox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*.cover
+*.py,cover
+.hypothesis/
+.pytest_cache/
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+local_settings.py
+db.sqlite3
+db.sqlite3-journal
+
+# Flask stuff:
+instance/
+.webassets-cache
+
+# Scrapy stuff:
+.scrapy
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# Jupyter Notebook
+.ipynb_checkpoints
+
+# IPython
+profile_default/
+ipython_config.py
+
+# pyenv
+.python-version
+
+# pipenv
+# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
+# However, in case of collaboration, if having platform-specific dependencies or dependencies
+# having no cross-platform support, pipenv may install dependencies that don't work, or not
+# install all needed dependencies.
+#Pipfile.lock
+
+# PEP 582; used by e.g. github.com/David-OConnor/pyflow
+__pypackages__/
+
+# Celery stuff
+celerybeat-schedule
+celerybeat.pid
+
+# SageMath parsed files
+*.sage.py
+
+# Environments
+.env
+.venv
+env/
+venv/
+ENV/
+env.bak/
+venv.bak/
+
+# Spyder project settings
+.spyderproject
+.spyproject
+
+# Rope project settings
+.ropeproject
+
+# mypy
+.mypy_cache/
+.dmypy.json
+dmypy.json
+
+# Pyre type checker
+.pyre/
+
+# github action
+.github/workflows/*yaml
diff --git a/odex25_ensan/odex_benefit/i18n/ar_001.po b/odex25_ensan/odex_benefit/i18n/ar_001.po
index c25d178e5..b5e7c3536 100644
--- a/odex25_ensan/odex_benefit/i18n/ar_001.po
+++ b/odex25_ensan/odex_benefit/i18n/ar_001.po
@@ -4794,10 +4794,14 @@ msgid "Expenses"
msgstr "الالتزامات"
#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_electrical_devices__account_id
+#: model:ir.model.fields,field_description:odex_benefit.field_family_validation_setting__account_id
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__account_id
+#: model:ir.model.fields,field_description:odex_benefit.field_service_request__device_account_id
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__account_id
+#: model:ir.model.fields,field_description:odex_benefit.field_transportation_insurance__account_id
msgid "Expenses Account"
-msgstr ""
+msgstr "حساب المصروف"
#. module: odex_benefit
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__expenses_request_ids
@@ -13821,3 +13825,42 @@ msgstr "اعتماد خدمات المستفيدين"
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__exception_or_steal_attach
msgid "Exception or steal Attachment"
msgstr "مرفق إثبات حالات الاستثناء"
+#: model:ir.model.fields,field_description:odex_benefit.field_service_request__service_reason_id
+msgid "Service Reason"
+msgstr "سبب الخدمة"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_service_request__max_amount
+msgid "Max Transportation Amount"
+msgstr "الحد الأعلى للنقل"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__transportation_insurance_ids
+#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__service_type__transportation_insurance
+msgid "Transportation Insurance"
+msgstr "تأمين مواصلات"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_electrical_devices__price_unit
+msgid "Price Unit"
+msgstr "سعر الوحدة"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_transportation_insurance__name
+msgid "Insurance Name"
+msgstr "اسم التأمين"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_transportation_insurance__limit_amount
+msgid "Limit Amount"
+msgstr "الحد الأعلى للمبلغ"
+
+#. module: odex_benefit
+#: model_terms:ir.ui.view,arch_db:odex_benefit.service_request_tree
+msgid "Request Creator"
+msgstr "منشئ الطلب"
+
+#. module: odex_benefit
+#: model:ir.model.fields,field_description:odex_benefit.field_service_request__requests_counts
+msgid "Requests Counts"
+msgstr "عدد الطلبات"
diff --git a/odex25_ensan/odex_benefit/models/service_request.py b/odex25_ensan/odex_benefit/models/service_request.py
index d472be59e..9be3295c1 100644
--- a/odex25_ensan/odex_benefit/models/service_request.py
+++ b/odex25_ensan/odex_benefit/models/service_request.py
@@ -67,7 +67,11 @@ class ServiceRequest(models.Model):
'attachment_id', string='Rent Attachment')
added_amount_if_mother_dead = fields.Float(string="Added Amount (If mother dead)",compute="_get_added_amount_if_mother_dead")
attachment_lines = fields.One2many('service.attachments.settings','service_request_id',related='service_cat.attachment_lines',readonly=False)
- account_id = fields.Many2one('account.account',string='Expenses Account',related='service_cat.account_id')
+ account_id = fields.Many2one(
+ 'account.account',
+ string='Expenses Account',
+ compute="_compute_account_id"
+ )
device_account_id = fields.Many2one('account.account',string='Expenses Account',related='device_id.account_id')
accountant_id = fields.Many2one('res.users',string='Accountant',related='service_cat.accountant_id',readonly=False)
service_producer_id = fields.Many2one('res.partner',string='Service Producer',related='service_cat.service_producer_id')
@@ -102,16 +106,18 @@ class ServiceRequest(models.Model):
max_electricity_bill_amount = fields.Float(string='Max Electricity Bill Amount')
max_water_bill_amount = fields.Float(string='Max Water Bill Amount')
#Transportation insurance
- service_reason = fields.Selection(selection=[
- ('government_transportation', 'Government Transportation'),
- ('universities_training_institutes_transportation', 'Universities Training Institutes Transportation'),
- ('hospitals_transportation', 'Hospitals Transportation'),
- ('programs_transportation', 'Programs Transportation'),
- ], string='Service Reason')
- max_government_transportation_amount = fields.Float(string='Max Government Transportation Amount')
- max_universities_training_institutes_transportation_amount = fields.Float(string='Max Universities Training Institutes Transportation Amount')
- max_hospitals_transportation_amount = fields.Float(string='Max Hospitals Transportation Amount')
- max_programs_transportation_amount = fields.Float(string='Max Programs Transportation Amount')
+ # service_reason = fields.Selection(selection=[
+ # ('government_transportation', 'Government Transportation'),
+ # ('universities_training_institutes_transportation', 'Universities Training Institutes Transportation'),
+ # ('hospitals_transportation', 'Hospitals Transportation'),
+ # ('programs_transportation', 'Programs Transportation'),
+ # ], string='Service Reason')
+ service_reason_id = fields.Many2one('transportation.insurance')
+ # max_government_transportation_amount = fields.Float(string='Max Government Transportation Amount')
+ # max_universities_training_institutes_transportation_amount = fields.Float(string='Max Universities Training Institutes Transportation Amount')
+ # max_hospitals_transportation_amount = fields.Float(string='Max Hospitals Transportation Amount')
+ # max_programs_transportation_amount = fields.Float(string='Max Programs Transportation Amount')
+ max_amount = fields.Float(string='Max Transportation Amount')
requests_counts = fields.Integer(string='Requests Counts',default = 1)
# Marriage
member_age = fields.Integer(string="Member Age", related="member_id.age")
@@ -144,6 +150,22 @@ class ServiceRequest(models.Model):
return_reason = fields.Text(string="Reason for Returning the Request")
specialist_note = fields.Text(string="Specialist's Note After Return")
+
+
+ @api.depends('service_cat', 'service_reason_id')
+ def _compute_account_id(self):
+ for rec in self:
+ if rec.service_type == 'transportation_insurance':
+ rec.account_id = rec.service_reason_id.account_id
+ else:
+ rec.account_id = rec.service_cat.account_id
+
+ @api.onchange('service_cat', 'device_id')
+ def _calculate_electrical_type_values(self):
+ for rec in self:
+ if rec.service_type == 'electrical_devices':
+ rec.requested_service_amount = rec.device_id.price_unit if rec.device_id else 0.0
+
@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_accountant_accept")\
@@ -357,13 +379,15 @@ class ServiceRequest(models.Model):
rec.eid_gift_benefit_count = 0
if rec.family_id:
rec.eid_gift_benefit_count = len(rec.family_id.member_ids.filtered(lambda x: x.age <= rec.service_cat.member_max_age))
- @api.onchange('requests_counts','service_type')
+ @api.onchange('requests_counts', 'service_type', 'service_reason_id')
def _get_max_transportation_amounts(self):
for rec in self:
- rec.max_government_transportation_amount = rec.requests_counts * rec.service_cat.max_government_transportation_amount
- rec.max_universities_training_institutes_transportation_amount = rec.requests_counts * rec.service_cat.max_universities_training_institutes_transportation_amount
- rec.max_hospitals_transportation_amount = rec.requests_counts * rec.service_cat.max_hospitals_transportation_amount
- rec.max_programs_transportation_amount = rec.requests_counts * rec.service_cat.max_programs_transportation_amount
+ # rec.max_government_transportation_amount = rec.requests_counts * rec.service_cat.max_government_transportation_amount
+ # rec.max_universities_training_institutes_transportation_amount = rec.requests_counts * rec.service_cat.max_universities_training_institutes_transportation_amount
+ # rec.max_hospitals_transportation_amount = rec.requests_counts * rec.service_cat.max_hospitals_transportation_amount
+ # rec.max_programs_transportation_amount = rec.requests_counts * rec.service_cat.max_programs_transportation_amount
+ rec.max_amount = rec.requests_counts * rec.service_reason_id.limit_amount
+
@api.depends('service_cat','family_id')
def _get_amount_for_buy_home(self):
for rec in self:
@@ -482,7 +506,18 @@ class ServiceRequest(models.Model):
self.max_electricity_bill_amount = electricity_bill_amount.max_amount_for_electricity_bill
self.max_water_bill_amount = water_bill_amount.max_amount_for_water_bill
- @api.onchange('requested_service_amount', 'benefit_type', 'date','service_cat','family_id','exception_or_steal','home_furnishing_exception','has_marriage_course','home_age')
+ @api.onchange(
+ 'requested_service_amount',
+ 'benefit_type',
+ 'date',
+ 'service_cat',
+ 'family_id',
+ 'exception_or_steal',
+ 'home_furnishing_exception',
+ 'has_marriage_course',
+ 'home_age',
+ 'service_reason_id'
+ )
def onchange_requested_service_amount(self):
res = {}
today = fields.Date.today()
@@ -695,33 +730,12 @@ class ServiceRequest(models.Model):
return res
# Validation for 'family' benefit type with 'transportation_insurance' service type
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'transportation_insurance':
- if rec.service_reason == 'government_transportation':
- if rec.requested_service_amount > rec.max_government_transportation_amount:
+ if rec.service_reason_id and rec.requested_service_amount > rec.max_amount:
self.benefit_type = False
- res['warning'] = {'title': _('ValidationError'),
- 'message': _(
- "You cannot request more than %s") % rec.max_government_transportation_amount}
- return res
- if rec.service_reason == 'universities_training_institutes_transportation':
- if rec.requested_service_amount > rec.max_universities_training_institutes_transportation_amount:
- self.benefit_type = False
- res['warning'] = {'title': _('ValidationError'),
- 'message': _(
- "You cannot request more than %s") % rec.max_universities_training_institutes_transportation_amount}
- return res
- if rec.service_reason == 'hospitals_transportation':
- if rec.requested_service_amount > rec.max_hospitals_transportation_amount:
- self.benefit_type = False
- res['warning'] = {'title': _('ValidationError'),
- 'message': _(
- "You cannot request more than %s") % rec.max_hospitals_transportation_amount}
- return res
- if rec.service_reason == 'programs_transportation':
- if rec.requested_service_amount > rec.max_programs_transportation_amount:
- self.benefit_type = False
- res['warning'] = {'title': _('ValidationError'),
- 'message': _(
- "You cannot request more than %s") % rec.max_hospitals_transportation_amount}
+ res['warning'] = {
+ 'title': _('ValidationError'),
+ 'message': _("You cannot request more than %s") % rec.max_amount
+ }
return res
# Validation for 'family' benefit type with 'recruiting_driver' service type
if rec.benefit_type == 'family' and rec.service_cat.service_type == 'debits':
diff --git a/odex25_ensan/odex_benefit/models/services_settings.py b/odex25_ensan/odex_benefit/models/services_settings.py
index 6d712e333..a4d1d501d 100644
--- a/odex25_ensan/odex_benefit/models/services_settings.py
+++ b/odex25_ensan/odex_benefit/models/services_settings.py
@@ -51,10 +51,7 @@ class ServicesSettings(models.Model):
#Recruiting_driver
max_recruiting_driver_amount = fields.Float(string='Max Buy Car Amount')
#Transportation insurance
- max_government_transportation_amount = fields.Float(string='Max Government Transportation Amount')
- max_universities_training_institutes_transportation_amount = fields.Float(string='Max Universities Training Institutes Transportation Amount')
- max_hospitals_transportation_amount = fields.Float(string='Max Hospitals Transportation Amount')
- max_programs_transportation_amount = fields.Float(string='Max Programs Transportation Amount')
+ transportation_insurance_ids = fields.One2many('transportation.insurance', 'services_settings_id')
#Debits
max_debits_amount = fields.Float(string='Max Debits Amount')
#Health_care
@@ -117,6 +114,7 @@ class ElectricalDevices(models.Model):
allowed_quantity = fields.Integer(string='Allowed Quantity')
account_id = fields.Many2one('account.account',string='Expenses Account',domain="[('user_type_id.id','=',15)]")
services_settings_id = fields.Many2one('services.settings')
+ price_unit = fields.Float()
class HomeFurnishingLines(models.Model):
_name = 'home.furnishing.lines'
@@ -151,3 +149,15 @@ class BuyHomeLines(models.Model):
amount_for_buy_home = fields.Float(string='Amount For Buy Home')
services_settings_id = fields.Many2one('services.settings', string='Services Settings')
+class TransportationInsurance(models.Model):
+ _name = 'transportation.insurance'
+
+ services_settings_id = fields.Many2one('services.settings')
+ name = fields.Char(string="Insurance Name", required=True)
+ limit_amount = fields.Float(required=True)
+ account_id = fields.Many2one(
+ 'account.account',
+ string='Expenses Account',
+ domain="[('user_type_id.id', '=', 15)]",
+ required=True
+ )
diff --git a/odex25_ensan/odex_benefit/security/ir.model.access.csv b/odex25_ensan/odex_benefit/security/ir.model.access.csv
index 2eb918592..158acd99d 100644
--- a/odex25_ensan/odex_benefit/security/ir.model.access.csv
+++ b/odex25_ensan/odex_benefit/security/ir.model.access.csv
@@ -142,4 +142,5 @@ access_buy_home_lines,access_buy_home_lines,model_buy_home_lines,base.group_user
access_location_settings,access_location_settings,model_location_settings,base.group_user,1,1,1,1
access_service_refuse_reason,access_service_refuse_reason,model_service_refuse_reason,base.group_user,1,1,1,1
access_service_refuse_reason_wizard,access_service_refuse_reason_wizard,model_service_refuse_reason_wizard,base.group_user,1,1,1,1
-access_reason_for_return_wizard,access_reason_for_return_wizard,model_reason_for_return_wizard,base.group_user,1,1,1,1
\ No newline at end of file
+access_reason_for_return_wizard,access_reason_for_return_wizard,model_reason_for_return_wizard,base.group_user,1,1,1,1
+access_transportation_insurance,access_transportation_insurance,model_transportation_insurance,base.group_user,1,1,1,1
diff --git a/odex25_ensan/odex_benefit/security/security_view.xml b/odex25_ensan/odex_benefit/security/security_view.xml
index d09dd548f..04bede50f 100644
--- a/odex25_ensan/odex_benefit/security/security_view.xml
+++ b/odex25_ensan/odex_benefit/security/security_view.xml
@@ -82,5 +82,30 @@
Accept income and expenses
+
+
+ Show Service Requests That Own
+
+
+ [
+ '|',
+ ('create_uid','=',user.id),
+ ('family_id.researcher_id.employee_id', '=', user.employee_id.id)
+ ]
+
+
+
+
+ Show Service Requests That Own
+
+
+ [
+ '|',
+ ('family_id.branch_custom_id.branch.manager_id', '=', user.employee_id.id),
+ ('family_id.branch_custom_id.branch.operation_manager_id', '=', user.employee_id.id)
+ ]
+
+
+
diff --git a/odex25_ensan/odex_benefit/views/service_request.xml b/odex25_ensan/odex_benefit/views/service_request.xml
index 1b3570fce..53b31e208 100644
--- a/odex25_ensan/odex_benefit/views/service_request.xml
+++ b/odex25_ensan/odex_benefit/views/service_request.xml
@@ -74,15 +74,13 @@
-
+
@@ -228,11 +226,8 @@
-
-
-
-
-
+
+
@@ -258,8 +253,10 @@
+
+
-
+
diff --git a/odex25_ensan/odex_benefit/views/services_settings.xml b/odex25_ensan/odex_benefit/views/services_settings.xml
index 3991481fd..216d3c60d 100644
--- a/odex25_ensan/odex_benefit/views/services_settings.xml
+++ b/odex25_ensan/odex_benefit/views/services_settings.xml
@@ -11,7 +11,11 @@
-
+
@@ -90,6 +94,7 @@
+
@@ -144,10 +149,13 @@
-
-
-
-
+
+
+
+
+
+
+