优化代码格式

This commit is contained in:
jinling.yang
2023-11-23 17:38:30 +08:00
parent 45d04e1a05
commit e9be2e9c43
9 changed files with 12 additions and 50 deletions

View File

@@ -8,7 +8,7 @@ class Common(models.Model):
_name = 'sf.sync.common' _name = 'sf.sync.common'
_description = u'公用类' _description = u'公用类'
def get_headers(self,token, secret_key): def get_headers(self, token, secret_key):
''' '''
获取requests中的heardes参数 获取requests中的heardes参数
''' '''
@@ -19,5 +19,3 @@ class Common(models.Model):
'TIMESTAMP': str(timestamp), 'TIMESTAMP': str(timestamp),
'checkstr': check_sf_str} 'checkstr': check_sf_str}
return headers return headers

View File

@@ -4,9 +4,3 @@ from . import tool_base_new
from . import fixture from . import fixture
from . import functional_fixture from . import functional_fixture
from . import tool_other_features from . import tool_other_features

View File

@@ -17,29 +17,7 @@ class MrsProductionMaterials(models.Model):
remark = fields.Text("备注") remark = fields.Text("备注")
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
# def open_url_action(self):
# base_url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
# # url = 'http://192.168.50.202:8080/api'
# url = 'https://bfw.jikimo.com/'
# # data = {
# # 'key' : 'value'
# # }
#
# response = requests.get(url)
# response.raise_for_status()
# return {
# 'type': 'ir.actions.act_url',
# 'url': response.url,
# 'target': 'new'
# }
def open_url_action(self): def open_url_action(self):
# sf_sync_config = self.env['res.config.settings'].get_values()
# token = sf_sync_config['token']
# sf_secret_key = sf_sync_config['sf_secret_key']
# headers = Common.get_headers(self, token, sf_secret_key)
url = 'http://192.168.50.127:8081' url = 'http://192.168.50.127:8081'
params = { params = {
'user_id': self._uid 'user_id': self._uid
@@ -82,7 +60,6 @@ class MrsMaterialModel(models.Model):
active = fields.Boolean('有效', default=True) active = fields.Boolean('有效', default=True)
class MrsProductionProcessCategory(models.Model): class MrsProductionProcessCategory(models.Model):
_name = 'sf.production.process.category' _name = 'sf.production.process.category'
_description = '表面工艺类别' _description = '表面工艺类别'
@@ -131,6 +108,7 @@ class MrsProcessingOrder(models.Model):
index=True, string='加工工艺') index=True, string='加工工艺')
production_process_id = fields.Many2one('sf.production.process', string="表面工艺") production_process_id = fields.Many2one('sf.production.process', string="表面工艺")
class SupplierSort(models.Model): class SupplierSort(models.Model):
_name = 'sf.supplier.sort' _name = 'sf.supplier.sort'
_description = '供应商排序' _description = '供应商排序'

View File

@@ -1,5 +1,5 @@
import requests
import json import json
import requests
from odoo import models, fields, api from odoo import models, fields, api
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
from odoo.exceptions import ValidationError from odoo.exceptions import ValidationError

View File

@@ -1,3 +1 @@
from .import controllers from . import controllers

View File

@@ -1,2 +1 @@
from . import models from . import models

View File

@@ -9,7 +9,7 @@
""", """,
'category': 'sf', 'category': 'sf',
'website': 'https://www.sf.jikimo.com', 'website': 'https://www.sf.jikimo.com',
'depends': ['sf_sale', 'sf_dlm','sf_manufacturing'], 'depends': ['sf_sale', 'sf_dlm', 'sf_manufacturing'],
'data': [ 'data': [
'views/product_template_management_view.xml', 'views/product_template_management_view.xml',
], ],

View File

@@ -1,7 +1,2 @@
#from . import product_template # from . import product_template
#from . import product_supplierinfo # from . import product_supplierinfo
#

View File

@@ -1,13 +1,12 @@
import logging
from datetime import datetime
from dateutil.relativedelta import relativedelta
import os import os
import base64 import base64
import math import math
import requests import requests
import logging
# import subprocess # import subprocess
from datetime import datetime
from dateutil.relativedelta import relativedelta
from odoo import api, fields, models, SUPERUSER_ID, _ from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import ValidationError
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
from odoo.exceptions import UserError from odoo.exceptions import UserError
from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController from odoo.addons.sf_mrs_connect.models.ftp_operate import FtpController
@@ -388,7 +387,8 @@ class ResMrpWorkOrder(models.Model):
productions._create_workorder() productions._create_workorder()
productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \ productions.filtered(lambda p: (not p.orderpoint_id and p.move_raw_ids) or \
( (
p.move_dest_ids.procure_method != 'make_to_order' and not p.move_raw_ids and not p.workorder_ids)).action_confirm() p.move_dest_ids.procure_method != 'make_to_order' and
not p.move_raw_ids and not p.workorder_ids)).action_confirm()
for production in productions: for production in productions:
origin_production = production.move_dest_ids and production.move_dest_ids[ origin_production = production.move_dest_ids and production.move_dest_ids[