diff --git a/app_stock_barcode/__manifest__.py b/app_stock_barcode/__manifest__.py index a5271024..cef49bc4 100644 --- a/app_stock_barcode/__manifest__.py +++ b/app_stock_barcode/__manifest__.py @@ -31,9 +31,10 @@ 'pre_init_hook': 'pre_init_hook', 'depends': ['stock_barcode'], 'data': [ - 'views/stock_pack_current_views.xml', + 'views/stock_pack_operation_views.xml', 'views/stock_picking_views.xml', 'views/stock_quant_package_views.xml', + 'views/app_stock_barcode_templates.xml', ], 'demo': [ ], diff --git a/app_stock_barcode/i18n/vi.po b/app_stock_barcode/i18n/vi.po deleted file mode 100644 index 421414bb..00000000 --- a/app_stock_barcode/i18n/vi.po +++ /dev/null @@ -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" diff --git a/app_stock_barcode/i18n/zh_CN.po b/app_stock_barcode/i18n/zh_CN.po index 5563acf3..6b719a38 100644 --- a/app_stock_barcode/i18n/zh_CN.po +++ b/app_stock_barcode/i18n/zh_CN.po @@ -6,8 +6,8 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 10.0+e-20180326\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2018-04-24 17:39+0000\n" -"PO-Revision-Date: 2018-04-24 17:39+0000\n" +"POT-Creation-Date: 2018-06-27 20:21+0000\n" +"PO-Revision-Date: 2018-06-27 20:21+0000\n" "Last-Translator: <>\n" "Language-Team: \n" "MIME-Version: 1.0\n" @@ -30,76 +30,26 @@ msgstr "扫码视图" 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" -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 #: model:ir.model,name:app_stock_barcode.model_stock_pack_current msgid "Current 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 #: 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 "完成总数" -#. 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 #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_product msgid "Last OP" msgstr "当前扫码" #. module: app_stock_barcode -#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_pack_current_write_uid -msgid "Last Updated by" -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" +#: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_last_op_package +msgid "Last Package" +msgstr "最近一次打包" #. module: app_stock_barcode #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_package_done_count @@ -111,6 +61,11 @@ msgstr "包裹完成" msgid "Package Total" 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 #: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form msgid "Package:" @@ -121,21 +76,11 @@ msgstr "包裹:" msgid "Packing Operation" 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 #: model:ir.model,name:app_stock_barcode.model_stock_quant_package msgid "Physical Packages" 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 #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_pack_operation_product_packed_ids msgid "Product packed" @@ -151,39 +96,22 @@ msgstr "当前打码散件" msgid "Product:" 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 #: model:ir.model.fields,field_description:app_stock_barcode.field_stock_picking_result_package_ids -msgid "Relate Packages" -msgstr "完成包裹" +msgid "Result Packages" +msgstr "包裹列表" #. 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_done_subtotal msgid "The weight of the contents in Kg, not including any packaging, etc." 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 #: 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 @@ -202,18 +130,11 @@ msgid "Transfer" msgstr "调拨" #. 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 msgid "Weight" msgstr "重量" #. 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 "重量小计" @@ -230,7 +151,7 @@ msgid "Weight Total:" msgstr "总重量:" #. module: app_stock_barcode -#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_pack_current_tree -msgid "total" -msgstr "总计" +#: model:ir.ui.view,arch_db:app_stock_barcode.app_view_picking_form +msgid "Working Product" +msgstr "当前操作散件" diff --git a/app_stock_barcode/models/__init__.py b/app_stock_barcode/models/__init__.py index 44a231bf..595691f0 100644 --- a/app_stock_barcode/models/__init__.py +++ b/app_stock_barcode/models/__init__.py @@ -2,5 +2,4 @@ import stock_picking import stock_pack_operation -import stock_pack_current import stock_quant_package \ No newline at end of file diff --git a/app_stock_barcode/models/stock_pack_current.py b/app_stock_barcode/models/stock_pack_current.py deleted file mode 100644 index faa89831..00000000 --- a/app_stock_barcode/models/stock_pack_current.py +++ /dev/null @@ -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 - diff --git a/app_stock_barcode/models/stock_pack_operation.py b/app_stock_barcode/models/stock_pack_operation.py index 041d49e5..3bb6a480 100644 --- a/app_stock_barcode/models/stock_pack_operation.py +++ b/app_stock_barcode/models/stock_pack_operation.py @@ -25,3 +25,4 @@ class PackOperation(models.Model): def _compute_weight_done_subtotal(self): for rec in self: rec.weight_done_subtotal = rec.weight * rec.qty_done + diff --git a/app_stock_barcode/models/stock_picking.py b/app_stock_barcode/models/stock_picking.py index b38d2105..d15cf6e7 100644 --- a/app_stock_barcode/models/stock_picking.py +++ b/app_stock_barcode/models/stock_picking.py @@ -13,34 +13,36 @@ 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) + 'stock.pack.operation', 'picking_id', string='Product packing', + compute='_compute_product_current', readonly=True, copy=False) # 作业,已装入包操作的散件 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) # 散件涉及到的包裹列表 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", 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", - 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'), - compute="_compute_done_total", readonly=True, store=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) # 放入的包裹数量 + compute="_compute_done_total", readonly=True, store=True, copy=False) # 总完成重量 + package_done_count = fields.Integer('Package Done 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, copy=False) # 放入的包裹数量 @api.depends('partner_id') def _compute_briefing(self): @@ -80,8 +82,8 @@ class Picking(models.Model): rec.qty_done_total = qty_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.one def _compute_package_count(self): for rec in self: # 散件打包数量 @@ -89,8 +91,8 @@ class Picking(models.Model): # 包裹再打包数量 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.one def _compute_package_done_count(self): for rec in self: 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 # 不用于字段compute,在每次放入包裹操作执行,重新计算 - def set_package(self): + # 设置上次打包的包裹 + @api.multi + def set_package(self, pack): for rec in self: + if pack: + rec.last_op_package = pack if rec.pack_operation_product_packed_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) pass - @api.multi - def put_in_pack2(self): - self.put_in_pack() - @api.multi def put_in_pack(self): pack = super(Picking, self).put_in_pack() - self.set_package() - self.set_current() + self.set_package(pack) return pack - # 每次重新算,todo: 只更新相关行 - @api.onchange('pack_operation_product_ids') - def set_current(self): - self.pack_operation_product_current_ids = [(5, 0, 0)] - current_ids = [] - if self.pack_operation_product_ids and self.state != 'done': - current_ids = self.pack_operation_product_ids \ - .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) + @api.multi + @api.depends('pack_operation_product_ids.qty_done', 'state') + def _compute_product_current(self): + for op in self: + if op.pack_operation_product_ids and op.state == 'assigned': + op.pack_operation_product_current_ids = op.pack_operation_product_ids.filtered( + lambda x: x.product_id and x.qty_done >= 1 and not x.result_package_id) def action_see_packages(self): self.ensure_one() @@ -149,3 +133,4 @@ class Picking(models.Model): packages += self.pack_operation_pack_ids.mapped('result_package_id') action['domain'] = [('id', 'in', packages.ids)] return action + diff --git a/app_stock_barcode/static/src/js/picking_barcode_handler.js b/app_stock_barcode/static/src/js/picking_barcode_handler.js new file mode 100644 index 00000000..0de2eb1c --- /dev/null +++ b/app_stock_barcode/static/src/js/picking_barcode_handler.js @@ -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(); + } + }, + }); + +}); diff --git a/app_stock_barcode/views/app_stock_barcode_templates.xml b/app_stock_barcode/views/app_stock_barcode_templates.xml new file mode 100644 index 00000000..c160d988 --- /dev/null +++ b/app_stock_barcode/views/app_stock_barcode_templates.xml @@ -0,0 +1,12 @@ + + + + + + + + diff --git a/app_stock_barcode/views/stock_pack_current_views.xml b/app_stock_barcode/views/stock_pack_current_views.xml deleted file mode 100644 index a8fbb778..00000000 --- a/app_stock_barcode/views/stock_pack_current_views.xml +++ /dev/null @@ -1,90 +0,0 @@ - - - - app.stock.pack.current.tree - stock.pack.current - - - - - - - - - - - - - - app.stock.pack.current.kanban - stock.pack.current - - - - - - - - - - - - - - - -
- - - - - / - - - - - - - - / - - - - - - - - / - - - - - - - - / - - - - -
-
-
-
-
-
-
-
-
- - - Packing Package - ir.actions.act_window - stock.pack.current - form - kanban,tree,form - [('picking_id', '=', active_id), ('qty_done, '>', 1)] - {"search_default_groupby_result_package_id":True,} - -
\ No newline at end of file diff --git a/app_stock_barcode/views/stock_pack_operation_views.xml b/app_stock_barcode/views/stock_pack_operation_views.xml new file mode 100644 index 00000000..02e1ce1c --- /dev/null +++ b/app_stock_barcode/views/stock_pack_operation_views.xml @@ -0,0 +1,67 @@ + + + + app.stock.pack.current.kanban + stock.pack.operation + 20 + + + + + + + + + + + + + + + +
+
+ + + + + / + + + + + + + + / + + + + + + + + / + + + + + + + + / + + + + +
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file diff --git a/app_stock_barcode/views/stock_picking_views.xml b/app_stock_barcode/views/stock_picking_views.xml index 6a4cbd4e..e3fe57fe 100644 --- a/app_stock_barcode/views/stock_picking_views.xml +++ b/app_stock_barcode/views/stock_picking_views.xml @@ -67,17 +67,19 @@ kg -
+
+
+
+
+
+
+
@@ -86,6 +88,7 @@