Merge branch 'develop' into feature/commercially_launched
This commit is contained in:
@@ -113,6 +113,7 @@ class PurchaseOrderLine(models.Model):
|
||||
part_name = fields.Char('零件名称', store=True, compute='_compute_part_name')
|
||||
related_product = fields.Many2one('product.product', string='关联产品',
|
||||
help='经此产品工艺加工成的成品')
|
||||
manual_part_number = fields.Char()
|
||||
manual_part_name = fields.Char()
|
||||
|
||||
@api.depends('product_id')
|
||||
@@ -144,3 +145,5 @@ class PurchaseOrderLine(models.Model):
|
||||
if record.manual_part_name:
|
||||
# 如果手动设置了 part_name,使用手动设置的值
|
||||
record.part_name = record.manual_part_name
|
||||
if record.manual_part_number:
|
||||
record.part_number = record.manual_part_number
|
||||
@@ -5,13 +5,15 @@ class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def button_validate(self):
|
||||
res = super(StockPicking, self).button_validate()
|
||||
"""
|
||||
出厂检验报告上传
|
||||
"""
|
||||
|
||||
out_quality_check = self.env['quality.check'].search(
|
||||
out_quality_checks = self.env['quality.check'].search(
|
||||
[('picking_id', '=', self.id), ('test_type_id.name', '=', '出厂检验报告')])
|
||||
# out_quality_checks 可能存在多个
|
||||
if out_quality_checks:
|
||||
for out_quality_check in out_quality_checks:
|
||||
if not out_quality_check.is_factory_report_uploaded:
|
||||
if out_quality_check and self.state == 'assigned':
|
||||
out_quality_check.upload_factory_report()
|
||||
@@ -21,9 +23,7 @@ class StockPicking(models.Model):
|
||||
“警告:存在不合格产品XXXX n 件、YYYYY m件,继续调拨请点“确认”,否则请取消?”
|
||||
"""
|
||||
context = self.env.context
|
||||
if (not (isinstance(res, dict) and res.get('type') == 'ir.actions.act_window')
|
||||
and not context.get('again_validate')
|
||||
and self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail')):
|
||||
if not context.get('again_validate') and self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail'):
|
||||
# 回滚事务,为二次确认/取消做准备
|
||||
self.env.cr.rollback()
|
||||
quality_check_ids = self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail')
|
||||
@@ -36,8 +36,14 @@ class StockPicking(models.Model):
|
||||
else:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('quantity_done'))
|
||||
fail_check_text = (f'{fail_check_text}、{product_id.name} {number}件'
|
||||
if fail_check_text != '' else f'{product_id.name} {number}件')
|
||||
if number == 0:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('reserved_availability'))
|
||||
if number == 0:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('product_uom_qty'))
|
||||
fail_check_text = (f'{fail_check_text}、{product_id.display_name} {number}件'
|
||||
if fail_check_text != '' else f'{product_id.display_name} {number}件')
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'picking.validate.check.wizard',
|
||||
@@ -49,4 +55,5 @@ class StockPicking(models.Model):
|
||||
'default_fail_check_text': f'警告:存在不合格产品{fail_check_text},继续调拨请点“确认”,否则请取消?',
|
||||
'again_validate': True}
|
||||
}
|
||||
res = super(StockPicking, self).button_validate()
|
||||
return res
|
||||
|
||||
@@ -386,7 +386,7 @@ class RePurchaseOrder(models.Model):
|
||||
'product_qty': 1,
|
||||
'product_uom': server_template.uom_id.id,
|
||||
'related_product': production.product_id.id,
|
||||
'part_number': pp.part_number,
|
||||
'manual_part_number': pp.part_number,
|
||||
'manual_part_name': pp.part_name,
|
||||
}))
|
||||
# 获取服务商品最后一个供应商的采购员
|
||||
|
||||
Reference in New Issue
Block a user