Commit f4b7f800 by 赵言乐

委外发料问题处理

parent 30835ea0
......@@ -22,6 +22,7 @@
'views/roke_entrust_issue_record_view.xml',
'wizard/assign_workcenter_wizard_view.xml',
'wizard/product_import_wizard_view.xml',
'wizard/inherit_transportation_product_info_wizard_views.xml'
],
'qweb': [
"static/src/xml/roke_craft_design.xml",
......
......@@ -9,6 +9,8 @@ class InheritProductionTask(models.Model):
standard_hours = fields.Float(string='标准工时', help='产品的标准工时(小时)')
mnemonic_aid_code = fields.Char(string="助记码")
material = fields.Char(string="材质")
hardness_requirements = fields.Char(string="硬度要求")
@api.model
def _name_search(self, name, args=None, operator='ilike', limit=100, name_get_uid=None):
......
......@@ -19,3 +19,6 @@ class InheritRokeSendMaterialRecordModel(models.Model):
process_id = fields.Many2one(related="material_id.process_id", string="工序", store=True)
entrust_customer = fields.Many2one(related="material_id.entrust_customer", string="委外客户", store=True)
material = fields.Char(related="product_id.material", string="材质", store=True)
hardness_requirements = fields.Char(related="product_id.hardness_requirements", string="硬度要求", store=True)
......@@ -6,6 +6,12 @@
<field name="model">roke.product</field>
<field name="inherit_id" ref="roke_workstation_api.capacity_inherit_view_roke_product_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='gross_profit_rate']" position="after">
<field name="material"/>
</xpath>
<xpath expr="//field[@name='uom_id']" position="after">
<field name="hardness_requirements"/>
</xpath>
<xpath expr="//field[@name='capacity']" position="after">
<field name="standard_hours"/>
</xpath>
......
......@@ -49,6 +49,8 @@
<field name="finish_qty" invisible="1"/>
<field name="employed"/>
<field name="note"/>
<field name="material"/>
<field name="hardness_requirements"/>
</tree>
</field>
</page>
......
......@@ -18,6 +18,12 @@ class InheritRokeResultPutWarehouseWizard(models.TransientModel):
return super(InheritRokeResultPutWarehouseWizard, self).default_get(field_names)
_logger.info(f"数据: {self.env.context.get('active_ids')}: {self.env._context.get('active_ids')}")
results = self.env['roke.production.result'].browse(self.env._context.get('active_ids'))
new_results = []
# 增加过滤
for result in results:
if result.pt_id.task_type == "main":
continue
new_results.append(result)
self.env._context = None
system_id = self.env.ref("roke_workstation_sync_ps.roke_workstation_sync_ps_integrate_system")
sync_address = system_id.sync_address
......@@ -31,7 +37,7 @@ class InheritRokeResultPutWarehouseWizard(models.TransientModel):
except Exception as e:
_logger.info("数据库链接失败,请检查数据库链接参数")
raise ValidationError("数据库链接失败,请检查数据库链接参数")
ids_str = [f"'{v.id}'" for v in results]
ids_str = [f"'{v.id}'" for v in new_results]
if not ids_str:
_logger.info("数据不需要同步")
return super(InheritRokeResultPutWarehouseWizard, self).default_get(field_names)
......@@ -60,7 +66,7 @@ class InheritRokeResultPutWarehouseWizard(models.TransientModel):
em = self.env["roke.employee"].search([("user_id", "=", self.env.uid)], limit=1)
insert_sql_data = []
_uuid = uuid.uuid1()
for v in results:
for v in new_results:
if v.id in insert_id:
continue
insert_sql_data.append(f"""
......
......@@ -58,4 +58,21 @@ class InheritTransportationProductInfoWizard(models.TransientModel):
'send_entrust_date': datetime.utcnow()
})
material_ids += entrust_id.material_ids.ids
self.env["roke.entrust.issue.record"].sudo().create({"material_ids": [(6, 0, material_ids)]})
record = self.env["roke.entrust.issue.record"].sudo().create({"material_ids": [(6, 0, material_ids)]})
return {
'name': "委外发料记录",
'type': 'ir.actions.act_window',
'res_model': 'roke.entrust.issue.record',
'view_mode': 'tree',
'target': 'current',
'context': {},
'domain': [('id', 'in', record.id)]
}
class InheritStockMoveInfoLine(models.TransientModel):
_inherit = "stock.move.info.line"
material = fields.Char(related="product_id.material", string="材质", store=True)
hardness_requirements = fields.Char(related="product_id.hardness_requirements", string="硬度要求", store=True)
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_transportation_product_info_wizard_form" model="ir.ui.view">
<field name="name">view.transportation.product.info.wizard.form</field>
<field name="model">transportation.product.info.wizard</field>
<field name="inherit_id" ref="roke_mes_entrust_order.transportation_product_info_wizard_form"/>
<field name="arch" type="xml">
<xpath expr="//notebook//page//field[@name='move_line_ids']//tree//field[@name='origin_work_id']" position="after">
<field name="material"/>
<field name="hardness_requirements"/>
</xpath>
</field>
</record>
</odoo>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment