Merge branch 'dev_odex25_ensan' of https://github.com/expsa/odex25-standard-modules into replace_between_replace_wating
Conflicts: odex25_ensan/odex_takaful/wizards/account_payment_register.xml
This commit is contained in:
commit
45a70d3c2e
|
|
@ -1475,7 +1475,7 @@ msgstr "موافقة"
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__approve_date
|
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__approve_date
|
||||||
msgid "Approve Date"
|
msgid "Approve Date"
|
||||||
msgstr "تاريخ الموافقة"
|
msgstr "تاريخ اعتماد الملف"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_sms_configuration__state__approve_family
|
#: model:ir.model.fields.selection,name:odex_benefit.selection__benefit_sms_configuration__state__approve_family
|
||||||
|
|
@ -2685,7 +2685,6 @@ msgstr "المرتد"
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_changes_requests__researcher_branch_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_changes_requests__researcher_branch_id
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_committees_line__branch_custom_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_committees_line__branch_custom_id
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_confirm_benefit_expense__branch_custom_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_confirm_benefit_expense__branch_custom_id
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_custom_id
|
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_res_districts__branch_custom_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_res_districts__branch_custom_id
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__branch_custom_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_service_request__branch_custom_id
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_search
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.grant_benefit_search
|
||||||
|
|
@ -2693,6 +2692,12 @@ msgstr "المرتد"
|
||||||
msgid "Branch"
|
msgid "Branch"
|
||||||
msgstr "الفرع"
|
msgstr "الفرع"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_custom_id
|
||||||
|
#: model:ir.model.fields,field_description:odex_benefit.field_researcher_family_wizard__branch_custom_id
|
||||||
|
msgid "Branch"
|
||||||
|
msgstr "الفرع التشغيلي"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:res.groups,name:odex_benefit.group_benefit_branch_manager
|
#: model:res.groups,name:odex_benefit.group_benefit_branch_manager
|
||||||
msgid "Branch Manager"
|
msgid "Branch Manager"
|
||||||
|
|
@ -3483,6 +3488,7 @@ msgid "Create the Relation"
|
||||||
msgstr "أنشاء ص قرابة"
|
msgstr "أنشاء ص قرابة"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.actions.act_window,help:odex_benefit.service_request_account_action
|
||||||
#: model_terms:ir.actions.act_window,help:odex_benefit.service_request_action
|
#: model_terms:ir.actions.act_window,help:odex_benefit.service_request_action
|
||||||
msgid "Create the Service Request"
|
msgid "Create the Service Request"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
@ -4181,7 +4187,6 @@ msgstr "تاريخ التوصيل"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model,name:odex_benefit.model_hr_department
|
#: model:ir.model,name:odex_benefit.model_hr_department
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_researcher_family_wizard__branch_custom_id
|
|
||||||
msgid "Department"
|
msgid "Department"
|
||||||
msgstr "القسم"
|
msgstr "القسم"
|
||||||
|
|
||||||
|
|
@ -10559,8 +10564,10 @@ msgid "Services Attachments Settings"
|
||||||
msgstr "المستندات المطلوبة للخدمة"
|
msgstr "المستندات المطلوبة للخدمة"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
|
#: model:ir.actions.act_window,name:odex_benefit.service_request_account_action
|
||||||
#: model:ir.actions.act_window,name:odex_benefit.service_request_action
|
#: model:ir.actions.act_window,name:odex_benefit.service_request_action
|
||||||
#: model:ir.ui.menu,name:odex_benefit.services_requests_menu
|
#: model:ir.ui.menu,name:odex_benefit.services_requests_menu
|
||||||
|
#: model:ir.ui.menu,name:odex_benefit.services_requests_account_menu
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.seasonal_service_form_view
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.seasonal_service_form_view
|
||||||
msgid "Services Requests"
|
msgid "Services Requests"
|
||||||
msgstr "طلبات الخدمات"
|
msgstr "طلبات الخدمات"
|
||||||
|
|
@ -16730,7 +16737,7 @@ msgstr "رقم الهوية %s موجود بالفعل في أسرة أخرى (
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_family_id
|
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_family_id
|
||||||
msgid "Family Branch"
|
msgid "Family Branch"
|
||||||
msgstr "فرع الأسرة"
|
msgstr "الفرع الأساسي"
|
||||||
|
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_has_employees
|
#: model:ir.model.fields,field_description:odex_benefit.field_grant_benefit__branch_has_employees
|
||||||
|
|
@ -17146,4 +17153,105 @@ msgstr "<span class=\"o_stat_text\">فاتورة العثيم</span>"
|
||||||
#. module: odex_benefit
|
#. module: odex_benefit
|
||||||
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
msgid "<span class=\"o_stat_text\">Payment Orders</span>"
|
msgid "<span class=\"o_stat_text\">Payment Orders</span>"
|
||||||
msgstr "<span class=\"o_stat_text\">أوامر الصرف</span>"
|
msgstr "<span class=\"o_stat_text\">أوامر الصرف</span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid "Othaim Line"
|
||||||
|
msgstr "مصروف العثيم"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model:ir.model.fields,field_description:odex_benefit.field_confirm_benefit_expense__othaim_line_ids
|
||||||
|
msgid "Othaim Lines"
|
||||||
|
msgstr "مصروف العثيم"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Total Othaim</span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي العثيم</span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-users text-info\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Member Count (Othaim)</span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-users text-info\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي عدد الأفراد للعثيم</span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-home text-primary\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Family Count (Othaim)</span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-home text-primary\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي عدد الأسر للعثيم</span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-home text-primary\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Family Count (Monthly Expense)\n"
|
||||||
|
" </span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-home text-primary\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي عدد الأسر للمصروف الشهري\n"
|
||||||
|
" </span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-users text-info\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Member Count (Monthly Expense)\n"
|
||||||
|
" </span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-users text-info\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي عدد الأفراد للمصروف الشهري\n"
|
||||||
|
" </span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Total Monthly Income\n"
|
||||||
|
" </span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي المصروف النقدي للأسر\n"
|
||||||
|
" </span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Total Monthly Meals\n"
|
||||||
|
" </span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي مصروف الغذاء للأسر\n"
|
||||||
|
" </span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Total Monthly Clothing\n"
|
||||||
|
" </span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-money text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">إجمالي مصروف الكساء للأسر\n"
|
||||||
|
" </span>"
|
||||||
|
|
||||||
|
#. module: odex_benefit
|
||||||
|
#: model_terms:ir.ui.view,arch_db:odex_benefit.view_confirm_benefit_expense_form
|
||||||
|
msgid ""
|
||||||
|
"<i class=\"fa fa-calculator text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">Total</span>"
|
||||||
|
msgstr ""
|
||||||
|
"<i class=\"fa fa-calculator text-success\" style=\"font-size: 20px; margin-bottom: 4px;\"/>\n"
|
||||||
|
" <span style=\"font-size: 12px; color: #555;\">الإجمالي</span>"
|
||||||
|
|
|
||||||
|
|
@ -1476,7 +1476,8 @@ class GrantBenefitProfile(models.Model):
|
||||||
rec.user_id.sudo().write({
|
rec.user_id.sudo().write({
|
||||||
'groups_id': [(4, self.env.ref('base.group_portal', False).id)],
|
'groups_id': [(4, self.env.ref('base.group_portal', False).id)],
|
||||||
})
|
})
|
||||||
rec.approve_date = datetime.now()
|
if rec.action_type == 'new':
|
||||||
|
rec.approve_date = datetime.now()
|
||||||
self.sudo().send_approval_benefit_email()
|
self.sudo().send_approval_benefit_email()
|
||||||
partner_ids = []
|
partner_ids = []
|
||||||
for id in self.message_follower_ids.ids:
|
for id in self.message_follower_ids.ids:
|
||||||
|
|
|
||||||
|
|
@ -47,9 +47,12 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
copy=False)
|
copy=False)
|
||||||
benefit_expense_line_ids = fields.One2many(comodel_name='benefit.expense.line', inverse_name='confirm_expense_id',
|
benefit_expense_line_ids = fields.One2many(comodel_name='benefit.expense.line', inverse_name='confirm_expense_id',
|
||||||
string='Benefit Expense Lines')
|
string='Benefit Expense Lines')
|
||||||
cash_expense = fields.Boolean(string='Include Cash Expense', states={'confirm': [('readonly', True)]})
|
othaim_line_ids = fields.One2many(comodel_name='benefit.expense.line', inverse_name='confirm_expense_id',
|
||||||
meal_expense = fields.Boolean(string='Include Meal Expense', states={'confirm': [('readonly', True)]})
|
string='Othaim Lines', domain=[('meal_card', '=', True)])
|
||||||
cloth_expense = fields.Boolean(string='Include Clothing Expense', states={'confirm': [('readonly', True)]})
|
cash_expense = fields.Boolean(string='Include Cash Expense', default=True, states={'confirm': [('readonly', True)]})
|
||||||
|
meal_expense = fields.Boolean(string='Include Meal Expense', default=True, states={'confirm': [('readonly', True)]})
|
||||||
|
cloth_expense = fields.Boolean(string='Include Clothing Expense', default=True,
|
||||||
|
states={'confirm': [('readonly', True)]})
|
||||||
payment_order_id = fields.Many2one('payment.orders', string='Payment Order', ondelete="set null", copy=False)
|
payment_order_id = fields.Many2one('payment.orders', string='Payment Order', ondelete="set null", copy=False)
|
||||||
move_id = fields.Many2one('account.move', ondelete='cascade')
|
move_id = fields.Many2one('account.move', ondelete='cascade')
|
||||||
available_payment_method_line_ids = fields.Many2many(comodel_name='account.payment.method.line')
|
available_payment_method_line_ids = fields.Many2many(comodel_name='account.payment.method.line')
|
||||||
|
|
@ -61,7 +64,8 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
family_monthly_othaime = fields.Float(string="Total Othaim", compute='_get_family_monthly_values', store=True)
|
family_monthly_othaime = fields.Float(string="Total Othaim", compute='_get_family_monthly_values', store=True)
|
||||||
family_monthly_total = fields.Float(string="Total", compute='_get_family_monthly_values', store=True)
|
family_monthly_total = fields.Float(string="Total", compute='_get_family_monthly_values', store=True)
|
||||||
branch_custom_ids = fields.Many2many(comodel_name='branch.settings', relation='confirm_benefit_expense_branch_rel',
|
branch_custom_ids = fields.Many2many(comodel_name='branch.settings', relation='confirm_benefit_expense_branch_rel',
|
||||||
column1='expense_id', column2='branch_id', string="Branches")
|
column1='expense_id', column2='branch_id', string="Branches",
|
||||||
|
domain="[('has_employees', '=', True)]")
|
||||||
family_domain_ids = fields.Many2many(comodel_name='grant.benefit', compute='_compute_domain_ids')
|
family_domain_ids = fields.Many2many(comodel_name='grant.benefit', compute='_compute_domain_ids')
|
||||||
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
company_id = fields.Many2one('res.company', default=lambda self: self.env.company)
|
||||||
currency_id = fields.Many2one(comodel_name='res.currency', string="Company Currency",
|
currency_id = fields.Many2one(comodel_name='res.currency', string="Company Currency",
|
||||||
|
|
@ -118,7 +122,7 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
self.ensure_one()
|
self.ensure_one()
|
||||||
for line in self.benefit_expense_line_ids:
|
for line in self.benefit_expense_line_ids:
|
||||||
family = line.family_id
|
family = line.family_id
|
||||||
income, meals, clotting = 0, 0, 0
|
income, meals, clotting, othaim = 0, 0, 0, 0
|
||||||
if not family:
|
if not family:
|
||||||
continue
|
continue
|
||||||
monthly_meals = 0.0 if family.meal_card else family.family_monthly_meals
|
monthly_meals = 0.0 if family.meal_card else family.family_monthly_meals
|
||||||
|
|
@ -127,6 +131,7 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
income = family.family_monthly_income
|
income = family.family_monthly_income
|
||||||
if self.meal_expense:
|
if self.meal_expense:
|
||||||
meals = monthly_meals
|
meals = monthly_meals
|
||||||
|
othaim = othaime
|
||||||
if self.cloth_expense:
|
if self.cloth_expense:
|
||||||
clotting = family.family_monthly_clotting
|
clotting = family.family_monthly_clotting
|
||||||
vals = {
|
vals = {
|
||||||
|
|
@ -139,7 +144,7 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
'family_monthly_income': income,
|
'family_monthly_income': income,
|
||||||
'family_monthly_meals': meals,
|
'family_monthly_meals': meals,
|
||||||
'family_monthly_clotting': clotting,
|
'family_monthly_clotting': clotting,
|
||||||
'family_monthly_othaime': othaime,
|
'family_monthly_othaime': othaim,
|
||||||
}
|
}
|
||||||
line.write(vals)
|
line.write(vals)
|
||||||
|
|
||||||
|
|
@ -152,7 +157,6 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
if not families:
|
if not families:
|
||||||
raise UserError(_("Please select at least one family to calculate."))
|
raise UserError(_("Please select at least one family to calculate."))
|
||||||
|
|
||||||
# Todo ask awatif
|
|
||||||
if not rec.cash_expense and not rec.meal_expense and not rec.cloth_expense:
|
if not rec.cash_expense and not rec.meal_expense and not rec.cloth_expense:
|
||||||
raise UserError(_("At least one expense type should be selected."))
|
raise UserError(_("At least one expense type should be selected."))
|
||||||
|
|
||||||
|
|
@ -239,25 +243,12 @@ class ConfirmBenefitExpense(models.Model):
|
||||||
rec.member_count_othaim = sum(othaim_lines.mapped('benefit_member_count'))
|
rec.member_count_othaim = sum(othaim_lines.mapped('benefit_member_count'))
|
||||||
|
|
||||||
def action_assistant_manager(self):
|
def action_assistant_manager(self):
|
||||||
# Todo ask awatif
|
for family in self.family_ids:
|
||||||
# if self.expense_type != 'family_expense':
|
if self.end_date and family.last_disbursement_date:
|
||||||
# self.state = 'assistant_general_manager'
|
if self.end_date > family.last_disbursement_date:
|
||||||
# return
|
family.last_disbursement_date = self.end_date
|
||||||
|
else:
|
||||||
disbursement_date = False
|
family.last_disbursement_date = self.end_date
|
||||||
# if not disbursement_date:
|
|
||||||
last_expense = self.search(
|
|
||||||
[("state", "=", "confirm"), ("end_date", "!=", False)],
|
|
||||||
order="id desc",
|
|
||||||
limit=1
|
|
||||||
)
|
|
||||||
if last_expense:
|
|
||||||
disbursement_date = last_expense.end_date
|
|
||||||
|
|
||||||
# Apply the disbursement date to all families
|
|
||||||
if disbursement_date:
|
|
||||||
for family in self.family_ids:
|
|
||||||
family.last_disbursement_date = disbursement_date
|
|
||||||
|
|
||||||
self.state = 'assistant_general_manager'
|
self.state = 'assistant_general_manager'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class SeasonalService(models.Model):
|
||||||
string="Seasonal Service Type", required=True)
|
string="Seasonal Service Type", required=True)
|
||||||
benefit_type = fields.Selection(string='Benefit Type', related='service_type_id.benefit_type')
|
benefit_type = fields.Selection(string='Benefit Type', related='service_type_id.benefit_type')
|
||||||
branch_ids = fields.Many2many('branch.settings', 'service_branch_rel', 'service_id', 'branch_id', string='Branches',
|
branch_ids = fields.Many2many('branch.settings', 'service_branch_rel', 'service_id', 'branch_id', string='Branches',
|
||||||
required=True)
|
required=True, domain="[('has_employees', '=', True)]")
|
||||||
family_category_ids = fields.Many2many(
|
family_category_ids = fields.Many2many(
|
||||||
'benefit.category',
|
'benefit.category',
|
||||||
'service_category_rel',
|
'service_category_rel',
|
||||||
|
|
|
||||||
|
|
@ -890,6 +890,7 @@ class ServiceRequest(models.Model):
|
||||||
rec.service_max_amount = rec.service_cat.fatherless_member_amount
|
rec.service_max_amount = rec.service_cat.fatherless_member_amount
|
||||||
if rec.is_orphan:
|
if rec.is_orphan:
|
||||||
rec.service_max_amount = rec.service_cat.orphan_member_amount
|
rec.service_max_amount = rec.service_cat.orphan_member_amount
|
||||||
|
rec.requested_service_amount = rec.service_max_amount
|
||||||
if rec.member_age > rec.service_cat.max_age:
|
if rec.member_age > rec.service_cat.max_age:
|
||||||
raise ValidationError(_("Member Age should be less than %s ") % rec.service_cat.max_age)
|
raise ValidationError(_("Member Age should be less than %s ") % rec.service_cat.max_age)
|
||||||
if rec.member_payroll > rec.service_cat.member_max_payroll:
|
if rec.member_payroll > rec.service_cat.member_max_payroll:
|
||||||
|
|
|
||||||
|
|
@ -546,6 +546,16 @@
|
||||||
</p>
|
</p>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
<record id="service_request_account_action" model="ir.actions.act_window">
|
||||||
|
<field name="name">Services Requests</field>
|
||||||
|
<field name="res_model">service.request</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="domain">[('is_seasonal','=',False),('state','=','accounting_approve'),('payment_order_state','=','none')]</field>
|
||||||
|
<field name="help" type="html">
|
||||||
|
<p class="oe_view_nocontent_create">Create the Service Request
|
||||||
|
</p>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
<record model="ir.actions.act_window" id="benefit_need_action">
|
<record model="ir.actions.act_window" id="benefit_need_action">
|
||||||
<field name="name">Benefit Need</field>
|
<field name="name">Benefit Need</field>
|
||||||
<field name="res_model">benefit.need</field>
|
<field name="res_model">benefit.need</field>
|
||||||
|
|
@ -993,6 +1003,8 @@
|
||||||
parent="odex_benefit.benefit_tools_services_settings_menu" action="services_settings_action" groups="odex_benefit.group_benefit_manager"/>
|
parent="odex_benefit.benefit_tools_services_settings_menu" action="services_settings_action" groups="odex_benefit.group_benefit_manager"/>
|
||||||
<menuitem id="services_requests_menu" name="Services Requests" sequence="2"
|
<menuitem id="services_requests_menu" name="Services Requests" sequence="2"
|
||||||
parent="odex_benefit.benefit_services" action="service_request_action"/>
|
parent="odex_benefit.benefit_services" action="service_request_action"/>
|
||||||
|
<menuitem id="services_requests_account_menu" name="Services Requests" sequence="9"
|
||||||
|
parent="account.menu_finance_payables" action="service_request_account_action"/>
|
||||||
|
|
||||||
<!-- <menuitem id="family_member_main_menu" name="Family Members"-->
|
<!-- <menuitem id="family_member_main_menu" name="Family Members"-->
|
||||||
<!-- parent="benefits_root_menu" sequence="2"/>-->
|
<!-- parent="benefits_root_menu" sequence="2"/>-->
|
||||||
|
|
|
||||||
|
|
@ -520,7 +520,7 @@
|
||||||
force_save="1"/>
|
force_save="1"/>
|
||||||
<field name="last_visit_date" readonly="1"/>
|
<field name="last_visit_date" readonly="1"/>
|
||||||
<field name="city_id"
|
<field name="city_id"
|
||||||
readonly="1"
|
invisible="1"
|
||||||
string="City" options="{'no_create': True, 'no_create_edit': True}"
|
string="City" options="{'no_create': True, 'no_create_edit': True}"
|
||||||
groups="!odex_benefit.group_benefit_manager"/>
|
groups="!odex_benefit.group_benefit_manager"/>
|
||||||
<field name="branch_custom_id"
|
<field name="branch_custom_id"
|
||||||
|
|
@ -539,6 +539,7 @@
|
||||||
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
|
options="{'currency_field': 'currency_id'}" readonly="1" force_save="1"/>
|
||||||
<field name="benefit_category_id" readonly="1" force_save="1"/>
|
<field name="benefit_category_id" readonly="1" force_save="1"/>
|
||||||
<field name="benefit_category_old"/>
|
<field name="benefit_category_old"/>
|
||||||
|
<field name="approve_date" readonly="1"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="currency_id" groups="base.group_multi_currency"/>
|
<field name="currency_id" groups="base.group_multi_currency"/>
|
||||||
<field name="mother_family_member_id" invisible="1" readonly="1"/>
|
<field name="mother_family_member_id" invisible="1" readonly="1"/>
|
||||||
|
|
@ -1787,7 +1788,7 @@
|
||||||
|
|
||||||
|
|
||||||
<xpath expr="//field[@name='city_id']" position="replace">
|
<xpath expr="//field[@name='city_id']" position="replace">
|
||||||
<field name="city_id" readonly="1"/>
|
<field name="city_id" invisible="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='branch_custom_id']" position="replace">
|
<xpath expr="//field[@name='branch_custom_id']" position="replace">
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,11 @@
|
||||||
<field name="family_expense_seq"/>
|
<field name="family_expense_seq"/>
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="name" string="Description"/>
|
<field name="name" string="Description"/>
|
||||||
<field name="branch_custom_ids" widget="many2many_tags"/>
|
|
||||||
<field name="currency_id" invisible="1" groups="base.group_multi_currency"/>
|
<field name="currency_id" invisible="1" groups="base.group_multi_currency"/>
|
||||||
<field name="family_monthly_total" decoration-bf="1" widget="monetary"
|
<field name="family_monthly_total" decoration-bf="1" widget="monetary"
|
||||||
options="{'currency_field': 'currency_id'}"/>
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
<field name="family_monthly_othaime" decoration-bf="1" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
<field name="state" widget="badge"
|
<field name="state" widget="badge"
|
||||||
decoration-info="state in ['draft','calculated']"
|
decoration-info="state in ['draft','calculated']"
|
||||||
decoration-warning="state in ['assistant_general_manager']"
|
decoration-warning="state in ['assistant_general_manager']"
|
||||||
|
|
@ -136,37 +137,109 @@
|
||||||
attrs="{'readonly':[('state', '!=', 'draft')]}"/>
|
attrs="{'readonly':[('state', '!=', 'draft')]}"/>
|
||||||
<field name="company_id" groups="base.group_multi_company"/>
|
<field name="company_id" groups="base.group_multi_company"/>
|
||||||
<field name="currency_id" invisible="1" groups="base.group_multi_currency"/>
|
<field name="currency_id" invisible="1" groups="base.group_multi_currency"/>
|
||||||
</group>
|
|
||||||
</group>
|
|
||||||
|
|
||||||
<group>
|
|
||||||
<group>
|
|
||||||
<field name="available_payment_method_line_ids" invisible="1"/>
|
<field name="available_payment_method_line_ids" invisible="1"/>
|
||||||
<field name="family_monthly_income" widget="monetary"
|
|
||||||
options="{'currency_field': 'currency_id'}"
|
|
||||||
attrs="{'invisible': [('cash_expense', '=', False)]}"/>
|
|
||||||
<field name="family_monthly_meals" widget="monetary"
|
|
||||||
options="{'currency_field': 'currency_id'}"
|
|
||||||
attrs="{'invisible': [('meal_expense', '=', False)]}"/>
|
|
||||||
<field name="family_monthly_clotting" widget="monetary"
|
|
||||||
options="{'currency_field': 'currency_id'}"
|
|
||||||
attrs="{'invisible': [('cloth_expense', '=', False)]}"/>
|
|
||||||
<field name="family_monthly_total" widget="monetary"
|
|
||||||
options="{'currency_field': 'currency_id'}"/>
|
|
||||||
</group>
|
|
||||||
<group>
|
|
||||||
<field name="family_count_expense"/>
|
|
||||||
<field name="member_count_expense"/>
|
|
||||||
<field name="family_count_othaim"/>
|
|
||||||
<field name="member_count_othaim"/>
|
|
||||||
<field name="family_monthly_othaime" widget="monetary"
|
|
||||||
options="{'currency_field': 'currency_id'}"
|
|
||||||
/>
|
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<!-- Notebook with Families page -->
|
<!-- Notebook with Families page -->
|
||||||
<notebook>
|
<notebook>
|
||||||
<page string="Family Monthly Expense" attrs="{'invisible': [('state', '=', 'draft')]}">
|
<page string="Family Monthly Expense" attrs="{'invisible': [('state', '=', 'draft')]}">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<!-- Family Count (Monthly Expense) -->
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e3f2fd; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-home text-primary"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Family Count (Monthly Expense)
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-primary"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_count_expense"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Member Count (Monthly Expense) -->
|
||||||
|
<div class="col-6">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e0f7fa; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-users text-info" style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Member Count (Monthly Expense)
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-info"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="member_count_expense"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="row mb-2">
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row text-center">
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e3f2fd; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-money text-success"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Total Monthly Income
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-primary"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_monthly_income" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Total Monthly Meals -->
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #fff3e0; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-money text-success"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Total Monthly Meals
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-warning"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_monthly_meals" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Total Monthly Clothing -->
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e0f7fa; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-money text-success"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Total Monthly Clothing
|
||||||
|
</span>
|
||||||
|
<span class="badge badge-info"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_monthly_clotting" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Monthly Total -->
|
||||||
|
<div class="col-3">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e8f7ef;padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-calculator text-success"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Total</span>
|
||||||
|
<span class="badge badge-success"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_monthly_total" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<field name="benefit_expense_line_ids" readonly="1">
|
<field name="benefit_expense_line_ids" readonly="1">
|
||||||
<tree>
|
<tree>
|
||||||
<field name="family_id"/>
|
<field name="family_id"/>
|
||||||
|
|
@ -183,6 +256,64 @@
|
||||||
<field name="family_monthly_clotting"
|
<field name="family_monthly_clotting"
|
||||||
attrs="{'column_invisible': [('parent.cloth_expense', '!=', True)]}"/>
|
attrs="{'column_invisible': [('parent.cloth_expense', '!=', True)]}"/>
|
||||||
<field name="total_family_expenses"/>
|
<field name="total_family_expenses"/>
|
||||||
|
<field name="payment_order_id" invisible="1"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
<page string="Othaim Line"
|
||||||
|
attrs="{'invisible': ['|',('state', '=', 'draft'),('meal_expense', '=', False)]}">
|
||||||
|
<div class="row mb-2">
|
||||||
|
<!-- Family Count -->
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e3f2fd; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-home text-primary"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Family Count (Othaim)</span>
|
||||||
|
<span class="badge badge-primary"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_count_othaim"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Member Count -->
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e0f7fa; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-users text-info" style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Member Count (Othaim)</span>
|
||||||
|
<span class="badge badge-info"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="member_count_othaim"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Total Othaim -->
|
||||||
|
<div class="col-4">
|
||||||
|
<div class="d-flex flex-column align-items-center"
|
||||||
|
style="background-color: #e8f5e9; padding: 8px; border-radius: 8px;">
|
||||||
|
<i class="fa fa-money text-success"
|
||||||
|
style="font-size: 20px; margin-bottom: 4px;"/>
|
||||||
|
<span style="font-size: 12px; color: #555;">Total Othaim</span>
|
||||||
|
<span class="badge badge-success"
|
||||||
|
style="font-size: 14px; padding: 4px 8px; margin-top: 3px; border-radius: 8px;">
|
||||||
|
<field name="family_monthly_othaime" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}"/>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<field name="othaim_line_ids" readonly="1">
|
||||||
|
<tree>
|
||||||
|
<field name="family_id"/>
|
||||||
|
<field name="branch_id"/>
|
||||||
|
<field name="family_category_id"/>
|
||||||
|
<field name="start_date" invisible="1"/>
|
||||||
|
<field name="end_date" invisible="1"/>
|
||||||
|
<field name="meal_card"/>
|
||||||
|
<field name="benefit_member_count"/>
|
||||||
<field name="family_monthly_othaime"/>
|
<field name="family_monthly_othaime"/>
|
||||||
<field name="payment_order_id" invisible="1"/>
|
<field name="payment_order_id" invisible="1"/>
|
||||||
</tree>
|
</tree>
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,10 @@ class ReasearcherFamilyWizard(models.TransientModel):
|
||||||
researcher_team = fields.Many2one("committees.line", string="Researcher Team",
|
researcher_team = fields.Many2one("committees.line", string="Researcher Team",
|
||||||
domain="[('branch_custom_id', '=',branch_custom_id)]")
|
domain="[('branch_custom_id', '=',branch_custom_id)]")
|
||||||
benefit_id = fields.Many2one("grant.benefit", string="Benefit", default=_default_benefit)
|
benefit_id = fields.Many2one("grant.benefit", string="Benefit", default=_default_benefit)
|
||||||
branch_custom_id = fields.Many2one("branch.settings", string="Department", default=_default_branch_custom_id)
|
branch_custom_id = fields.Many2one("branch.settings", string="Branch",
|
||||||
branch_has_employees = fields.Boolean('Has Employees In branch',related="benefit_id.branch_has_employees")
|
domain="[('has_employees', '=', True)]",
|
||||||
|
default=_default_branch_custom_id)
|
||||||
|
branch_has_employees = fields.Boolean('Has Employees In branch', related="benefit_id.branch_has_employees")
|
||||||
is_submitted = fields.Boolean(string="Submitted", default=False)
|
is_submitted = fields.Boolean(string="Submitted", default=False)
|
||||||
|
|
||||||
def submit_family(self):
|
def submit_family(self):
|
||||||
|
|
@ -65,7 +67,7 @@ class ReasearcherFamilyWizard(models.TransientModel):
|
||||||
'state': 'complete_info',
|
'state': 'complete_info',
|
||||||
'contact_type': 'sms',
|
'contact_type': 'sms',
|
||||||
'researcher_id': rec.researcher_team.id,
|
'researcher_id': rec.researcher_team.id,
|
||||||
'branch_custom_id':rec.branch_custom_id.id,
|
'branch_custom_id': rec.branch_custom_id.id,
|
||||||
})
|
})
|
||||||
visit_record = self.env['visit.location'].create({
|
visit_record = self.env['visit.location'].create({
|
||||||
'benefit_id': rec.benefit_id.id,
|
'benefit_id': rec.benefit_id.id,
|
||||||
|
|
@ -80,7 +82,8 @@ class ReasearcherFamilyWizard(models.TransientModel):
|
||||||
rec._send_assignment_notification(visit_record)
|
rec._send_assignment_notification(visit_record)
|
||||||
specialist_name = rec.researcher_team.name or _('Not Specified')
|
specialist_name = rec.researcher_team.name or _('Not Specified')
|
||||||
visit_number = visit_record.name or str(visit_record.id)
|
visit_number = visit_record.name or str(visit_record.id)
|
||||||
message = _('File has been assigned to specialist "%s" and initial visit created with number "%s"') % (specialist_name, visit_number)
|
message = _('File has been assigned to specialist "%s" and initial visit created with number "%s"') % (
|
||||||
|
specialist_name, visit_number)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.client',
|
'type': 'ir.actions.client',
|
||||||
|
|
@ -135,7 +138,8 @@ class ReasearcherFamilyWizard(models.TransientModel):
|
||||||
'email_to': specialist_user.work_email or specialist_user.email,
|
'email_to': specialist_user.work_email or specialist_user.email,
|
||||||
'email_cc': self.env.user.company_id.hr_email or self.env.user.company_id.email,
|
'email_cc': self.env.user.company_id.hr_email or self.env.user.company_id.email,
|
||||||
})
|
})
|
||||||
template.with_context(lang=self.env.user.lang).send_mail(visit_record.id, force_send=True, raise_exception=False)
|
template.with_context(lang=self.env.user.lang).send_mail(visit_record.id, force_send=True,
|
||||||
|
raise_exception=False)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self._send_in_system_notification(specialist_user, visit_record)
|
self._send_in_system_notification(specialist_user, visit_record)
|
||||||
|
|
|
||||||
|
|
@ -271,6 +271,12 @@ class DonationsDetailsLines(models.Model):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
rec.total_months_amount = rec.donation_amount * rec.payment_month_count
|
rec.total_months_amount = rec.donation_amount * rec.payment_month_count
|
||||||
|
|
||||||
|
@api.onchange('sponsorship_duration')
|
||||||
|
def _onchange_sponsorship_duration(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.sponsorship_duration == "permanent":
|
||||||
|
rec.direct_debit = False
|
||||||
|
|
||||||
@api.onchange('product_template_id')
|
@api.onchange('product_template_id')
|
||||||
def _onchange_product_template_id(self):
|
def _onchange_product_template_id(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|
@ -535,6 +541,7 @@ class DonationsDetailsLines(models.Model):
|
||||||
self._onchange_sponsorship_type()
|
self._onchange_sponsorship_type()
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
@api.onchange('donation_types', 'donation_type')
|
@api.onchange('donation_types', 'donation_type')
|
||||||
def _onchange_sponsorship_type(self):
|
def _onchange_sponsorship_type(self):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
|
|
@ -688,6 +695,16 @@ class DonationsDetailsLines(models.Model):
|
||||||
domain = expression.AND([domain, [
|
domain = expression.AND([domain, [
|
||||||
('age', '>=', benefit_age_limit)
|
('age', '>=', benefit_age_limit)
|
||||||
]])
|
]])
|
||||||
|
if rec.sponsorship_id or rec.sponsorship_mechanism_id:
|
||||||
|
all_benefit_ids = (
|
||||||
|
|
||||||
|
(
|
||||||
|
rec.sponsorship_mechanism_id.donations_details_lines_mechanism_ids if rec.sponsorship_mechanism_id else
|
||||||
|
self.env['donations.details.lines'])
|
||||||
|
)
|
||||||
|
selected_benefit_ids = all_benefit_ids.mapped('benefit_ids').ids
|
||||||
|
domain = expression.AND([domain, [('id', 'not in', selected_benefit_ids)]])
|
||||||
|
|
||||||
elif rec.record_type == 'donation' and rec.donation_mechanism == "with_conditions" and rec.family_id:
|
elif rec.record_type == 'donation' and rec.donation_mechanism == "with_conditions" and rec.family_id:
|
||||||
domain = [("benefit_id", "=", rec.family_id.id)]
|
domain = [("benefit_id", "=", rec.family_id.id)]
|
||||||
members = self.env['family.member'].sudo().search(domain)
|
members = self.env['family.member'].sudo().search(domain)
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ access_donation_extension_wizard_line,donation.extension.wizard.line.access,mode
|
||||||
access_donation_replacement_log,donation.replacement.log.access,model_donation_replacement_log,odex_takaful.group_kufula_user,1,1,1,0
|
access_donation_replacement_log,donation.replacement.log.access,model_donation_replacement_log,odex_takaful.group_kufula_user,1,1,1,0
|
||||||
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,odex_takaful.group_replace_sponsor,1,1,1,1
|
access_replace_sponsor_wizard,replace.sponsor.wizard.access,model_replace_sponsor_wizard,odex_takaful.group_replace_sponsor,1,1,1,1
|
||||||
access_add_benefit_wizard,add.benefit.wizard.access,model_add_benefit_wizard,odex_takaful.group_kufula_user,1,1,1,1
|
access_add_benefit_wizard,add.benefit.wizard.access,model_add_benefit_wizard,odex_takaful.group_kufula_user,1,1,1,1
|
||||||
|
access_extension_payment_wizard_line,extension.payment.wizard.line.access,model_extension_payment_wizard_line,odex_takaful.group_kufula_user,1,1,1,1
|
||||||
access_group_kufula_user_product_template,access_group_kufula_user_product_template,product.model_product_template,odex_takaful.group_kufula_user,1,1,0,0
|
access_group_kufula_user_product_template,access_group_kufula_user_product_template,product.model_product_template,odex_takaful.group_kufula_user,1,1,0,0
|
||||||
access_group_kufula_user_account_move,access_group_kufula_user_account_move,account.model_account_move,odex_takaful.group_kufula_user,1,1,1,0
|
access_group_kufula_user_account_move,access_group_kufula_user_account_move,account.model_account_move,odex_takaful.group_kufula_user,1,1,1,0
|
||||||
access_group_kufula_user_sale_order,access_group_kufula_user_sale_order,sale.model_sale_order,odex_takaful.group_kufula_user,1,1,1,0
|
access_group_kufula_user_sale_order,access_group_kufula_user_sale_order,sale.model_sale_order,odex_takaful.group_kufula_user,1,1,1,0
|
||||||
|
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
j_type = ""
|
j_type = ""
|
||||||
if payment_method == "cash":
|
if payment_method == "cash":
|
||||||
j_type = "cash"
|
j_type = "cash"
|
||||||
elif payment_method in ("bank", "check"):
|
elif payment_method in ("bank", "check","network"):
|
||||||
j_type = "bank"
|
j_type = "bank"
|
||||||
if j_type:
|
if j_type:
|
||||||
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
||||||
|
|
|
||||||
|
|
@ -10,15 +10,14 @@
|
||||||
<xpath expr="//field[@name='amount']" position="after">
|
<xpath expr="//field[@name='amount']" position="after">
|
||||||
<field name="is_refund_sponsorship" invisible="1"/>
|
<field name="is_refund_sponsorship" invisible="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<!-- <xpath expr="//field[@name='amount']" position="attributes">-->
|
<!-- <xpath expr="//field[@name='amount']" position="attributes">-->
|
||||||
<!-- <attribute name="attrs">{'readonly':[('group_payment','=',True)]}</attribute>-->
|
<!-- <attribute name="attrs">{'readonly':[('group_payment','=',True)]}</attribute>-->
|
||||||
<!-- </xpath>-->
|
<!-- </xpath>-->
|
||||||
<xpath expr="//field[@name='journal_id']" position="attributes">
|
<xpath expr="//field[@name='journal_id']" position="attributes">
|
||||||
<attribute name="attrs">
|
<attribute name="attrs">{'readonly':[('is_refund_sponsorship','=',True)]}</attribute>
|
||||||
{'readonly': [('is_refund_sponsorship', '=', True)]}
|
|
||||||
</attribute>
|
|
||||||
<attribute name="string">Association Journal</attribute>
|
<attribute name="string">Association Journal</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='partner_bank_id']" position="attributes">
|
<xpath expr="//field[@name='partner_bank_id']" position="attributes">
|
||||||
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
@ -26,7 +25,7 @@
|
||||||
<xpath expr="//field[@name='payment_method_line_id']" position="attributes">
|
<xpath expr="//field[@name='payment_method_line_id']" position="attributes">
|
||||||
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='branch_id']" position="attributes">
|
<xpath expr="//field[@name='branch_id']" position="attributes">
|
||||||
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
@ -36,99 +35,94 @@
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='journal_id']" position="before">
|
<xpath expr="//field[@name='journal_id']" position="before">
|
||||||
<field name="takaful_payment_method_id" attrs="{'invisible': [('sponsorship_payment', '=', False)]}"
|
<field name="takaful_payment_method_id" attrs="{'invisible': [('sponsorship_payment', '=', False)]}" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||||
options="{'no_create': True, 'no_create_edit': True}"/>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
<xpath expr="//field[@name='partner_bank_id']" position="after">
|
<xpath expr="//field[@name='partner_bank_id']" position="after">
|
||||||
<field name="sponsorship_payment" invisible="1"/>
|
<field name="sponsorship_payment" invisible="1"/>
|
||||||
<field name="takaful_payment_method" invisible="1"/>
|
<field name="takaful_payment_method" invisible="1"/>
|
||||||
<!-- <field name="payment_method" attrs="{'invisible': [('sponsorship_payment', '=', False)]}"/>-->
|
<!-- <field name="payment_method" attrs="{'invisible': [('sponsorship_payment', '=', False)]}"/>-->
|
||||||
<field name="payment_method" invisible="1"/>
|
<field name="payment_method" invisible="1"/>
|
||||||
<field name="check_number"
|
<field name="check_number" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
<field name="check_due_date" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
||||||
<field name="check_due_date"
|
<field name="partner_bank_id" context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}" attrs="{'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')], 'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','bank')]}"/>
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
|
||||||
<field name="partner_bank_id"
|
|
||||||
context="{'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create', 'default_partner_id': context.get('force_sponsorship_line_partner_id')}"
|
|
||||||
attrs="{'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')], 'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','bank')]}"/>
|
|
||||||
<field name="transaction_file_attachment" widget="binary"
|
<field name="transaction_file_attachment" widget="binary"
|
||||||
filename="transaction_attachment_file_name"
|
filename="transaction_attachment_file_name"
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank', 'check'])], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','bank')]}"/>
|
||||||
<field name="transaction_attachment_file_name" invisible="1"/>
|
<field name="transaction_attachment_file_name" invisible="1"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<!--<xpath expr="//group" position="after">-->
|
<!--<xpath expr="//group" position="after">-->
|
||||||
<!-- <notebook>-->
|
<!-- <notebook>-->
|
||||||
<!-- <page string="Sub Payments" attrs="{'invisible': [('group_payment', '=', False)]}">-->
|
<!-- <page string="Sub Payments" attrs="{'invisible': [('group_payment', '=', False)]}">-->
|
||||||
<!-- <field name="account_payment_register_ids" attrs="{'invisible': [('group_payment', '=', False)]}" nolabel="1">-->
|
<!-- <field name="account_payment_register_ids" attrs="{'invisible': [('group_payment', '=', False)]}" nolabel="1">-->
|
||||||
<!-- <tree editable="bottom" delete="true" create="true">-->
|
<!-- <tree editable="bottom" delete="true" create="true">-->
|
||||||
<!-- <field name="sponsorship_payment" invisible="1"/>-->
|
<!-- <field name="sponsorship_payment" invisible="1"/>-->
|
||||||
<!-- <field name="takaful_payment_method" invisible="1"/>-->
|
<!-- <field name="takaful_payment_method" invisible="1"/>-->
|
||||||
<!-- <field name="available_partner_bank_ids" invisible="1"/>-->
|
<!-- <field name="available_partner_bank_ids" invisible="1"/>-->
|
||||||
<!-- <field name="company_id" invisible="1"/>-->
|
<!-- <field name="company_id" invisible="1"/>-->
|
||||||
<!-- <field name="takaful_payment_method_id" options="{'no_create': True, 'no_create_edit': True}"/>-->
|
<!-- <field name="takaful_payment_method_id" options="{'no_create': True, 'no_create_edit': True}"/>-->
|
||||||
<!-- <field name="journal_id" string="Association Journal"/>-->
|
<!-- <field name="journal_id" string="Association Journal"/>-->
|
||||||
<!-- <field name="amount"/>-->
|
<!-- <field name="amount"/>-->
|
||||||
<!-- <field name="check_number"-->
|
<!-- <field name="check_number"-->
|
||||||
<!-- attrs="{-->
|
<!-- attrs="{-->
|
||||||
<!-- 'invisible': [-->
|
<!-- 'invisible': [-->
|
||||||
<!-- ('takaful_payment_method','!=','check')-->
|
<!-- ('takaful_payment_method','!=','check')-->
|
||||||
<!-- ],-->
|
<!-- ],-->
|
||||||
<!-- 'required': [-->
|
<!-- 'required': [-->
|
||||||
<!-- ('takaful_payment_method','=','check')-->
|
<!-- ('takaful_payment_method','=','check')-->
|
||||||
<!-- ]-->
|
<!-- ]-->
|
||||||
<!-- }"-->
|
<!-- }"-->
|
||||||
<!-- optional="hide"/>-->
|
<!-- optional="hide"/>-->
|
||||||
<!-- <field name="check_due_date"-->
|
<!-- <field name="check_due_date"-->
|
||||||
<!-- attrs="{-->
|
<!-- attrs="{-->
|
||||||
<!-- 'invisible': [-->
|
<!-- 'invisible': [-->
|
||||||
<!-- ('takaful_payment_method','!=','check')-->
|
<!-- ('takaful_payment_method','!=','check')-->
|
||||||
<!-- ],-->
|
<!-- ],-->
|
||||||
<!-- 'required': [-->
|
<!-- 'required': [-->
|
||||||
<!-- ('takaful_payment_method','=','check')-->
|
<!-- ('takaful_payment_method','=','check')-->
|
||||||
<!-- ]-->
|
<!-- ]-->
|
||||||
<!-- }"-->
|
<!-- }"-->
|
||||||
<!-- optional="hide"/>-->
|
<!-- optional="hide"/>-->
|
||||||
<!-- <field name="partner_bank_id"-->
|
<!-- <field name="partner_bank_id"-->
|
||||||
<!-- context="{-->
|
<!-- context="{-->
|
||||||
<!-- 'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create',-->
|
<!-- 'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create',-->
|
||||||
<!-- 'default_partner_id': context.get('force_sponsorship_line_partner_id')-->
|
<!-- 'default_partner_id': context.get('force_sponsorship_line_partner_id')-->
|
||||||
<!-- }"-->
|
<!-- }"-->
|
||||||
<!-- attrs="{-->
|
<!-- attrs="{-->
|
||||||
<!-- 'required': [-->
|
<!-- 'required': [-->
|
||||||
<!-- ('takaful_payment_method','=','bank')-->
|
<!-- ('takaful_payment_method','=','bank')-->
|
||||||
<!-- ],-->
|
<!-- ],-->
|
||||||
<!-- 'invisible': [-->
|
<!-- 'invisible': [-->
|
||||||
<!-- ('takaful_payment_method','!=','bank')-->
|
<!-- ('takaful_payment_method','!=','bank')-->
|
||||||
<!-- ]-->
|
<!-- ]-->
|
||||||
<!-- }"-->
|
<!-- }"-->
|
||||||
<!-- readonly="0"-->
|
<!-- readonly="0"-->
|
||||||
<!-- optional="hide"/>-->
|
<!-- optional="hide"/>-->
|
||||||
<!-- <field name="transaction_file_attachment"-->
|
<!-- <field name="transaction_file_attachment"-->
|
||||||
<!-- widget="binary"-->
|
<!-- widget="binary"-->
|
||||||
<!-- filename="transaction_attachment_file_name"-->
|
<!-- filename="transaction_attachment_file_name"-->
|
||||||
<!-- attrs="{-->
|
<!-- attrs="{-->
|
||||||
<!-- 'invisible': [-->
|
<!-- 'invisible': [-->
|
||||||
<!-- ('takaful_payment_method','not in',['bank', 'check'])-->
|
<!-- ('takaful_payment_method','not in',['bank', 'check'])-->
|
||||||
<!-- ],-->
|
<!-- ],-->
|
||||||
<!-- 'required': ['|',-->
|
<!-- 'required': ['|',-->
|
||||||
<!-- ('takaful_payment_method','=','bank'),-->
|
<!-- ('takaful_payment_method','=','bank'),-->
|
||||||
<!-- ('takaful_payment_method','=','check')-->
|
<!-- ('takaful_payment_method','=','check')-->
|
||||||
<!-- ]-->
|
<!-- ]-->
|
||||||
<!-- }"-->
|
<!-- }"-->
|
||||||
<!-- optional="hide"/>-->
|
<!-- optional="hide"/>-->
|
||||||
<!-- </tree>-->
|
<!-- </tree>-->
|
||||||
<!-- </field>-->
|
<!-- </field>-->
|
||||||
<!-- </page>-->
|
<!-- </page>-->
|
||||||
<!-- </notebook>-->
|
<!-- </notebook>-->
|
||||||
<!-- </xpath>-->
|
<!-- </xpath>-->
|
||||||
<!-- <xpath expr="//footer/button[@name='action_create_payments']" position="after">-->
|
<!-- <xpath expr="//footer/button[@name='action_create_payments']" position="after">-->
|
||||||
<!-- <button name="action_register_all_lines"-->
|
<!-- <button name="action_register_all_lines"-->
|
||||||
<!-- type="object"-->
|
<!-- type="object"-->
|
||||||
<!-- string="Register All Lines"-->
|
<!-- string="Register All Lines"-->
|
||||||
<!-- class="btn-secondary"-->
|
<!-- class="btn-secondary"-->
|
||||||
<!-- attrs="{'invisible': [('line_ids','=',False)]}"/>-->
|
<!-- attrs="{'invisible': [('line_ids','=',False)]}"/>-->
|
||||||
<!-- </xpath>-->
|
<!-- </xpath>-->
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ from odoo import models, fields, api, _
|
||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from dateutil.relativedelta import relativedelta
|
from dateutil.relativedelta import relativedelta
|
||||||
import logging
|
import logging
|
||||||
|
from odoo.tools import float_compare
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
@ -17,6 +19,12 @@ class DonationExtensionWizard(models.TransientModel):
|
||||||
required=True,
|
required=True,
|
||||||
default=lambda self: self._compute_line_ids(),
|
default=lambda self: self._compute_line_ids(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
payment_line_ids = fields.One2many(
|
||||||
|
'extension.payment.wizard.line',
|
||||||
|
'wizard_id',
|
||||||
|
string='Payments',
|
||||||
|
)
|
||||||
|
|
||||||
months = fields.Integer(
|
months = fields.Integer(
|
||||||
string='Extension Months',
|
string='Extension Months',
|
||||||
|
|
@ -25,6 +33,27 @@ class DonationExtensionWizard(models.TransientModel):
|
||||||
help='Number of months to extend'
|
help='Number of months to extend'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
is_different_payment = fields.Boolean(string='Is Different Payment')
|
||||||
|
total_extension_amount = fields.Float(
|
||||||
|
string='Total Extension Amount',
|
||||||
|
compute='_compute_total_extension_amount',
|
||||||
|
store=True,
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.depends('line_ids.total_donation_amount')
|
||||||
|
def _compute_total_extension_amount(self):
|
||||||
|
for rec in self:
|
||||||
|
rec.total_extension_amount = sum(line.total_donation_amount for line in rec.line_ids if line.direct_debit == False)
|
||||||
|
|
||||||
|
@api.constrains('is_different_payment', 'payment_line_ids')
|
||||||
|
def _check_payment_sum_when_different(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.is_different_payment:
|
||||||
|
sum_payments = sum(line.payment_amount for line in rec.payment_line_ids)
|
||||||
|
if float_compare(sum_payments, rec.total_extension_amount, precision_digits=2) != 0:
|
||||||
|
raise ValidationError(_("Total payment amounts (%s) must equal total extension amount (%s).") %
|
||||||
|
(sum_payments, rec.total_extension_amount))
|
||||||
|
|
||||||
def _compute_line_ids(self):
|
def _compute_line_ids(self):
|
||||||
extension_line_ids = [(5,)]
|
extension_line_ids = [(5,)]
|
||||||
donation_detail_ids = self.env['donations.details.lines'].browse(self.env.context.get('donation_detail_ids'))
|
donation_detail_ids = self.env['donations.details.lines'].browse(self.env.context.get('donation_detail_ids'))
|
||||||
|
|
@ -58,8 +87,28 @@ class DonationExtensionWizard(models.TransientModel):
|
||||||
if result:
|
if result:
|
||||||
invoice_ids += result[0]
|
invoice_ids += result[0]
|
||||||
donation_line_ids += result[1]
|
donation_line_ids += result[1]
|
||||||
|
|
||||||
if invoice_ids:
|
if invoice_ids and self.is_different_payment:
|
||||||
|
for pay_line in self.payment_line_ids:
|
||||||
|
payment_register_vals = {
|
||||||
|
'payment_type': 'inbound',
|
||||||
|
'partner_type': 'customer',
|
||||||
|
'partner_id': pay_line.partner_id.id,
|
||||||
|
'amount': pay_line.payment_amount,
|
||||||
|
'journal_id': pay_line.journal_id.id,
|
||||||
|
'payment_method_id': pay_line.payment_method.id,
|
||||||
|
'communication': _("Extension Payment"),
|
||||||
|
}
|
||||||
|
|
||||||
|
payment_register = self.env['account.payment.register'].sudo().with_context(
|
||||||
|
active_model='account.move',
|
||||||
|
active_ids=invoice_ids.ids,
|
||||||
|
).create(payment_register_vals)
|
||||||
|
print('.................',payment_register)
|
||||||
|
payment_register.action_create_payments()
|
||||||
|
|
||||||
|
|
||||||
|
elif invoice_ids and not self.is_different_payment:
|
||||||
return {
|
return {
|
||||||
'name': _('Register Payment'),
|
'name': _('Register Payment'),
|
||||||
'res_model': 'account.payment.register',
|
'res_model': 'account.payment.register',
|
||||||
|
|
@ -96,6 +145,70 @@ class DonationExtensionWizard(models.TransientModel):
|
||||||
"""
|
"""
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|
||||||
|
class ExtensionPaymentWizardLine(models.TransientModel):
|
||||||
|
_name = 'extension.payment.wizard.line'
|
||||||
|
_description = "Extension Payment Wizard Line"
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _default_journal_id(self):
|
||||||
|
journal_id = self.env.company.sponsorship_direct_debit_journal_id.id
|
||||||
|
return journal_id if journal_id else False
|
||||||
|
@api.model
|
||||||
|
def _default_payment_method_id(self):
|
||||||
|
payment_method = self.env['takaful.payment.method'].sudo().search(
|
||||||
|
[('payment_method', '=', 'cash')],
|
||||||
|
limit=1
|
||||||
|
)
|
||||||
|
return payment_method.id if payment_method else False
|
||||||
|
|
||||||
|
|
||||||
|
wizard_id = fields.Many2one('donation.extension.wizard', string='Wizard', required=True)
|
||||||
|
donation_line_ids = fields.Many2many('donations.details.lines')
|
||||||
|
payment_method = fields.Many2one('takaful.payment.method', string="Payment Method", required=True, default=_default_payment_method_id)
|
||||||
|
partner_bank_id = fields.Many2one("res.partner.bank", string="Partner Bank", domain="[('partner_id', '=', partner_id)]")
|
||||||
|
payment_file_attachment = fields.Binary(string='Payment Attachment', attachment=True)
|
||||||
|
journal_id = fields.Many2one('account.journal', string="Journal", domain="[('type','=','bank')]",
|
||||||
|
default=_default_journal_id)
|
||||||
|
check_number = fields.Char(string='Check Number')
|
||||||
|
check_due_date = fields.Date(string='Check Due Date')
|
||||||
|
payment_amount = fields.Float(string='Payment Amount',
|
||||||
|
help="Amount to be paid for this line (when different payments used).",
|
||||||
|
default=0.0)
|
||||||
|
currency_id = fields.Many2one('res.currency', string='Currency',
|
||||||
|
default=lambda self: self.env.company.currency_id, readonly=True)
|
||||||
|
payment_method_type= fields.Selection(related='payment_method.payment_method')
|
||||||
|
partner_id = fields.Many2one(
|
||||||
|
'res.partner',
|
||||||
|
compute='_compute_partner_id',
|
||||||
|
store=True
|
||||||
|
)
|
||||||
|
|
||||||
|
@api.onchange('payment_method')
|
||||||
|
def _onchange_payment_method(self):
|
||||||
|
if self.wizard_id and not self.donation_line_ids:
|
||||||
|
self.donation_line_ids = self.wizard_id.line_ids.mapped('donation_line_id').ids
|
||||||
|
|
||||||
|
@api.depends('donation_line_ids')
|
||||||
|
def _compute_partner_id(self):
|
||||||
|
for rec in self:
|
||||||
|
first_line = rec.donation_line_ids[:1]
|
||||||
|
rec.partner_id = first_line.sponsor_id.id if first_line else False
|
||||||
|
|
||||||
|
@api.onchange("payment_method")
|
||||||
|
def onchange_payment_method(self):
|
||||||
|
for rec in self:
|
||||||
|
if rec.payment_method and rec.payment_method.journal_id:
|
||||||
|
rec.journal_id = rec.payment_method.journal_id.id
|
||||||
|
payment_method = rec.payment_method.payment_method
|
||||||
|
j_type = ""
|
||||||
|
if payment_method == "cash":
|
||||||
|
j_type = "cash"
|
||||||
|
elif payment_method in ("bank", "check", "network"):
|
||||||
|
j_type = "bank"
|
||||||
|
if j_type:
|
||||||
|
return {"domain": {"journal_id": [("type", "=", j_type)]}}
|
||||||
|
|
||||||
|
|
||||||
class DonationExtensionWizardLine(models.TransientModel):
|
class DonationExtensionWizardLine(models.TransientModel):
|
||||||
_name = 'donation.extension.wizard.line'
|
_name = 'donation.extension.wizard.line'
|
||||||
_description = "Donation Extension Wizard Line"
|
_description = "Donation Extension Wizard Line"
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@
|
||||||
<group>
|
<group>
|
||||||
<group string="Extension Details">
|
<group string="Extension Details">
|
||||||
<field name="months"/>
|
<field name="months"/>
|
||||||
|
<field name="is_different_payment"/>
|
||||||
</group>
|
</group>
|
||||||
</group>
|
</group>
|
||||||
<notebook>
|
<notebook>
|
||||||
|
|
@ -77,6 +78,68 @@
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
</page>
|
</page>
|
||||||
|
<page string="Sub Payments" attrs="{'invisible': [('is_different_payment', '=', False)]}">
|
||||||
|
<field name="payment_line_ids" attrs="{'invisible': [('is_different_payment', '=', False)]}" nolabel="1">
|
||||||
|
<tree editable="bottom" delete="true" create="true">
|
||||||
|
<field name="payment_method" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||||
|
<field name="currency_id" invisible="1"/>
|
||||||
|
<field name="donation_line_ids" invisible="1"/>
|
||||||
|
<field name="payment_method_type" invisible="1"/>
|
||||||
|
<field name="partner_id" invisible="1"/>
|
||||||
|
<field name="journal_id" string="Association Journal"/>
|
||||||
|
<field name="payment_amount" widget="monetary"
|
||||||
|
options="{'currency_field': 'currency_id'}" force_save="1"/>
|
||||||
|
<field name="check_number"
|
||||||
|
attrs="{
|
||||||
|
'invisible': [
|
||||||
|
('payment_method_type','!=','check')
|
||||||
|
],
|
||||||
|
'required': [
|
||||||
|
('payment_method_type','=','check')
|
||||||
|
]
|
||||||
|
}"
|
||||||
|
optional="hide"/>
|
||||||
|
<field name="check_due_date"
|
||||||
|
attrs="{
|
||||||
|
'invisible': [
|
||||||
|
('payment_method_type','!=','check')
|
||||||
|
],
|
||||||
|
'required': [
|
||||||
|
('payment_method_type','=','check')
|
||||||
|
]
|
||||||
|
}"
|
||||||
|
optional="hide"/>
|
||||||
|
<field name="partner_bank_id"
|
||||||
|
context="{
|
||||||
|
'form_view_ref': 'odex_takaful.res_partner_bank_view_form_quick_create',
|
||||||
|
'default_partner_id': context.get('force_sponsorship_line_partner_id')
|
||||||
|
}"
|
||||||
|
attrs="{
|
||||||
|
'required': [
|
||||||
|
('payment_method_type','=','bank')
|
||||||
|
],
|
||||||
|
'invisible': [
|
||||||
|
('payment_method_type','!=','bank')
|
||||||
|
]
|
||||||
|
}"
|
||||||
|
readonly="0"
|
||||||
|
optional="hide"/>
|
||||||
|
<field name="payment_file_attachment"
|
||||||
|
widget="binary"
|
||||||
|
filename="payment_file_attachment_name"
|
||||||
|
attrs="{
|
||||||
|
'invisible': [
|
||||||
|
('payment_method_type','not in',['bank', 'check'])
|
||||||
|
],
|
||||||
|
'required': ['|',
|
||||||
|
('payment_method_type','=','bank'),
|
||||||
|
('payment_method_type','=','check')
|
||||||
|
]
|
||||||
|
}"
|
||||||
|
optional="hide"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</sheet>
|
</sheet>
|
||||||
<footer>
|
<footer>
|
||||||
|
|
|
||||||
|
|
@ -130,46 +130,46 @@ class ReplacementWiz(models.TransientModel):
|
||||||
('sponsor_related_id', '=', False),
|
('sponsor_related_id', '=', False),
|
||||||
('general_restriction', '=', False)
|
('general_restriction', '=', False)
|
||||||
]])
|
]])
|
||||||
if rec.old_members_id.relationn.relation_type in ['mother','replacement_mother']:
|
# if rec.old_members_id.relationn.relation_type in ['mother','replacement_mother']:
|
||||||
|
# domain = expression.AND([domain, [
|
||||||
|
# ('relationn.relation_type', 'in', ['mother', 'replacement_mother'])
|
||||||
|
# ]])
|
||||||
|
# elif rec.old_members_id.relationn.relation_type in ['son','daughter']:
|
||||||
|
# domain = expression.AND([domain, [
|
||||||
|
# ('relationn.relation_type', 'in', ['son', 'daughter'])
|
||||||
|
# ]])
|
||||||
|
if 1 <= rec.old_members_id.age <= 6:
|
||||||
domain = expression.AND([domain, [
|
domain = expression.AND([domain, [
|
||||||
('relationn.relation_type', 'in', ['mother', 'replacement_mother'])
|
('age', '>=',1)
|
||||||
]])
|
]])
|
||||||
elif rec.old_members_id.relationn.relation_type in ['son','daughter']:
|
|
||||||
domain = expression.AND([domain, [
|
domain = expression.AND([domain, [
|
||||||
('relationn.relation_type', 'in', ['son', 'daughter'])
|
('age', '<=', 6)
|
||||||
|
]])
|
||||||
|
elif 7 <= rec.old_members_id.age <= 10:
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '>=',7)
|
||||||
|
]])
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '<=', 10)
|
||||||
|
]])
|
||||||
|
elif 11 <= rec.old_members_id.age <= 15:
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '>=',11)
|
||||||
|
]])
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '<=', 15)
|
||||||
|
]])
|
||||||
|
elif 16 <= rec.old_members_id.age <= 18:
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '>=',16)
|
||||||
|
]])
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '<=', 18)
|
||||||
|
]])
|
||||||
|
elif rec.old_members_id.age > 18:
|
||||||
|
domain = expression.AND([domain, [
|
||||||
|
('age', '>',18)
|
||||||
]])
|
]])
|
||||||
if 1 <= rec.old_members_id.age <= 6:
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '>=',1)
|
|
||||||
]])
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '<=', 6)
|
|
||||||
]])
|
|
||||||
elif 7 <= rec.old_members_id.age <= 10:
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '>=',7)
|
|
||||||
]])
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '<=', 10)
|
|
||||||
]])
|
|
||||||
elif 11 <= rec.old_members_id.age <= 15:
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '>=',11)
|
|
||||||
]])
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '<=', 15)
|
|
||||||
]])
|
|
||||||
elif 16 <= rec.old_members_id.age <= 18:
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '>=',16)
|
|
||||||
]])
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '<=', 18)
|
|
||||||
]])
|
|
||||||
elif rec.old_members_id.age > 18:
|
|
||||||
domain = expression.AND([domain, [
|
|
||||||
('age', '>',18)
|
|
||||||
]])
|
|
||||||
|
|
||||||
|
|
||||||
members = self.env['family.member'].sudo().search(domain)
|
members = self.env['family.member'].sudo().search(domain)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue