计算总数量
This commit is contained in:
@@ -136,7 +136,18 @@ class QualityCheck(models.Model):
|
|||||||
# # 出厂检验报告编号
|
# # 出厂检验报告编号
|
||||||
# report_number = fields.Char('出厂检验报告编号', compute='_compute_report_number', readonly=True)
|
# report_number = fields.Char('出厂检验报告编号', compute='_compute_report_number', readonly=True)
|
||||||
# 总数量,值为调拨单_产品明细_数量
|
# 总数量,值为调拨单_产品明细_数量
|
||||||
total_qty = fields.Char('总数量', readonly=True)
|
total_qty = fields.Char('总数量', compute='_compute_total_qty')
|
||||||
|
|
||||||
|
@api.depends('picking_id')
|
||||||
|
def _compute_total_qty(self):
|
||||||
|
for record in self:
|
||||||
|
if record.picking_id:
|
||||||
|
total_qty = 0
|
||||||
|
for move in record.picking_id.move_ids_without_package:
|
||||||
|
total_qty += move.quantity_done
|
||||||
|
record.total_qty = total_qty if total_qty > 0 else ''
|
||||||
|
else:
|
||||||
|
record.total_qty = ''
|
||||||
# 检验数
|
# 检验数
|
||||||
check_qty = fields.Char('检验数', default=lambda self: self._get_default_check_qty())
|
check_qty = fields.Char('检验数', default=lambda self: self._get_default_check_qty())
|
||||||
|
|
||||||
@@ -166,7 +177,6 @@ class QualityCheck(models.Model):
|
|||||||
|
|
||||||
categ_type = fields.Selection(string='产品的类别', related='product_id.categ_id.type', store=True)
|
categ_type = fields.Selection(string='产品的类别', related='product_id.categ_id.type', store=True)
|
||||||
|
|
||||||
|
|
||||||
def add_measure_line(self):
|
def add_measure_line(self):
|
||||||
"""
|
"""
|
||||||
新增测量值,如果测量值有5列了,则提示“最多只能有5列测量值”
|
新增测量值,如果测量值有5列了,则提示“最多只能有5列测量值”
|
||||||
@@ -209,7 +219,6 @@ class QualityCheck(models.Model):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
@depends('product_id')
|
@depends('product_id')
|
||||||
def _compute_material_name(self):
|
def _compute_material_name(self):
|
||||||
for record in self:
|
for record in self:
|
||||||
|
|||||||
Reference in New Issue
Block a user