mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
opt sale weight.
This commit is contained in:
@@ -4,10 +4,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 11.0+e-20180617\n"
|
||||
"Project-Id-Version: Odoo Server 12.0+e-20181123\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-07-20 17:42+0000\n"
|
||||
"PO-Revision-Date: 2018-07-20 17:42+0000\n"
|
||||
"POT-Creation-Date: 2018-12-14 04:46+0000\n"
|
||||
"PO-Revision-Date: 2018-12-14 04:46+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -16,22 +16,42 @@ msgstr ""
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.ui.view,arch_db:app_product_weight_sale.sale_weight_line_form
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_weight_sale.sale_weight_line_form
|
||||
msgid "<span> kg</span>"
|
||||
msgstr "<span> 公斤</span>"
|
||||
msgstr ""
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_weight_total
|
||||
#: model:ir.model,name:app_product_weight_sale.model_sale_order
|
||||
msgid "Sale Order"
|
||||
msgstr "销售订单"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model,name:app_product_weight_sale.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr "销售订单行"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order__weight_total
|
||||
msgid "Total Weight(kg)"
|
||||
msgstr "总重量(kg)"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.ui.view,arch_db:app_product_weight_sale.sale_weight_line_form
|
||||
#: model_terms:ir.ui.view,arch_db:app_product_weight_sale.sale_weight_line_form
|
||||
msgid "Total Weight:"
|
||||
msgstr "总重量:"
|
||||
msgstr "总重量"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line_weight
|
||||
msgid "Weight(kg)"
|
||||
msgstr "公斤"
|
||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line__weight
|
||||
msgid "Weight"
|
||||
msgstr "单重"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line__weight_subtotal
|
||||
msgid "Weight Subtotal"
|
||||
msgstr "重量小计"
|
||||
|
||||
#. module: app_product_weight_sale
|
||||
#: model:ir.model.fields,help:app_product_weight_sale.field_sale_order_line__weight
|
||||
msgid "Weight of the product, packaging not included. The unit of measure can be changed in the general settings"
|
||||
msgstr "产品重量、包装不包括在内。可以在一般设置中改变测量单位。"
|
||||
|
||||
|
||||
@@ -9,18 +9,20 @@ from odoo import api, fields, models, _
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
weight = fields.Float(string='Weight', store=True)
|
||||
# 显示的单位,影响性能暂时不使用
|
||||
# weight_uom_name = fields.Char(string='Weight Measure', related='product_id.weight_uom_id.name', readonly=True)
|
||||
weight = fields.Float(string='Weight', related='product_id.weight', store=True, readonly=True)
|
||||
weight_subtotal = fields.Float(string='Weight Subtotal', compute='_compute_weight_subtotal',
|
||||
inverse='_set_weight_subtotal', store=True)
|
||||
|
||||
@api.multi
|
||||
@api.depends('product_id', 'product_uom_qty')
|
||||
@api.depends('product_id', 'product_uom', 'product_uom_qty')
|
||||
def _compute_weight_subtotal(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_qty / line.product_uom.factor)
|
||||
line.weight = weight
|
||||
weight_subtotal += (line.product_id.weight * line.product_uom_qty / line.product_uom.factor)
|
||||
line.weight_subtotal = weight_subtotal
|
||||
|
||||
@api.one
|
||||
def _set_weight_subtotal(self):
|
||||
|
||||
@@ -41,9 +41,11 @@
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="after">
|
||||
<field name="weight"/>
|
||||
<field name="weight_subtotal"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
|
||||
<field name="weight"/>
|
||||
<field name="weight_subtotal"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user