代码规范
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from . import controllers
|
from . import controllers
|
||||||
from . import models
|
from . import models
|
||||||
|
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ class SfMaintenanceEquipment(models.Model):
|
|||||||
|
|
||||||
MTcode = fields.Char("机台编码", default=get_no)
|
MTcode = fields.Char("机台编码", default=get_no)
|
||||||
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
created_user = fields.Many2one('res.users', string='创建人', default=lambda self: self.env.user)
|
||||||
equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'), ('检测设备', '检测设备')]
|
equipment_type = fields.Selection([('机床', '机床'), ('机器人', '机器人'), ('AGV小车', 'AGV小车'),
|
||||||
, compute='_compute_category_id')
|
('检测设备', '检测设备')], compute='_compute_category_id')
|
||||||
|
|
||||||
@api.depends('category_id')
|
@api.depends('category_id')
|
||||||
def _compute_category_id(self):
|
def _compute_category_id(self):
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from odoo.tests.common import TransactionCase
|
from odoo.tests.common import TransactionCase
|
||||||
|
|
||||||
|
|
||||||
class TestEquipmentMaintenanceStandards(TransactionCase):
|
class TestEquipmentMaintenanceStandards(TransactionCase):
|
||||||
def setUp(self, *args, **kwargs):
|
def setUp(self, *args, **kwargs):
|
||||||
result = super().setUp(*args, **kwargs)
|
result = super().setUp(*args, **kwargs)
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from dateutil.relativedelta import relativedelta
|
|||||||
from odoo import api, fields, models, _
|
from odoo import api, fields, models, _
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class MaintenanceEquipment(models.Model):
|
class MaintenanceEquipment(models.Model):
|
||||||
_inherit = "maintenance.equipment"
|
_inherit = "maintenance.equipment"
|
||||||
|
|
||||||
@@ -64,6 +63,7 @@ class MaintenanceRequest(models.Model):
|
|||||||
production_company_id = fields.Many2one(string='Production Company', related='production_id.company_id')
|
production_company_id = fields.Many2one(string='Production Company', related='production_id.company_id')
|
||||||
company_id = fields.Many2one(domain="[('id', '=?', production_company_id)]")
|
company_id = fields.Many2one(domain="[('id', '=?', production_company_id)]")
|
||||||
|
|
||||||
|
|
||||||
class SfMaintenanceLogs(models.Model):
|
class SfMaintenanceLogs(models.Model):
|
||||||
_inherit = 'sf.maintenance.logs'
|
_inherit = 'sf.maintenance.logs'
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
# -*-coding:utf-8-*-
|
# -*-coding:utf-8-*-
|
||||||
from .import models
|
from .import models
|
||||||
from .import controllers
|
from .import controllers
|
||||||
|
|||||||
@@ -16,18 +16,14 @@ from odoo.tools.safe_eval import safe_eval, time
|
|||||||
from odoo.addons.web.controllers.report import ReportController
|
from odoo.addons.web.controllers.report import ReportController
|
||||||
from ..models.common import Common
|
from ..models.common import Common
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
_logger = logging.getLogger(__name__)
|
_logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ZplReportController(ReportController):
|
class ZplReportController(ReportController):
|
||||||
|
|
||||||
|
# ------------------------------------------------------
|
||||||
#------------------------------------------------------
|
|
||||||
# Report controllers
|
# Report controllers
|
||||||
#------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
@http.route([
|
@http.route([
|
||||||
'/report/<converter>/<reportname>',
|
'/report/<converter>/<reportname>',
|
||||||
'/report/<converter>/<reportname>/<docids>',
|
'/report/<converter>/<reportname>/<docids>',
|
||||||
@@ -57,4 +53,4 @@ class ZplReportController(ReportController):
|
|||||||
texthttpheaders = [('Content-Type', 'text/plain'), ('Content-Length', len(text))]
|
texthttpheaders = [('Content-Type', 'text/plain'), ('Content-Length', len(text))]
|
||||||
return request.make_response(text, headers=texthttpheaders)
|
return request.make_response(text, headers=texthttpheaders)
|
||||||
else:
|
else:
|
||||||
raise werkzeug.exceptions.HTTPException(description='Converter %s not implemented.' % converter)
|
raise werkzeug.exceptions.HTTPException(description='Converter %s not implemented.' % converter)
|
||||||
|
|||||||
Reference in New Issue
Block a user