From be486d6358b2c6abe31ad2093504c5c87872b511 Mon Sep 17 00:00:00 2001 From: Benoit Aimont Date: Fri, 21 May 2021 12:09:35 +0200 Subject: [PATCH] [ADD] fieldservice_stock_account - on invoice, quantity from stock.request with direction inbound should be negative --- fieldservice_stock_account/models/fsm_order.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/fieldservice_stock_account/models/fsm_order.py b/fieldservice_stock_account/models/fsm_order.py index 8556c01d9f..a0d2be009c 100644 --- a/fieldservice_stock_account/models/fsm_order.py +++ b/fieldservice_stock_account/models/fsm_order.py @@ -11,9 +11,13 @@ class FSMOrder(models.Model): def _prepare_inv_line_for_stock_request(self, stock_request, invoice=False): accounts = stock_request.product_id.product_tmpl_id.get_product_accounts() account = accounts["income"] + if stock_request.direction == "inbound": + quantity = -stock_request.qty_done + else: + quantity = stock_request.qty_done vals = { "product_id": stock_request.product_id.id, - "quantity": stock_request.qty_done, + "quantity": quantity, "name": stock_request.product_id.name, "price_unit": 0, "show_in_report": False,