mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
update stock_barcode
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
'author': 'Sunpop.cn',
|
||||
'website': 'http://www.sunpop.cn',
|
||||
'license': 'LGPL-3',
|
||||
'category': 'Felive',
|
||||
'category': 'Warehouse',
|
||||
'sequence': 0,
|
||||
'pre_init_hook': 'pre_init_hook',
|
||||
'depends': ['stock_barcode'],
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0+e-20171107\n"
|
||||
"Project-Id-Version: Odoo Server 10.0+e-20180326\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2018-03-19 21:04+0000\n"
|
||||
"PO-Revision-Date: 2018-03-19 21:04+0000\n"
|
||||
"POT-Creation-Date: 2018-04-24 17:39+0000\n"
|
||||
"PO-Revision-Date: 2018-04-24 17:39+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -15,6 +15,21 @@ msgstr ""
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
|
||||
msgid "<span class=\"ml4\">kg</span>"
|
||||
msgstr "<span class=\"ml4\">kg</span>"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_is_barcode_view
|
||||
msgid "Barcode view"
|
||||
msgstr "扫码视图"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_header_title
|
||||
msgid "Briefing"
|
||||
msgstr "打包摘要"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_create_uid
|
||||
msgid "Created by"
|
||||
@@ -81,6 +96,11 @@ msgstr "最后更新人"
|
||||
msgid "Last Updated on"
|
||||
msgstr "最后更新时间"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_operation_id
|
||||
msgid "Pack Operation Id"
|
||||
msgstr "操作Id"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_done_count
|
||||
msgid "Package Done Total"
|
||||
@@ -141,11 +161,6 @@ msgstr "完成包裹"
|
||||
msgid "Source Package"
|
||||
msgstr "源包裹"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
|
||||
msgid "Statistics"
|
||||
msgstr "操作统计"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_picking_id
|
||||
msgid "Stock Picking"
|
||||
@@ -171,6 +186,7 @@ msgstr "待办"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_product_qty_total
|
||||
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_product_qty_total
|
||||
msgid "To Do Total"
|
||||
msgstr "待办总数"
|
||||
|
||||
@@ -178,7 +194,7 @@ msgstr "待办总数"
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_vpicktree
|
||||
msgid "Total"
|
||||
msgstr "总计"
|
||||
msgstr "合计"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.model,name:app_stock_barcode.model_stock_picking
|
||||
@@ -210,8 +226,8 @@ msgstr "完成总重量(kg)"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
|
||||
msgid "Working Product"
|
||||
msgstr "当前操作散件"
|
||||
msgid "Weight Total:"
|
||||
msgstr "总重量:"
|
||||
|
||||
#. module: app_stock_barcode
|
||||
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_pack_current_tree
|
||||
|
||||
@@ -13,8 +13,15 @@ class StockPackCurrent(models.Model):
|
||||
|
||||
picking_id = fields.Many2one(
|
||||
'stock.picking', 'Stock Picking',
|
||||
required=True, ondelete="cascade",
|
||||
# required=True,
|
||||
ondelete="cascade",
|
||||
help='The stock operation where the packing has been made')
|
||||
|
||||
operation_id = fields.Many2one(
|
||||
'stock.pack.operation', 'Pack Operation Id',
|
||||
# required=True,
|
||||
ondelete="cascade")
|
||||
|
||||
product_id = fields.Many2one('product.product', 'Product', ondelete="cascade")
|
||||
product_uom_id = fields.Many2one('product.uom', 'Unit of Measure')
|
||||
product_qty = fields.Float('To Do', default=0.0, digits=dp.get_precision('Product Unit of Measure'), required=True)
|
||||
|
||||
@@ -13,6 +13,11 @@ class Picking(models.Model):
|
||||
_name = 'stock.picking'
|
||||
_inherit = ['stock.picking', 'barcodes.barcode_events_mixin']
|
||||
|
||||
# 是否在扫码视图
|
||||
is_barcode_view = fields.Boolean('Barcode view', defult=False)
|
||||
# 扫码摘要
|
||||
header_title = fields.Char('Briefing', compute='_compute_briefing')
|
||||
|
||||
# 作业,已扫码未装入包操作的记录行
|
||||
pack_operation_product_current_ids = fields.One2many(
|
||||
'stock.pack.current', 'picking_id', string='Product packing', readonly=True, copy=False)
|
||||
@@ -21,19 +26,32 @@ class Picking(models.Model):
|
||||
'stock.pack.operation', 'picking_id', 'Product packed',
|
||||
domain=[('product_id', '>=', 1), ('qty_done', '>=', 1), ('result_package_id', '!=', False)], readonly=True, copy=False)
|
||||
# 散件涉及到的包裹列表
|
||||
result_package_ids = fields.Many2many('stock.quant.package', string='Relate Packages', readonly=True, copy=False)
|
||||
result_package_ids = fields.Many2many('stock.quant.package', string='Result Packages', readonly=True, copy=False)
|
||||
# 当前操作产品
|
||||
last_op_product = fields.Many2one('product.product', string='Last OP', readonly=True)
|
||||
|
||||
# 统计,散件与包裹一起处理的数量
|
||||
# 待办统计,散件与包裹一起处理的数量
|
||||
product_qty_total = fields.Float('To Do Total', compute="_compute_product_qty_total",
|
||||
digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) # 总待办数量
|
||||
# 完成统计,验证后才有
|
||||
qty_done_total = fields.Float('Done Total', compute="_compute_done_total",
|
||||
digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) # 总完成数量
|
||||
weight_done_total = fields.Float('Weight Done Total(kg)', digits=dp.get_precision('Stock Weight'),
|
||||
compute="_compute_done_total", readonly=True, store=True) # 总完成重量
|
||||
package_count = fields.Integer('Package Total', compute="_compute_package_count", readonly=True) # 待处理的包裹数量
|
||||
package_count = fields.Integer('Package Total', compute="_compute_package_count", readonly=True) # 待处理的包裹数量
|
||||
package_done_count = fields.Integer('Package Done Total', compute="_compute_package_done_count", readonly=True, store=True) # 已处理的包裹数量
|
||||
result_package_count = fields.Integer('Result Package Total', compute="_compute_package_done_count", readonly=True, store=True) # 放入的包裹数量
|
||||
|
||||
@api.depends('partner_id')
|
||||
def _compute_briefing(self):
|
||||
for rec in self:
|
||||
try:
|
||||
title = '客户:' + rec.partner_id.name
|
||||
if rec.origin:
|
||||
title += ',源单据:' + rec.origin
|
||||
rec.header_title = title
|
||||
except:
|
||||
pass
|
||||
|
||||
@api.depends('pack_operation_product_ids.product_qty', 'pack_operation_pack_ids.product_qty')
|
||||
def _compute_product_qty_total(self):
|
||||
@@ -76,10 +94,9 @@ class Picking(models.Model):
|
||||
def _compute_package_done_count(self):
|
||||
for rec in self:
|
||||
if rec.state == 'done':
|
||||
rec.package_done_count = len(rec.pack_operation_product_packed_ids.mapped('result_package_id').ids)
|
||||
rec.result_package_count = len(rec.pack_operation_product_packed_ids.mapped('result_package_id').ids)
|
||||
pack_packs = rec.pack_operation_pack_ids.filtered(lambda pack: not pack.product_id and pack.qty_done and pack.result_package_id)
|
||||
rec.package_done_count += len(pack_packs.mapped('result_package_id').ids)
|
||||
|
||||
rec.package_done_count += len(pack_packs.mapped('result_package_id').ids) + rec.result_package_count
|
||||
|
||||
# 不用于字段compute,在每次放入包裹操作执行,重新计算
|
||||
def set_package(self):
|
||||
@@ -123,4 +140,12 @@ class Picking(models.Model):
|
||||
|
||||
def _check_product(self, product, qty=1.0):
|
||||
self.last_op_product = product
|
||||
return super(Picking, self)._check_product()
|
||||
return super(Picking, self)._check_product(product, qty)
|
||||
|
||||
def action_see_packages(self):
|
||||
self.ensure_one()
|
||||
action = self.env.ref('stock.action_package_view').read()[0]
|
||||
packages = self.pack_operation_product_ids.mapped('result_package_id')
|
||||
packages += self.pack_operation_pack_ids.mapped('result_package_id')
|
||||
action['domain'] = [('id', 'in', packages.ids)]
|
||||
return action
|
||||
|
||||
@@ -6,6 +6,9 @@ from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
class QuantPackage(models.Model):
|
||||
_inherit = 'stock.quant.package'
|
||||
# 待办统计,散件与包裹一起处理的数量
|
||||
product_qty_total = fields.Float('To Do Total',
|
||||
digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) # 总待办数量
|
||||
qty_done_total = fields.Float('Done Total', default=0.0, store=True,
|
||||
compute="_compute_done_total",
|
||||
digits=dp.get_precision('Product Unit of Measure')) # 总完成数量
|
||||
@@ -13,7 +16,7 @@ class QuantPackage(models.Model):
|
||||
digits=dp.get_precision('Stock Weight'),
|
||||
compute="_compute_done_total", readonly=True) # 总完成重量
|
||||
|
||||
@api.depends('quant_ids.qty')
|
||||
@api.depends('quant_ids.qty', 'children_ids')
|
||||
def _compute_done_total(self):
|
||||
for rec in self:
|
||||
try:
|
||||
@@ -21,7 +24,14 @@ class QuantPackage(models.Model):
|
||||
except:
|
||||
rec.qty_done_total = 0
|
||||
try:
|
||||
rec.weight_done_total = sum(rec.quant_ids.mapped('weight_done_subtotal'))
|
||||
# 不增加quant的计算字段,省资源
|
||||
weight_done_total = 0
|
||||
for q in rec.quant_ids:
|
||||
weight_done_total += q.qty * q.product_id.weight
|
||||
for c in rec.children_ids:
|
||||
weight_done_total += c.weight_done_total
|
||||
|
||||
rec.weight_done_total = weight_done_total
|
||||
except:
|
||||
rec.weight_done_total = 0
|
||||
|
||||
|
||||
13
app_stock_barcode/views/stock_move_views.xml
Normal file
13
app_stock_barcode/views/stock_move_views.xml
Normal file
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<odoo>
|
||||
<record model="ir.ui.view" id="app_stock_move_tree">
|
||||
<field name="name">app.stock.move.tree</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.stock_move_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='product_uom_qty']" position="attributes">
|
||||
<attribute name="sum">Total</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -34,7 +34,7 @@
|
||||
<t t-if="record.qty_done.value >= 1">
|
||||
<t t-if="record.product_id.value">
|
||||
<t t-if="record.result_package_id.value==false">
|
||||
<div t-attf-class="oe_kanban_card oe_kanban_global_click" style="box-shadow:0px 2px 2px 1px #ccc">
|
||||
<div name="app_barcode_card" t-attf-class="oe_kanban_card oe_kanban_global_click" style="box-shadow:0px 2px 2px 1px #ccc">
|
||||
<t t-esc="record.product_id.value"/>
|
||||
<t t-if="record.product_qty.value==0">
|
||||
<span class="pull-right badge oe_kanban_color_9">
|
||||
|
||||
@@ -20,18 +20,68 @@
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<field name="result_package_ids" widget="many2many_tags" readonly="1"/>
|
||||
<label for="last_op_product"/>
|
||||
<div>
|
||||
<strong><field name="last_op_product"/></strong>
|
||||
<button class="btn btn-primary oe_right" name="put_in_pack2" type="object" string="↳放入包裹"
|
||||
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" groups="stock.group_tracking_lot"/>
|
||||
<button class="btn btn-primary oe_right mb4 mr4" name="set_current" type="object" string="刷新扫码视图"
|
||||
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" icon="fa-refresh"/>
|
||||
<!--扫码视图下隐藏部份内容,此字段不用,用context取代-->
|
||||
<xpath expr="//field[@name='partner_id']" position="before">
|
||||
<field name="is_barcode_view" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//header" position="attributes">
|
||||
<attribute name="invisible">context.get('form_view_initial_mode')</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//h1[1]" position="attributes">
|
||||
<attribute name="invisible">context.get('form_view_initial_mode')</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//h1[1]" position="after">
|
||||
<h1>
|
||||
<field name="header_title" readonly="1"
|
||||
invisible="not context.get('form_view_initial_mode')"/>
|
||||
</h1>
|
||||
</xpath>
|
||||
<xpath expr="//div[@name='button_box']" position="inside">
|
||||
<button class="oe_stat_button" name="action_see_packages" type="object" icon="fa-cubes"
|
||||
attrs="{'invisible': [('result_package_count', '<', 1)]}">
|
||||
<field string="Packages" name="result_package_count" widget="statinfo"/>
|
||||
</button>
|
||||
</xpath>
|
||||
<xpath expr="//group[1]" position="attributes">
|
||||
<attribute name="invisible">context.get('form_view_initial_mode')</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//group[1]" position="after">
|
||||
<group>
|
||||
<field name="result_package_ids" widget="many2many_tags" readonly="1"/>
|
||||
</group>
|
||||
<div class="row" readonly="1">
|
||||
<div class="col-xs-6 col-md-2">
|
||||
Product:
|
||||
<field name="product_qty_total" class="oe_inline o_form_label"/>
|
||||
->
|
||||
<field name="qty_done_total" class="oe_inline o_form_label"/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-2">
|
||||
Package:
|
||||
<field name="package_count" class="oe_inline o_form_label"/>
|
||||
->
|
||||
<field name="package_done_count" class="oe_inline o_form_label"/>
|
||||
</div>
|
||||
<div class="col-xs-6 col-md-2">
|
||||
Weight Total:
|
||||
<field name="weight_done_total" class="oe_inline o_form_label"/>
|
||||
<span class="ml4">kg</span>
|
||||
</div>
|
||||
<div class="col-xs-12 col-md-6">
|
||||
<label for="last_op_product"/>
|
||||
<div>
|
||||
<strong>
|
||||
<field name="last_op_product"/>
|
||||
</strong>
|
||||
<button class="btn btn-primary oe_right" name="put_in_pack2" type="object" string="↳放入包裹"
|
||||
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" groups="stock.group_tracking_lot"/>
|
||||
<button class="btn btn-primary oe_right mb4 mr4" name="set_current" type="object" string="刷新扫码视图"
|
||||
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" icon="fa-refresh"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</xpath>
|
||||
|
||||
<!--实时扫码操作-->
|
||||
<xpath expr="//notebook/page[1]" position="before">
|
||||
<page name="current_op" string="Working Product " attrs="{'invisible': [('state', 'in', ('draft', 'confirmed', 'waiting'))]}">
|
||||
<field name="pack_operation_product_current_ids" options="{'reload_on_button': True}"
|
||||
@@ -39,21 +89,6 @@
|
||||
context="{'default_picking_id': id}"/>
|
||||
</page>
|
||||
</xpath>
|
||||
|
||||
<xpath expr="//field[@name='location_dest_id']" position="after">
|
||||
<label for="" string="Statistics"/>
|
||||
<div class="o_row" readonly="1">
|
||||
<div class="col-xs-3">
|
||||
Product:<field name="qty_done_total" class="oe_inline o_form_label"/>/
|
||||
<field name="product_qty_total" class="oe_inline o_form_label"/>
|
||||
</div>
|
||||
<div class="col-xs-3">
|
||||
Package:<field name="package_count" class="oe_inline o_form_label"/>/
|
||||
<field name="package_done_count" class="oe_inline o_form_label"/>
|
||||
</div>
|
||||
</div>
|
||||
<field name="weight_done_total"/>
|
||||
</xpath>
|
||||
<!--显示总数量-->
|
||||
<xpath expr="//field[@name='pack_operation_product_ids']/tree/field[@name='product_qty']" position="attributes">
|
||||
<attribute name="sum">Total</attribute>
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
<field name="inherit_id" ref="stock.view_quant_package_tree"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='packaging_id']" position="after">
|
||||
<field name="product_qty_total"/>
|
||||
<field name="qty_done_total"/>
|
||||
<field name="weight_done_total"/>
|
||||
</xpath>
|
||||
|
||||
Reference in New Issue
Block a user