Merge pull request #5975 from expsa/14.0-i18n-odex_takaful-auto-20260105_003754
[FIX] odex_takaful: improve data models and business logic
This commit is contained in:
commit
dc978aeb49
|
|
@ -7657,4 +7657,76 @@ msgstr "مساهمة مالية بالأمر %s"
|
|||
#: model:ir.model.fields.selection,name:odex_takaful.selection__takaful_sponsorship__state__paid
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_sponsorship_view_search
|
||||
msgid "Paid"
|
||||
msgstr "تم الدفع"
|
||||
msgstr "تم الدفع"
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.view_account_payment_register_form
|
||||
msgid "Donor Bank Account"
|
||||
msgstr "حساب المتبرع"
|
||||
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.donation_extension_wizard
|
||||
msgid "Months Amount"
|
||||
msgstr "مبلغ الشهور"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.replace_benefit_wizard
|
||||
msgid "Replacement Information"
|
||||
msgstr "معلومات الاستبدال"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.replace_benefit_wizard
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.orphan_replacement_wizard
|
||||
msgid "Replacement Reason"
|
||||
msgstr "سبب الاستبدال"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.add_benefit_wizard
|
||||
msgid "Benefit Information"
|
||||
msgstr "معلومات المستفيد"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.add_benefit_wizard
|
||||
msgid "Add Benefit"
|
||||
msgstr "إضافة مستفيد"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.replace_sponsor_wizard
|
||||
msgid "Sponsor Information"
|
||||
msgstr "معلومات المتبرع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.replace_sponsor_wizard
|
||||
msgid "Replace Sponsor"
|
||||
msgstr "استبدال المتبرع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.transfer_deduction_wizard_views
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.benefit_month_payment_wiz_view
|
||||
msgid "Print PDF"
|
||||
msgstr "طباعة PDF"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.transfer_deduction_wizard_views
|
||||
msgid "Print Excel"
|
||||
msgstr "طباعة Excel"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.orphan_replacement_wizard
|
||||
msgid "Replacement Wizard"
|
||||
msgstr "معالج الاستبدال"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.esterdad_wizard
|
||||
msgid "Esterdad Wizard"
|
||||
msgstr "معالج الاسترداد"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.esterdad_wizard
|
||||
msgid "Payment Details"
|
||||
msgstr "تفاصيل الدفع"
|
||||
|
||||
#. module: odex_takaful
|
||||
#: model_terms:ir.ui.view,arch_db:odex_takaful.takaful_reports_wizards
|
||||
msgid "Print The Report"
|
||||
msgstr "طباعة التقرير"
|
||||
|
|
|
|||
|
|
@ -236,7 +236,7 @@ class DonationsDetailsLines(models.Model):
|
|||
# bank_transfer_attachment_file_name = fields.Char('Bank Transfer File Name', required=False)
|
||||
|
||||
|
||||
@api.depends('sponsorship_duration' , 'product_template_id' , 'payment_month_count' , 'direct_debit')
|
||||
@api.depends('sponsorship_duration', 'product_template_id', 'payment_month_count', 'direct_debit', 'record_type')
|
||||
def _compute_get_age_range(self):
|
||||
for rec in self:
|
||||
# ages field is only used for sponsorships (in _compute_members_domain_ids)
|
||||
|
|
@ -735,7 +735,8 @@ class DonationsDetailsLines(models.Model):
|
|||
@api.depends('family_id','record_type')
|
||||
def _compute_family_domain_ids(self):
|
||||
for rec in self:
|
||||
if rec.record_type == 'donation':
|
||||
# Only fetch families for conditional donations where family_id field is used
|
||||
if rec.record_type == 'donation' and rec.donation_mechanism == 'with_conditions':
|
||||
domain = [
|
||||
'|',
|
||||
('state', '=', 'second_approve'),
|
||||
|
|
@ -745,7 +746,7 @@ class DonationsDetailsLines(models.Model):
|
|||
family = self.env['grant.benefit'].sudo().search(domain)
|
||||
rec.family_domain_ids = [(6, 0, family.ids)] if family else False
|
||||
else:
|
||||
# No family selection needed for sponsorships or other types
|
||||
# No family selection needed for sponsorships, unconditional donations, or other types
|
||||
rec.family_domain_ids = False
|
||||
|
||||
@api.depends('gender',
|
||||
|
|
|
|||
|
|
@ -829,7 +829,6 @@ class TakafulSponsorship(models.Model):
|
|||
family_lines = sponsorship_lines.filtered(lambda l: l.family_id == family)
|
||||
bill_values = {
|
||||
'takaful_sponsorship_id': sponsorship.id,
|
||||
'name': self.env['ir.sequence'].next_by_code('account.move.accrsp'),
|
||||
'move_type': 'in_invoice',
|
||||
'journal_id': benefit_journal_id,
|
||||
'date': fields.Date.today(),
|
||||
|
|
@ -1480,7 +1479,7 @@ class TakafulSponsorship(models.Model):
|
|||
current_invoice.sudo().write(invoice_values)
|
||||
invoice_id = current_invoice
|
||||
else:
|
||||
invoice_values.update({'invoice_line_ids': invoice_line_vals, 'name': self.env['ir.sequence'].next_by_code('account.move.accrsp')})
|
||||
invoice_values.update({'invoice_line_ids': invoice_line_vals})
|
||||
invoice_id = Invoice.create(invoice_values)
|
||||
|
||||
for line in invoice_id.invoice_line_ids:
|
||||
|
|
|
|||
|
|
@ -135,7 +135,6 @@ class AccountRegisterPayment(models.TransientModel):
|
|||
|
||||
bill_values = {
|
||||
'takaful_sponsorship_id': sponsorship.id,
|
||||
'name': self.env['ir.sequence'].next_by_code('account.move.accrsp'),
|
||||
'move_type': 'in_invoice',
|
||||
'journal_id': benefit_journal_id,
|
||||
'date': fields.Date.today(),
|
||||
|
|
|
|||
|
|
@ -7,6 +7,39 @@
|
|||
<field name="model">account.payment.register</field>
|
||||
<field name="inherit_id" ref="account.view_account_payment_register_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//label[@for='amount']" position="attributes">
|
||||
<attribute name="invisible">1</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='amount_div']" position="attributes">
|
||||
<attribute name="colspan">2</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='amount']" position="attributes">
|
||||
<attribute name="class">oe_center saudi_amount_field</attribute>
|
||||
<attribute name="style">font-size: 60px !important; height: 90px !important; font-weight: 800 !important; background-color: transparent; border: none !important; flex: 1 !important; min-width: 0 !important; text-align: center; font-family: 'SF Pro Display', 'Roboto', sans-serif; display: flex !important; flex-direction: row-reverse !important; justify-content: center !important; align-items: center !important; letter-spacing: -2px;</attribute>
|
||||
<attribute name="placeholder">0.00</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//group" position="before">
|
||||
<style>
|
||||
.saudi_amount_field {
|
||||
color: #006C35 !important; /* Saudi Green for Symbol */
|
||||
}
|
||||
.saudi_amount_field .o_input {
|
||||
color: #2C3E50 !important; /* Dark Blue-Grey for Number */
|
||||
border: none !important;
|
||||
border-bottom: none !important;
|
||||
box-shadow: none !important;
|
||||
background-color: transparent !important;
|
||||
width: auto !important; /* Fix: Allow flex to control width */
|
||||
flex: 1 !important;
|
||||
min-width: 0 !important;
|
||||
}
|
||||
.saudi_amount_field .o_input:focus {
|
||||
outline: none !important;
|
||||
box-shadow: none !important;
|
||||
border: none !important;
|
||||
}
|
||||
</style>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='amount']" position="after">
|
||||
<field name="is_refund_sponsorship" invisible="1"/>
|
||||
<field name="show_payment_group" invisible="1"/>
|
||||
|
|
@ -35,12 +68,15 @@
|
|||
<attribute name="invisible">context.get('sponsorship_payment')</attribute>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='payment_date']" position="attributes">
|
||||
<attribute name="readonly">context.get('sponsorship_payment')</attribute>
|
||||
<xpath expr="//field[@name='payment_date']" position="replace">
|
||||
<field name="payment_date" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='communication']" position="replace">
|
||||
<field name="communication" invisible="1"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='journal_id']" position="before">
|
||||
<field name="takaful_payment_method_id" attrs="{'invisible': [('sponsorship_payment', '=', False)]}" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
<field name="takaful_payment_method_id" string="Payment Method" attrs="{'invisible': [('sponsorship_payment', '=', False)]}" options="{'no_create': True, 'no_create_edit': True}"/>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='partner_bank_id']" position="after">
|
||||
|
|
@ -50,17 +86,18 @@
|
|||
<field name="payment_method" invisible="1"/>
|
||||
<field name="check_number" 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="partner_bank_id" options="{'skip_disable_quick_create': True}" 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')]}" create="1" edit="1"/>
|
||||
<field name="partner_bank_id" string="Donor Bank Account" options="{'skip_disable_quick_create': True}" 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')]}" create="1" edit="1"/>
|
||||
<field name="transaction_file_attachment" widget="binary"
|
||||
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')]}"/>
|
||||
<field name="transaction_attachment_file_name" invisible="1"/>
|
||||
<field name="payment_date" attrs="{'readonly': [('sponsorship_payment', '=', True)]}"/>
|
||||
<field name="communication"/>
|
||||
</xpath>
|
||||
<xpath expr="//footer/button[2]" position="replace">
|
||||
<!-- <field name="show_cancel_button" invisible="1"/>-->
|
||||
<button name="action_cancel"
|
||||
type="object"
|
||||
string="Cancel"
|
||||
<button string="Cancel"
|
||||
special="cancel"
|
||||
class="btn-secondary"/>
|
||||
<!-- attrs="{'invisible': [('show_cancel_button', '=', True)]}" />-->
|
||||
</xpath>
|
||||
|
|
|
|||
|
|
@ -435,7 +435,6 @@ class DonationExtensionWizardLine(models.TransientModel):
|
|||
Invoice = self.env["account.move"].sudo()
|
||||
invoice_values = {
|
||||
'takaful_sponsorship_id': sponsorship.id,
|
||||
'name': self.env['ir.sequence'].next_by_code('account.move.accrsp'),
|
||||
'move_type': 'out_invoice',
|
||||
'journal_id': int(kafala_journal_id),
|
||||
'date': fields.Date.today(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue