[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) <sig@openerp.com>
This commit is contained in:
Goffin Simon
2020-04-22 10:06:12 +00:00
parent 6825147ecb
commit 5b80a301db
+2 -1
View File
@@ -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()