[FIX] point_of_sale: anglo saxon price unit when invoicing before closing the session
Task 2041208 1. I create a product with fifo and real_time valuation (make sure the invoicing policy is 'delivered' and make it available in pos). 2. set the cost of the product to be 5.0 and sale price to be 10.0. 3. I update its inventory and set 5 items. -> total valuation of 25. 4. I change the cost of the product to 1.0. 5. I update again the quantity to 10, making the valuation of the product to 30.0. 6. I configure point of sale to allow invoicing. 7. Open a pos session then sell 7 items of the product (invoice the order). 8. Since the product is fifo, this means that the cost of goods sold is 5 * 5.0 + 2 * 1.0 = 27.0. 9. The correct expense account line should have balance of 27.0. 10. The correct output account line should have balance of -27.0 Followp of https://github.com/odoo/odoo/pull/35335 There was missing the part when an invoice is created from the POS When the invoice is created from action_pos_order_invoice, it only contains invoice_line_ids. The stock valuation lines are present when the account.move is posted through addons/stock_account/models/account_move.py post method. That method requires _stock_account_get_anglo_saxon_price_unit to give the average unit price if it comes from a pos.order, just like it does when a sale.order. closes odoo/odoo#35379 Signed-off-by:Simon Lejeune (sle) <sle@openerp.com>
Showing
- addons/point_of_sale/models/__init__.py 1 addition, 0 deletionsaddons/point_of_sale/models/__init__.py
- addons/point_of_sale/models/account_move.py 24 additions, 0 deletionsaddons/point_of_sale/models/account_move.py
- addons/point_of_sale/models/pos_order.py 1 addition, 0 deletionsaddons/point_of_sale/models/pos_order.py
- addons/point_of_sale/tests/test_anglo_saxon.py 56 additions, 14 deletionsaddons/point_of_sale/tests/test_anglo_saxon.py
Loading
Please register or sign in to comment