[IMP] odex_benefit: Updates to Service Configuration and Request
This commit is contained in:
parent
8be2f0dfb4
commit
5e80198d69
|
|
@ -16340,11 +16340,6 @@ msgstr "الحد الأقصى لعدد الأفراد"
|
|||
msgid "Amount For Buy Home for member count"
|
||||
msgstr "القيمة الإجمالية للمنزل"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__max_health_care_amount
|
||||
msgid "Max Health Care Amount In Year"
|
||||
msgstr "حقل الحد الأقصى للخدمة في العام"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__member_max_payroll
|
||||
msgid "Member Max Payroll"
|
||||
|
|
@ -16631,6 +16626,62 @@ msgid ""
|
|||
"one year."
|
||||
msgstr "لا يمكنك طلب هذه الخدمة لأن تاريخ عقد الزواج يتجاوز سنة واحدة."
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__max_limit_period__request
|
||||
msgid "Per Request"
|
||||
msgstr "للطلب"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__max_limit_period__individual
|
||||
msgid "Per Individual"
|
||||
msgstr "للفرد"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__max_limit_period__month
|
||||
msgid "Per Month"
|
||||
msgstr "للشهر"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__max_limit_period__year
|
||||
msgid "Per Year"
|
||||
msgstr "للسنة"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__services_settings__max_limit_period__recurrence_period
|
||||
msgid "For Allowed Recurrence Period"
|
||||
msgstr "لفترة التكرار المسموح"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__max_months_limit
|
||||
msgid "Maximum Number of Months"
|
||||
msgstr "أقصى عدد للشهور"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__max_limit_period
|
||||
#: model:ir.model.fields,field_description:odex_benefit.field_services_settings__max_limit_period
|
||||
msgid "Maximum Limit Period"
|
||||
msgstr "فترة الحد الأقصى"
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/service_request.py:0
|
||||
#, python-format
|
||||
msgid "Start date must be before end date."
|
||||
msgstr "يجب أن يكون تاريخ البداية قبل تاريخ النهاية."
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/service_request.py:0
|
||||
#, python-format
|
||||
msgid "You cannot request this service for more than %s months."
|
||||
msgstr "لا يمكنك طلب هذه الخدمة لأكثر من %s شهرًا."
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/service_request.py:0
|
||||
#, python-format
|
||||
msgid ""
|
||||
"This service request overlaps with an existing requests [%s] for the same "
|
||||
"service between %s and %s."
|
||||
msgstr "يتداخل هذا الطلب مع طلبات أخرى لنفس الخدمة [%s] خلال الفترة من %s إلى %s."
|
||||
|
||||
#. module: odex_benefit
|
||||
#: code:addons/odex_benefit/models/service_request.py:0
|
||||
#, python-format
|
||||
|
|
|
|||
|
|
@ -31,6 +31,7 @@ class ServiceRequest(models.Model):
|
|||
estimated_rent_amount_payment = fields.Float(string="Estimated Rent Amount Payment",compute="_get_estimated_rent_amount_payment")
|
||||
paid_rent_amount = fields.Float(string="Paid Rent Amount",compute="_get_paid_rent_amount")
|
||||
service_type = fields.Selection([('rent', 'Rent')],string='Service Type',related='service_cat.service_type')
|
||||
max_limit_period = fields.Selection(string='Maximum Limit Period',related='service_cat.max_limit_period')
|
||||
# is_alternative_housing = fields.Boolean(string='Is Alternative Housing?')
|
||||
rent_contract_number = fields.Char(string="Rent Contract Number",compute='_compute_rent_details',store=True)
|
||||
rent_start_date = fields.Date(string='Rent Start Date',compute='_compute_rent_details',store=True)
|
||||
|
|
@ -571,7 +572,8 @@ class ServiceRequest(models.Model):
|
|||
'device_id',
|
||||
'requested_quantity',
|
||||
'amount_for_buy_home_for_member_count',
|
||||
'marriage_contract_date'
|
||||
'marriage_contract_date',
|
||||
'start','end'
|
||||
)
|
||||
def onchange_requested_service_amount(self):
|
||||
res = {}
|
||||
|
|
@ -660,6 +662,22 @@ class ServiceRequest(models.Model):
|
|||
raise ValidationError(
|
||||
_("You cannot request this service Again Because the home Age More than %s") % rec.service_cat.home_age)
|
||||
|
||||
if rec.start and rec.end:
|
||||
if rec.start > rec.end:
|
||||
raise ValidationError(_("Start date must be before end date."))
|
||||
overlap_domain = base_domain + [
|
||||
('start', '!=', False),
|
||||
('end', '!=', False),
|
||||
('start', '<=', rec.end),
|
||||
('end', '>=', rec.start)
|
||||
]
|
||||
overlap_requests = Service.search(overlap_domain)
|
||||
if overlap_requests:
|
||||
raise ValidationError(
|
||||
_("This service request overlaps with an existing requests [%s] for the same service "
|
||||
"between %s and %s.") % (", ".join(overlap_requests.mapped('name')),rec.start, rec.end)
|
||||
)
|
||||
|
||||
if allowed:
|
||||
if allowed == 'unlimited':
|
||||
pass
|
||||
|
|
@ -743,16 +761,30 @@ class ServiceRequest(models.Model):
|
|||
rec.service_max_amount = rec.service_cat.limit_person_line_ids and max(rec.service_cat.limit_person_line_ids.filtered(
|
||||
lambda x: x.min_count_member <= rec.benefit_member_count <= x.max_count_member)).amount or 0
|
||||
|
||||
if rec.max_limit_period:
|
||||
if rec.max_limit_period == "month":
|
||||
num_months = (rec.end.year - rec.start.year) * 12 + (rec.end.month - rec.start.month) + 1
|
||||
if num_months > rec.service_cat.max_months_limit:
|
||||
raise ValidationError(
|
||||
_("You cannot request this service for more than %s months.") % rec.service_cat.max_months_limit
|
||||
)
|
||||
rec.service_max_amount *= num_months
|
||||
elif rec.max_limit_period == "year":
|
||||
before_year_domain = base_domain + [('date', '>', date_before_year)]
|
||||
existing_requests_within_year = Service.search(before_year_domain)
|
||||
total_spent = sum(existing_requests_within_year.mapped('requested_service_amount'))
|
||||
rec.service_max_amount = rec.service_cat.max_amount - total_spent
|
||||
elif rec.max_limit_period == "individual":
|
||||
if rec.benefit_type == "family":
|
||||
rec.service_max_amount *= rec.benefit_member_count
|
||||
elif rec.max_limit_period == "recurrence_period":
|
||||
pass
|
||||
|
||||
if service_type == 'transportation_insurance':
|
||||
if rec.service_reason_id and rec.requested_service_amount > rec.max_amount:
|
||||
raise ValidationError(_("You cannot request more than %s"))
|
||||
continue
|
||||
|
||||
if rec.service_cat.service_type == 'health_care':
|
||||
domain = base_domain + [('date', '>', date_before_year)]
|
||||
existing_requests_within_year = Service.search(domain)
|
||||
rec.service_max_amount = rec.service_cat.max_health_care_amount - sum(existing_requests_within_year.mapped('requested_service_amount'))
|
||||
|
||||
if rec.service_cat.service_type == 'marriage':
|
||||
if rec.member_id.relationn.relation_type == 'son' and not rec.member_id.is_work:
|
||||
raise ValidationError(_("This service is not eligible because the son is not working."))
|
||||
|
|
|
|||
|
|
@ -43,8 +43,6 @@ class ServicesSettings(models.Model):
|
|||
min_count_member = fields.Integer(string='Mini Count Member')
|
||||
#Transportation insurance
|
||||
transportation_insurance_ids = fields.One2many('transportation.insurance', 'services_settings_id')
|
||||
#Health_care
|
||||
max_health_care_amount = fields.Float(string='Max Health Care Amount In Year')
|
||||
member_max_payroll = fields.Float(string='Member Max Payroll')
|
||||
fatherless_member_amount = fields.Float(string='Fatherless Member Amount')
|
||||
orphan_member_amount = fields.Float(string='Orphan Member Amount')
|
||||
|
|
@ -107,6 +105,17 @@ class ServicesSettings(models.Model):
|
|||
needs_legal_approval = fields.Boolean(string="Needs Legal Approval")
|
||||
needs_project_management_approval = fields.Boolean(string="Needs Project Management Approval")
|
||||
allow_non_beneficiary = fields.Boolean(string="Allow Non Beneficiary")
|
||||
max_limit_period = fields.Selection([
|
||||
('request', 'Per Request'),
|
||||
('individual', 'Per Individual'),
|
||||
('month', 'Per Month'),
|
||||
('year', 'Per Year'),
|
||||
('recurrence_period', 'For Allowed Recurrence Period'),
|
||||
], string='Maximum Limit Period')
|
||||
max_months_limit = fields.Integer(
|
||||
string='Maximum Number of Months',
|
||||
help='Specify the maximum allowed number of months when the period type is monthly.'
|
||||
)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -201,10 +201,26 @@
|
|||
</group>
|
||||
<group>
|
||||
<field name="available_service_cats" invisible="1"/>
|
||||
<field name="max_limit_period" invisible="1"/>
|
||||
<field name="service_cat"
|
||||
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"
|
||||
domain="[('id','in',available_service_cats)]" required="1"/>
|
||||
<field name="marriage_contract_date" attrs="{'invisible':[('service_type', '!=', 'marriage')]}"/>
|
||||
<label for="start" string="Period"
|
||||
attrs="{'invisible': ['&', ('service_type', '!=', 'rent'), ('max_limit_period', '!=', 'month')]}"/>
|
||||
<div name="dates" class="o_row"
|
||||
attrs="{'invisible': ['&', ('service_type', '!=', 'rent'), ('max_limit_period', '!=', 'month')]}">
|
||||
<field name="start"
|
||||
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
|
||||
<i class="fa fa-long-arrow-right mx-2 oe_edit_only"
|
||||
aria-label="Arrow icon" title="Arrow"/>
|
||||
<i class="fa fa-long-arrow-right mx-2 oe_read_only"
|
||||
aria-label="Arrow icon" title="Arrow"
|
||||
attrs="{'invisible': [('start', '=', False), ('end', '=', False)]}"/>
|
||||
<field name="end"
|
||||
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
|
||||
</div>
|
||||
<field name="marriage_contract_date"
|
||||
attrs="{'invisible':[('service_type', '!=', 'marriage')]}"/>
|
||||
<field name="service_approval_date"
|
||||
attrs="{'invisible':[('service_approval_date','=',False)]}"/>
|
||||
<field name="need_status"
|
||||
|
|
@ -279,18 +295,7 @@
|
|||
<field name="rent_end_date"
|
||||
attrs="{'invisible':[('benefit_type','!=','family')]}"
|
||||
force_save="1"/>
|
||||
<label for="start" string="Period"/>
|
||||
<div name="dates" class="o_row">
|
||||
<field name="start"
|
||||
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
|
||||
<i class="fa fa-long-arrow-right mx-2 oe_edit_only"
|
||||
aria-label="Arrow icon" title="Arrow"/>
|
||||
<i class="fa fa-long-arrow-right mx-2 oe_read_only"
|
||||
aria-label="Arrow icon" title="Arrow"
|
||||
attrs="{'invisible': [('start', '=', False), ('end', '=', False)]}"/>
|
||||
<field name="end"
|
||||
attrs="{'readonly':[('state','not in',['draft','researcher','waiting_approve'])]}"/>
|
||||
</div>
|
||||
|
||||
<field name="rent_amount"
|
||||
attrs="{'invisible':[('benefit_type','!=','family')]}"
|
||||
force_save="1"/>
|
||||
|
|
|
|||
|
|
@ -36,8 +36,6 @@
|
|||
<field name="max_limit_type"/>
|
||||
<field name="max_amount"
|
||||
attrs="{'invisible': [('max_limit_type', '!=', 'fixed')]}"/>
|
||||
<field name="max_health_care_amount"
|
||||
attrs="{'invisible': ['|',('service_type','!=','health_care'),('max_limit_type', '!=', 'service')]}"/>
|
||||
<field name="min_count_member"
|
||||
attrs="{'invisible':[('service_type','!=','buy_car')]}"/>
|
||||
<field name="buy_home_max_total_amount"
|
||||
|
|
@ -66,6 +64,9 @@
|
|||
<field name="recurrence_interval" class="oe_inline" nolabel="1"/>
|
||||
<field name="recurrence_period" class="oe_inline" nolabel="1"/>
|
||||
</div>
|
||||
<field name="max_limit_period"/>
|
||||
<field name="max_months_limit"
|
||||
attrs="{'invisible': [('max_limit_period', '!=', 'month')]}"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="requires_visit" widget="boolean_toggle"/>
|
||||
|
|
@ -100,7 +101,8 @@
|
|||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Eligibility Criteria" attrs="{'invisible':[('service_type','=','main_service')]}">
|
||||
<page string="Eligibility Criteria"
|
||||
attrs="{'invisible':[('service_type','=','main_service')]}">
|
||||
<group>
|
||||
<field name="service_conditions"/>
|
||||
</group>
|
||||
|
|
|
|||
Loading…
Reference in New Issue