diff options
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([ |
