Accept Merge Request #2153: (feature/6694 -> develop)
Merge Request: 出厂检验报告需求 Created By: @胡尧 Accepted By: @胡尧 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2153?initial=true
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<field name="name">quality.check.measure.line.tree</field>
|
<field name="name">quality.check.measure.line.tree</field>
|
||||||
<field name="model">quality.check.measure.line</field>
|
<field name="model">quality.check.measure.line</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree editable="bottom" class="measureTable" attrs="{ 'pacthResize': True }">
|
<tree editable="bottom" class="measureTable">
|
||||||
<!-- <field name="sequence" class="measureTableSequence"/> -->
|
<!-- <field name="sequence" class="measureTableSequence"/> -->
|
||||||
<!-- <field name="column_nums"/> -->
|
<!-- <field name="column_nums"/> -->
|
||||||
<field name="measure_item"/>
|
<field name="measure_item"/>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
'author': 'jikimo',
|
'author': 'jikimo',
|
||||||
'website': 'https://sf.cs.jikimo.com',
|
'website': 'https://sf.cs.jikimo.com',
|
||||||
# 此处依赖sf_manufacturing是因为我要重写其中的一个字段operation_id的string,故需要sf_manufacturing先安装
|
# 此处依赖sf_manufacturing是因为我要重写其中的一个字段operation_id的string,故需要sf_manufacturing先安装
|
||||||
'depends': ['quality_control', 'web_widget_model_viewer', 'sf_manufacturing','jikimo_attachment_viewer'],
|
'depends': ['quality_control', 'web_widget_model_viewer', 'sf_manufacturing','jikimo_attachment_viewer', 'jikimo_confirm_dialog'],
|
||||||
'data': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'data/check_standards.xml',
|
'data/check_standards.xml',
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ from odoo import fields, models, api
|
|||||||
from odoo.exceptions import ValidationError
|
from odoo.exceptions import ValidationError
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from odoo.addons.sf_base.commons.common import Common
|
from odoo.addons.sf_base.commons.common import Common
|
||||||
from odoo.tools import float_round
|
from odoo.tools import float_round, float_compare
|
||||||
|
|
||||||
|
|
||||||
class QualityCheck(models.Model):
|
class QualityCheck(models.Model):
|
||||||
@@ -208,4 +208,43 @@ class QualityCheck(models.Model):
|
|||||||
'title': '警告',
|
'title': '警告',
|
||||||
'message': '不合格数量不能超过已检数量'
|
'message': '不合格数量不能超过已检数量'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
total_qty_readonly = fields.Boolean(compute='_compute_total_qty_readonly', store=True)
|
||||||
|
|
||||||
|
def _compute_total_qty_readonly(self):
|
||||||
|
report_test_type_id = self.env.ref('sf_quality.test_type_factory_inspection').id
|
||||||
|
for record in self:
|
||||||
|
if (record.measure_on != 'move_line' or record.workorder_id is False) and record.point_id.test_type_id.id != report_test_type_id:
|
||||||
|
record.total_qty_readonly = True
|
||||||
|
else:
|
||||||
|
record.total_qty_readonly = False
|
||||||
|
|
||||||
|
def preview_doc(self):
|
||||||
|
"""预览出厂检验报告"""
|
||||||
|
self.ensure_one()
|
||||||
|
picking_qty = sum(self.picking_id.move_ids.mapped('product_uom_qty'))
|
||||||
|
if float_compare(float(self.total_qty), picking_qty, self.picking_id.product_id.uom_id.rounding) != 0:
|
||||||
|
return {
|
||||||
|
'type': 'ir.actions.client',
|
||||||
|
'tag': 'jikimo_confirm_dialog',
|
||||||
|
'params': {
|
||||||
|
'active_id': self.id,
|
||||||
|
'message': f"拣货调拨单号{self.picking_id.name}需求数量为{picking_qty},当前质量检查单产品数量为{self.total_qty},数量不一致,是否确认继续?",
|
||||||
|
'next_model': self._name,
|
||||||
|
'next_method': 'preview_doc_confirm',
|
||||||
|
'context': self.env.context
|
||||||
|
}
|
||||||
|
}
|
||||||
|
action = self.env.ref("sf_quality.action_report_quality_inspection_preview").read()[0]
|
||||||
|
return action
|
||||||
|
|
||||||
|
|
||||||
|
def preview_doc_confirm(self):
|
||||||
|
self.ensure_one()
|
||||||
|
action = self.env.ref("sf_quality.action_report_quality_inspection_preview").read()[0]
|
||||||
|
action['context'] = {
|
||||||
|
'active_id': self.id,
|
||||||
|
'active_ids': [self.id]
|
||||||
|
}
|
||||||
|
return action
|
||||||
|
|||||||
@@ -73,9 +73,9 @@
|
|||||||
<xpath expr="//header" position="inside">
|
<xpath expr="//header" position="inside">
|
||||||
<field name="is_out_check" invisible="1"/>
|
<field name="is_out_check" invisible="1"/>
|
||||||
<field name="publish_status" invisible="1"/>
|
<field name="publish_status" invisible="1"/>
|
||||||
<button name="%(sf_quality.action_report_quality_inspection_preview)d"
|
<button name="preview_doc"
|
||||||
string="预览"
|
string="预览"
|
||||||
type="action"
|
type="object"
|
||||||
class="oe_highlight" attrs="{'invisible': [('is_out_check', '=', False)]}"/>
|
class="oe_highlight" attrs="{'invisible': [('is_out_check', '=', False)]}"/>
|
||||||
<!-- --><!-- 如果还需要打印按钮 -->
|
<!-- --><!-- 如果还需要打印按钮 -->
|
||||||
<!-- <button name="%(sf_quality.action_report_quality_inspection)d" -->
|
<!-- <button name="%(sf_quality.action_report_quality_inspection)d" -->
|
||||||
@@ -88,10 +88,13 @@
|
|||||||
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" confirm="确定取消发布吗?" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
<button name="do_cancel_publish" string="取消发布" type="object" class="btn-primary" confirm="确定取消发布吗?" attrs="{'invisible': ['|',('is_out_check', '=', False), ('publish_status', '!=', 'published')]}"/>
|
||||||
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
<button name="do_re_publish" string="重新发布" type="object" class="btn-primary" attrs="{'invisible': ['|', ('is_out_check', '=', False), ('publish_status', '!=', 'canceled')]}"/>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<xpath expr="//field[@name='total_qty']" position="before">
|
||||||
|
<field name="total_qty_readonly" invisible="1"/>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='total_qty']" position="attributes">
|
<xpath expr="//field[@name='total_qty']" position="attributes">
|
||||||
<attribute name="attrs">{
|
<attribute name="attrs">{
|
||||||
'invisible': ['&', '|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False), '|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)],
|
'invisible': ['&', '|', ('measure_on', '!=', 'product'), ('is_out_check', '=', False), '|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)],
|
||||||
'readonly': ['|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)],
|
'readonly': [('total_qty_readonly', '=', True)],
|
||||||
'on_change': ['|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)]
|
'on_change': ['|', ('measure_on', '!=', 'move_line'), ('workorder_id', '=', False)]
|
||||||
}</attribute>
|
}</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|||||||
Reference in New Issue
Block a user