Merge pull request #5183 from expsa/kll_dev_odex25_ensan

[IMP] odex_benefit: imp benefit
This commit is contained in:
kchyounes19 2025-11-03 14:06:10 +01:00 committed by GitHub
commit a9c94d5f0c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 80 additions and 53 deletions

View File

@ -33,6 +33,10 @@ class SeasonalService(models.Model):
], string='state', default='draft', tracking=True, copy=False)
is_payment_order_done = fields.Boolean(string='Is Payment Order Done?', copy=False)
account_id = fields.Many2one('account.account', string='Expenses Account', related="service_type_id.account_id")
service_requests_ids = fields.One2many('service.request', 'seasonal_service_id', string='Service Requests')
benefit_ids = fields.Many2many(comodel_name='grant.benefit', relation='benefit_grant_seasonal_service_rel',
column1='seasonal_service_id',
column2='benefit_id', string='Families',copy=False)
@api.depends('service_type_id','service_type_id.benefit_category_ids')
@ -128,12 +132,16 @@ class SeasonalService(models.Model):
def action_approval_of_beneficiary_services(self):
for rec in self:
if not rec.family_ids:
raise UserError(_("You Must Enter Families First"))
if not rec.service_requests_ids:
raise UserError(_("You must add at least one service request."))
rec.service_requests_ids.write({'state': 'accounting_approve'})
rec.state = 'approval_of_beneficiary_services'
def action_accounting_approve(self):
for rec in self:
rec.service_requests_ids.write({'state': 'send_request_to_supplier'})
rec.state = 'accounting_approve'

View File

@ -190,6 +190,8 @@ class ServiceRequest(models.Model):
string="Driving License")
owner_identity = fields.Many2many('ir.attachment', 'request_owner_identity_rel', 'request_id', 'attachment_id',
string="Owner Identity")
seasonal_service_id = fields.Many2one('seasonal.service', string='Seasonal Service', ondelete='cascade')
is_seasonal = fields.Boolean(string='Is Seasonal Service?',related='service_cat.is_seasonal_service')
@api.depends('requested_service_amount', 'service_max_amount')
def _get_money_for_payment_is_appearance(self):

View File

@ -540,6 +540,7 @@
<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)]</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">Create the Service Request
</p>

View File

@ -9,77 +9,83 @@
<form string="Seasonal Service">
<header>
<button name="action_approval_of_beneficiary_services" type="object"
string="Approve Beneficiary Services" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'draft')]}"
groups="odex_benefit.group_approval_of_beneficiary_services" />
string="Approve Beneficiary Services" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'draft')]}"
groups="odex_benefit.group_approval_of_beneficiary_services"/>
<button name="get_families" type="object"
string="Get Families" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'draft')]}" />
string="Get Families" class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'draft')]}"/>
<button name="action_accounting_approve" type="object"
string="Accounting Approve"
class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'approval_of_beneficiary_services')]}"
groups="odex_benefit.group_benefit_accounting_accept" />
string="Accounting Approve"
class="oe_highlight"
attrs="{'invisible': [('state', '!=', 'approval_of_beneficiary_services')]}"
groups="odex_benefit.group_benefit_accounting_accept"/>
<button name="action_open_exchange_order_wizard"
type="object"
string="امر الصرف"
class="oe_highlight"
attrs="{'invisible': ['|', ('state', '!=', 'accounting_approve'), ('payment_order_id', '!=', False)]}"
groups="odex_benefit.group_benefit_accounting_accept" />
type="object"
string="امر الصرف"
class="oe_highlight"
attrs="{'invisible': ['|', ('state', '!=', 'accounting_approve'), ('payment_order_id', '!=', False)]}"
groups="odex_benefit.group_benefit_accounting_accept"/>
<field name="state" widget="statusbar"
statusbar_visible="draft, approval_of_beneficiary_services,accounting_approve" />
statusbar_visible="draft, approval_of_beneficiary_services,accounting_approve"/>
</header>
<sheet>
<field name="is_payment_order_done" invisible="1" />
<field name="is_payment_order_done" invisible="1"/>
<widget name="web_ribbon" title="Payment Order Done" bg_color="bg-success"
attrs="{'invisible': [('is_payment_order_done', '=', False)]}" />
attrs="{'invisible': [('is_payment_order_done', '=', False)]}"/>
<group>
<group>
<field name="name" attrs="{'readonly': [('state', '!=', 'draft')]}" />
<field name="date" attrs="{'readonly': [('state', '!=', 'draft')]}" />
<field name="name" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="date" attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="service_type_id"
attrs="{'readonly': [('state', '!=', 'draft')]}" />
attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="branch_ids" widget="many2many_tags"
attrs="{'readonly': [('state', '!=', 'draft')]}" />
<field name="family_category_ids" widget="many2many_tags" readonly="1" />
attrs="{'readonly': [('state', '!=', 'draft')]}"/>
<field name="family_category_ids" widget="many2many_tags" readonly="1"/>
<field name="payment_order_id" readonly="1"
groups="odex_benefit.group_benefit_accounting_accept"
attrs="{
groups="odex_benefit.group_benefit_accounting_accept"
attrs="{
'invisible': [('payment_order_id', '=', False)],
'readonly': [('state', '!=', 'draft')]
}" />
}"/>
</group>
<group>
<field name="aid_amount" readonly="1" />
<field name="family_count" readonly="1" />
<field name="benefit_member_count" readonly="1" />
<field name="family_disbursement_total_amount" readonly="1" />
<field name="aid_amount" readonly="1"/>
<field name="family_count" readonly="1"/>
<field name="benefit_member_count" readonly="1"/>
<field name="family_disbursement_total_amount" readonly="1"/>
</group>
</group>
<notebook>
<page string="Families">
<field name="family_ids" widget="one2many_list"
attrs="{'readonly': [('state', '!=', 'draft')]}">
attrs="{'readonly': [('state', '!=', 'draft')]}">
<tree editable="bottom">
<field name="family_id" />
<field name="branch_custom_id" />
<field name="account_id" />
<field name="name" string="Service Number" />
<field name="aid_amount" string="Service Amount" />
<field name="family_id"/>
<field name="branch_custom_id"/>
<field name="account_id"/>
<field name="name" string="Service Number"/>
<field name="aid_amount" string="Service Amount"/>
</tree>
</field>
</page>
<page string="Services Requests">
<field name="service_requests_ids" widget="one2many_list" mode="tree,form"/>
</page>
<page string="Families">
<field name="benefit_ids"/>
</page>
</notebook>
</sheet>
<div class="oe_chatter">
<field name="message_follower_ids" widget="mail_followers"
groups="base.group_user" />
<field name="activity_ids" />
<field name="message_ids" widget="mail_thread" />
groups="base.group_user"/>
<field name="activity_ids"/>
<field name="message_ids" widget="mail_thread"/>
</div>
</form>
</field>
@ -91,14 +97,14 @@
<field name="model">seasonal.service</field>
<field name="arch" type="xml">
<tree string="Seasonal Services">
<field name="name" />
<field name="date" />
<field name="service_type_id" />
<field name="aid_amount" />
<field name="family_count" />
<field name="benefit_member_count" />
<field name="family_disbursement_total_amount" />
<field name="state" />
<field name="name"/>
<field name="date"/>
<field name="service_type_id"/>
<field name="aid_amount"/>
<field name="family_count"/>
<field name="benefit_member_count"/>
<field name="family_disbursement_total_amount"/>
<field name="state"/>
</tree>
</field>
</record>

View File

@ -256,6 +256,7 @@
<field name="refuse_reason" attrs="{'invisible': [('refuse_reason', '=', False)]}"
readonly="1"/>
<field name="required_attach" invisible="1"/>
<field name="is_seasonal" invisible="1"/>
</group>
</group>
<group>

View File

@ -3283,7 +3283,7 @@ msgstr "نظام الكفلاء ونقاط البيع"
#. module: odex_takaful
#: model:res.groups,name:odex_takaful.group_kufula_user
msgid "Kufula User"
msgstr ""
msgstr "مستخدم الكفالات"
#. module: odex_takaful
#: model:ir.model.fields,field_description:odex_takaful.field_takaful_sponsor__lang

View File

@ -213,9 +213,18 @@
<field name="name">Responsible Users can access related Sponsorships</field>
<field name="model_id" ref="model_takaful_sponsorship"/>
<field name="groups" eval="[(4, ref('group_kufula_user'))]"/>
<field name="domain_force">
[('sponsor_id.responsible_user_ids', 'in', [user.id])]
</field>
<field name="domain_force">[('create_uid','=',user.id)]</field>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>
<field name="perm_unlink" eval="1"/>
</record>
<record id="kufula_user_donations_details_lines_access" model="ir.rule">
<field name="name">Users can access related Donations Details Lines</field>
<field name="model_id" ref="model_donations_details_lines"/>
<field name="groups" eval="[(4, ref('group_kufula_user'))]"/>
<field name="domain_force">[('create_uid','=',user.id)]</field>
<field name="perm_read" eval="1"/>
<field name="perm_write" eval="1"/>
<field name="perm_create" eval="1"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<odoo>
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon.png" groups="odex_takaful.group_kufula_user"/>
<menuitem id="takaful_kufula_app_top_menu" sequence="15" name="Kafalat System" web_icon="odex_takaful,static/description/icon.png" groups="odex_takaful.donation_officer_group"/>
<!-- Main Kafalat-->
<menuitem id="kafalat_main_menu" parent="takaful_kufula_app_top_menu"