Merge pull request #6183 from expsa/14.0-fix-odex_takaful-auto-20260113_145935

[IMP] odex_takaful: improve data models and business logic
This commit is contained in:
Mohamed Eltayar 2026-01-13 15:21:51 +03:00 committed by GitHub
commit ac9d7fc999
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 8 deletions

View File

@ -993,14 +993,15 @@ class TakafulSponsorship(models.Model):
vendor_bill_vals.append(bill_values)
bill_id = self.env['account.move'].sudo().create(vendor_bill_vals)
for line in bill_id.invoice_line_ids:
line.account_id = line._get_computed_account()
taxes = line._get_computed_taxes()
if taxes and line.move_id.fiscal_position_id:
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
line.tax_ids = taxes
line.product_uom_id = line._get_computed_uom()
bill_id.action_post()
for bill in bill_id:
for line in bill.invoice_line_ids:
line.account_id = line._get_computed_account()
taxes = line._get_computed_taxes()
if taxes and line.move_id.fiscal_position_id:
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
line.tax_ids = taxes
line.product_uom_id = line._get_computed_uom()
bill.action_post()
else:
sponsorship.state = 'wait_pay'