diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-06 15:25:19 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-06 15:25:19 +0700 |
| commit | 163a039add87b9d3dc3d3b9240e72034edb9d597 (patch) | |
| tree | fdace4793a6adc1d88cbcde6756e83f83a017016 /fixco_custom/models/sale.py | |
| parent | 5230d59fcd311ff5d3fa53c3907e971e97d4fb44 (diff) | |
| parent | d221d6dd6bafba1c49fb942a802160832c0fdb82 (diff) | |
Merge branch 'main' of https://bitbucket.org/altafixco/fixco-addons
merge
Diffstat (limited to 'fixco_custom/models/sale.py')
| -rwxr-xr-x | fixco_custom/models/sale.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fixco_custom/models/sale.py b/fixco_custom/models/sale.py index b7cbe17..8b04538 100755 --- a/fixco_custom/models/sale.py +++ b/fixco_custom/models/sale.py @@ -19,6 +19,18 @@ class SaleOrder(models.Model): remaining_down_payment = fields.Float('Remaining Down Payment', compute='_compute_remaining_down_payment', store=True) + def create_invoices(self): + created_invoices = self.env['account.move'] + for order in self: + # Create invoice for this SO only + invoice = order.with_context(default_invoice_origin=order.name)._create_invoices(final=True) + invoice.action_post() + created_invoices += invoice + + # Link the invoice to the SO + order.invoice_ids += invoice + + def _compute_remaining_down_payment(self): for order in self: down_payments = self.env['account.move'].search([ |
