Commit 0bbda3f9 by 夏超

[fix] 东联委外记录功能记录

parent 9a7897b0
...@@ -12,12 +12,14 @@ ...@@ -12,12 +12,14 @@
""", """,
'data': [ 'data': [
'security/ir.model.access.csv', 'security/ir.model.access.csv',
'datas/sequence_data.xml',
'views/inherit_roke_production_task.xml', 'views/inherit_roke_production_task.xml',
'views/button_js.xml', 'views/button_js.xml',
'views/iniherit_work_order_view.xml', 'views/iniherit_work_order_view.xml',
'views/inherit_roke_product.xml', 'views/inherit_roke_product.xml',
'views/inherit_roke_routing_line.xml', 'views/inherit_roke_routing_line.xml',
'views/inherit_view_roke_process_form.xml', 'views/inherit_view_roke_process_form.xml',
'views/roke_entrust_issue_record_view.xml',
'wizard/assign_workcenter_wizard_view.xml', 'wizard/assign_workcenter_wizard_view.xml',
'wizard/product_import_wizard_view.xml', 'wizard/product_import_wizard_view.xml',
], ],
......
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data noupdate="1">
<record id="roek_entrust_issue_record_code_sequence" model="ir.sequence">
<field name="name">委外发料记录编号</field>
<field name="code">roke.entrust.issue.record.code</field>
<field name="prefix">EI%(y)s%(month)s%(day)s</field>
<field eval="True" name="use_date_range"/>
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
</data>
</odoo>
...@@ -4,3 +4,4 @@ from . import inherit_roke_routing ...@@ -4,3 +4,4 @@ from . import inherit_roke_routing
from . import inherit_roke_product from . import inherit_roke_product
from . import inherit_roke_process from . import inherit_roke_process
from . import inherit_roke_pub_interate_model from . import inherit_roke_pub_interate_model
from . import roke_entrust_issue_record
...@@ -90,8 +90,11 @@ class InheritWorkOrder(models.Model): ...@@ -90,8 +90,11 @@ class InheritWorkOrder(models.Model):
raise UserError('请前往仓库管理->作业类型,配置标识为 WW/OUT/ 的出库类型的委外出库!') raise UserError('请前往仓库管理->作业类型,配置标识为 WW/OUT/ 的出库类型的委外出库!')
# 数据创建展示 # 数据创建展示
for record in self: for record in self:
if record.routing_line_id.p_bom_ids:
for bom in record.routing_line_id.p_bom_ids: for bom in record.routing_line_id.p_bom_ids:
product_list.append((0, 0, self._get_bom_transportation_line_vals(record, bom))) product_list.append((0, 0, self._get_bom_transportation_line_vals(record, bom)))
else:
product_list.append((0, 0, self._get_transportation_line_vals(record)))
res = self.env["transportation.product.info.wizard"].create({ res = self.env["transportation.product.info.wizard"].create({
"picking_type_id": type_id.id, "picking_type_id": type_id.id,
"src_location_id": type_id.src_location_id.id, "src_location_id": type_id.src_location_id.id,
......
from odoo import models, fields, api, _
class RokeEntrustIssueRecordModel(models.Model):
_name = "roke.entrust.issue.record"
_description = "委外发料记录"
_rec_name = "code"
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code('roke.entrust.issue.record.code'))
material_ids = fields.Many2many("roke.send.material.record", string="委外发料记录")
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
,,,,,,, roke.entrust.issue.record,roke.entrust.issue.record,model_roke_entrust_issue_record,base.group_system,1,1,1,1
\ No newline at end of file \ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="roke_entrust_issue_record_tree" model="ir.ui.view">
<field name="name">roke.entrust.issue.record.tree.view</field>
<field name="model">roke.entrust.issue.record</field>
<field name="arch" type="xml">
<tree string="委外发料记录" create="0" edit="0" duplicate="0">
<field name="code"/>
<field name="material_ids" widget="many2many_tags"/>
<field name="create_uid" string="创建人"/>
<field name="create_date" string="创建时间"/>
</tree>
</field>
</record>
<record id="roke_entrust_issue_record_form" model="ir.ui.view">
<field name="name">roke.entrust.issue.record.form.view</field>
<field name="model">roke.entrust.issue.record</field>
<field name="arch" type="xml">
<form string="委外发料记录" create="0" edit="0" duplicate="0">
<group>
<group>
<group>
<field name="code"/>
</group>
<group>
<field name="create_uid" string="创建人"/>
</group>
</group>
<group>
<group>
<field name="create_date" string="创建时间"/>
</group>
<group>
</group>
</group>
</group>
<notebook>
<page string="发料明细">
<field name="material_ids" options="{'no_create': True}">
<tree>
<field name="product_id"/>
<field name="qty"/>
<field name="consume_qty"/>
<field name="surplus_qty"/>
<field name="finish_qty"/>
<field name="employed"/>
<field name="note"/>
</tree>
</field>
</page>
</notebook>
</form>
</field>
</record>
<record id="roke_entrust_issue_record_action" model="ir.actions.act_window">
<field name="name">委外发料记录</field>
<field name="res_model">roke.entrust.issue.record</field>
<field name="view_mode">tree,form</field>
<field name="type">ir.actions.act_window</field>
</record>
<menuitem id="roke_entrust_issue_record_menu" name="委外发料记录" sequence="91"
parent="roke_mes_production.roke_production_report_menu"
action="roke_entrust_issue_record_action"
groups="base.group_system"/>
</odoo>
\ No newline at end of file
...@@ -2,3 +2,4 @@ from . import assign_workcenter_wizard ...@@ -2,3 +2,4 @@ from . import assign_workcenter_wizard
from . import product_import_wizard from . import product_import_wizard
from . import inherit_roke_bom_create_picking_wizard from . import inherit_roke_bom_create_picking_wizard
from . import inherit_result_put_warehose_wizard from . import inherit_result_put_warehose_wizard
from . import inherit_transportation_product_info_wizard
from odoo import models, fields, api, _
from datetime import datetime
from odoo.exceptions import UserError
class InheritTransportationProductInfoWizard(models.TransientModel):
_inherit = "transportation.product.info.wizard"
def confirm(self):
# 是否生成委外调拨单
if not self.move_line_ids:
raise UserError('发料明细为空!')
setting = self.env['ir.config_parameter'].sudo().get_param('entrust.stock.type', default='禁止')
material_ids = []
if setting == '允许':
for entrust_id in self.entrust_ids:
move_ids = self.move_line_ids.filtered(lambda v: v.origin_work_id.id == entrust_id.id and v.qty > 0)
move_list = []
for move in move_ids:
# 取出明细
move_list.append((0, 0, self._get_move_list_vals(move)))
data = {
'state': self.state,
'picking_type_id': self.picking_type_id.id,
'type': self.type,
'partner_id': move_ids[0].partner_id.id if move_ids else False,
'src_location_id': self.src_location_id.id,
'dest_location_id': self.dest_location_id.id,
'picking_date': self.picking_date,
'origin': entrust_id.code,
'employee_id': self.employee_id.id,
'note': self.note,
'move_line_ids': move_list
}
# 创建调拨单
picking = self.env["roke.mes.stock.picking"].create(data)
entrust_id.write({
'entrust_state': '已发料',
'wo_start_state': '已开工',
'material_ids':move_list,
'send_entrust_date':datetime.utcnow(),
'entrust_id': picking.id,
'picking_count': entrust_id.picking_count + 1
})
material_ids += entrust_id.material_ids.ids
else:
for entrust_id in self.entrust_ids:
move_ids = self.move_line_ids.filtered(lambda v: v.origin_work_id.id == entrust_id.id and v.qty > 0)
move_list = []
for move in move_ids:
# 取出明细
move_list.append((0, 0, self._get_move_list_vals(move)))
# 写入工单发料记录
entrust_id.write({
'entrust_state': '已发料',
'wo_start_state': '已开工',
'material_ids': move_list,
'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)]})
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