diff --git a/mrp_workorder/views/mrp_workorder_views.xml b/mrp_workorder/views/mrp_workorder_views.xml
index 8c208f19..eba33155 100644
--- a/mrp_workorder/views/mrp_workorder_views.xml
+++ b/mrp_workorder/views/mrp_workorder_views.xml
@@ -138,7 +138,7 @@ if env.user.has_group('mrp.group_mrp_workorder_dependencies'):
-
+
diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py
index 58691ca0..aa27736c 100644
--- a/sf_bf_connect/models/jd_eclp.py
+++ b/sf_bf_connect/models/jd_eclp.py
@@ -151,6 +151,12 @@ class JdEclp(models.Model):
_logger.info('准备调接口1')
url1 = config['bfm_url_new'] + '/api/create/jd/order'
requests.post(url1, json=json1, data=None)
+ # ===============修改销售订单状态为【物流中】===================
+ item = self.env['sale.order'].sudo().search([('name', '=', self.origin)])
+ if not item:
+ raise ValidationError('没有查询到订单号为【%s】的销售订单!' % self.origin)
+ else:
+ item.write({'state': 'physical_distribution'})
_logger.info('调用成功1')
_logger.info('准备调接口2')
json2 = {
diff --git a/sf_hr/models/hr_employee.py b/sf_hr/models/hr_employee.py
index 5d37f199..2a93ddc5 100644
--- a/sf_hr/models/hr_employee.py
+++ b/sf_hr/models/hr_employee.py
@@ -23,6 +23,16 @@ class JkmPracticeEmployee(models.Model):
vals["we_id"] = self._get_we_id(vals.get('work_email'))
return super(JkmPracticeEmployee, self).write(vals)
+ def unlink(self):
+ for record in self:
+ res_partner_obj = record.env['res.partner'].sudo().search([('email', '=', record.work_email)])
+ if res_partner_obj:
+ res_partner_obj.unlink()
+ res = super(JkmPracticeEmployee, self).unlink()
+
+ return res
+
+
@api.depends('work_contact_id', 'work_contact_id.mobile', 'work_contact_id.email')
def _compute_work_contact_details(self):
for employee in self:
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index 612577c2..936afaaf 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -40,6 +40,7 @@
'views/res_config_settings_views.xml',
'views/sale_order_views.xml',
'views/mrp_workorder_batch_replan.xml',
+ 'views/purchase_order_view.xml',
],
'assets': {
@@ -52,6 +53,8 @@
'sf_manufacturing/static/src/scss/kanban_change.scss',
'sf_manufacturing/static/src/xml/button_show_on_tree.xml',
'sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js',
+ 'sf_manufacturing/static/src/js/agv_scheduling_resend_confirm.js',
+ 'sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js',
'sf_manufacturing/static/src/js/qr.js',
'sf_manufacturing/static/src/xml/qr.xml',
]
diff --git a/sf_manufacturing/controllers/main.py b/sf_manufacturing/controllers/main.py
index e45265d3..839b87fe 100644
--- a/sf_manufacturing/controllers/main.py
+++ b/sf_manufacturing/controllers/main.py
@@ -27,7 +27,7 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
bfm_process_order_list = json.loads(kw['bfm_process_order_list'])
order_id = request.env['sale.order'].with_user(request.env.ref("base.user_admin")).sale_order_create(
company_id, kw['delivery_name'], kw['delivery_telephone'], kw['delivery_address'],
- kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], state='draft')
+ kw['delivery_end_date'], kw['payments_way'], kw['pay_way'], kw['order_number'], state='draft')
i = 1
# 给sale_order的default_code字段赋值
# aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
diff --git a/sf_manufacturing/models/__init__.py b/sf_manufacturing/models/__init__.py
index 9f77d841..c4d8ad94 100644
--- a/sf_manufacturing/models/__init__.py
+++ b/sf_manufacturing/models/__init__.py
@@ -15,3 +15,4 @@ from . import sf_technology_design
from . import sf_production_common
from . import sale_order
from . import quick_easy_order
+from . import purchase_order
\ No newline at end of file
diff --git a/sf_manufacturing/models/agv_scheduling.py b/sf_manufacturing/models/agv_scheduling.py
index 868964d5..f39c07e7 100644
--- a/sf_manufacturing/models/agv_scheduling.py
+++ b/sf_manufacturing/models/agv_scheduling.py
@@ -1,6 +1,7 @@
import logging
import requests
+from datetime import timedelta
from odoo import models, fields, api, _
from odoo.exceptions import UserError
@@ -210,9 +211,18 @@ class AgvScheduling(models.Model):
def button_cancel(self):
# 弹出二次确认窗口后执行
for rec in self:
- if rec.state != '待下发':
- raise UserError('只有待下发状态的AGV调度任务才能取消!')
rec.state = '已取消'
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'target': 'new',
+ 'params': {
+ 'message': '任务取消成功!',
+ 'type': 'success',
+ 'sticky': False,
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ }
def finish_scheduling(self):
"""
@@ -232,7 +242,7 @@ class AgvScheduling(models.Model):
agv_route sf.agv.task.route对象
"""
for rec in self:
- if rec.state != '待下发':
+ if rec.state not in ['待下发', '配送中']:
return False
_logger.info('AGV任务调度:下发调度任务,路线为%s' % agv_task_route)
rec.state = '配送中'
@@ -264,7 +274,45 @@ class AgvScheduling(models.Model):
'task_delivery_time': fields.Datetime.now()
})
return super().write(vals)
+
+ def button_cancel_confirm(self):
+ if self.task_delivery_time > fields.Datetime.now() - timedelta(minutes=10):
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'agv_scheduling_cancel_confirm',
+ 'params': {
+ 'agv_scheduling_id': self.id,
+ }
+ }
+ else:
+ return self.button_cancel()
+ def button_resend_confirm(self):
+ if self.task_delivery_time > fields.Datetime.now() - timedelta(minutes=10):
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'agv_scheduling_resend_confirm',
+ 'params': {
+ 'agv_scheduling_id': self.id,
+ 'context': self.env.context,
+ }
+ }
+ else:
+ return self.button_resend()
+
+ def button_resend(self):
+ self.dispatch_scheduling(self.agv_route_id)
+ return {
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'target': 'new',
+ 'params': {
+ 'message': '任务重新下发成功!',
+ 'type': 'success',
+ 'sticky': False,
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ }
class ResMrpWorkOrder(models.Model):
_inherit = 'mrp.workorder'
diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py
index 1fe36b90..601c34e8 100644
--- a/sf_manufacturing/models/model_type.py
+++ b/sf_manufacturing/models/model_type.py
@@ -75,7 +75,7 @@ class ManualProductModelTypeRoutingSort(models.Model):
_description = '成品工序排序(人工线下加工)'
sequence = fields.Integer('Sequence')
- route_workcenter_id = fields.Many2one('mrp.routing.workcenter')
+ route_workcenter_id = fields.Many2one('mrp.routing.workcenter', domain=[('routing_type', 'in', ['人工线下加工'])])
is_repeat = fields.Boolean('重复', related='route_workcenter_id.is_repeat')
routing_type = fields.Selection(string="工序类型", related='route_workcenter_id.routing_type')
workcenter_ids = fields.Many2many('mrp.workcenter', required=False, related='route_workcenter_id.workcenter_ids')
diff --git a/sf_manufacturing/models/mrp_production.py b/sf_manufacturing/models/mrp_production.py
index 7bfc0abb..4d8f11df 100644
--- a/sf_manufacturing/models/mrp_production.py
+++ b/sf_manufacturing/models/mrp_production.py
@@ -440,6 +440,18 @@ class MrpProduction(models.Model):
process_parameters = []
account_moves = []
parameters_not = []
+ # 获取原有的工单对应的工序
+ origin_designs = self.workorder_ids.technology_design_id
+ # 获取已删除的工序
+ deleted_designs = origin_designs - self.technology_design_ids
+ if deleted_designs:
+ for deleted_design in deleted_designs:
+ workorder = self.env['mrp.workorder'].search([('technology_design_id', '=', deleted_design.id)])
+ purchase = workorder._get_surface_technics_purchase_ids()
+ account = self.env['account.move'].search([('id', 'in', purchase.invoice_ids.ids)])
+ if account.state not in ['cancel', False]:
+ if purchase.name not in account_moves:
+ account_moves.append(purchase.name)
special_design = self.technology_design_ids.filtered(
lambda a: a.routing_tag == 'special' and a.is_auto is False)
for special in special_design:
@@ -451,11 +463,7 @@ class MrpProduction(models.Model):
if not product_production_process:
if special.process_parameters_id not in process_parameters:
process_parameters.append(special.process_parameters_id.display_name)
- purchase = self.env['purchase.order'].search([('origin', '=', special.production_id.name)])
- account = self.env['account.move'].search([('id', 'in', purchase.invoice_ids)])
- if account.state not in ['cancel', False]:
- if purchase.name not in account_moves:
- account_moves.append(purchase.name)
+
if account_moves:
raise UserError(_("请联系工厂生产经理对采购订单为%s生成的账单进行取消", ", ".join(account_moves)))
if parameters_not:
diff --git a/sf_manufacturing/models/mrp_routing_workcenter.py b/sf_manufacturing/models/mrp_routing_workcenter.py
index e28bd091..27c8e9d2 100644
--- a/sf_manufacturing/models/mrp_routing_workcenter.py
+++ b/sf_manufacturing/models/mrp_routing_workcenter.py
@@ -94,4 +94,10 @@ class ResMrpRoutingWorkcenter(models.Model):
route_ids.append(t.route_id.surface_technics_id.id)
domain = [('id', 'not in', route_ids), ('routing_tag', '=', 'special')]
return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
+ if self._context.get('is_duplicate') and self._context.get('model_name'):
+ # 查询出已经选择的工序
+ model_type = self.env[self._context.get('model_name')].search_read([],['route_workcenter_id'])
+ route_workcenter_ids = [item['route_workcenter_id'][0] if item['route_workcenter_id'] else False for item in model_type]
+ domain = args + [('id', 'not in', route_workcenter_ids)]
+ return self._search(domain, limit=limit, access_rights_uid=name_get_uid)
return super()._name_search(name, args, operator, limit, name_get_uid)
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index bab7e282..52fa30c8 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -36,7 +36,7 @@ class ResMrpWorkOrder(models.Model):
store=True, check_company=True, string="材料")
product_tmpl_id_materials_type_id = fields.Many2one(related='production_id.product_tmpl_id.materials_type_id',
readonly=True, store=True, check_company=True, string="型号")
- workcenter_id = fields.Many2one('mrp.workcenter', string='工作中心', required=False)
+ # workcenter_id = fields.Many2one('mrp.workcenter', string='工作中心', required=False)
users_ids = fields.Many2many("res.users", 'users_workorder', related="workcenter_id.users_ids")
processing_panel = fields.Char('加工面')
sequence = fields.Integer(string='工序')
@@ -1114,9 +1114,7 @@ class ResMrpWorkOrder(models.Model):
# ================= 如果制造订单刀具状态为[无效刀、缺刀] 或者 制造订单状态为[返工]==========================
if (workorder.production_id.tool_state in ['1', '2'] or workorder.production_id.state == 'rework'
or workorder.production_id.schedule_state != '已排'
- or workorder.production_id.reservation_state not in ['assigned']
- or workorder.production_id.workorder_ids.filtered(
- lambda wk: wk.sequence == workorder.sequence - 1).test_results in ['报废', '返工']):
+ or workorder.production_id.reservation_state not in ['assigned']):
if workorder.state != 'waiting':
workorder.state = 'waiting'
continue
@@ -1425,8 +1423,7 @@ class ResMrpWorkOrder(models.Model):
len(done_workorder) == len(record.production_id.workorder_ids)):
is_production_id = True
if record.routing_type in ['解除装夹'] or (
- record.is_rework is True and record.routing_type in ['装夹预调']) or (
- record.test_results in ['返工', '报废'] and record.routing_type in ['CNC加工']):
+ record.is_rework is True and record.routing_type in ['装夹预调']):
for workorder in record.production_id.workorder_ids:
if workorder.processing_panel == record.processing_panel:
rfid_code = workorder.rfid_code
diff --git a/sf_manufacturing/models/product_template.py b/sf_manufacturing/models/product_template.py
index 460fd994..4b927596 100644
--- a/sf_manufacturing/models/product_template.py
+++ b/sf_manufacturing/models/product_template.py
@@ -774,11 +774,10 @@ class ResProductMo(models.Model):
# bfm下单
manual_quotation = fields.Boolean('人工编程', default=False, readonly=True)
- part_number = fields.Char(string='零件图号', readonly=True)
machining_drawings = fields.Binary('2D加工图纸', readonly=True)
quality_standard = fields.Binary('质检标准', readonly=True)
part_name = fields.Char(string='零件名称', readonly=True)
-
+ part_number = fields.Char(string='零件图号', readonly=True)
@api.constrains('tool_length')
def _check_tool_length_size(self):
if self.tool_length > 1000000:
@@ -892,7 +891,7 @@ class ResProductMo(models.Model):
'machining_drawings': '' if not item['machining_drawings'] else base64.b64decode(
item['machining_drawings']),
'quality_standard': '' if not item['quality_standard'] else base64.b64decode(item['quality_standard']),
- 'part_name': item['part_name'],
+ 'part_name': item.get('part_name') or '',
}
tax_id = self.env['account.tax'].sudo().search(
[('type_tax_use', '=', 'sale'), ('amount', '=', item.get('tax')), ('price_include', '=', 'True')])
diff --git a/sf_manufacturing/models/purchase_order.py b/sf_manufacturing/models/purchase_order.py
new file mode 100644
index 00000000..1ffed728
--- /dev/null
+++ b/sf_manufacturing/models/purchase_order.py
@@ -0,0 +1,33 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from collections import defaultdict
+
+from odoo import api, fields, models, _
+from odoo.tools import OrderedSet
+
+
+# _get_surface_technics_purchase_ids
+class PurchaseOrder(models.Model):
+ _inherit = 'purchase.order'
+ def button_confirm(self):
+ super().button_confirm()
+ workorders = self.env['mrp.workorder'].search([('purchase_id', '=', self.id)])
+ for workorder in workorders:
+ if workorder.routing_type == '表面工艺' and workorder.is_subcontract is True:
+ move_out = workorder.move_subcontract_workorder_ids[1]
+ # move_out = self.env['stock.move'].search(
+ # [('location_id', '=', self.env['stock.location'].search(
+ # [('barcode', 'ilike', 'WH-PREPRODUCTION')]).id),
+ # ('location_dest_id', '=', self.env['stock.location'].search(
+ # [('barcode', 'ilike', 'VL-SPOC')]).id),
+ # ('origin', '=', self.production_id.name), ('state', 'not in', ['cancel', 'done'])])
+ for mo in move_out:
+ if mo.state != 'done':
+ mo.write({'state': 'assigned', 'production_id': False})
+ if not mo.move_line_ids:
+ self.env['stock.move.line'].create(mo.get_move_line(workorder.production_id, workorder))
+ return True
+class PurchaseOrderLine(models.Model):
+ _inherit = 'purchase.order.line'
+ part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
diff --git a/sf_manufacturing/models/sale_order.py b/sf_manufacturing/models/sale_order.py
index a56721a2..e31faf1c 100644
--- a/sf_manufacturing/models/sale_order.py
+++ b/sf_manufacturing/models/sale_order.py
@@ -13,6 +13,9 @@ class SaleOrder(models.Model):
('sent', "报价已发送"),
('supply method', "供货方式待确认"),
('sale', "销售订单"),
+ ('processing', "加工中"),
+ ('physical_distribution', "物流中"),
+ ('delivered', "已交付"),
('done', "已锁定"),
('cancel', "已取消"),
])
@@ -149,7 +152,7 @@ class SaleOrder(models.Model):
class SaleOrderLine(models.Model):
_inherit = 'sale.order.line'
-
+ part_number = fields.Char('零件图号', related='product_id.part_number', readonly=True)
# 供货方式
supply_method = fields.Selection([
('automation', "自动化产线加工"),
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index fbe3be8c..6506cc1a 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -644,12 +644,19 @@ class StockPicking(models.Model):
workorder = move_in.subcontract_workorder_id
workorders = workorder.production_id.workorder_ids
subcontract_workorders = workorders.filtered(lambda wo: wo.is_subcontract == True).sorted('sequence')
- if workorder == subcontract_workorders[-1]:
+ if workorder == subcontract_workorders[-1]:
self.env['stock.quant']._update_reserved_quantity(
- move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty, lot_id=move_in.move_line_ids.lot_id,
+ move_in.product_id, move_in.location_dest_id, move_in.product_uom_qty,
+ lot_id=move_in.move_line_ids.lot_id,
package_id=False, owner_id=False, strict=False
)
-
+ workorder.button_finish()
+ picking_type_out = self.env.ref('sf_manufacturing.outcontract_picking_out').id
+ if res and self.picking_type_id.id == picking_type_out:
+ move_out = self.move_ids
+ if move_out:
+ workorder = move_out.subcontract_workorder_id
+ workorder.button_start()
return res
# 创建 外协出库入单
@@ -671,14 +678,16 @@ class StockPicking(models.Model):
else:
# 从sorted_workorders中找到上一工单的move
if sorted_workorders.index(workorder) > 0:
- move_dest_id = sorted_workorders[sorted_workorders.index(workorder) - 1].move_subcontract_workorder_ids[1].id
+ move_dest_id = \
+ sorted_workorders[sorted_workorders.index(workorder) - 1].move_subcontract_workorder_ids[1].id
new_picking = True
outcontract_picking_type_in = self.env.ref(
'sf_manufacturing.outcontract_picking_in').id,
outcontract_picking_type_out = self.env.ref(
'sf_manufacturing.outcontract_picking_out').id,
moves_in = self.env['stock.move'].sudo().create(
- self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_in, procurement_group_id.id, move_dest_id))
+ self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_in,
+ procurement_group_id.id, move_dest_id))
picking_in = self.create(
moves_in._get_new_picking_values_Res(item, workorder, 'WH/OCIN/'))
# pick_ids.append(picking_in.id)
@@ -686,7 +695,8 @@ class StockPicking(models.Model):
{'picking_id': picking_in.id, 'state': 'waiting'})
moves_in._assign_picking_post_process(new=new_picking)
moves_out = self.env['stock.move'].sudo().create(
- self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_out, procurement_group_id.id, moves_in.id))
+ self.env['stock.move']._get_stock_move_values_Res(item, outcontract_picking_type_out,
+ procurement_group_id.id, moves_in.id))
workorder.write({'move_subcontract_workorder_ids': [(6, 0, [moves_in.id, moves_out.id])]})
picking_out = self.create(
moves_out._get_new_picking_values_Res(item, workorder, 'WH/OCOUT/'))
@@ -694,8 +704,7 @@ class StockPicking(models.Model):
moves_out.write(
{'picking_id': picking_out.id, 'state': 'waiting'})
moves_out._assign_picking_post_process(new=new_picking)
-
-
+
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
def _compute_state(self):
super(StockPicking, self)._compute_state()
@@ -706,7 +715,9 @@ class StockPicking(models.Model):
if picking.move_ids:
workorder = picking.move_ids[0].subcontract_workorder_id
if picking.state == 'assigned':
- if workorder.state in ['pending', 'waiting'] or workorder._get_surface_technics_purchase_ids().state in ['draft', 'sent']:
+ if workorder.state in ['pending',
+ 'waiting'] or workorder._get_surface_technics_purchase_ids().state in [
+ 'draft', 'sent']:
picking.state = 'waiting'
@@ -719,7 +730,8 @@ class ReStockMove(models.Model):
def _get_stock_move_values_Res(self, item, picking_type_id, group_id, move_dest_ids=False):
route_id = self.env.ref('sf_manufacturing.route_surface_technology_outsourcing').id
- stock_rule = self.env['stock.rule'].sudo().search([('route_id', '=', route_id), ('picking_type_id', '=', picking_type_id)])
+ stock_rule = self.env['stock.rule'].sudo().search(
+ [('route_id', '=', route_id), ('picking_type_id', '=', picking_type_id)])
move_values = {
'name': '推',
'company_id': item.company_id.id,
@@ -997,8 +1009,9 @@ class ReStockMove(models.Model):
res['origin'] = ','.join(productions.mapped('name'))
res['retrospect_ref'] = production.product_id.name
return res
-
- subcontract_workorder_id = fields.Many2one('mrp.workorder', '外协工单组件', check_company=True, index='btree_not_null')
+
+ subcontract_workorder_id = fields.Many2one('mrp.workorder', '外协工单组件', check_company=True,
+ index='btree_not_null')
class ReStockQuant(models.Model):
diff --git a/sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js b/sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js
new file mode 100644
index 00000000..7fd19178
--- /dev/null
+++ b/sf_manufacturing/static/src/js/agv_scheduling_cancel_confirm.js
@@ -0,0 +1,50 @@
+odoo.define('sf_manufacturing.agv_scheduling_button_confirm', function (require) {
+ const core = require('web.core');
+ const ajax = require('web.ajax');
+ const Dialog = require('web.Dialog');
+ var rpc = require('web.rpc');
+ var _t = core._t;
+
+ async function agv_scheduling_cancel_confirm(parent, {params}) {
+ const dialog = new Dialog(parent, {
+ title: "确认",
+ $content: $('
').append("工件正在配送中,确定取消"),
+ buttons: [
+ { text: "确认", classes: 'btn-primary', close: true, click: () => dispatchConfirmed(parent, params) },
+ { text: "取消", close: true },
+ ],
+ });
+ dialog.open();
+
+
+ async function dispatchConfirmed(parent, params) {
+ rpc.query({
+ model: 'sf.agv.scheduling',
+ method: 'button_cancel',
+ args: [params.agv_scheduling_id],
+ kwargs: {
+ context: params.context,
+ }
+ }).then(res => {
+ parent.services.action.doAction({
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'target': 'new',
+ 'params': {
+ 'message': '取消成功!',
+ 'type': 'success',
+ 'sticky': false,
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ });
+ parent.services.action.doAction({
+ 'type': 'ir.actions.client',
+ 'tag': 'reload',
+ });
+ })
+ }
+ }
+
+ core.action_registry.add('agv_scheduling_cancel_confirm', agv_scheduling_cancel_confirm);
+ return agv_scheduling_cancel_confirm;
+});
diff --git a/sf_manufacturing/static/src/js/agv_scheduling_resend_confirm.js b/sf_manufacturing/static/src/js/agv_scheduling_resend_confirm.js
new file mode 100644
index 00000000..2ccda0e4
--- /dev/null
+++ b/sf_manufacturing/static/src/js/agv_scheduling_resend_confirm.js
@@ -0,0 +1,50 @@
+odoo.define('sf_manufacturing.agv_scheduling_resend_confirm', function (require) {
+ const core = require('web.core');
+ const ajax = require('web.ajax');
+ const Dialog = require('web.Dialog');
+ var rpc = require('web.rpc');
+ var _t = core._t;
+
+ async function agv_scheduling_resend_confirm(parent, {params}) {
+ const dialog = new Dialog(parent, {
+ title: "确认",
+ $content: $('
').append("工件正在配送中,确定重新下发"),
+ buttons: [
+ { text: "确认", classes: 'btn-primary', close: true, click: () => dispatchConfirmed(parent, params) },
+ { text: "取消", close: true },
+ ],
+ });
+ dialog.open();
+
+
+ async function dispatchConfirmed(parent, params) {
+ rpc.query({
+ model: 'sf.agv.scheduling',
+ method: 'button_resend',
+ args: [params.agv_scheduling_id],
+ kwargs: {
+ context: params.context,
+ }
+ }).then(res => {
+ parent.services.action.doAction({
+ 'type': 'ir.actions.client',
+ 'tag': 'display_notification',
+ 'target': 'new',
+ 'params': {
+ 'message': '重新下发成功!',
+ 'type': 'success',
+ 'sticky': false,
+ 'next': {'type': 'ir.actions.act_window_close'},
+ }
+ });
+ parent.services.action.doAction({
+ 'type': 'ir.actions.client',
+ 'tag': 'reload',
+ });
+ })
+ }
+ }
+
+ core.action_registry.add('agv_scheduling_resend_confirm', agv_scheduling_resend_confirm );
+ return agv_scheduling_resend_confirm;
+});
diff --git a/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js b/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js
index d7900984..e99b4473 100644
--- a/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js
+++ b/sf_manufacturing/static/src/js/workpiece_delivery_wizard_confirm.js
@@ -22,8 +22,7 @@ odoo.define('sf_manufacturing.action_dispatch_confirm', function (require) {
rpc.query({
model: 'sf.workpiece.delivery.wizard',
method: 'confirm',
- args: [params.active_id]
- ,
+ args: [params.active_id],
kwargs: {
context: params.context,
}
diff --git a/sf_manufacturing/views/agv_scheduling_views.xml b/sf_manufacturing/views/agv_scheduling_views.xml
index c24cdf94..d0d0bb85 100644
--- a/sf_manufacturing/views/agv_scheduling_views.xml
+++ b/sf_manufacturing/views/agv_scheduling_views.xml
@@ -33,6 +33,20 @@
class="btn-danger"
confirm="你确定要取消这条记录吗?"
/>
+
+
diff --git a/sf_manufacturing/views/model_type_view.xml b/sf_manufacturing/views/model_type_view.xml
index 0f8b3085..f4c1f994 100644
--- a/sf_manufacturing/views/model_type_view.xml
+++ b/sf_manufacturing/views/model_type_view.xml
@@ -3,7 +3,7 @@
#------------------模型类型------------------
-
+
search.sf.model.type
sf.model.type
@@ -14,7 +14,7 @@
-
+
tree.sf.model.type
sf.model.type
@@ -24,7 +24,7 @@
-
+
form.sf.model.type
sf.model.type
@@ -37,7 +37,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
@@ -59,7 +59,7 @@
-
+
@@ -70,7 +70,7 @@
-
+
@@ -81,7 +81,7 @@
-
+
模型类型
ir.actions.act_window
sf.model.type
@@ -96,11 +96,11 @@
\ No newline at end of file
diff --git a/sf_manufacturing/views/mrp_production_addional_change.xml b/sf_manufacturing/views/mrp_production_addional_change.xml
index 043990ef..c9856cb8 100644
--- a/sf_manufacturing/views/mrp_production_addional_change.xml
+++ b/sf_manufacturing/views/mrp_production_addional_change.xml
@@ -18,9 +18,12 @@
+
+
+
diff --git a/sf_manufacturing/views/mrp_workorder_view.xml b/sf_manufacturing/views/mrp_workorder_view.xml
index 3828f00e..de94390a 100644
--- a/sf_manufacturing/views/mrp_workorder_view.xml
+++ b/sf_manufacturing/views/mrp_workorder_view.xml
@@ -29,6 +29,8 @@
+
+
@@ -55,7 +57,7 @@
{'invisible': ['|', '|', '|','|','|', ('production_state','in', ('draft',
'done',
- 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done', 'cancel')),
+ 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done','rework', 'cancel')),
('is_user_working', '!=', False),("user_permissions","=",False),("name","in",("CNC加工","解除装夹"))]}
@@ -174,9 +176,9 @@
+ attrs="{'invisible': ['|', '|', '|', '|', '|', ('routing_type', '=', '装夹预调'), ('routing_type', '=', '解除装夹'), ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done','rework', 'cancel','to be detected')), ('is_user_working', '!=', False)]}"/>
+ attrs="{'invisible': ['|', '|', '|', '|', ('routing_type', '!=', '装夹预调'), ('production_state','in', ('draft', 'done', 'cancel')), ('working_state', '=', 'blocked'), ('state', 'in', ('done','rework', 'cancel','to be detected')), ('is_user_working', '!=', False)]}"/>