[IMP] purchase_stock: remove onchange order pick type

This commit removes onchange on picktype in PO replacing it with compute

Part-of: odoo/odoo#95770
This commit is contained in:
Ahmed Khalaf (ahkh)
2022-09-09 00:02:17 +02:00
parent 16445b7008
commit 0ff3ab2f21
+4 -5
View File
@@ -21,7 +21,7 @@ class PurchaseOrder(models.Model):
incoterm_location = fields.Char(string='Incoterm Location', states={'done': [('readonly', True)]})
incoming_picking_count = fields.Integer("Incoming Shipment count", compute='_compute_incoming_picking_count')
picking_ids = fields.Many2many('stock.picking', compute='_compute_picking_ids', string='Receptions', copy=False, store=True)
dest_address_id = fields.Many2one('res.partner', compute='_compute_dest_address_id', store=True, readonly=False)
picking_type_id = fields.Many2one('stock.picking.type', 'Deliver To', states=Purchase.READONLY_STATES, required=True, default=_default_picking_type, domain="['|', ('warehouse_id', '=', False), ('warehouse_id.company_id', '=', company_id)]",
help="This will determine operation type of incoming shipment")
default_location_dest_id_usage = fields.Selection(related='picking_type_id.default_location_dest_id.usage', string='Destination Location Type',
@@ -73,10 +73,9 @@ class PurchaseOrder(models.Model):
else:
order.receipt_status = 'pending'
@api.onchange('picking_type_id')
def _onchange_picking_type_id(self):
if self.picking_type_id.default_location_dest_id.usage != 'customer':
self.dest_address_id = False
@api.depends('picking_type_id')
def _compute_dest_address_id(self):
self.filtered(lambda po: po.picking_type_id.default_location_dest_id.usage != 'customer').dest_address_id = False
@api.onchange('company_id')
def _onchange_company_id(self):