解决冲突
This commit is contained in:
@@ -235,7 +235,7 @@ class MrpProduction(models.Model):
|
||||
programming_no = fields.Char('编程单号')
|
||||
work_state = fields.Char('业务状态')
|
||||
programming_state = fields.Selection(
|
||||
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'), ('已下发', '已下发')],
|
||||
[('编程中', '编程中'), ('已编程', '已编程'), ('已编程未下发', '已编程未下发'), ('已下发', '已下发'), ('已取消', '已取消')],
|
||||
string='编程状态',
|
||||
tracking=True)
|
||||
glb_file = fields.Binary("glb模型文件")
|
||||
@@ -646,6 +646,28 @@ class MrpProduction(models.Model):
|
||||
logging.info('update_programming_state error:%s' % e)
|
||||
raise UserError("更新编程单状态失败,请联系管理员")
|
||||
|
||||
# 修改编程单状态
|
||||
def _change_programming_state(self):
|
||||
try:
|
||||
res = {"programming_no": self.programming_no, "state": "已取消"}
|
||||
logging.info('res=%s:' % res)
|
||||
configsettings = self.env['res.config.settings'].get_values()
|
||||
config_header = Common.get_headers(self, configsettings['token'], configsettings['sf_secret_key'])
|
||||
url = '/api/intelligent_programming/set_state'
|
||||
config_url = configsettings['sf_url'] + url
|
||||
ret = requests.post(config_url, json=res, data=None, headers=config_header)
|
||||
ret = ret.json()
|
||||
result = json.loads(ret['result'])
|
||||
logging.info('change_programming_state-ret:%s' % result)
|
||||
if result['status'] == 1:
|
||||
self.write({'programming_state': '已取消'})
|
||||
else:
|
||||
raise UserError(ret['message'])
|
||||
except Exception as e:
|
||||
logging.info('change_programming_state error:%s' % e)
|
||||
raise UserError("修改编程单状态失败,请联系管理员")
|
||||
|
||||
|
||||
# cnc程序获取
|
||||
def fetchCNC(self, production_names):
|
||||
cnc = self.env['mrp.production'].search([('id', '=', self.id)])
|
||||
@@ -1707,7 +1729,7 @@ class sf_programming_record(models.Model):
|
||||
programming_method = fields.Selection([
|
||||
('auto', '自动'),
|
||||
('manual operation', '人工')], string="编程方式")
|
||||
current_programming_count = fields.Integer('当前编程次数')
|
||||
current_programming_count = fields.Integer('重新编程次数')
|
||||
target_production_id = fields.Char('目标制造单号')
|
||||
apply_time = fields.Datetime('申请时间')
|
||||
send_time = fields.Datetime('下发时间')
|
||||
|
||||
@@ -1087,7 +1087,8 @@ class ResMrpWorkOrder(models.Model):
|
||||
if (workorder.production_id.production_type == '人工线下加工'
|
||||
and workorder.production_id.schedule_state == '已排'
|
||||
and len(workorder.production_id.picking_ids.filtered(
|
||||
lambda w: w.state not in ['done', 'cancel'])) == 0):
|
||||
lambda w: w.state not in ['done', 'cancel'])) == 0
|
||||
and workorder.production_id.programming_state == '已编程'):
|
||||
if workorder.is_subcontract is True:
|
||||
purchase_orders_id = self._get_surface_technics_purchase_ids()
|
||||
if purchase_orders_id.state == 'purchase':
|
||||
|
||||
@@ -151,6 +151,23 @@ class SaleOrder(models.Model):
|
||||
product_bom_purchase.with_user(self.env.ref("base.user_admin")).bom_create_line_has(
|
||||
purchase_embryo)
|
||||
return super(SaleOrder, self).action_confirm()
|
||||
|
||||
def action_show_cancel_wizard(self):
|
||||
wizard = self.env['sf.sale.order.cancel.wizard'].create({
|
||||
'order_id': self.id,
|
||||
})
|
||||
|
||||
# 创建关联单据行
|
||||
self.env['sf.sale.order.cancel.line'].create_from_order(wizard.id, self)
|
||||
|
||||
return {
|
||||
'name': '取消销售订单',
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'sf.sale.order.cancel.wizard',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'res_id': wizard.id,
|
||||
}
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
@@ -611,6 +611,18 @@ class StockPicking(models.Model):
|
||||
return sequence_id
|
||||
|
||||
def button_validate(self):
|
||||
# 校验“收料入库单、客供料入库单”是否已经分配序列号,如果没有分配则自动分配
|
||||
if self.picking_type_id.use_existing_lots is False and self.picking_type_id.use_create_lots is True:
|
||||
for move in self.move_ids:
|
||||
if not move.move_line_nosuggest_ids:
|
||||
move.action_show_details()
|
||||
else:
|
||||
# 对已经生成的序列号做唯一性校验,如果重复则重新生成新的序列号
|
||||
line_lot_name = [line_id.lot_name for line_id in move.move_line_nosuggest_ids]
|
||||
lot_ids = self.env['stock.lot'].sudo().search([('name', 'in', line_lot_name)])
|
||||
if lot_ids:
|
||||
move.action_clear_lines_show_details()
|
||||
move.action_show_details()
|
||||
res = super().button_validate()
|
||||
picking_type_in = self.env.ref('sf_manufacturing.outcontract_picking_in').id
|
||||
if res is True and self.picking_type_id.id == picking_type_in:
|
||||
@@ -844,7 +856,8 @@ class ReStockMove(models.Model):
|
||||
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
|
||||
else:
|
||||
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
||||
if self.picking_type_id.sequence_code == 'DL' and not self.move_line_nosuggest_ids:
|
||||
if (self.picking_type_id.use_existing_lots is False
|
||||
and self.picking_type_id.use_create_lots is True and not self.move_line_nosuggest_ids):
|
||||
self.action_assign_serial_show_details()
|
||||
elif self.product_id.tracking == "lot":
|
||||
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
||||
|
||||
Reference in New Issue
Block a user