diff --git a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py index f7819e1dc..f7418cacf 100644 --- a/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py +++ b/odex25_ensan/odex_takaful/models/takaful_sponorship_model.py @@ -1169,7 +1169,7 @@ class DonationsDetailsLines(models.Model): class PaymentDetailsLines(models.Model): _name = "payment.details.lines" - payment_method = fields.Selection(selection=[("cash", "Cash"),("card", "Card"),("check", "Check"),("credit_card", "Credit Card")]) + payment_method = fields.Selection(selection=[("cash", "Cash"),("card", "Card"),("check", "Check"),("credit_card", "Credit Card"),("bank_transfer", "Bank Transfer"),("direct_debit", "Direct Debit")]) donation_amount = fields.Float(string='Donation Amount') donation_date = fields.Date(string='Donation Date',default=lambda self: fields.Date.today()) note = fields.Char(string='Note') @@ -1182,6 +1182,27 @@ class PaymentDetailsLines(models.Model): check_number = fields.Char(string='Check Number') account_payment_method = fields.Many2one('account.payment.method.line',domain="[('payment_type','=','inbound')]",string='Account Payment Method') branch_custom_id = fields.Many2one('branch.settings', string="Branch",related='sponsorship_id.branch_custom_id') + sponsor_account_number = fields.Char(string='Sponsor Account Number') + sa_iban = fields.Char('SA',default='SA',readonly=True) + charity_bank_id = fields.Many2one('account.journal', string="charity Bank") + bank_transfer_amount = fields.Float(string='Bank Transfer Amount') + direct_debit_amount = fields.Float(string='Direct Debit Amount') + payment_attachment = fields.Many2many('ir.attachment', 'rel_attachment_payment_details', 'payment_id','attachment_id', string='Payment Attachment') + direct_debit_start_date = fields.Date(string='Direct Debit Start Date') + direct_debit_end_date = fields.Date(string='Direct Debit End Date') + + @api.onchange('sponsor_account_number') + def onchange_sponsor_account_number(self): + if self.sponsor_account_number: + # Check if the value is numeric before anything else + if not self.sponsor_account_number.isdigit(): + raise ValidationError(_("The account number should contain only digits.")) + + # Check if the account number contains exactly 22 digits + if len(self.sponsor_account_number) != 22: + raise ValidationError(_("The IBAN number must contain exactly 22 digits.")) + + @api.model diff --git a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml index cce23028e..c23891183 100644 --- a/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml +++ b/odex25_ensan/odex_takaful/views/takaful_sponorship_view.xml @@ -243,19 +243,31 @@ - + + - + + + - - - + + + +