Skip to content

Commit

Permalink
[IMP] account_receipt_sale: Prepare invoice instead of forcing receipt
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTakobi authored and eLBati committed Oct 21, 2022
1 parent fd7e5d3 commit 828fa64
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
1 change: 0 additions & 1 deletion account_receipt_sale/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from . import account_fiscal_position
from . import partner
from . import sale
from . import account_move
14 changes: 0 additions & 14 deletions account_receipt_sale/models/account_move.py

This file was deleted.

19 changes: 6 additions & 13 deletions account_receipt_sale/models/sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,19 +111,12 @@ def _onchange_fiscal_position_id_receipts(self):
if self.fiscal_position_id:
self.receipts = self.fiscal_position_id.receipts

def _create_invoices(self, grouped=False, final=False, date=None):
sale_receipts = self.filtered(lambda o: o.receipts)
sale_no_receipts = self.filtered(lambda o: not o.receipts)
moves = self.env["account.move"]
if sale_receipts:
moves |= super(
SaleOrder, sale_receipts.with_context(force_move_type="out_receipt")
)._create_invoices(grouped, final, date)
if sale_no_receipts:
moves |= super(SaleOrder, sale_no_receipts)._create_invoices(
grouped, final, date
)
return moves
def _prepare_invoice(self):
invoice_values = super()._prepare_invoice()
if self.receipts:
invoice_values["move_type"] = "out_receipt"
self.env["account.move"]._update_receipts_journal([invoice_values])
return invoice_values


class OrderLine(models.Model):
Expand Down

0 comments on commit 828fa64

Please sign in to comment.