diff --git a/app_product_weight_sale/i18n/zh_CN.po b/app_product_weight_sale/i18n/zh_CN.po index b52a650f..e8bc69d8 100644 --- a/app_product_weight_sale/i18n/zh_CN.po +++ b/app_product_weight_sale/i18n/zh_CN.po @@ -38,7 +38,7 @@ msgstr "总重量" #. module: app_product_weight_sale #: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line__weight msgid "Weight" -msgstr "重量" +msgstr "单位重量" #. module: app_product_weight_sale #: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order__weight_uom_name diff --git a/app_product_weight_sale/models/sale_order.py b/app_product_weight_sale/models/sale_order.py index 65beb42b..bf347fd7 100644 --- a/app_product_weight_sale/models/sale_order.py +++ b/app_product_weight_sale/models/sale_order.py @@ -15,7 +15,7 @@ class SaleOrder(models.Model): else: return self.env.ref('uom.product_uom_kgm').name - weight_total = fields.Float(string='Total Weight', compute='_compute_weight_total', store=True) + weight_total = fields.Float(string='Total Weight', compute='_compute_weight_total') # 重量显示的单位 weight_uom_name = fields.Char(string='Weight Measure', default=_get_default_weight_uom_name, readonly=True) diff --git a/app_product_weight_sale/models/sale_order_line.py b/app_product_weight_sale/models/sale_order_line.py index 224fd83c..23fd1851 100644 --- a/app_product_weight_sale/models/sale_order_line.py +++ b/app_product_weight_sale/models/sale_order_line.py @@ -15,14 +15,14 @@ class SaleOrderLine(models.Model): weight_subtotal = fields.Float(string='Weight Subtotal', compute='_compute_weight', store=True) @api.multi - @api.depends('product_id', 'product_uom', 'product_qty') + @api.depends('product_id', 'product_uom', 'product_uom_qty') def _compute_weight(self): for line in self: weight = 0 weight_subtotal = 0 if line.product_id and line.product_id.weight: weight = line.product_id.weight / line.product_uom.factor - weight_subtotal += (weight * line.product_qty) + weight_subtotal += (weight * line.product_uom_qty) line.weight = weight line.weight_subtotal = weight_subtotal diff --git a/app_product_weight_sale/static/description/demo2.jpg b/app_product_weight_sale/static/description/demo2.jpg new file mode 100644 index 00000000..c947a788 Binary files /dev/null and b/app_product_weight_sale/static/description/demo2.jpg differ diff --git a/app_product_weight_sale/static/description/icon.png b/app_product_weight_sale/static/description/icon.png index 4c57f611..0153a963 100644 Binary files a/app_product_weight_sale/static/description/icon.png and b/app_product_weight_sale/static/description/icon.png differ diff --git a/app_product_weight_sale/static/description/index.html b/app_product_weight_sale/static/description/index.html index 00adfd61..2eed82af 100644 --- a/app_product_weight_sale/static/description/index.html +++ b/app_product_weight_sale/static/description/index.html @@ -29,6 +29,13 @@ +
+

+ Show product total weight in list view. +

+ +
+

Get product weight and total weight in order. diff --git a/app_product_weight_sale/views/sale_order_views.xml b/app_product_weight_sale/views/sale_order_views.xml index 5aa8a469..f626ca6a 100644 --- a/app_product_weight_sale/views/sale_order_views.xml +++ b/app_product_weight_sale/views/sale_order_views.xml @@ -9,7 +9,7 @@ - + @@ -20,7 +20,7 @@ - + @@ -39,7 +39,7 @@

- +