From 5b80a301db905634364fc8b6e2d04d3e6d22ddcc Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 20 Apr 2020 10:11:45 +0000 Subject: [PATCH] [FIX] stock_account: User not allowed to update product cost Steps to reproduce the bug: - Login with demo user (no accounting app access) - Go to any product with Update Cost button and try to update it Bug: Error message "You don't have the access rights to post an invoice" even if the inventory valuation was manual. opw:2240513 closes odoo/odoo#49950 X-original-commit: edc54cdf6d39d7689902903fa637df2a709b4396 Signed-off-by: Simon Goffin (sig) --- addons/stock_account/models/product.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/stock_account/models/product.py b/addons/stock_account/models/product.py index 855d1b5e8ac..a87cdcd7510 100644 --- a/addons/stock_account/models/product.py +++ b/addons/stock_account/models/product.py @@ -269,7 +269,8 @@ class ProductProduct(models.Model): am_vals_list.append(move_vals) account_moves = self.env['account.move'].sudo().create(am_vals_list) - account_moves.post() + if account_moves: + account_moves.post() def _run_fifo(self, quantity, company): self.ensure_one()