[FIX] solve bugs from test9
This commit is contained in:
parent
0a95295f26
commit
2d11576926
|
|
@ -7524,3 +7524,48 @@ msgstr "رقم المرجع"
|
||||||
#: model:ir.model.fields,help:odex_takaful.field_account_payment__machine_reference
|
#: model:ir.model.fields,help:odex_takaful.field_account_payment__machine_reference
|
||||||
msgid "Reference number from the payment machine"
|
msgid "Reference number from the payment machine"
|
||||||
msgstr "رقم المرجع من ماكينة الدفع"
|
msgstr "رقم المرجع من ماكينة الدفع"
|
||||||
|
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter Check Due Date."
|
||||||
|
msgstr "يجب إدخال تاريخ الإستحقاق"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter Check Number."
|
||||||
|
msgstr "يجب إدخال رقم الشيك"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter File Attached."
|
||||||
|
msgstr "يجب إدخال المستند"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter Machine."
|
||||||
|
msgstr "يجب إدخال الماكينة"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter Partner Bank ID."
|
||||||
|
msgstr "يجب إدخال بنك المتبرع/الكافل"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter Payment Method."
|
||||||
|
msgstr "يجل إدخال طريقة الدفع"
|
||||||
|
|
||||||
|
#. module: odex_takaful
|
||||||
|
#: code:addons/odex_takaful/wizards/account_payment_register.py:0
|
||||||
|
#, python-format
|
||||||
|
msgid "Please enter journal ID."
|
||||||
|
msgstr "يجب إدخال جساب الجمعية"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -301,6 +301,7 @@ class DonationsDetailsLines(models.Model):
|
||||||
for rec in self:
|
for rec in self:
|
||||||
show_extend_button = (
|
show_extend_button = (
|
||||||
rec.record_type == 'sponsorship' and
|
rec.record_type == 'sponsorship' and
|
||||||
|
rec.sponsorship_duration != "permanent" and
|
||||||
rec.end_date and
|
rec.end_date and
|
||||||
rec.end_date >= today and
|
rec.end_date >= today and
|
||||||
rec.state == 'active'
|
rec.state == 'active'
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
|
@ -271,6 +273,37 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
return super(AccountRegisterPayment, self)._get_batch_available_partner_banks(batch_result, journal)
|
return super(AccountRegisterPayment, self)._get_batch_available_partner_banks(batch_result, journal)
|
||||||
|
|
||||||
def action_create_payments(self):
|
def action_create_payments(self):
|
||||||
|
errors = []
|
||||||
|
|
||||||
|
if self.sponsorship_payment:
|
||||||
|
if not self.takaful_payment_method_id:
|
||||||
|
errors.append(_("Please enter Payment Method."))
|
||||||
|
|
||||||
|
if not self.journal_id:
|
||||||
|
errors.append(_("Please enter journal ID."))
|
||||||
|
|
||||||
|
if self.takaful_payment_method_id:
|
||||||
|
method = self.takaful_payment_method_id.payment_method
|
||||||
|
|
||||||
|
if method in ('check', 'bank'):
|
||||||
|
if not self.partner_bank_id:
|
||||||
|
errors.append(_("Please enter Partner Bank ID."))
|
||||||
|
if not self.transaction_file_attachment:
|
||||||
|
errors.append(_("Please enter File Attached."))
|
||||||
|
|
||||||
|
if method == 'check':
|
||||||
|
if not self.check_number:
|
||||||
|
errors.append(_("Please enter Check Number."))
|
||||||
|
if not self.check_due_date:
|
||||||
|
errors.append(_("Please enter Check Due Date."))
|
||||||
|
|
||||||
|
if method == 'network':
|
||||||
|
if not self.machine_id:
|
||||||
|
errors.append(_("Please enter Machine."))
|
||||||
|
|
||||||
|
if errors:
|
||||||
|
raise ValidationError("\n".join(errors))
|
||||||
|
|
||||||
res = super(AccountRegisterPayment,
|
res = super(AccountRegisterPayment,
|
||||||
self.with_context(skip_account_move_synchronization=True)).action_create_payments()
|
self.with_context(skip_account_move_synchronization=True)).action_create_payments()
|
||||||
|
|
||||||
|
|
@ -291,6 +324,7 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
'no_quick_close': True,
|
'no_quick_close': True,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
return {
|
return {
|
||||||
'type': 'ir.actions.client',
|
'type': 'ir.actions.client',
|
||||||
'tag': 'display_notification',
|
'tag': 'display_notification',
|
||||||
|
|
@ -303,6 +337,7 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
else:
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def action_cancel(self):
|
def action_cancel(self):
|
||||||
|
|
@ -322,5 +357,5 @@ class AccountRegisterPayment(models.TransientModel):
|
||||||
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
else:
|
||||||
return {'type': 'ir.actions.act_window_close'}
|
return {'type': 'ir.actions.act_window_close'}
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@
|
||||||
<field name="machine_id"
|
<field name="machine_id"
|
||||||
options="{'no_create': True, 'no_create_edit': True, 'no_open': True}"
|
options="{'no_create': True, 'no_create_edit': True, 'no_open': True}"
|
||||||
domain="[('branch_custom_id', '=', sponsorship_branch_id)]"
|
domain="[('branch_custom_id', '=', sponsorship_branch_id)]"
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method', '!=', 'network')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method', '=', 'network')]}"/>
|
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method', '!=', 'network')]}"/>
|
||||||
<field name="machine_reference"
|
<field name="machine_reference"
|
||||||
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method', '!=', 'network')]}"/>
|
attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method', '!=', 'network')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
@ -97,20 +97,19 @@
|
||||||
<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" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')], 'required': [('sponsorship_payment', '=', True), ('takaful_payment_method','=','check')]}"/>
|
<field name="check_number" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('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" attrs="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','!=','check')]}"/>
|
||||||
<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','in',['bank','check'])], 'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank','check'])]}" 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="{'invisible': ['|', ('sponsorship_payment', '=', False), ('takaful_payment_method','not in',['bank','check'])]}" create="1" edit="1"/>
|
||||||
<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'])]}"/>
|
||||||
<field name="transaction_attachment_file_name" invisible="1"/>
|
<field name="transaction_attachment_file_name" invisible="1"/>
|
||||||
<field name="payment_date" attrs="{'readonly': [('sponsorship_payment', '=', True)]}"/>
|
<field name="payment_date" attrs="{'readonly': [('sponsorship_payment', '=', True)]}"/>
|
||||||
<field name="communication"/>
|
<field name="communication"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//footer/button[2]" position="replace">
|
<xpath expr="//footer/button[2]" position="replace">
|
||||||
<!-- <field name="show_cancel_button" invisible="1"/>-->
|
<!-- <field name="show_cancel_button" invisible="1"/>-->
|
||||||
<button string="Cancel"
|
<button name="action_cancel" type="object" string="Cancel"
|
||||||
special="cancel"
|
|
||||||
class="btn-secondary"/>
|
class="btn-secondary"/>
|
||||||
<!-- attrs="{'invisible': [('show_cancel_button', '=', True)]}" />-->
|
<!-- attrs="{'invisible': [('show_cancel_button', '=', True)]}" />-->
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue