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 ""
|
msgid ""
|
||||||
msgstr ""
|
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"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2018-07-20 17:42+0000\n"
|
"POT-Creation-Date: 2018-12-14 04:46+0000\n"
|
||||||
"PO-Revision-Date: 2018-07-20 17:42+0000\n"
|
"PO-Revision-Date: 2018-12-14 04:46+0000\n"
|
||||||
"Last-Translator: <>\n"
|
"Last-Translator: <>\n"
|
||||||
"Language-Team: \n"
|
"Language-Team: \n"
|
||||||
"MIME-Version: 1.0\n"
|
"MIME-Version: 1.0\n"
|
||||||
@@ -16,22 +16,42 @@ msgstr ""
|
|||||||
"Plural-Forms: \n"
|
"Plural-Forms: \n"
|
||||||
|
|
||||||
#. module: app_product_weight_sale
|
#. 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>"
|
msgid "<span> kg</span>"
|
||||||
msgstr "<span> 公斤</span>"
|
msgstr ""
|
||||||
|
|
||||||
#. module: app_product_weight_sale
|
#. 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)"
|
msgid "Total Weight(kg)"
|
||||||
msgstr "总重量(kg)"
|
msgstr "总重量(kg)"
|
||||||
|
|
||||||
#. module: app_product_weight_sale
|
#. 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:"
|
msgid "Total Weight:"
|
||||||
msgstr "总重量:"
|
msgstr "总重量"
|
||||||
|
|
||||||
#. module: app_product_weight_sale
|
#. module: app_product_weight_sale
|
||||||
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line_weight
|
#: model:ir.model.fields,field_description:app_product_weight_sale.field_sale_order_line__weight
|
||||||
msgid "Weight(kg)"
|
msgid "Weight"
|
||||||
msgstr "公斤"
|
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):
|
class SaleOrderLine(models.Model):
|
||||||
_inherit = 'sale.order.line'
|
_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',
|
weight_subtotal = fields.Float(string='Weight Subtotal', compute='_compute_weight_subtotal',
|
||||||
inverse='_set_weight_subtotal', store=True)
|
inverse='_set_weight_subtotal', store=True)
|
||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
@api.depends('product_id', 'product_uom_qty')
|
@api.depends('product_id', 'product_uom', 'product_uom_qty')
|
||||||
def _compute_weight_subtotal(self):
|
def _compute_weight_subtotal(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
weight = 0
|
weight_subtotal = 0
|
||||||
if line.product_id and line.product_id.weight:
|
if line.product_id and line.product_id.weight:
|
||||||
weight += (line.product_id.weight * line.product_uom_qty / line.product_uom.factor)
|
weight_subtotal += (line.product_id.weight * line.product_uom_qty / line.product_uom.factor)
|
||||||
line.weight = weight
|
line.weight_subtotal = weight_subtotal
|
||||||
|
|
||||||
@api.one
|
@api.one
|
||||||
def _set_weight_subtotal(self):
|
def _set_weight_subtotal(self):
|
||||||
|
|||||||
@@ -41,9 +41,11 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="after">
|
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="after">
|
||||||
<field name="weight"/>
|
<field name="weight"/>
|
||||||
|
<field name="weight_subtotal"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
|
<xpath expr="//field[@name='order_line']/form/group/group/field[@name='price_unit']" position="before">
|
||||||
<field name="weight"/>
|
<field name="weight"/>
|
||||||
|
<field name="weight_subtotal"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
Reference in New Issue
Block a user