[IMP] delivery: add estimated price on picking
This commit is contained in:
@@ -131,6 +131,13 @@ class SaleOrder(models.Model):
|
||||
if all(line.product_id.invoice_policy == 'delivery' and line.invoice_status == 'no' for line in order_lines):
|
||||
order.invoice_status = 'no'
|
||||
|
||||
def _get_estimated_weight(self):
|
||||
self.ensure_one()
|
||||
weight = 0.0
|
||||
for order_line in self.order_line.filtered(lambda l: l.product_id.type in ['product', 'consu'] and not l.is_delivery and not l.display_type):
|
||||
weight += order_line.product_qty * order_line.product_id.weight
|
||||
return weight
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
@@ -225,6 +225,13 @@ class StockPicking(models.Model):
|
||||
raise UserError(_('You are shipping different packaging types in the same shipment.\nPackaging Types: %s' % package_names))
|
||||
return True
|
||||
|
||||
def _get_estimated_weight(self):
|
||||
self.ensure_one()
|
||||
weight = 0.0
|
||||
for move in self.move_lines:
|
||||
weight += move.product_qty * move.product_id.weight
|
||||
return weight
|
||||
|
||||
|
||||
class StockReturnPicking(models.TransientModel):
|
||||
_inherit = 'stock.return.picking'
|
||||
|
||||
Reference in New Issue
Block a user