加工中代码测试完成
This commit is contained in:
@@ -8,7 +8,7 @@ from odoo.http import request
|
||||
|
||||
class Sf_Bf_Connect(http.Controller):
|
||||
|
||||
@http.route('/api/bfm_process_order/list', type='http', auth='none', methods=['GET', 'POST'], csrf=False,
|
||||
@http.route('/api/bfm_process_order/list', type='http', auth='sf_token', methods=['GET', 'POST'], csrf=False,
|
||||
cors="*")
|
||||
def get_bfm_process_order_list(self, **kw):
|
||||
"""
|
||||
@@ -19,6 +19,9 @@ class Sf_Bf_Connect(http.Controller):
|
||||
res = {'status': 1, 'factory_order_no': ''}
|
||||
logging.info('get_bfm_process_order_list:%s' % kw)
|
||||
try:
|
||||
logging.info('get_bfm_process_order_list===================================:%s' % kw['order_number'])
|
||||
# aa = request.env['sale.order'].sudo().get_default_code(kw['order_number'])
|
||||
|
||||
# datas = request.httprequest.data
|
||||
# ret = json.loads(datas)
|
||||
# ret = json.loads(ret['result'])
|
||||
@@ -44,9 +47,7 @@ class Sf_Bf_Connect(http.Controller):
|
||||
# else:
|
||||
product = request.env['product.template'].sudo().product_create(product_id, item, order_id,
|
||||
kw['order_number'], i)
|
||||
# order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
logging.info('order_id:%s' % order_id)
|
||||
logging.info('product:%s' % product)
|
||||
i += 1
|
||||
bom_data = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).get_bom(product)
|
||||
logging.info('bom_data:%s' % bom_data)
|
||||
if bom_data:
|
||||
@@ -102,8 +103,12 @@ class Sf_Bf_Connect(http.Controller):
|
||||
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
|
||||
purchase_embryo)
|
||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
i += 1
|
||||
res['factory_order_no'] = order_id.name
|
||||
aa = request.env['sale.order'].sudo().search([('name', '=', order_id.name)])
|
||||
logging.info('get_bfm_process_or===================================:%s' % order_id.name)
|
||||
aa.default_code = kw['order_number']
|
||||
logging.info('get_bfm_process_order_listaaaaaaaaaaaaaaaaaaaaaaaaaaaa================:%s' % aa.default_code)
|
||||
|
||||
except Exception as e:
|
||||
logging.info('get_bfm_process_order_list error:%s' % e)
|
||||
res['status'] = -1
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
from . import http
|
||||
from . import models
|
||||
|
||||
from . import process_status
|
||||
|
||||
@@ -39,16 +39,12 @@ class StatusChange(models.Model):
|
||||
logging.info('函数已经执行=============5')
|
||||
self.action_done()
|
||||
process_start_time = str(datetime.now())
|
||||
|
||||
|
||||
default_code = self.env['product.template'].search([('default_code', '=', self)])
|
||||
logging.info('函数已经执行=============default_code', default_code)
|
||||
json1 = {
|
||||
'params': {
|
||||
'model_name': 'jikimo.process.order',
|
||||
'field_name': 'name',
|
||||
# 'default_code': 'PO-2022-1214-0022',
|
||||
'default_code': default_code,
|
||||
'default_code': self.default_code,
|
||||
# 'default_code': self.name,
|
||||
'state': '加工中',
|
||||
'process_start_time': process_start_time,
|
||||
@@ -74,7 +70,7 @@ class StatusChange(models.Model):
|
||||
'params': {
|
||||
'model_name': 'jikimo.process.order',
|
||||
'field_name': 'name',
|
||||
'default_code': 'PO-2022-1214-0022',
|
||||
'default_code': self.default_code,
|
||||
# 'default_code': self.name,
|
||||
'state': '待派单',
|
||||
},
|
||||
@@ -112,47 +108,3 @@ class StatusChange(models.Model):
|
||||
else:
|
||||
return self._action_cancel()
|
||||
|
||||
# def action_cancel(self):
|
||||
# """ Cancel SO after showing the cancel wizard when needed. (cfr :meth:`_show_cancel_wizard`)
|
||||
#
|
||||
# For post-cancel operations, please only override :meth:`_action_cancel`.
|
||||
#
|
||||
# note: self.ensure_one() if the wizard is shown.
|
||||
# """
|
||||
# cancel_warning = self._show_cancel_wizard()
|
||||
# if cancel_warning:
|
||||
# self.ensure_one()
|
||||
# template_id = self.env['ir.model.data']._xmlid_to_res_id(
|
||||
# 'sale.mail_template_sale_cancellation', raise_if_not_found=False
|
||||
# )
|
||||
# lang = self.env.context.get('lang')
|
||||
# template = self.env['mail.template'].browse(template_id)
|
||||
# if template.lang:
|
||||
# lang = template._render_lang(self.ids)[self.id]
|
||||
# ctx = {
|
||||
# 'default_use_template': bool(template_id),
|
||||
# 'default_template_id': template_id,
|
||||
# 'default_order_id': self.id,
|
||||
# 'mark_so_as_canceled': True,
|
||||
# 'default_email_layout_xmlid': "mail.mail_notification_layout_with_responsible_signature",
|
||||
# 'model_description': self.with_context(lang=lang).type_name,
|
||||
# }
|
||||
|
||||
#
|
||||
# return {
|
||||
# 'name': _('Cancel %s', self.type_name),
|
||||
# 'view_mode': 'form',
|
||||
# 'res_model': 'sale.order.cancel',
|
||||
# 'view_id': self.env.ref('sale.sale_order_cancel_view_form').id,
|
||||
# 'type': 'ir.actions.act_window',
|
||||
# 'context': ctx,
|
||||
# 'target': 'new'
|
||||
# }
|
||||
# else:
|
||||
# return self._action_cancel()
|
||||
#
|
||||
# def _action_cancel(self):
|
||||
# inv = self.invoice_ids.filtered(lambda inv: inv.state == 'draft')
|
||||
# inv.button_cancel()
|
||||
# return self.write({'state': 'cancel'})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user