[FIX] stock: date should be date_expected until done
date help: "Move date: scheduled date until move is done, then date of actual move processing") As this behaviour is also wanted when the onchange mechanism do not work (ie in a manufacturing order move raw and finished), we move it to write. task-2154781
This commit is contained in:
committed by
Debauche Stéphane
parent
8944674d6d
commit
efa1d7f303
@@ -492,6 +492,10 @@ class StockMove(models.Model):
|
||||
initial_values = dict((picking.id, {'state': picking.state}) for picking in pickings)
|
||||
|
||||
res = super(StockMove, self).write(vals)
|
||||
if vals.get('date_expected'):
|
||||
for move in self:
|
||||
if move.state not in ('done', 'cancel'):
|
||||
move.date = move.date_expected
|
||||
|
||||
if track_pickings:
|
||||
pickings.message_track(pickings.fields_get(['state']), initial_values)
|
||||
@@ -812,11 +816,6 @@ class StockMove(models.Model):
|
||||
self.name = product.partner_ref
|
||||
self.product_uom = product.uom_id.id
|
||||
|
||||
@api.onchange('date_expected')
|
||||
def onchange_date(self):
|
||||
if self.date_expected:
|
||||
self.date = self.date_expected
|
||||
|
||||
@api.onchange('move_line_nosuggest_ids')
|
||||
def onchange_move_line_nosuggest_ids(self):
|
||||
breaking_char = '\n'
|
||||
|
||||
Reference in New Issue
Block a user