Compare commits
17 Commits
release/re
...
feature/优化
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba955ca658 | ||
|
|
ccbe311c58 | ||
|
|
4c58f4d7f3 | ||
|
|
b5a3815f1f | ||
|
|
988c4a460d | ||
|
|
c050e2f11a | ||
|
|
8bc68e1edd | ||
|
|
ea6fd42b2e | ||
|
|
625499f758 | ||
|
|
0c2d6dd582 | ||
|
|
005a7bb68e | ||
|
|
45178ac38b | ||
|
|
09ee1c26b1 | ||
|
|
f07a003f2c | ||
|
|
0ef46407dd | ||
|
|
cae5e14587 | ||
|
|
d187bb2bba |
@@ -24,6 +24,7 @@ class SfEquipmentSaintenanceStandards(models.Model):
|
|||||||
remark = fields.Char('备注')
|
remark = fields.Char('备注')
|
||||||
maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养')
|
maintenance_type = fields.Selection([('保养', '保养'), ("检修", "检修")], string='类型', default='保养')
|
||||||
name = fields.Char(string='名称')
|
name = fields.Char(string='名称')
|
||||||
|
active = fields.Boolean(default=True)
|
||||||
|
|
||||||
@api.model_create_multi
|
@api.model_create_multi
|
||||||
def create(self, vals_list):
|
def create(self, vals_list):
|
||||||
|
|||||||
@@ -6,15 +6,16 @@
|
|||||||
<field name="name">equipment.maintenance.standards.form</field>
|
<field name="name">equipment.maintenance.standards.form</field>
|
||||||
<field name="model">equipment.maintenance.standards</field>
|
<field name="model">equipment.maintenance.standards</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="设备维保标准">
|
<form string="设备维保标准" delete="false" duplicate="false">
|
||||||
<sheet>
|
<sheet>
|
||||||
<group>
|
<group>
|
||||||
<group>
|
<group>
|
||||||
<field name="code" readonly="1" force_save="1"/>
|
<field name="active" invisible="1"/>
|
||||||
<field name="name" readonly="1" force_save="1"/>
|
<field name="code" readonly="1" force_save="1"/>
|
||||||
<field name="maintenance_equipment_category_id" required="1" />
|
<field name="name" readonly="1" force_save="1"/>
|
||||||
<field name="eq_maintenance_ids" invisible='1'/>
|
<field name="maintenance_equipment_category_id" required="1"/>
|
||||||
<field name="overhaul_ids" invisible='1'/>
|
<field name="eq_maintenance_ids" invisible='1'/>
|
||||||
|
<field name="overhaul_ids" invisible='1'/>
|
||||||
|
|
||||||
|
|
||||||
</group>
|
</group>
|
||||||
@@ -50,7 +51,8 @@
|
|||||||
<field name="name">equipment.maintenance.standards.tree</field>
|
<field name="name">equipment.maintenance.standards.tree</field>
|
||||||
<field name="model">equipment.maintenance.standards</field>
|
<field name="model">equipment.maintenance.standards</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="设备维保标准">
|
<tree string="设备维保标准" delete="false">
|
||||||
|
<field name="active" invisible="1"/>
|
||||||
<field name="code" readonly="1" force_save="1"/>
|
<field name="code" readonly="1" force_save="1"/>
|
||||||
<field name="maintenance_type" required="1"/>
|
<field name="maintenance_type" required="1"/>
|
||||||
<field name="name" required="1"/>
|
<field name="name" required="1"/>
|
||||||
@@ -77,6 +79,7 @@
|
|||||||
<field name="name" string="日常机床保养"/>
|
<field name="name" string="日常机床保养"/>
|
||||||
<field name="created_user_id" string="创建人"/>
|
<field name="created_user_id" string="创建人"/>
|
||||||
<field name="maintenance_equipment_category_id" string="设备类别"/>
|
<field name="maintenance_equipment_category_id" string="设备类别"/>
|
||||||
|
<filter name="filter_active" string="已归档" domain="[('active','=',False)]"/>
|
||||||
</search>
|
</search>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ from odoo.http import request
|
|||||||
|
|
||||||
class Workpiece(http.Controller):
|
class Workpiece(http.Controller):
|
||||||
|
|
||||||
@http.route('/agvApi/backfeed', type='json', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
@http.route('/agvApi/backfeed', type='json', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||||
cors="*")
|
cors="*")
|
||||||
def backfeed(self, **kw):
|
def backfeed(self, **kw):
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -779,7 +779,8 @@ class MrpProduction(models.Model):
|
|||||||
routing_workcenter = self.env['mrp.routing.workcenter'].sudo().search(
|
routing_workcenter = self.env['mrp.routing.workcenter'].sudo().search(
|
||||||
[('name', '=', work.routing_type)])
|
[('name', '=', work.routing_type)])
|
||||||
|
|
||||||
work.write({'date_planned_start': date_planned_start, 'date_planned_finished': date_planned_end,'duration_expected':routing_workcenter.time_cycle})
|
work.write({'date_planned_start': date_planned_start, 'date_planned_finished': date_planned_end,
|
||||||
|
'duration_expected': routing_workcenter.time_cycle})
|
||||||
|
|
||||||
# 修改标记已完成方法
|
# 修改标记已完成方法
|
||||||
def button_mark_done1(self):
|
def button_mark_done1(self):
|
||||||
@@ -1078,27 +1079,22 @@ class MrpProduction(models.Model):
|
|||||||
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
productions.write({'programming_no': self.programming_no, 'is_remanufacture': True})
|
||||||
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
# productions.procurement_group_id.mrp_production_ids.move_dest_ids.write(
|
||||||
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
# {'group_id': self.env['procurement.group'].search([('name', '=', sale_order.name)])})
|
||||||
stock_picking = None
|
stock_picking_remanufacture = self.env['stock.picking'].search([('origin', '=', productions.name)])
|
||||||
pc_picking = self.env['stock.picking'].search(
|
for pick in stock_picking_remanufacture:
|
||||||
[('origin', '=', productions.name), ('name', 'ilike', 'WH/PC/')])
|
if pick.name.startswith('WH/PC/') or pick.name.startswith('WH/INT/'):
|
||||||
stock_picking = pc_picking
|
if pick.move_ids:
|
||||||
int_picking = self.env['stock.picking'].search(
|
product_type_id = pick.move_ids[0].product_id.categ_id
|
||||||
[('origin', '=', productions.name), ('name', 'ilike', 'WH/INT/')])
|
if product_type_id.name == '坯料':
|
||||||
stock_picking |= int_picking
|
location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
|
||||||
for pick in stock_picking:
|
if not location_id:
|
||||||
if pick.move_ids:
|
logging.info(f'没有搜索到【坯料存货区】: {location_id}')
|
||||||
product_type_id = pick.move_ids[0].product_id.categ_id
|
break
|
||||||
if product_type_id.name == '坯料':
|
if pick.picking_type_id.name == '内部调拨':
|
||||||
location_id = self.env['stock.location'].search([('name', '=', '坯料存货区')])
|
if pick.location_dest_id.product_type != product_type_id:
|
||||||
if not location_id:
|
pick.location_dest_id = location_id.id
|
||||||
logging.info(f'没有搜索到【坯料存货区】: {location_id}')
|
elif pick.picking_type_id.name == '生产发料':
|
||||||
break
|
if pick.location_id.product_type != product_type_id:
|
||||||
if pick.picking_type_id.name == '内部调拨':
|
pick.location_id = location_id.id
|
||||||
if pick.location_dest_id.product_type != product_type_id:
|
|
||||||
pick.location_dest_id = location_id.id
|
|
||||||
elif pick.picking_type_id.name == '生产发料':
|
|
||||||
if pick.location_id.product_type != product_type_id:
|
|
||||||
pick.location_id = location_id.id
|
|
||||||
scarp_process_parameter_workorder = self.env['mrp.workorder'].search(
|
scarp_process_parameter_workorder = self.env['mrp.workorder'].search(
|
||||||
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', self.id),
|
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', self.id),
|
||||||
('is_subcontract', '=', True)])
|
('is_subcontract', '=', True)])
|
||||||
@@ -1111,7 +1107,6 @@ class MrpProduction(models.Model):
|
|||||||
for process_item in scarp_process_parameter_workorder:
|
for process_item in scarp_process_parameter_workorder:
|
||||||
if purchase_item.product_id.categ_type == '表面工艺':
|
if purchase_item.product_id.categ_type == '表面工艺':
|
||||||
if purchase_item.product_id.server_product_process_parameters_id == process_item.surface_technics_parameters_id:
|
if purchase_item.product_id.server_product_process_parameters_id == process_item.surface_technics_parameters_id:
|
||||||
print(purchase_orders.origin.find(productions.name))
|
|
||||||
if purchase_orders.origin.find(productions.name) == -1:
|
if purchase_orders.origin.find(productions.name) == -1:
|
||||||
purchase_orders.origin += ',' + productions.name
|
purchase_orders.origin += ',' + productions.name
|
||||||
if item['is_reprogramming'] is False:
|
if item['is_reprogramming'] is False:
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
material_width = fields.Float(string='宽')
|
material_width = fields.Float(string='宽')
|
||||||
material_height = fields.Float(string='高')
|
material_height = fields.Float(string='高')
|
||||||
# 零件图号
|
# 零件图号
|
||||||
part_number = fields.Char(string='零件图号')
|
part_number = fields.Char(related='production_id.part_number', string='零件图号')
|
||||||
# 工序状态
|
# 工序状态
|
||||||
process_state = fields.Selection([
|
process_state = fields.Selection([
|
||||||
('待装夹', '待装夹'),
|
('待装夹', '待装夹'),
|
||||||
@@ -1100,7 +1100,7 @@ class ResMrpWorkOrder(models.Model):
|
|||||||
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
[('barcode', 'ilike', 'VL-SPOC')]).id),
|
||||||
('origin', '=', self.production_id.name)])
|
('origin', '=', self.production_id.name)])
|
||||||
if move_out.state != 'done':
|
if move_out.state != 'done':
|
||||||
move_out.write({'state': 'assigned'})
|
move_out.write({'state': 'assigned', 'production_id': False})
|
||||||
self.env['stock.move.line'].create(move_out.get_move_line(self.production_id, self))
|
self.env['stock.move.line'].create(move_out.get_move_line(self.production_id, self))
|
||||||
|
|
||||||
# move_out._action_assign()
|
# move_out._action_assign()
|
||||||
|
|||||||
@@ -267,6 +267,11 @@ class StockRule(models.Model):
|
|||||||
workorder_duration += workorder.duration_expected
|
workorder_duration += workorder.duration_expected
|
||||||
|
|
||||||
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
|
||||||
|
# 根据销售订单号查询快速订单
|
||||||
|
quick_easy_order = self.env['quick.easy.order'].sudo().search([('sale_order_id', '=', sale_order.id)])
|
||||||
|
if quick_easy_order:
|
||||||
|
production.write({'part_number': quick_easy_order.part_drawing_number,
|
||||||
|
'part_drawing': quick_easy_order.machining_drawings})
|
||||||
if sale_order:
|
if sale_order:
|
||||||
# sale_order.write({'schedule_status': 'to schedule'})
|
# sale_order.write({'schedule_status': 'to schedule'})
|
||||||
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
self.env['sf.production.plan'].sudo().with_company(company_id).create({
|
||||||
@@ -288,6 +293,7 @@ class StockRule(models.Model):
|
|||||||
# 为同一个product_id创建一个生产订单名称列表
|
# 为同一个product_id创建一个生产订单名称列表
|
||||||
product_id_to_production_names[product_id] = [production.name for production in all_production]
|
product_id_to_production_names[product_id] = [production.name for production in all_production]
|
||||||
for production_item in productions:
|
for production_item in productions:
|
||||||
|
|
||||||
production_programming = self.env['mrp.production'].search(
|
production_programming = self.env['mrp.production'].search(
|
||||||
[('product_id.id', '=', production_item.product_id.id),
|
[('product_id.id', '=', production_item.product_id.id),
|
||||||
('origin', '=', production_item.origin)],
|
('origin', '=', production_item.origin)],
|
||||||
@@ -574,6 +580,7 @@ class StockPicking(models.Model):
|
|||||||
('origin', '=', self.origin), ('picking_id', '=', self.id)])
|
('origin', '=', self.origin), ('picking_id', '=', self.id)])
|
||||||
if self.location_id == move_in.location_id and self.location_dest_id == move_in.location_dest_id:
|
if self.location_id == move_in.location_id and self.location_dest_id == move_in.location_dest_id:
|
||||||
if move_out.origin == move_in.origin:
|
if move_out.origin == move_in.origin:
|
||||||
|
move_in.write({'production_id': False})
|
||||||
if move_out.picking_id.state != 'done':
|
if move_out.picking_id.state != 'done':
|
||||||
raise UserError(
|
raise UserError(
|
||||||
_('该入库单对应的单号为%s的出库单还未完成,不能进行验证操作!' % move_out.picking_id.name))
|
_('该入库单对应的单号为%s的出库单还未完成,不能进行验证操作!' % move_out.picking_id.name))
|
||||||
@@ -659,6 +666,11 @@ class ReStockMove(models.Model):
|
|||||||
return move_values
|
return move_values
|
||||||
|
|
||||||
def _get_new_picking_values_Res(self, item, sorted_workorders, rescode):
|
def _get_new_picking_values_Res(self, item, sorted_workorders, rescode):
|
||||||
|
picking_type_id = self.mapped('picking_type_id').id
|
||||||
|
if rescode == 'WH/OCOUT/':
|
||||||
|
picking_type_id = self.env.ref('sf_manufacturing.outcontract_picking_out').id
|
||||||
|
elif rescode == 'WH/OCIN/':
|
||||||
|
picking_type_id = self.env.ref('sf_manufacturing.outcontract_picking_in').id
|
||||||
return {
|
return {
|
||||||
'name': self.env['stock.picking']._get_name_Res(rescode),
|
'name': self.env['stock.picking']._get_name_Res(rescode),
|
||||||
'origin': item.name,
|
'origin': item.name,
|
||||||
@@ -667,7 +679,7 @@ class ReStockMove(models.Model):
|
|||||||
'user_id': False,
|
'user_id': False,
|
||||||
'move_type': self.mapped('group_id').move_type or 'direct',
|
'move_type': self.mapped('group_id').move_type or 'direct',
|
||||||
'partner_id': sorted_workorders.supplier_id.id,
|
'partner_id': sorted_workorders.supplier_id.id,
|
||||||
'picking_type_id': self.mapped('picking_type_id').id,
|
'picking_type_id': picking_type_id,
|
||||||
'location_id': self.mapped('location_id').id,
|
'location_id': self.mapped('location_id').id,
|
||||||
'location_dest_id': self.mapped('location_dest_id').id,
|
'location_dest_id': self.mapped('location_dest_id').id,
|
||||||
'state': 'confirmed',
|
'state': 'confirmed',
|
||||||
|
|||||||
@@ -56,6 +56,27 @@ class QuickEasyOrder(models.Model):
|
|||||||
processing_time = fields.Integer('加工时长(min)')
|
processing_time = fields.Integer('加工时长(min)')
|
||||||
sale_order_id = fields.Many2one('sale.order', '销售订单号')
|
sale_order_id = fields.Many2one('sale.order', '销售订单号')
|
||||||
|
|
||||||
|
part_drawing_number = fields.Char('零件图号')
|
||||||
|
machining_drawings = fields.Binary('2D加工图纸')
|
||||||
|
machining_drawings_name = fields.Char('2D加工图纸名')
|
||||||
|
|
||||||
|
@api.onchange('machining_drawings_name')
|
||||||
|
def _onchange_machining_drawings_name(self):
|
||||||
|
for item in self:
|
||||||
|
if item.machining_drawings_name:
|
||||||
|
if not item.machining_drawings_name.lower().endswith(
|
||||||
|
'.pdf'):
|
||||||
|
raise ValidationError('文件格式上传有误,请检查文件后缀(不区分大小写)是否为pdf')
|
||||||
|
|
||||||
|
@api.onchange('parameter_ids')
|
||||||
|
def _compute_parameter_ids(self):
|
||||||
|
my_parameter_ids = {}
|
||||||
|
for item in self:
|
||||||
|
for item1 in item.parameter_ids:
|
||||||
|
my_parameter_ids[item1.process_id.id] = item1.ids[0]
|
||||||
|
my_parameter_ids = list(my_parameter_ids.values())
|
||||||
|
item.write({'parameter_ids': [(6, 0, my_parameter_ids)]})
|
||||||
|
|
||||||
@api.depends('unit_price', 'quantity')
|
@api.depends('unit_price', 'quantity')
|
||||||
def _compute_total_amount(self):
|
def _compute_total_amount(self):
|
||||||
for item in self:
|
for item in self:
|
||||||
@@ -116,6 +137,10 @@ class QuickEasyOrder(models.Model):
|
|||||||
if len(item.upload_model_file) > 1:
|
if len(item.upload_model_file) > 1:
|
||||||
raise ValidationError('只允许上传一个文件')
|
raise ValidationError('只允许上传一个文件')
|
||||||
if item.upload_model_file:
|
if item.upload_model_file:
|
||||||
|
if not item.upload_model_file.name.lower().endswith(
|
||||||
|
'.step') and not item.upload_model_file.name.lower().endswith(
|
||||||
|
'.stp'):
|
||||||
|
raise ValidationError('文件格式上传有误,请检查文件后缀(不区分大小写)是否为step、stp')
|
||||||
file_attachment_id = item.upload_model_file[0]
|
file_attachment_id = item.upload_model_file[0]
|
||||||
# 附件路径
|
# 附件路径
|
||||||
report_path = file_attachment_id._full_path(file_attachment_id.store_fname)
|
report_path = file_attachment_id._full_path(file_attachment_id.store_fname)
|
||||||
|
|||||||
@@ -73,12 +73,15 @@
|
|||||||
<field name="material_model_id" options="{'no_create': True}" required="1"/>
|
<field name="material_model_id" options="{'no_create': True}" required="1"/>
|
||||||
<!-- <field name="process_id"/>-->
|
<!-- <field name="process_id"/>-->
|
||||||
<field name="parameter_ids" widget="many2many_tags" string="表面工艺参数"
|
<field name="parameter_ids" widget="many2many_tags" string="表面工艺参数"
|
||||||
options="{'no_create': True}" required="1"/>
|
options="{'no_create': True}"/>
|
||||||
<field name="machining_precision" required="1"/>
|
<field name="machining_precision" required="1"/>
|
||||||
<field name="processing_time"/>
|
<field name="processing_time"/>
|
||||||
<field name="quantity" options="{'format': false}"/>
|
<field name="quantity" options="{'format': false}"/>
|
||||||
<field name="unit_price"/>
|
<field name="unit_price"/>
|
||||||
<field name="price" options="{'format': false}"/>
|
<field name="price" options="{'format': false}"/>
|
||||||
|
<field name="part_drawing_number"/>
|
||||||
|
<field name="machining_drawings" filename="machining_drawings_name" widget="pdf_viewer"/>
|
||||||
|
<field name="machining_drawings_name" invisible="1"/>
|
||||||
<field name="sale_order_id"
|
<field name="sale_order_id"
|
||||||
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
attrs='{"invisible": [("sale_order_id","=",False)],"readonly": [("sale_order_id","!=",False)]}'/>
|
||||||
</group>
|
</group>
|
||||||
|
|||||||
@@ -100,8 +100,7 @@
|
|||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="property_supplier_payment_term_id" position="before">
|
<field name="property_supplier_payment_term_id" position="before">
|
||||||
<field name="purchase_user_id" context="{'supplier_rank': supplier_rank }"
|
<field name="purchase_user_id" context="{'supplier_rank': supplier_rank }"
|
||||||
widget="many2one_avatar_user"
|
widget="many2one_avatar_user"/>
|
||||||
attrs="{'required' : [('supplier_rank','>', 0)]}"/>
|
|
||||||
</field>
|
</field>
|
||||||
<xpath expr="//field[@name='property_account_position_id']" position="attributes">
|
<xpath expr="//field[@name='property_account_position_id']" position="attributes">
|
||||||
<attribute name="attrs">{'readonly': [('id','!=', False)]}</attribute>
|
<attribute name="attrs">{'readonly': [('id','!=', False)]}</attribute>
|
||||||
|
|||||||
Reference in New Issue
Block a user