[IMP] stock: propagate_date on 1st receipt move
1) Before this commit, propagate date on 1st receipt move was always False if PO was created manually. After this commit, move will be assigned with propagte_date of buy route of warehouse only if there is not move_dest_ids. 2) Default settings on routes as - 1) If receipts in 3 steps > the alert on the receipt (+ propagate) and the propagate rescheduling on the followings 2) If receipt in 1 step > the alert on the buy rule (no propagate rescheduling) Task-2209541 closes odoo/odoo#51853 Signed-off-by: Simon Lejeune (sle) <sle@openerp.com>
This commit is contained in:
@@ -468,7 +468,7 @@ class PurchaseOrderLine(models.Model):
|
||||
'picking_type_id': self.order_id.picking_type_id.id,
|
||||
'group_id': self.order_id.group_id.id,
|
||||
'origin': self.order_id.name,
|
||||
'propagate_date': self.propagate_date,
|
||||
'propagate_date': self.order_id.picking_type_id.warehouse_id.buy_pull_id.propagate_date if not self.move_dest_ids else self.propagate_date,
|
||||
'propagate_date_minimum_delta': self.propagate_date_minimum_delta,
|
||||
'description_picking': description_picking,
|
||||
'propagate_cancel': self.propagate_cancel,
|
||||
|
||||
@@ -126,12 +126,15 @@ class StockWarehouse(models.Model):
|
||||
'company_id': self.company_id.id,
|
||||
'route_id': self._find_global_route('purchase_stock.route_warehouse0_buy', _('Buy')).id,
|
||||
'propagate_cancel': self.reception_steps != 'one_step',
|
||||
'delay_alert': True,
|
||||
'propagate_date': self.reception_steps != 'one_step',
|
||||
},
|
||||
'update_values': {
|
||||
'active': self.buy_to_resupply,
|
||||
'name': self._format_rulename(location_id, False, 'Buy'),
|
||||
'location_id': location_id.id,
|
||||
'propagate_cancel': self.reception_steps != 'one_step',
|
||||
'propagate_date': self.reception_steps != 'one_step',
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
@@ -214,3 +214,13 @@ class TestPurchaseOrder(AccountTestCommon):
|
||||
# A new move of 10 unit (15 - 5 units)
|
||||
self.assertEqual(po1.order_line.qty_received, 5)
|
||||
self.assertEqual(po1.picking_ids[-1].move_lines.product_qty, 10)
|
||||
|
||||
def test_propagate_date_of_move(self):
|
||||
""" Propagate date of move should be assigned as per value of mto
|
||||
buy route if PO is created manually (not from mto route).
|
||||
"""
|
||||
warehouse = self.env.ref('stock.warehouse0')
|
||||
self.po = self.env['purchase.order'].create(self.po_vals)
|
||||
self.po.button_confirm()
|
||||
self.assertFalse(self.po.order_line.mapped('move_dest_ids'))
|
||||
self.assertEqual(self.po.picking_ids.move_lines[0].propagate_date, warehouse.buy_pull_id.propagate_date)
|
||||
|
||||
Reference in New Issue
Block a user