[FIX] delivery: onchange_carrier
Steps to reproduce: - Create a Sales Order with 2 product qty - Keep Delivery Method as DHL International - Confirm - Open Delivery Order - Edit Qty of the Delivery Order - Change Carrier (any integrated) - Validate the transfer - Process the backorder - Edit and change the Carrier to normal or free delivery charges - Validate Bug: The price of the free delivery charges was not recomputed and kept the carrier price set on the SO. Fix: When the price of the carrier is "fixed" or "base_on_rule", the price must be reconsidered in case of change. opw:691224
This commit is contained in:
@@ -52,7 +52,7 @@ class StockPicking(models.Model):
|
||||
weight += uom_obj._compute_qty_obj(packop.product_uom_id , packop.product_qty, packop.product_id.uom_id) * packop.product_id.weight
|
||||
self.weight_bulk = weight
|
||||
|
||||
carrier_price = fields.Float(string="Shipping Cost", readonly=True)
|
||||
carrier_price = fields.Float(string="Shipping Cost")
|
||||
delivery_type = fields.Selection(related='carrier_id.delivery_type', readonly=True)
|
||||
carrier_id = fields.Many2one("delivery.carrier", string="Carrier")
|
||||
volume = fields.Float(copy=False)
|
||||
@@ -63,6 +63,11 @@ class StockPicking(models.Model):
|
||||
package_ids = fields.Many2many('stock.quant.package', compute='_compute_packages', string='Packages')
|
||||
weight_bulk = fields.Float('Bulk Weight', compute='_compute_bulk_weight')
|
||||
|
||||
@api.onchange('carrier_id')
|
||||
def onchange_carrier(self):
|
||||
if self.carrier_id.delivery_type in ['fixed', 'base_on_rule']:
|
||||
self.carrier_price = self.carrier_id.price
|
||||
|
||||
@api.depends('product_id', 'move_lines')
|
||||
def _cal_weight(self):
|
||||
for picking in self:
|
||||
|
||||
Reference in New Issue
Block a user