程序工时修改
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
from . import controllers
|
||||||
from . import models
|
from . import models
|
||||||
from . import wizard
|
from . import wizard
|
||||||
|
|||||||
1
sf_demand_plan/controllers/__init__.py
Normal file
1
sf_demand_plan/controllers/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
from . import controllers
|
||||||
37
sf_demand_plan/controllers/controllers.py
Normal file
37
sf_demand_plan/controllers/controllers.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
|
import json
|
||||||
|
from odoo import http, fields, models
|
||||||
|
from odoo.http import request
|
||||||
|
from odoo.addons.sf_base.controllers.controllers import MultiInheritController
|
||||||
|
|
||||||
|
|
||||||
|
class Sf_Plan_Mrs_Connect(http.Controller, MultiInheritController):
|
||||||
|
|
||||||
|
@http.route('/api/demand_plan/update_processing_time', type='json', auth='sf_token', methods=['GET', 'POST'],
|
||||||
|
csrf=False,
|
||||||
|
cors="*")
|
||||||
|
def update_processing_time(self, **kw):
|
||||||
|
"""
|
||||||
|
根据模型id修改程序工时
|
||||||
|
:param kw:
|
||||||
|
:return:
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
res = {'status': 1, 'message': '成功'}
|
||||||
|
datas = request.httprequest.data
|
||||||
|
ret = json.loads(datas)
|
||||||
|
ret = json.loads(ret['result'])
|
||||||
|
logging.info('根据模型id修改程序工时:%s' % ret)
|
||||||
|
demand_plan = request.env['sf.production.demand.plan'].sudo().search(
|
||||||
|
[('model_id', '=', ret['model_id'])])
|
||||||
|
if demand_plan:
|
||||||
|
demand_plan.write(
|
||||||
|
{'processing_time': ret['total_estimated_time']})
|
||||||
|
else:
|
||||||
|
res = {'status': 0, 'message': '未查到该需求计划'}
|
||||||
|
except Exception as e:
|
||||||
|
logging.info('update_demand_paln error:%s' % e)
|
||||||
|
res['status'] = -1
|
||||||
|
res['message'] = '系统解析错误!'
|
||||||
|
return json.JSONEncoder().encode(res)
|
||||||
@@ -92,7 +92,7 @@ class sf_production_plan(models.Model):
|
|||||||
('0', "未齐套"),
|
('0', "未齐套"),
|
||||||
('1', "已齐套"),
|
('1', "已齐套"),
|
||||||
], string='投料齐套检查', compute='_compute_material_check', store=True)
|
], string='投料齐套检查', compute='_compute_material_check', store=True)
|
||||||
processing_time = fields.Char('程序工时')
|
processing_time = fields.Char('程序工时', readonly=True)
|
||||||
planned_start_date = fields.Date('计划开工日期')
|
planned_start_date = fields.Date('计划开工日期')
|
||||||
actual_start_date = fields.Date('实际开工日期', compute='_compute_actual_start_date', store=True)
|
actual_start_date = fields.Date('实际开工日期', compute='_compute_actual_start_date', store=True)
|
||||||
actual_end_date = fields.Date('实际完工日期', compute='_compute_actual_end_date', store=True)
|
actual_end_date = fields.Date('实际完工日期', compute='_compute_actual_end_date', store=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user