[IMP] delivery: add estimated price on picking

This commit is contained in:
Pierre Masereel
2020-02-04 12:57:52 +00:00
parent d5fd89df5d
commit c89993df67
2 changed files with 14 additions and 0 deletions
+7
View File
@@ -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'
+7
View File
@@ -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'