[FIX] stock: transfers calendar view
There's no readonly possibility on the calendar view so the only way to prevent updating a done or cancelled transfer is to raise on the write. We should to raise in the inverse function so that it is possible to bypass the constraint by writing directly on the move, as we want to change some date in the demo data. closes odoo/odoo#36550 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -535,18 +535,30 @@
|
||||
|
||||
<record id="stock.outgoing_shipment_main_warehouse4" model="stock.picking">
|
||||
<field name="date_done" eval="DateTime.today() - timedelta(days=24)"/>
|
||||
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=26)"/>
|
||||
</record>
|
||||
|
||||
<record id="stock.outgoing_shipment_main_warehouse5" model="stock.picking">
|
||||
<field name="date_done" eval="DateTime.today() - timedelta(days=17)"/>
|
||||
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=18)"/>
|
||||
</record>
|
||||
|
||||
<record id="stock.outgoing_shipment_main_warehouse6" model="stock.picking">
|
||||
<field name="date_done" eval="DateTime.today() - timedelta(days=7)"/>
|
||||
<field name="scheduled_date" eval="DateTime.today() - timedelta(days=7)"/>
|
||||
</record>
|
||||
|
||||
<function model="stock.move" name="write">
|
||||
<value model="stock.move" search="[('picking_id', '=', ref('stock.outgoing_shipment_main_warehouse4'))]"/>
|
||||
<value eval="{'date_expected': DateTime.today() - timedelta(days=26)}"/>
|
||||
</function>
|
||||
|
||||
<function model="stock.move" name="write">
|
||||
<value model="stock.move" search="[('picking_id', '=', ref('stock.outgoing_shipment_main_warehouse5'))]"/>
|
||||
<value eval="{'date_expected': DateTime.today() - timedelta(days=18)}"/>
|
||||
</function>
|
||||
|
||||
<function model="stock.move" name="write">
|
||||
<value model="stock.move" search="[('picking_id', '=', ref('stock.outgoing_shipment_main_warehouse6'))]"/>
|
||||
<value eval="{'date_expected': DateTime.today() - timedelta(days=7)}"/>
|
||||
</function>
|
||||
|
||||
</data>
|
||||
</odoo>
|
||||
|
||||
@@ -449,6 +449,8 @@ class Picking(models.Model):
|
||||
|
||||
def _set_scheduled_date(self):
|
||||
for picking in self:
|
||||
if picking.state in ('done', 'cancel'):
|
||||
raise UserError(_("You cannot change the Scheduled Date on a done or cancelled transfer."))
|
||||
picking.move_lines.write({'date_expected': picking.scheduled_date})
|
||||
|
||||
def _has_scrap_move(self):
|
||||
|
||||
Reference in New Issue
Block a user