Skip to content
Snippets Groups Projects
Commit 93c65791 authored by Joseph Caburnay's avatar Joseph Caburnay Committed by fw-bot
Browse files

[FIX] point_of_sale: reconcile invoice anglo-saxon lines


Reconcile the stock output lines of the pos.order invoice
for products with real-time valuation. This is to be more
consistent with the sales module.

closes odoo/odoo#38437

Task-id: 2048668
X-original-commit: 1eaea47c
Signed-off-by: default avatarpimodoo <pimodoo@users.noreply.github.com>
parent 88cd1f1c
No related branches found
No related tags found
No related merge requests found
......@@ -9,6 +9,13 @@ class AccountMove(models.Model):
pos_order_ids = fields.One2many('pos.order', 'account_move')
def _stock_account_get_last_step_stock_moves(self):
stock_moves = super(AccountMove, self)._stock_account_get_last_step_stock_moves()
for invoice in self.filtered(lambda x: x.type == 'out_invoice'):
stock_moves += invoice.mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_dest_id.usage == 'customer')
for invoice in self.filtered(lambda x: x.type == 'out_refund'):
stock_moves += invoice.mapped('pos_order_ids.picking_id.move_lines').filtered(lambda x: x.state == 'done' and x.location_id.usage == 'customer')
return stock_moves
class AccountMoveLine(models.Model):
_inherit = 'account.move.line'
......
......@@ -190,5 +190,9 @@ class TestPoSStock(TestPoSCommon):
invoiced_output_account_lines = invoiced_order.account_move.line_ids.filtered(lambda line: line.account_id == self.output_account)
self.assertAlmostEqual(sum(invoiced_output_account_lines.mapped('balance')), -121.0)
# The stock output account move lines of the invoiced order should be properly reconciled
for move_line in invoiced_order.account_move.line_ids.filtered(lambda line: line.account_id == self.output_account):
self.assertTrue(move_line.full_reconcile_id)
self.assertTrue(receivable_line_cash.full_reconcile_id, msg='Cash receivable line should be fully-reconciled.')
self.assertTrue(output_line.full_reconcile_id, msg='The stock output account line should be fully-reconciled.')
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment