update stock_barcode

This commit is contained in:
ivan deng
2018-07-06 20:04:46 +08:00
parent a99ebdad06
commit e28cc0b382
12 changed files with 178 additions and 511 deletions

View File

@@ -31,9 +31,10 @@
'pre_init_hook': 'pre_init_hook', 'pre_init_hook': 'pre_init_hook',
'depends': ['stock_barcode'], 'depends': ['stock_barcode'],
'data': [ 'data': [
'views/stock_pack_current_views.xml', 'views/stock_pack_operation_views.xml',
'views/stock_picking_views.xml', 'views/stock_picking_views.xml',
'views/stock_quant_package_views.xml', 'views/stock_quant_package_views.xml',
'views/app_stock_barcode_templates.xml',
], ],
'demo': [ 'demo': [
], ],

View File

@@ -1,219 +0,0 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * app_stock_barcode
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20171107\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"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_create_uid
msgid "Created by"
msgstr "Tạo bởi"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_create_date
msgid "Created on"
msgstr "Tạo ngày"
#. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_pack_current
msgid "Current Packing Operation"
msgstr "Đóng gói hiện tại"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_result_package_id
msgid "Destination Package"
msgstr "Kiện hàng đích"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_display_name
msgid "Display Name"
msgstr "Tên hiển thị"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_qty_done
msgid "Done"
msgstr "Hoàn tất"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_qty_done_total
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_qty_done_total
msgid "Done Total"
msgstr "Tổng hoàn tất"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_id
msgid "ID"
msgstr "ID"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_result_package_id
msgid "If set, the operations are packed into this package"
msgstr "Nếu thiết lập, các hoạt động được đóng gói trong gói này"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current___last_update
msgid "Last Modified on"
msgstr "Chỉnh sửa gần đây"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_product
msgid "Last OP"
msgstr "Hoạt động gần đây"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_write_uid
msgid "Last Updated by"
msgstr "Cập nhật bởi"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_write_date
msgid "Last Updated on"
msgstr "Cập nhật ngày"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_done_count
msgid "Package Done Total"
msgstr "Tổng kiện hàng hoàn tất"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_count
msgid "Package Total"
msgstr "Tổng kiện hàng"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Package"
msgstr "Gói hàng"
#. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_pack_operation
msgid "Packing Operation"
msgstr "Hoạt động gói hàng"
#. module: app_stock_barcode
#: model:ir.actions.act_window,name:app_stock_barcode.picking_2_current_action
msgid "Packing Package"
msgstr "Đóng gói kiện hàng"
#. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_quant_package
msgid "Physical Packages"
msgstr "Kiện hàng"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_id
msgid "Product"
msgstr "Sản phẩm"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_pack_operation_product_packed_ids
msgid "Product packed"
msgstr "Sản phẩm đã đóng gói"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_pack_operation_product_current_ids
msgid "Product packing"
msgstr "Sản phẩm đang đóng gói"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Product"
msgstr "Sản phẩm"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_result_package_ids
msgid "Relate Packages"
msgstr "Kiện hàng liên quan"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_package_id
msgid "Source Package"
msgstr "Kiện hàng nguồn"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Statistics"
msgstr "Số liệu thống kê"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_picking_id
msgid "Stock Picking"
msgstr "Giao nhận kho"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_picking_id
msgid "The stock operation where the packing has been made"
msgstr "Các hoạt động kho nơi đóng gói đã được thực hiện"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_weight
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_weight_done_subtotal
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal
msgid "The weight of the contents in Kg, not including any packaging, etc."
msgstr "Trọng lượng của các nội dung trong Kg, không bao gồm bất kỳ bao bì, vv"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_qty
msgid "To Do"
msgstr "Cần làm"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_product_qty_total
msgid "To Do Total"
msgstr "Tổng cần làm"
#. module: app_stock_barcode
#: 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 "Tổng"
#. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_picking
msgid "Transfer"
msgstr "Chuyển khoản"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_uom_id
msgid "Unit of Measure"
msgstr "Đơn vị"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_weight
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight
msgid "Weight"
msgstr "Trọng lượng"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_weight_done_subtotal
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal
msgid "Weight Done Subtotal"
msgstr "Tổng trọng lượng đã hoàn tẩt"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_weight_done_total
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_weight_done_total
msgid "Weight Done Total(kg)"
msgstr "Tổng trọng lượng đã hoàn tất (kg)"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Working Product"
msgstr "Sản phẩm đang làm"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_pack_current_tree
msgid "total"
msgstr "tổng"

View File

@@ -6,8 +6,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Odoo Server 10.0+e-20180326\n" "Project-Id-Version: Odoo Server 10.0+e-20180326\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-04-24 17:39+0000\n" "POT-Creation-Date: 2018-06-27 20:21+0000\n"
"PO-Revision-Date: 2018-04-24 17:39+0000\n" "PO-Revision-Date: 2018-06-27 20:21+0000\n"
"Last-Translator: <>\n" "Last-Translator: <>\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@@ -30,76 +30,26 @@ msgstr "扫码视图"
msgid "Briefing" msgid "Briefing"
msgstr "打包摘要" msgstr "打包摘要"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_create_uid
msgid "Created by"
msgstr "创建人"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_create_date
msgid "Created on"
msgstr "创建时间"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_pack_current #: model:ir.model,name:app_stock_barcode.model_stock_pack_current
msgid "Current Packing Operation" msgid "Current Packing Operation"
msgstr "当前扫码打包信息 Packing Operation" msgstr "当前扫码打包信息 Packing Operation"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_result_package_id
msgid "Destination Package"
msgstr "目的包裹"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_display_name
msgid "Display Name"
msgstr "显示名称"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_qty_done
msgid "Done"
msgstr "完成"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_qty_done_total #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_qty_done_total
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_qty_done_total #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_qty_done_total
msgid "Done Total" msgid "Done Total"
msgstr "完成总数" msgstr "完成总数"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_id
msgid "ID"
msgstr "ID"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_result_package_id
msgid "If set, the operations are packed into this package"
msgstr "如果设置,此作业即打包到此包裹内"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current___last_update
msgid "Last Modified on"
msgstr "最后修改日"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_product #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_product
msgid "Last OP" msgid "Last OP"
msgstr "当前扫码" msgstr "当前扫码"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_write_uid #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_package
msgid "Last Updated by" msgid "Last Package"
msgstr "最后更新人" msgstr "最近一次打包"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_write_date
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 #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_done_count #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_done_count
@@ -111,6 +61,11 @@ msgstr "包裹完成"
msgid "Package Total" msgid "Package Total"
msgstr "包裹待办" msgstr "包裹待办"
#. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Packages"
msgstr "包裹"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form #: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "Package" msgid "Package"
@@ -121,21 +76,11 @@ msgstr "包裹:"
msgid "Packing Operation" msgid "Packing Operation"
msgstr "打包作业" msgstr "打包作业"
#. module: app_stock_barcode
#: model:ir.actions.act_window,name:app_stock_barcode.picking_2_current_action
msgid "Packing Package"
msgstr "包裹再包装"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model,name:app_stock_barcode.model_stock_quant_package #: model:ir.model,name:app_stock_barcode.model_stock_quant_package
msgid "Physical Packages" msgid "Physical Packages"
msgstr "物理包裹" msgstr "物理包裹"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_id
msgid "Product"
msgstr "产品"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_pack_operation_product_packed_ids #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_pack_operation_product_packed_ids
msgid "Product packed" msgid "Product packed"
@@ -151,39 +96,22 @@ msgstr "当前打码散件"
msgid "Product" msgid "Product"
msgstr "散件:" msgstr "散件:"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_result_package_count
msgid "Result Package Total"
msgstr "包裹总数"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_result_package_ids #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_result_package_ids
msgid "Relate Packages" msgid "Result Packages"
msgstr "完成包裹" msgstr "包裹列表"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_package_id
msgid "Source Package"
msgstr "源包裹"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_picking_id
msgid "Stock Picking"
msgstr "仓库拣货"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_picking_id
msgid "The stock operation where the packing has been made"
msgstr "打包作业执行的库存作业"
#. module: app_stock_barcode
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_weight
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_current_weight_done_subtotal
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight #: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight
#: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal #: model:ir.model.fields,help:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal
msgid "The weight of the contents in Kg, not including any packaging, etc." msgid "The weight of the contents in Kg, not including any packaging, etc."
msgstr "以Kg(公斤)表示内容物重量,不包含任何包装等。" msgstr "以Kg(公斤)表示内容物重量,不包含任何包装等。"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_qty
msgid "To Do"
msgstr "待办"
#. module: app_stock_barcode #. 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_picking_product_qty_total
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_product_qty_total #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_quant_package_product_qty_total
@@ -202,18 +130,11 @@ msgid "Transfer"
msgstr "调拨" msgstr "调拨"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_product_uom_id
msgid "Unit of Measure"
msgstr "计量单位"
#. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_weight
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight
msgid "Weight" msgid "Weight"
msgstr "重量" msgstr "重量"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_weight_done_subtotal
#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_operation_weight_done_subtotal
msgid "Weight Done Subtotal" msgid "Weight Done Subtotal"
msgstr "重量小计" msgstr "重量小计"
@@ -230,7 +151,7 @@ msgid "Weight Total"
msgstr "总重量:" msgstr "总重量:"
#. module: app_stock_barcode #. module: app_stock_barcode
#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_pack_current_tree #: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form
msgid "total" msgid "Working Product"
msgstr "总计" msgstr "当前操作散件"

View File

@@ -2,5 +2,4 @@
import stock_picking import stock_picking
import stock_pack_operation import stock_pack_operation
import stock_pack_current
import stock_quant_package import stock_quant_package

View File

@@ -1,47 +0,0 @@
# -*- coding: utf-8 -*-
from odoo import fields, models, api, _
import odoo.addons.decimal_precision as dp
import logging
logger = logging.getLogger(__name__)
class StockPackCurrent(models.Model):
_name = "stock.pack.current"
_description = "Current Packing Operation"
_order = "id desc"
picking_id = fields.Many2one(
'stock.picking', 'Stock Picking',
# 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)
qty_done = fields.Float('Done', default=0.0, digits=dp.get_precision('Product Unit of Measure'))
package_id = fields.Many2one('stock.quant.package', 'Source Package')
result_package_id = fields.Many2one(
'stock.quant.package', 'Destination Package',
ondelete='cascade', required=False,
help="If set, the operations are packed into this package")
weight = fields.Float(
'Weight', digits=dp.get_precision('Stock Weight'), related='product_id.weight', readonly=True, store=True,
help="The weight of the contents in Kg, not including any packaging, etc.")
weight_done_subtotal = fields.Float(
'Weight Done Subtotal', digits=dp.get_precision('Stock Weight'), compute='_compute_weight_done_subtotal', readonly=True, store=True,
help="The weight of the contents in Kg, not including any packaging, etc.")
@api.depends('weight', 'qty_done')
def _compute_weight_done_subtotal(self):
for rec in self:
rec.weight_done_subtotal = rec.weight * rec.qty_done

View File

@@ -25,3 +25,4 @@ class PackOperation(models.Model):
def _compute_weight_done_subtotal(self): def _compute_weight_done_subtotal(self):
for rec in self: for rec in self:
rec.weight_done_subtotal = rec.weight * rec.qty_done rec.weight_done_subtotal = rec.weight * rec.qty_done

View File

@@ -13,34 +13,36 @@ class Picking(models.Model):
_name = 'stock.picking' _name = 'stock.picking'
_inherit = ['stock.picking', 'barcodes.barcode_events_mixin'] _inherit = ['stock.picking', 'barcodes.barcode_events_mixin']
# 是否在扫码视图 # 是否在扫码视图,暂时不用,使用原生方式处理
is_barcode_view = fields.Boolean('Barcode view', defult=False) is_barcode_view = fields.Boolean('Barcode view', defult=False)
# 扫码摘要 # 扫码摘要
header_title = fields.Char('Briefing', compute='_compute_briefing') header_title = fields.Char('Briefing', compute='_compute_briefing')
# 作业,已扫码未装入包操作的记录行
pack_operation_product_current_ids = fields.One2many( pack_operation_product_current_ids = fields.One2many(
'stock.pack.current', 'picking_id', string='Product packing', readonly=True, copy=False) 'stock.pack.operation', 'picking_id', string='Product packing',
compute='_compute_product_current', readonly=True, copy=False)
# 作业,已装入包操作的散件 # 作业,已装入包操作的散件
pack_operation_product_packed_ids = fields.One2many( pack_operation_product_packed_ids = fields.One2many(
'stock.pack.operation', 'picking_id', 'Product packed', 'stock.pack.operation', 'picking_id', string='Product packed',
domain=[('product_id', '>=', 1), ('qty_done', '>=', 1), ('result_package_id', '!=', False)], readonly=True, copy=False) domain=[('product_id', '>=', 1), ('qty_done', '>=', 1), ('result_package_id', '!=', False)], readonly=True, copy=False)
# 散件涉及到的包裹列表 # 散件涉及到的包裹列表
result_package_ids = fields.Many2many('stock.quant.package', string='Result 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) last_op_product = fields.Many2one('product.product', string='Last OP', readonly=True, copy=False)
# 上次打包的包裹,用于批量克隆
last_op_package = fields.Many2one('stock.quant.package', string='Last Package', readonly=True, copy=False)
# 待办统计,散件与包裹一起处理的数量 # 待办统计,散件与包裹一起处理的数量
product_qty_total = fields.Float('To Do Total', compute="_compute_product_qty_total", 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) # 总待办数量 digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) # 总待办数量
package_count = fields.Integer('Package Total', compute="_compute_package_count", readonly=True) # 待处理的包裹数量
# 完成统计,验证后才有 # 完成统计,验证后才有
qty_done_total = fields.Float('Done Total', compute="_compute_done_total", qty_done_total = fields.Float('Done Total', compute="_compute_done_total",
digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True) # 总完成数量 digits=dp.get_precision('Product Unit of Measure'), readonly=True, store=True, copy=False) # 总完成数量
weight_done_total = fields.Float('Weight Done Total(kg)', digits=dp.get_precision('Stock Weight'), weight_done_total = fields.Float('Weight Done Total(kg)', digits=dp.get_precision('Stock Weight'),
compute="_compute_done_total", readonly=True, store=True) # 总完成重量 compute="_compute_done_total", readonly=True, store=True, copy=False) # 总完成重量
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, copy=False) # 处理的包裹数量
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, copy=False) # 放入的包裹数量
result_package_count = fields.Integer('Result Package Total', compute="_compute_package_done_count", readonly=True, store=True) # 放入的包裹数量
@api.depends('partner_id') @api.depends('partner_id')
def _compute_briefing(self): def _compute_briefing(self):
@@ -80,8 +82,8 @@ class Picking(models.Model):
rec.qty_done_total = qty_done_total rec.qty_done_total = qty_done_total
rec.weight_done_total = weight_done_total rec.weight_done_total = weight_done_total
@api.multi
@api.depends('pack_operation_product_ids.result_package_id', 'pack_operation_pack_ids') @api.depends('pack_operation_product_ids.result_package_id', 'pack_operation_pack_ids')
@api.one
def _compute_package_count(self): def _compute_package_count(self):
for rec in self: for rec in self:
# 散件打包数量 # 散件打包数量
@@ -89,8 +91,8 @@ class Picking(models.Model):
# 包裹再打包数量 # 包裹再打包数量
rec.package_count += len(rec.pack_operation_pack_ids) rec.package_count += len(rec.pack_operation_pack_ids)
@api.multi
@api.depends('state', 'pack_operation_product_ids.result_package_id', 'pack_operation_pack_ids.result_package_id') @api.depends('state', 'pack_operation_product_ids.result_package_id', 'pack_operation_pack_ids.result_package_id')
@api.one
def _compute_package_done_count(self): def _compute_package_done_count(self):
for rec in self: for rec in self:
if rec.state == 'done': if rec.state == 'done':
@@ -99,48 +101,30 @@ class Picking(models.Model):
rec.package_done_count += len(pack_packs.mapped('result_package_id').ids) + rec.result_package_count rec.package_done_count += len(pack_packs.mapped('result_package_id').ids) + rec.result_package_count
# 不用于字段compute在每次放入包裹操作执行重新计算 # 不用于字段compute在每次放入包裹操作执行重新计算
def set_package(self): # 设置上次打包的包裹
@api.multi
def set_package(self, pack):
for rec in self: for rec in self:
if pack:
rec.last_op_package = pack
if rec.pack_operation_product_packed_ids: if rec.pack_operation_product_packed_ids:
rec.result_package_ids = rec.pack_operation_product_ids.mapped('result_package_id').ids rec.result_package_ids = rec.pack_operation_product_ids.mapped('result_package_id').ids
rec.package_count = len(rec.result_package_ids) + len(rec.pack_operation_pack_ids) rec.package_count = len(rec.result_package_ids) + len(rec.pack_operation_pack_ids)
pass pass
@api.multi
def put_in_pack2(self):
self.put_in_pack()
@api.multi @api.multi
def put_in_pack(self): def put_in_pack(self):
pack = super(Picking, self).put_in_pack() pack = super(Picking, self).put_in_pack()
self.set_package() self.set_package(pack)
self.set_current()
return pack return pack
# 每次重新算todo: 只更新相关行 @api.multi
@api.onchange('pack_operation_product_ids') @api.depends('pack_operation_product_ids.qty_done', 'state')
def set_current(self): def _compute_product_current(self):
self.pack_operation_product_current_ids = [(5, 0, 0)] for op in self:
current_ids = [] if op.pack_operation_product_ids and op.state == 'assigned':
if self.pack_operation_product_ids and self.state != 'done': op.pack_operation_product_current_ids = op.pack_operation_product_ids.filtered(
current_ids = self.pack_operation_product_ids \ lambda x: x.product_id and x.qty_done >= 1 and not x.result_package_id)
.filtered(lambda pack: pack.product_id and pack.qty_done > 0 and not pack.result_package_id)
if current_ids:
ops = []
for op in current_ids:
ops.insert(0, [0, 0, {
'picking_id': self.id,
'product_id': op.product_id.id,
'product_uom_id': op.product_uom_id.id,
'product_qty': op.product_qty,
'qty_done': op.qty_done,
'weight': op.weight,
}])
self.update({'pack_operation_product_current_ids': ops})
def _check_product(self, product, qty=1.0):
self.last_op_product = product
return super(Picking, self)._check_product(product, qty)
def action_see_packages(self): def action_see_packages(self):
self.ensure_one() self.ensure_one()
@@ -149,3 +133,4 @@ class Picking(models.Model):
packages += self.pack_operation_pack_ids.mapped('result_package_id') packages += self.pack_operation_pack_ids.mapped('result_package_id')
action['domain'] = [('id', 'in', packages.ids)] action['domain'] = [('id', 'in', packages.ids)]
return action return action

View File

@@ -0,0 +1,34 @@
odoo.define('app_stock_barcode.appPickingBarcodeHandler', function (require) {
"use strict";
var core = require('web.core');
var appFormViewBarcodeHandler = require('stock_barcode.PickingBarcodeHandler');
//用于获取最后扫码的产品,继承覆盖
appFormViewBarcodeHandler.include({
try_increasing_po_qty: function (barcode) {
function is_suitable(pack_operation) {
return pack_operation.get('product_barcode') === barcode
&& !pack_operation.get('lots_visible')
&& !pack_operation.get('location_processed')
&& !pack_operation.get('result_package_id');
}
var po_field = this.form_view.fields.pack_operation_product_ids;
var po_records = this._get_records(po_field);
var candidate = this._get_candidates(po_records, is_suitable);
if (candidate) {
this.field_manager.set_values({'last_op_product': candidate.get('product_id')}).done(function () {
self.updating = false;
});
return po_field.data_update(candidate.get('id'), {'qty_done': candidate.get('qty_done') + 1}).then(function () {
return po_field.viewmanager.active_view.controller.reload_record(candidate);
});
} else {
return $.Deferred().reject();
}
},
});
});

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<template id="assets_backend" name="app_stock_barcode assets" inherit_id="web.assets_backend">
<xpath expr="." position="inside">
<script type="text/javascript" src="/app_stock_barcode/static/src/js/picking_barcode_handler.js"></script>
</xpath>
</template>
</data>
</odoo>

View File

@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="app_view_pack_current_tree">
<field name="name">app.stock.pack.current.tree</field>
<field name="model">stock.pack.current</field>
<field name="arch" type="xml">
<tree>
<field name="weight"/>
<field name="picking_id"/>
<field name="product_id"/>
<field name="product_uom_id" groups="product.group_uom" invisible="1"/>
<field name="product_qty" sum="total"/>
<field name="qty_done" sum="total"/>
<field name="weight_done_subtotal" sum="total"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="app_view_pack_current_kanban">
<field name="name">app.stock.pack.current.kanban</field>
<field name="model">stock.pack.current</field>
<field name="arch" type="xml">
<!--default_group_by="default_pack_rule"-->
<kanban
quick_create="false" group_create="false" group_delete="false" group_edit="false">
<field name="product_id"/>
<field name="product_uom_id"/>
<field name="weight"/>
<field name="package_id"/>
<field name="result_package_id"/>
<field name="product_qty"/>
<field name="qty_done"/>
<templates>
<t t-name="kanban-box">
<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 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">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-elif="record.qty_done.value &gt; record.product_qty.value">
<span class="pull-right badge oe_kanban_color_7">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-elif="record.qty_done.value &lt; record.product_qty.value">
<span class="pull-right badge oe_kanban_color_6">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-else="">
<span class="pull-right badge oe_kanban_color_5">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
</div>
</t>
</t>
</t>
</t>
</templates>
</kanban>
</field>
</record>
<record id="picking_2_current_action" model="ir.actions.act_window">
<field name="name">Packing Package</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.pack.current</field>
<field name="view_type">form</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('picking_id', '=', active_id), ('qty_done, '>', 1)]</field>
<field name="context">{"search_default_groupby_result_package_id":True,}</field>
</record>
</odoo>

View File

@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<record model="ir.ui.view" id="app_view_pack_operation_current_kanban">
<field name="name">app.stock.pack.current.kanban</field>
<field name="model">stock.pack.operation</field>
<field name="priority">20</field>
<field name="arch" type="xml">
<!--default_group_by="default_pack_rule"-->
<kanban quick_create="false" group_create="false" group_delete="false" group_edit="false">
<field name="product_id"/>
<field name="product_uom_id"/>
<field name="weight"/>
<field name="package_id"/>
<field name="result_package_id"/>
<field name="product_qty"/>
<field name="qty_done"/>
<templates>
<t t-name="kanban-box">
<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 name="app_barcode_card" t-attf-class="oe_kanban_card oe_kanban_global_click" style="box-shadow:0px 2px 2px 1px #ccc">
<div class="text-muted">
<t t-esc="record.product_id.value"/>
<t t-if="record.product_qty.value==0">
<span class="pull-right badge oe_kanban_color_9">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-elif="record.qty_done.value &gt; record.product_qty.value">
<span class="pull-right badge oe_kanban_color_7">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-elif="record.qty_done.value &lt; record.product_qty.value">
<span class="pull-right badge oe_kanban_color_6">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
<t t-else="">
<span class="pull-right badge oe_kanban_color_5">
<t t-esc="record.qty_done.value" class="ml4 mr4"/>
/
<t t-esc="record.product_qty.value" class="ml4"/>
<t t-esc="record.product_uom_id.value" class="ml4"/>
</span>
</t>
</div>
</div>
</t>
</t>
</t>
</t>
</templates>
</kanban>
</field>
</record>
</odoo>

View File

@@ -67,17 +67,19 @@
<field name="weight_done_total" class="oe_inline o_form_label"/> <field name="weight_done_total" class="oe_inline o_form_label"/>
<span class="ml4">kg</span> <span class="ml4">kg</span>
</div> </div>
<div class="col-xs-12 col-md-6"> </div>
<div class="row" readonly="1">
<div class="col-xs-6 col-md-3">
<label for="last_op_product"/> <label for="last_op_product"/>
<div> <field name="last_op_product" class="oe_inline o_form_label"/>
<strong> </div>
<field name="last_op_product"/> <div class="col-xs-6 col-md-3">
</strong> <label for="last_op_package"/>
<button class="btn btn-primary oe_right" name="put_in_pack2" type="object" string="&#8627;放入包裹" <field name="last_op_package" class="oe_inline o_form_label"/>
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" groups="stock.group_tracking_lot"/> </div>
<button class="btn btn-primary oe_right mb4 mr4" name="set_current" type="object" string="刷新扫码视图" <div class="col-xs-12 col-md-6">
attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" icon="fa-refresh"/> <button class="btn btn-primary oe_right ml4" name="put_in_pack" id="put_in_pack_copy" type="object" string="&#8627;放入包裹"
</div> attrs="{'invisible': [('state', 'in', ('done', 'cancel'))]}" groups="stock.group_tracking_lot"/>
</div> </div>
</div> </div>
</xpath> </xpath>
@@ -86,6 +88,7 @@
<page name="current_op" string="Working Product " attrs="{'invisible': [('state', 'in', ('draft', 'confirmed', 'waiting'))]}"> <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}" <field name="pack_operation_product_current_ids" options="{'reload_on_button': True}"
mode="kanban" attrs="{'invisible': [('state', 'in', ('draft', 'confirmed', 'waiting'))]}" mode="kanban" attrs="{'invisible': [('state', 'in', ('draft', 'confirmed', 'waiting'))]}"
view_id="app_view_pack_current_kanban"
context="{'default_picking_id': id}"/> context="{'default_picking_id': id}"/>
</page> </page>
</xpath> </xpath>