Skip to content

Commit

Permalink
cycle_count: fix cycle count state issue
Browse files Browse the repository at this point in the history
  • Loading branch information
LoisRForgeFlow committed Sep 8, 2017
1 parent 7ae6767 commit 7497965
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions stock_cycle_count/models/stock_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,23 @@ def _compute_inventory_accuracy(self):
string='Accuracy', compute='_compute_inventory_accuracy',
digits=(3, 2))

def _update_cycle_state(self):
for inv in self:
if inv.cycle_count_id and inv.state == 'done':
inv.cycle_count_id.state = 'done'
return True

@api.multi
def action_done(self):
if self.cycle_count_id:
self.cycle_count_id.state = 'done'
return super(StockInventory, self).action_done()
res = super(StockInventory, self).action_done()
self._update_cycle_state()
return res

@api.multi
def action_force_done(self):
res = super(StockInventory, self).action_force_done()
self._update_cycle_state()
return res

@api.multi
def write(self, vals):
Expand Down

0 comments on commit 7497965

Please sign in to comment.