diff options
| author | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-07 08:49:07 +0700 |
|---|---|---|
| committer | Mqdd <ahmadmiqdad27@gmail.com> | 2026-01-07 08:49:07 +0700 |
| commit | 32367b9f81a74915dd1deebcb4553685797f1773 (patch) | |
| tree | 97bd3fd31b82830aa95281e25401cb47ae0b06b7 /fixco_custom/models/sale.py | |
| parent | 4c43a3f542de0d0dea89c514f0e038459415b544 (diff) | |
| parent | 52767afb54fe6e2ef2e2a976a5730c9299ef2ea0 (diff) | |
Merge branch 'main' of https://bitbucket.org/altafixco/fixco-addons into print_picking_list
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([ |
