Accept Merge Request #1524: (feature/制造功能优化 -> develop)
Merge Request: 调整采购单查找逻辑 Created By: @马广威 Accepted By: @马广威 URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1524?initial=true
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
import logging
|
||||||
from odoo import models, fields, api, _
|
from odoo import models, fields, api, _
|
||||||
|
|
||||||
|
|
||||||
@@ -29,7 +30,14 @@ class StockRuleInherit(models.Model):
|
|||||||
if supplier:
|
if supplier:
|
||||||
domain = rule._make_po_get_domain(procurement.company_id, procurement.values,
|
domain = rule._make_po_get_domain(procurement.company_id, procurement.values,
|
||||||
supplier.partner_id)
|
supplier.partner_id)
|
||||||
po = self.env['purchase.order'].sudo().search([dom for dom in domain], limit=1)
|
logging.info("domain=============: %s", domain)
|
||||||
|
po = self.env['purchase.order'].sudo().search([
|
||||||
|
('partner_id', '=', supplier.partner_id.id),
|
||||||
|
('company_id', '=', procurement.company_id.id), # 保证公司一致
|
||||||
|
('origin', '=', procurement.origin), # 根据来源匹配
|
||||||
|
('state', '=', 'draft') # 状态为草稿
|
||||||
|
], limit=1)
|
||||||
|
logging.info("po=: %s", po)
|
||||||
if po:
|
if po:
|
||||||
po.write({'purchase_type': 'consignment'})
|
po.write({'purchase_type': 'consignment'})
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -1264,6 +1264,7 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
"""
|
"""
|
||||||
获取
|
获取
|
||||||
"""
|
"""
|
||||||
|
logging.info("kw=============:%s" % kw)
|
||||||
res = {'status': 1, 'message': '成功', 'data': {}}
|
res = {'status': 1, 'message': '成功', 'data': {}}
|
||||||
# 连接数据库
|
# 连接数据库
|
||||||
conn = psycopg2.connect(**db_config)
|
conn = psycopg2.connect(**db_config)
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
import re
|
import re
|
||||||
import json
|
import json
|
||||||
|
import logging
|
||||||
import datetime
|
import datetime
|
||||||
import requests
|
import requests
|
||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
@@ -90,11 +91,18 @@ class SfMaintenanceEquipmentOEE(models.Model):
|
|||||||
|
|
||||||
def get_running_datas(self):
|
def get_running_datas(self):
|
||||||
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||||
url_time = base_url + '/api/RunningTimeDetail'
|
logging.info("base_url=============:%s" % base_url)
|
||||||
|
# 只有当原始 URL 使用 http 时才替换为 https
|
||||||
|
if base_url.startswith("http://"):
|
||||||
|
secure_base_url = base_url.replace("http://", "https://")
|
||||||
|
else:
|
||||||
|
secure_base_url = base_url
|
||||||
|
url_time = secure_base_url + '/api/RunningTimeDetail'
|
||||||
|
logging.info("url_time=============:%s" % url_time)
|
||||||
cnc_list_obj = self.env['maintenance.equipment'].sudo().search(
|
cnc_list_obj = self.env['maintenance.equipment'].sudo().search(
|
||||||
[('function_type', '!=', False), ('active', '=', True)])
|
[('function_type', '!=', False), ('active', '=', True)])
|
||||||
machine_list = list(map(lambda x: x.code, cnc_list_obj))
|
machine_list = list(map(lambda x: x.code, cnc_list_obj))
|
||||||
# print('machine_list: %s' % machine_list)
|
logging.info("machine_list=============:%s" % machine_list)
|
||||||
|
|
||||||
data_time = {
|
data_time = {
|
||||||
"machine_list": str(machine_list)
|
"machine_list": str(machine_list)
|
||||||
|
|||||||
Reference in New Issue
Block a user