[FIX] stock_account: fix reference to undefined variable

post_inventory method does not return anything (in stock), and True (in
mrp). Anyway the returned result is not used anywhere and does not have
any meaning.

In stock_account call to super is done on some sub record sets and result
of super is returned. However due to code architecture it is unsure whether
super is actually called. Let us avoid any issue with res being undefined if
there is no call to super done.
This commit is contained in:
Thibault Delavallée
2019-04-02 11:42:55 +00:00
parent 2afd482c1a
commit 02f548ce9e
+2 -3
View File
@@ -24,11 +24,10 @@ class StockInventory(models.Model):
def post_inventory(self):
acc_inventories = self.filtered(lambda inventory: inventory.accounting_date)
for inventory in acc_inventories:
res = super(StockInventory, inventory.with_context(force_period_date=inventory.accounting_date)).post_inventory()
super(StockInventory, inventory.with_context(force_period_date=inventory.accounting_date)).post_inventory()
other_inventories = self - acc_inventories
if other_inventories:
res = super(StockInventory, other_inventories).post_inventory()
return res
super(StockInventory, other_inventories).post_inventory()
class StockLocation(models.Model):