diff --git a/app_stock_barcode/__manifest__.py b/app_stock_barcode/__manifest__.py
index 2ddd062f..a5271024 100644
--- a/app_stock_barcode/__manifest__.py
+++ b/app_stock_barcode/__manifest__.py
@@ -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'],
diff --git a/app_stock_barcode/i18n/zh_CN.po b/app_stock_barcode/i18n/zh_CN.po
index d55fafe1..5563acf3 100644
--- a/app_stock_barcode/i18n/zh_CN.po
+++ b/app_stock_barcode/i18n/zh_CN.po
@@ -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 "kg"
+msgstr "kg"
+
+#. 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
diff --git a/app_stock_barcode/models/stock_pack_current.py b/app_stock_barcode/models/stock_pack_current.py
index 8105512c..faa89831 100644
--- a/app_stock_barcode/models/stock_pack_current.py
+++ b/app_stock_barcode/models/stock_pack_current.py
@@ -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)
diff --git a/app_stock_barcode/models/stock_picking.py b/app_stock_barcode/models/stock_picking.py
index a1ff275f..b38d2105 100644
--- a/app_stock_barcode/models/stock_picking.py
+++ b/app_stock_barcode/models/stock_picking.py
@@ -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()
\ No newline at end of file
+ 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
diff --git a/app_stock_barcode/models/stock_quant_package.py b/app_stock_barcode/models/stock_quant_package.py
index d7e6c2f6..7112c3eb 100644
--- a/app_stock_barcode/models/stock_quant_package.py
+++ b/app_stock_barcode/models/stock_quant_package.py
@@ -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
diff --git a/app_stock_barcode/views/stock_move_views.xml b/app_stock_barcode/views/stock_move_views.xml
new file mode 100644
index 00000000..e4b45f2b
--- /dev/null
+++ b/app_stock_barcode/views/stock_move_views.xml
@@ -0,0 +1,13 @@
+
+
+
+ app.stock.move.tree
+ stock.picking
+
+
+
+ Total
+
+
+
+
\ No newline at end of file
diff --git a/app_stock_barcode/views/stock_pack_current_views.xml b/app_stock_barcode/views/stock_pack_current_views.xml
index 7d473bf9..a8fbb778 100644
--- a/app_stock_barcode/views/stock_pack_current_views.xml
+++ b/app_stock_barcode/views/stock_pack_current_views.xml
@@ -34,7 +34,7 @@
-
+
diff --git a/app_stock_barcode/views/stock_picking_views.xml b/app_stock_barcode/views/stock_picking_views.xml
index 815c8da3..6a4cbd4e 100644
--- a/app_stock_barcode/views/stock_picking_views.xml
+++ b/app_stock_barcode/views/stock_picking_views.xml
@@ -20,18 +20,68 @@
stock.picking
-
-
-
-
-
-
-
+
+
+
+
+
+ context.get('form_view_initial_mode')
+
+
+ context.get('form_view_initial_mode')
+
+
+
+
+
+
+
+
+
+
+ context.get('form_view_initial_mode')
+
+
+
+
+
+
+
+ Product:
+
+ ->
+
+
+
+ Package:
+
+ ->
+
+
+
+ Weight Total:
+
+ kg
+
+
-
+
-
-
-
-
-
- Product:/
-
-
-
- Package:/
-
-
-
-
-
Total
diff --git a/app_stock_barcode/views/stock_quant_package_views.xml b/app_stock_barcode/views/stock_quant_package_views.xml
index c6198d31..77d44a03 100644
--- a/app_stock_barcode/views/stock_quant_package_views.xml
+++ b/app_stock_barcode/views/stock_quant_package_views.xml
@@ -6,6 +6,7 @@
+
diff --git a/odoo.conf b/odoo.conf
index af1dc7b3..603bea73 100644
--- a/odoo.conf
+++ b/odoo.conf
@@ -1,6 +1,6 @@
[options]
addons_path = d:\odoo10\app-odoo,d:\odoo10\source\odoo\addons,D:\odoo10ent\source\odoo\addons
-data_dir = file
+data_dir = d:\odoo10\file
db_host = 127.0.0.1
db_maxconn = 64
db_name = False