summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--addons/delivery/models/stock_picking.py30
-rw-r--r--addons/delivery/views/delivery_view.xml22
-rw-r--r--addons/delivery/views/report_deliveryslip.xml2
-rw-r--r--addons/delivery/views/report_shipping.xml2
-rw-r--r--addons/product/models/product.py2
5 files changed, 40 insertions, 18 deletions
diff --git a/addons/delivery/models/stock_picking.py b/addons/delivery/models/stock_picking.py
index a9afc258004..eb969156b09 100644
--- a/addons/delivery/models/stock_picking.py
+++ b/addons/delivery/models/stock_picking.py
@@ -20,8 +20,16 @@ class StockQuantPackage(models.Model):
weight += quant.quantity * quant.product_id.weight
self.weight = weight
- weight = fields.Float(compute='_compute_weight', help="Weight computed based on the sum of the weights of the products.")
- shipping_weight = fields.Float(string='Shipping Weight', help="Weight used to compute the price of the delivery (if applicable).")
+ def _get_default_weight_uom(self):
+ return self.env['product.template']._get_weight_uom_name_from_ir_config_parameter()
+
+ def _compute_weight_uom_name(self):
+ for package in self:
+ package.weight_uom_name = self.env['product.template']._get_weight_uom_name_from_ir_config_parameter()
+
+ weight = fields.Float(compute='_compute_weight', help="Total weight of all the products contained in the package.")
+ weight_uom_name = fields.Char(string='Weight unit of measure label', compute='_compute_weight_uom_name', readonly=True, default=_get_default_weight_uom)
+ shipping_weight = fields.Float(string='Shipping Weight', help="Total weight of the package.")
class StockMoveLine(models.Model):
@@ -74,28 +82,30 @@ class StockPicking(models.Model):
def _compute_shipping_weight(self):
self.shipping_weight = self.weight_bulk + sum([pack.shipping_weight for pack in self.package_ids])
+ def _get_default_weight_uom(self):
+ return self.env['product.template']._get_weight_uom_name_from_ir_config_parameter()
+
+ def _compute_weight_uom_name(self):
+ for package in self:
+ package.weight_uom_name = self.env['product.template']._get_weight_uom_name_from_ir_config_parameter()
+
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)
- weight = fields.Float(compute='_cal_weight', digits=dp.get_precision('Stock Weight'), store=True)
+ weight = fields.Float(compute='_cal_weight', digits=dp.get_precision('Stock Weight'), store=True, help="Total weight of the products in the picking.")
carrier_tracking_ref = fields.Char(string='Tracking Reference', copy=False)
carrier_tracking_url = fields.Char(string='Tracking URL', compute='_compute_carrier_tracking_url')
- weight_uom_id = fields.Many2one('uom.uom', string='Unit of Measure', compute='_compute_weight_uom_id', help="Unit of measurement for Weight")
+ weight_uom_name = fields.Char(string='Weight unit of measure label', compute='_compute_weight_uom_name', readonly=True, default=_get_default_weight_uom)
package_ids = fields.Many2many('stock.quant.package', compute='_compute_packages', string='Packages')
weight_bulk = fields.Float('Bulk Weight', compute='_compute_bulk_weight')
- shipping_weight = fields.Float("Weight for Shipping", compute='_compute_shipping_weight')
+ shipping_weight = fields.Float("Weight for Shipping", compute='_compute_shipping_weight', help="Total weight of the packages and products which are not in a package. That's the weight used to compute the cost of the shipping.")
@api.depends('carrier_id', 'carrier_tracking_ref')
def _compute_carrier_tracking_url(self):
for picking in self:
picking.carrier_tracking_url = picking.carrier_id.get_tracking_link(picking) if picking.carrier_id and picking.carrier_tracking_ref else False
- def _compute_weight_uom_id(self):
- weight_uom_id = self.env['product.template']._get_weight_uom_id_from_ir_config_parameter()
- for picking in self:
- picking.weight_uom_id = weight_uom_id
-
@api.depends('move_lines')
def _cal_weight(self):
for picking in self:
diff --git a/addons/delivery/views/delivery_view.xml b/addons/delivery/views/delivery_view.xml
index 495ce53448a..66042997266 100644
--- a/addons/delivery/views/delivery_view.xml
+++ b/addons/delivery/views/delivery_view.xml
@@ -204,7 +204,7 @@
<field name="arch" type="xml">
<data>
<xpath expr="//group[@name='other_infos']" position="before">
- <group name='carrier_data' string="Delivery Information">
+ <group name='carrier_data' string="Shipping Information">
<field name="carrier_id" attrs="{'readonly': [('state', 'in', ('done', 'cancel'))]}" options="{'no_create': True, 'no_open': True}"/>
<field name="delivery_type" attrs="{'invisible':True}"/>
<label for="carrier_tracking_ref"/>
@@ -215,9 +215,13 @@
<label for="weight" string="Weight"/>
<div>
<field name="weight" class="oe_inline"/>
- <field name="weight_uom_id" nolabel="1" class="oe_inline" style="margin-left:5px"/>
+ <field name="weight_uom_name" nolabel="1" class="oe_inline" style="margin-left:5px"/>
+ </div>
+ <label for="shipping_weight" string="Weight for shipping"/>
+ <div>
+ <field name="shipping_weight" class="oe_inline"/>
+ <field name="weight_uom_name" nolabel="1" class="oe_inline" style="margin-left:5px"/>
</div>
- <field name="shipping_weight"/>
</group>
</xpath>
<div name="button_box" position="inside">
@@ -255,8 +259,16 @@
<field name="arch" type="xml">
<field name="company_id" position="before">
<field name="packaging_id" domain="[('product_id', '=', False)]"/>
- <field name="weight"/>
- <field name="shipping_weight"/>
+ <label for="weight" string="Weight"/>
+ <div>
+ <field name="weight" class="oe_inline"/>
+ <field name="weight_uom_name" nolabel="1" class="oe_inline" style="margin-left:5px"/>
+ </div>
+ <label for="shipping_weight"/>
+ <div class="o_row" name="Shipping Weight">
+ <field name="shipping_weight"/>
+ <span><field name="weight_uom_name"/></span>
+ </div>
</field>
</field>
</record>
diff --git a/addons/delivery/views/report_deliveryslip.xml b/addons/delivery/views/report_deliveryslip.xml
index a618bae5144..149c02de408 100644
--- a/addons/delivery/views/report_deliveryslip.xml
+++ b/addons/delivery/views/report_deliveryslip.xml
@@ -11,7 +11,7 @@
</td>
<td t-if="o.shipping_weight">
<span t-field="o.shipping_weight"/>
- <span t-field="o.weight_uom_id"/>
+ <span t-field="o.weight_uom_name"/>
</td>
<td t-if="o.carrier_tracking_ref">
<span t-field="o.carrier_tracking_ref"/>
diff --git a/addons/delivery/views/report_shipping.xml b/addons/delivery/views/report_shipping.xml
index dd795a1f5ac..b9861df6fe1 100644
--- a/addons/delivery/views/report_shipping.xml
+++ b/addons/delivery/views/report_shipping.xml
@@ -10,7 +10,7 @@
</td>
<td t-if="o.weight">
<span t-field="o.weight"/>
- <span t-field="o.weight_uom_id"/>
+ <span t-field="o.weight_uom_name"/>
</td>
</xpath>
</template>
diff --git a/addons/product/models/product.py b/addons/product/models/product.py
index 6c2518615ae..990090b4218 100644
--- a/addons/product/models/product.py
+++ b/addons/product/models/product.py
@@ -627,7 +627,7 @@ class ProductPackaging(models.Model):
name = fields.Char('Package Type', required=True)
sequence = fields.Integer('Sequence', default=1, help="The first in the sequence is the default one.")
product_id = fields.Many2one('product.product', string='Product')
- qty = fields.Float('Contained Quantity', help="The total number of products you can have per pallet or box.")
+ qty = fields.Float('Contained Quantity', help="Quantity of products contained in the packaging.")
barcode = fields.Char('Barcode', copy=False, help="Barcode used for packaging identification.")
product_uom_id = fields.Many2one('uom.uom', related='product_id.uom_id', readonly=True)