Merge pull request !1402 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-01-19 09:11:12 +00:00
committed by Gitee
20 changed files with 612 additions and 248 deletions
@@ -2,4 +2,3 @@
from . import main
from . import sh_firebase_notification
from . import home
from . import login
@@ -1,72 +0,0 @@
# -*- encoding: utf-8 -*-
import hashlib
import odoo
from odoo import http
from odoo.tools import pycompat
from odoo.tools.translate import _
from odoo.http import request
from odoo.addons.web.controllers.home import Home as WebHome
from odoo.addons.web.controllers.utils import ensure_db, _get_login_redirect_url
# Shared parameters for all login/signup flows
SIGN_UP_REQUEST_PARAMS = {'db', 'login', 'debug', 'token', 'message', 'error',
'scope', 'mode', 'redirect', 'redirect_hostname',
'email', 'name', 'partner_id', 'password',
'confirm_password', 'city', 'country_id', 'lang'}
class Home(WebHome):
@http.route(route='/web/login', type='http', auth="none")
def web_login(self, redirect=None, **kw):
"""Override web_login function to add features of this module."""
ensure_db()
request.params['login_success'] = False
if request.httprequest.method == 'GET' and redirect and request.session.uid:
return request.redirect(redirect)
if not request.uid:
request.update_env(user=odoo.SUPERUSER_ID)
values = {val: item for val, item in request.params.items() if
val in SIGN_UP_REQUEST_PARAMS}
try:
values['databases'] = http.db_list()
except odoo.exceptions.AccessDenied:
values['databases'] = None
if request.httprequest.method == 'POST':
old_uid = request.update_env(user=request.session.uid)
try:
uid = request.session.authenticate(request.session.db,
request.params['login'],
request.params['password'])
request.params['login_success'] = True
return request.redirect(
self._login_redirect(uid, redirect=redirect))
except odoo.exceptions.AccessDenied as e:
request.update_env = old_uid
if e.args == odoo.exceptions.AccessDenied().args:
values['error'] = _("错误的用户名和密码!")
else:
values['error'] = e.args[0]
else:
if 'error' in request.params and request.params.get(
'error') == 'access':
values['error'] = _("只有员工才能访问此数据库。请联系管理员。")
if 'login' not in values and request.session.get('auth_login'):
values['login'] = request.session.get('auth_login')
if not odoo.tools.config['list_db']:
values['disable_database_manager'] = True
response = request.render('sh_backmate_theme_adv_enterprise.sh_backmate_theme_web_login_main_template', values)
response.headers['X-Frame-Options'] = 'DENY'
return response
class Website(Home):
# override
@http.route(website=True, auth="public", sitemap=False)
def web_login(self, *args, **kw):
return super().web_login(*args, **kw)
@@ -1,90 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<template id="sh_backmate_theme_adv_enterprise.login_layout" name="Login Layout">
<t t-call="web.frontend_layout">
<t t-set="html_data" t-value="{'style': 'height: 100%;'}"/>
<t t-set="body_classname" t-value="'bg-100'"/>
<t t-set="no_header" t-value="True"/>
<t t-set="no_footer" t-value="True"/>
<div class="container py-5">
<div t-attf-class="card border-0 mx-auto bg-100 {{login_card_classes}} o_database_list" style="max-width: 300px;">
<div class="card-body">
<div t-attf-class="text-center pb-3 border-bottom {{'mb-3' if form_small else 'mb-4'}}">
<img t-attf-src="/web/binary/company_logo{{ '?dbname='+db if db else '' }}" alt="Logo" style="max-height:120px; max-width: 100%; width:auto"/>
</div>
<t t-out="0"/>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="border-end pe-2 me-1" href="/web/database/manager">管理数据库</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
</div>
</div>
</div>
</div>
</t>
</template>
<template id="sh_backmate_theme_adv_enterprise.login" name="Login">
<t t-call="sh_backmate_theme_adv_enterprise.login_layout">
<form class="oe_login_form" role="form" t-attf-action="/web/login" method="post" onsubmit="this.action = '/web/login' + location.hash">
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="mb-3" t-if="databases and len(databases) &gt; 1">
<label for="db" class="col-form-label">Database</label>
<div t-attf-class="input-group {{'input-group-sm' if form_small else ''}}">
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择 <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
</div>
</div>
<div class="mb-3 field-login">
<label for="login" class="form-label">用户名</label>
<input type="text" placeholder="Email" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="username" autofocus="autofocus" autocapitalize="off"/>
</div>
<div class="mb-3">
<label for="password" class="form-label">密码</label>
<input type="password" placeholder="Password" name="password" id="password" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="current-password" t-att-autofocus="'autofocus' if login else None" maxlength="4096"/>
</div>
<p class="alert alert-danger" t-if="error" role="alert">
<t t-esc="error"/>
</p>
<p class="alert alert-success" t-if="message" role="status">
<t t-esc="message"/>
</p>
<div t-attf-class="clearfix oe_login_buttons text-center gap-1 d-grid mb-1 {{'pt-2' if form_small else 'pt-3'}}">
<button type="submit" class="btn btn-primary">登 录</button>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm">以超级用户身份登录</button>
</t>
<div class="o_login_auth"/>
</div>
<input type="hidden" name="redirect" t-att-value="redirect"/>
</form>
</t>
</template>
<template id="sh_backmate_theme_adv_enterprise.login_successful" name="Login successful">
<t t-call="sh_backmate_theme_adv_enterprise.login_layout">
<div class="oe_login_form">
<p>
您已登录
</p>
<div t-attf-class="clearfix oe_login_buttons text-center mb-1 pt-3">
<a class="btn btn-primary btn-block" href="/web/session/logout">注 销</a>
</div>
</div>
</t>
</template>
<template id="sh_backmate_theme_web_login_layout" inherit_id="sh_backmate_theme_adv_enterprise.login_layout" name="Backmate Login Layout">
<template id="sh_backmate_theme_web_login_layout" inherit_id="web.login_layout" name="Backmate Login Layout">
<xpath expr="//div[hasclass('container')]" position="replace">
<t t-set="pageName" t-value="'sh_backmate_advance_enterprise_website_login_page_wrapper'" />
<t t-set="theme_config" t-value="request.env['sh.back.theme.config.settings'].search([('id','=',1)],limit = 1)" />
@@ -105,9 +22,9 @@
<t t-raw="0"/>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="pr-2 mr-1" href="/web/database/manager">管理数据库</a>
<a class="pr-2 mr-1" href="/web/database/manager">Manage Databases</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</div>
@@ -129,9 +46,9 @@
<t t-raw="0"/>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="border-right pr-2 mr-1" href="/web/database/manager">管理数据库</a>
<a class="border-right pr-2 mr-1" href="/web/database/manager">Manage Databases</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</div>
@@ -157,13 +74,13 @@
<div t-attf-class="card border-0 mx-auto mt-5 bg-100 {{login_card_classes}} o_database_list col-lg-6 col-md-6 col-sm-6 col-12" style="max-width: 300px;">
<div class="card-body">
<!-- -->
<h1><center><span class="sign_in">登录</span></center></h1>
<h1><center><span class="sign_in">Sign In</span></center></h1>
<t t-raw="0"/>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="border-right pr-2 mr-1" href="/web/database/manager">管理数据库</a>
<a class="border-right pr-2 mr-1" href="/web/database/manager">Manage Databases</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</div>
@@ -187,9 +104,9 @@
</div>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="pr-2 mr-1" href="/web/database/manager">管理数据库</a>
<a class="pr-2 mr-1" href="/web/database/manager">Manage Databases</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</div>
@@ -205,9 +122,9 @@
<t t-raw="0"/>
<div class="text-center small mt-4 pt-3 border-top" t-if="not disable_footer">
<t t-if="not disable_database_manager">
<a class="border-right pr-2 mr-1" href="/web/database/manager">管理数据库</a>
<a class="border-right pr-2 mr-1" href="/web/database/manager">Manage Databases</a>
</t>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">提供者 <span>Odoo</span></a>
<a href="https://www.odoo.com?utm_source=db&amp;utm_medium=auth" target="_blank">Powered by <span>Odoo</span></a>
</div>
</div>
</div>
@@ -215,7 +132,7 @@
</t>
</xpath>
</template>
<template id="sh_backmate_theme_web_login_main_template" inherit_id="sh_backmate_theme_adv_enterprise.login" name="Backmate Login" primary="True">
<template id="sh_backmate_theme_web_login_main_template" inherit_id="web.login" name="Backmate Login" primary="True">
<xpath expr="//form[hasclass('oe_login_form')]" position="replace">
<t t-set="theme_config" t-value="request.env['sh.back.theme.config.settings'].search([('id','=',1)],limit = 1)" />
<t t-if="theme_config.login_page_style == 'style_1'">
@@ -229,7 +146,7 @@
</div>
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<span class="input-group-append">
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择</a>
<a role="button" href="/web/database/selector" class="btn btn-secondary">Select</a>
</span>
</div>
</div>
@@ -265,18 +182,18 @@
<div class="row">
<div class="col-8">
<div class="justify-content-between mt-2 d-flex small">
<a t-if="signup_enabled" style="color:#919191;text-decoration:none;" t-attf-href="/web/signup?{{ keep_query() }}">没有帐户?</a>
<a t-if="reset_password_enabled" style="color:#5c77ff;" t-attf-href="/web/reset_password?{{ keep_query() }}">重置密码</a>
<a t-if="signup_enabled" style="color:#919191;text-decoration:none;" t-attf-href="/web/signup?{{ keep_query() }}">Don't have an account?</a>
<a t-if="reset_password_enabled" style="color:#5c77ff;" t-attf-href="/web/reset_password?{{ keep_query() }}">Reset Password</a>
</div>
</div>
<div class="col-4">
<button type="submit" class="btn btn-primary btn-block">登 录</button>
<button type="submit" class="btn btn-primary btn-block">Log in</button>
</div>
</div>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">以超级用户身份登录</button>
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">Log in as superuser</button>
</t>
<div class="o_login_auth"></div>
@@ -290,22 +207,22 @@
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="form-group field-db" t-if="databases and len(databases) &gt; 1">
<label for="db" class="col-form-label">数据库</label>
<label for="db" class="col-form-label">Database</label>
<div t-attf-class="input-group {{'input-group-sm' if form_small else ''}}">
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<span class="input-group-append">
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择 <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
<a role="button" href="/web/database/selector" class="btn btn-secondary">Select <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
</span>
</div>
</div>
<div class="form-group field-login">
<label for="login">用户名</label>
<label for="login">Username</label>
<input type="text" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autofocus="autofocus" autocapitalize="off"/>
</div>
<div class="form-group field-password">
<label for="password">密码</label>
<label for="password">Password</label>
<input type="password" name="password" id="password" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="current-password" t-att-autofocus="'autofocus' if login else None" maxlength="4096"/>
</div>
@@ -317,13 +234,13 @@
</p>
<div t-attf-class="clearfix oe_login_buttons text-center mb-1 {{'pt-2' if form_small else 'pt-3'}}">
<button type="submit" class="btn btn-primary btn-block">登录</button>
<button type="submit" class="btn btn-primary btn-block">Log in</button>
<div class="justify-content-between mt-2 d-flex small">
<a t-if="signup_enabled" t-attf-href="/web/signup?{{ keep_query() }}">没有帐户?</a>
<a t-if="reset_password_enabled" t-attf-href="/web/reset_password?{{ keep_query() }}">重置密码</a>
<a t-if="signup_enabled" t-attf-href="/web/signup?{{ keep_query() }}">Don't have an account?</a>
<a t-if="reset_password_enabled" t-attf-href="/web/reset_password?{{ keep_query() }}">Reset Password</a>
</div>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">以超级用户身份登录</button>
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">Log in as superuser</button>
</t>
<div class="o_login_auth"></div>
</div>
@@ -341,7 +258,7 @@
<div t-attf-class="input-group {{'input-group-sm' if form_small else ''}}">
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<span class="input-group-append">
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择 <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
<a role="button" href="/web/database/selector" class="btn btn-secondary">Select <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
</span>
</div>
</div>
@@ -376,11 +293,11 @@
<div t-attf-class="clearfix oe_login_buttons text-center mb-1 {{'pt-2' if form_small else 'pt-3'}}">
<button type="submit" class="btn btn-primary btn-block">Log in</button>
<div class="justify-content-between mt-2 d-flex small">
<a t-if="signup_enabled" t-attf-href="/web/signup?{{ keep_query() }}">没有帐户?</a>
<a t-if="reset_password_enabled" t-attf-href="/web/reset_password?{{ keep_query() }}">重置密码</a>
<a t-if="signup_enabled" t-attf-href="/web/signup?{{ keep_query() }}">Don't have an account?</a>
<a t-if="reset_password_enabled" t-attf-href="/web/reset_password?{{ keep_query() }}">Reset Password</a>
</div>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">以超级用户身份登录</button>
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">Log in as superuser</button>
</t>
<div class="o_login_auth"></div>
</div>
@@ -393,11 +310,11 @@
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="form-group field-db" t-if="databases and len(databases) &gt; 1">
<label for="db" class="col-form-label">数据库</label>
<label for="db" class="col-form-label">Database</label>
<div t-attf-class="input-group {{'input-group-sm' if form_small else ''}}">
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<span class="input-group-append">
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择 <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
<a role="button" href="/web/database/selector" class="btn btn-secondary">Select <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
</span>
</div>
</div>
@@ -433,15 +350,15 @@
<button type="submit" class="btn btn-primary btn-block">Log in</button>
<div class="justify-content-between mt-2 d-flex small">
<a t-if="signup_enabled" style="color:#919191;text-decoration:none;" t-attf-href="/web/signup?{{ keep_query() }}">没有帐户?</a>
<a t-if="reset_password_enabled" style="color:#5c77ff;" t-attf-href="/web/reset_password?{{ keep_query() }}">重置密码</a>
<a t-if="signup_enabled" style="color:#919191;text-decoration:none;" t-attf-href="/web/signup?{{ keep_query() }}">Don't have an account?</a>
<a t-if="reset_password_enabled" style="color:#5c77ff;" t-attf-href="/web/reset_password?{{ keep_query() }}">Reset Password</a>
</div>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">以超级用户身份登录</button>
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">Log in as superuser</button>
</t>
<div class="o_login_auth"></div>
@@ -455,22 +372,22 @@
<input type="hidden" name="csrf_token" t-att-value="request.csrf_token()"/>
<div class="form-group field-db" t-if="databases and len(databases) &gt; 1">
<label for="db" class="col-form-label">数据库</label>
<label for="db" class="col-form-label">Database</label>
<div t-attf-class="input-group {{'input-group-sm' if form_small else ''}}">
<input type="text" name="db" t-att-value="request.db" id="db" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" readonly="readonly"/>
<span class="input-group-append">
<a role="button" href="/web/database/selector" class="btn btn-secondary">选择 <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
<a role="button" href="/web/database/selector" class="btn btn-secondary">Select <i class="fa fa-database" role="img" aria-label="Database" title="Database"></i></a>
</span>
</div>
</div>
<div class="form-group field-login">
<label for="login">用户名</label>
<label for="login">Email</label>
<input type="text" placeholder="Email" name="login" t-att-value="login" id="login" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autofocus="autofocus" autocapitalize="off"/>
</div>
<div class="form-group field-password">
<label for="password">密码</label>
<label for="password">Password</label>
<input type="password" placeholder="Password" name="password" id="password" t-attf-class="form-control #{'form-control-sm' if form_small else ''}" required="required" autocomplete="current-password" t-att-autofocus="'autofocus' if login else None" maxlength="4096"/>
</div>
@@ -482,9 +399,9 @@
</p>
<div t-attf-class="clearfix oe_login_buttons text-center mb-1 {{'pt-2' if form_small else 'pt-3'}}">
<button type="submit" class="btn btn-primary btn-block">登录</button>
<button type="submit" class="btn btn-primary btn-block">Log in</button>
<t t-if="debug">
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">以超级用户身份登录</button>
<button type="submit" name="redirect" value="/web/become" class="btn btn-link btn-sm btn-block">Log in as superuser</button>
</t>
<div class="o_login_auth"/>
</div>
@@ -153,6 +153,29 @@ class SoongWorkflowMixin(models.AbstractModel):
auto_join=True,
)
@api.model_create_multi
def create(self, vals_list):
res = super().create(vals_list)
for record in res:
button_ids = record.workflow_id.node_ids.button_ids
for button_id in button_ids:
# 不自动匹配
if not button_id.is_automatic:
employee_ids = record.env['hr.employee'].search(
['|', ('user_role_id', '=', button_id.users_role_id.id),
('user_role_ids', 'in', button_id.users_role_id.id)])
else:
# 自动匹配
employee_ids = record.env['hr.employee'].search(
['|', ('user_role_id', '=', button_id.users_role_id.id),
('user_role_ids', 'in', button_id.users_role_id.id),
'|', ('department_id', '=', record.env.user.employee_id.department_id.id), ('department_ids', 'in', record.env.user.employee_id.department_id.id),
('yuthon_company', '=', record.env.user.employee_id.yuthon_company)])
# 判断当前用户是否是 当前节点的员工
if record.env.user.employee_id.id in employee_ids.ids:
record.state = button_id.node_id.node_name
return res
def _create_update_logs(self, btn_rec):
log_obj = self.env["soong.workflow.log"]
if btn_rec.name in ['退回']:
+4
View File
@@ -13,7 +13,11 @@
'depends': ['documents'],
'data': [
'security/ir.model.access.csv',
'views/lessee_service_setting_views.xml',
'views/property_report_repair.xml',
'views/yuthon_maintain_service_views.xml',
'views/maintenance_equipment_views.xml',
'views/all_menu.xml',
],
'installable': True,
'application': True,
+3 -1
View File
@@ -1,5 +1,7 @@
# -*- coding: utf-8 -*-
from . import inherit_maintenance_equipment
from . import lessee_service_setting
from . import property_report_repair
from . import yuthon_maintain_service
@@ -0,0 +1,46 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, exceptions, _
class SoftwareIssuesSetting(models.Model):
_name = 'software.issues.setting'
_description = '软件问题'
name = fields.Char(string='软件问题')
class HardwareIssuesSetting(models.Model):
_name = 'hardware.issues.setting'
_description = '硬件问题'
name = fields.Char(string='硬件问题')
class SoftwareIssuesProcessing(models.Model):
_name = 'software.issues.processing'
_description = '软件处理类型'
name = fields.Char(string='软件处理方式')
class HardwareIssuesProcessing(models.Model):
_name = 'hardware.issues.processing'
_description = '硬件处理类型'
name = fields.Char(string='硬件处理方式')
class MaintainServiceSetting(models.Model):
_name = 'maintain.service.setting'
_description = '服务器类型'
name = fields.Char(string='服务器类型')
class MaintainDesktopSetting(models.Model):
_name = 'maintain.desktop.setting'
_description = '桌面类型'
name = fields.Char(string='桌面类型')
@@ -0,0 +1,58 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, exceptions, _
class PropertyRentRelief(models.Model):
_name = 'property.report.repair'
_description = '报事报修审批'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
_rec_name = 'name'
name = fields.Char(string='标题')
code = fields.Char(string="报修编号",
default=lambda self: self.env['ir.sequence'].next_by_code('property_report_repair_code'))
users_id = fields.Many2one('res.users', string="报修人", default=lambda self: self.env.user.id)
repairer_date = fields.Date(string="报修时间")
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="报修部门")
repairer_address = fields.Char(string="报修人地址")
fault = fields.Text(string="故障信息")
dispatch_date = fields.Date(string="派单时间")
dispatch_head_id = fields.Many2one('hr.employee', string="派单人负责人")
team_ids = fields.Many2many('hr.employee', string="维修团队")
completion_time = fields.Datetime(string="预计完成时间")
dispatch_notes = fields.Text(string="派单备注")
urgency = fields.Selection([('low', '低'), ('middle', '中'), ('high', '高')], string="紧急程度")
possible_causes = fields.Selection([('software', '软件问题'), ('hardware', '硬件问题')], string="可能原因")
software_id = fields.Many2one('software.issues.setting', string="具体软件问题")
hardware_id = fields.Many2one('hardware.issues.setting', string="具体硬件问题")
specific_reasons = fields.Text(string="具体原因")
software_processing_id = fields.Many2one('software.issues.processing', string="处理类型")
hardware_processing_id = fields.Many2one('hardware.issues.processing', string="处理类型")
resolution = fields.Text(string="解决方法")
documents_ids = fields.Many2many('ir.attachment', string="附件")
fees = fields.Float(string="费用")
repair_company = fields.Char(string="维修人/公司")
list_quotations = fields.Many2one('ir.attachment', string="报价清单")
invoice_id = fields.Many2one('ir.attachment', string="发票附件")
hardware_parts = fields.Char(string="更换部件")
hardware_fee = fields.Float(string="部件费用")
software_parts = fields.Char(string="软件名称/版本")
software_fee = fields.Float(string="软件费用")
duration_service = fields.Float(string="服务时长")
service_fee = fields.Float(string="服务费")
service_fee_total = fields.Float(string="总费用")
service_fee_remark = fields.Text(string="费用备注")
situation = fields.Char(string="现场说明情况")
is_fee = fields.Boolean(string="是否产生费用")
labor_costs = fields.Float(string="人工费")
confirmation_repairer = fields.Char(string="报修人确认")
warehouse_management = fields.Char(string="库管")
total = fields.Float(string="总价")
remake = fields.Text(string="备注")
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, exceptions, _
class YuthonMaintainDesktop(models.Model):
_name = 'yuthon.maintain.desktop'
_description = '桌面设置'
name = fields.Char(string='名称')
desktop_id = fields.Many2one('maintain.desktop.setting', string='类型')
mac_address = fields.Char(string='MAC地址')
ip_address = fields.Char(string='IP地址')
cpu = fields.Char(string='CPU')
memory = fields.Char(string='内存')
hard_disk = fields.Char(string='硬盘')
account = fields.Char(string='账号')
password = fields.Char(string='密码')
desktop_type = fields.Char(string='类型')
purchase_date = fields.Date(string='购买日期')
users_id = fields.Many2one('res.users', string='使用人')
remake = fields.Text(string='备注日志')
qr_Image = fields.Image(string='二维码')
@@ -0,0 +1,19 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, fields, api, exceptions, _
class YuthonMaintainService(models.Model):
_name = 'yuthon.maintain.service'
_description = '服务器类'
name = fields.Char(string='名称', required=True)
service_type_id = fields.Many2one('maintain.service.setting', string='服务器类型')
mac_address = fields.Char(string='MAC地址')
ip_address = fields.Char(string='IP地址')
time_purchase = fields.Date(string='购买时间')
service_state = fields.Char(string='状态')
remake = fields.Text(string='备注日志')
updated = fields.Datetime(string='更新时间')
qr_Image = fields.Image(string='二维码')
@@ -1,2 +1,9 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
access_property_report_repair,property_report_repair,model_property_report_repair,base.group_user,1,1,1,1
access_software_issues_setting,software_issues_setting,model_software_issues_setting,base.group_user,1,1,1,1
access_hardware_issues_setting,hardware_issues_setting,model_hardware_issues_setting,base.group_user,1,1,1,1
access_software_issues_processing,software_issues_processing,model_software_issues_processing,base.group_user,1,1,1,1
access_hardware_issues_processing,hardware_issues_processing,model_hardware_issues_processing,base.group_user,1,1,1,1
access_maintain_service_setting,maintain_service_setting,model_maintain_service_setting,base.group_user,1,1,1,1
access_maintain_desktop_setting,maintain_desktop_setting,model_maintain_desktop_setting,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_property_report_repair property_report_repair model_property_report_repair base.group_user 1 1 1 1
3 access_software_issues_setting software_issues_setting model_software_issues_setting base.group_user 1 1 1 1
4 access_hardware_issues_setting hardware_issues_setting model_hardware_issues_setting base.group_user 1 1 1 1
5 access_software_issues_processing software_issues_processing model_software_issues_processing base.group_user 1 1 1 1
6 access_hardware_issues_processing hardware_issues_processing model_hardware_issues_processing base.group_user 1 1 1 1
7 access_maintain_service_setting maintain_service_setting model_maintain_service_setting base.group_user 1 1 1 1
8 access_maintain_desktop_setting maintain_desktop_setting model_maintain_desktop_setting base.group_user 1 1 1 1
9
+59
View File
@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<menuitem id="yuthon_property_report_repair"
parent="maintenance.menu_maintenance_title"
name="报事报修"
action="property_report_repair_action"
sequence="1"/>
<menuitem id="yuthon_maintenance_equipment_menu"
parent="maintenance.menu_maintenance_title"
name="设备"
sequence="5"/>
<menuitem id="yuthon_maintenance_equipment_category_menu"
parent="yuthon_maintenance_equipment_menu"
action="hr_equipment_action"
name="设备"
sequence="1"/>
<menuitem id="yuthon_maintain_desktop_menu"
parent="yuthon_maintenance_equipment_menu"
action="view_yuthon_maintain_desktop_action"
name="桌面"
sequence="5"/>
<menuitem id="yuthon_maintain_service_menu"
parent="yuthon_maintenance_equipment_menu"
action="view_yuthon_maintain_service_action"
name="服务"
sequence="10"/>
<!--配置-->
<menuitem id="yuthon_software_issues_setting"
parent="maintenance.menu_maintenance_configuration"
name="软件问题"
action="view_software_issues_setting_action"
sequence="1"/>
<menuitem id="yuthon_hardware_issues_setting"
parent="maintenance.menu_maintenance_configuration"
name="硬件问题"
action="view_hardware_issues_setting_action"
sequence="5"/>
<menuitem id="yuthon_software_issues_processing"
parent="maintenance.menu_maintenance_configuration"
name="软件处理类型"
action="view_software_issues_processing_action"
sequence="10"/>
<menuitem id="yuthon_hardware_issues_processing"
parent="maintenance.menu_maintenance_configuration"
name="硬件处理类型"
action="view_hardware_issues_processing_action"
sequence="15"/>
<menuitem id="yuthon_maintain_service_type_setting"
parent="maintenance.menu_maintenance_configuration"
name="服务器类型"
action="view_yuthon_maintain_service_setting_action"
sequence="20"/>
<menuitem id="yuthon_maintain_desktop_type_setting"
parent="maintenance.menu_maintenance_configuration"
name="桌面类型"
action="view_yuthon_maintain_desktop_setting_action"
sequence="25"/>
</odoo>
@@ -0,0 +1,86 @@
<odoo>
<record id="view_software_issues_setting_tree" model="ir.ui.view">
<field name="name">software issues setting</field>
<field name="model">software.issues.setting</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_software_issues_setting_action" model="ir.actions.act_window">
<field name="name">软件问题</field>
<field name="res_model">software.issues.setting</field>
<field name="view_mode">tree</field>
</record>
<record id="view_hardware_issues_setting_tree" model="ir.ui.view">
<field name="name">hardware issues setting</field>
<field name="model">hardware.issues.setting</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_hardware_issues_setting_action" model="ir.actions.act_window">
<field name="name">硬件问题</field>
<field name="res_model">hardware.issues.setting</field>
<field name="view_mode">tree</field>
</record>
<record id="view_software_issues_processing_tree" model="ir.ui.view">
<field name="name">software issues processing</field>
<field name="model">software.issues.processing</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_software_issues_processing_action" model="ir.actions.act_window">
<field name="name">软件处理类型</field>
<field name="res_model">software.issues.processing</field>
<field name="view_mode">tree</field>
</record>
<record id="view_hardware_issues_processing_tree" model="ir.ui.view">
<field name="name">hardware issues processing</field>
<field name="model">hardware.issues.processing</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_hardware_issues_processing_action" model="ir.actions.act_window">
<field name="name">硬件处理类型</field>
<field name="res_model">hardware.issues.processing</field>
<field name="view_mode">tree</field>
</record>
<record id="view_yuthon_maintain_desktop_setting_tree" model="ir.ui.view">
<field name="name">maintain.desktop.setting</field>
<field name="model">maintain.desktop.setting</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_yuthon_maintain_desktop_setting_action" model="ir.actions.act_window">
<field name="name">桌面类型设置</field>
<field name="res_model">maintain.desktop.setting</field>
<field name="view_mode">tree</field>
</record>
<record id="view_yuthon_maintain_service_setting_tree" model="ir.ui.view">
<field name="name">maintain.service.setting</field>
<field name="model">maintain.service.setting</field>
<field name="arch" type="xml">
<tree editable="bottom">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_yuthon_maintain_service_setting_action" model="ir.actions.act_window">
<field name="name">服务类型设置</field>
<field name="res_model">maintain.service.setting</field>
<field name="view_mode">tree</field>
</record>
</odoo>
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_property_report_repair_tree" model="ir.ui.view">
<field name="name">property.report.repair.tree</field>
<field name="model">property.report.repair</field>
<field name="arch" type="xml">
<tree string="报事报修审批">
<field name="name"/>
<field name="code"/>
</tree>
</field>
</record>
<record id="view_property_report_repair_form" model="ir.ui.view">
<field name="name">property.report.repair.form</field>
<field name="model">property.report.repair</field>
<field name="arch" type="xml">
<form string="报事报修审批">
<sheet>
<group>
<field name="code" readonly="1" string="流水号:"/>
</group>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name" required="1"/>
</h1>
</div>
<group string="基本信息" col="3">
<group>
<field name="repairer_date"/>
</group>
<group>
<field name="department_id"/>
</group>
<group>
<field name="users_id"/>
</group>
</group>
<group string="故障信息">
<field name="fault"/>
</group>
<group string="派单信息" col="2">
<group>
<field name="dispatch_date"/>
<field name="dispatch_head_id"/>
<field name="dispatch_notes"/>
</group>
<group>
<field name="team_ids" widget="many2many_tags"/>
<field name="completion_time"/>
</group>
</group>
<group string="处理信息">
<field name="urgency"/>
<field name="possible_causes"/>
<field name="software_id" invisible="possible_causes == 'software'"/>
<field name="hardware_id" invisible="possible_causes == 'hardware'"/>
</group>
<group string="具体问题详情">
<field name="specific_reasons"/>
<field name="software_processing_id" invisible="possible_causes == 'software'"/>
<field name="hardware_processing_id" invisible="possible_causes == 'hardware'"/>
<field name="resolution"/>
<field name="documents_ids" widget="many2many_tags"/>
<field name="repair_company"/>
<field name="fees"/>
<field name="list_quotations" widget="many2one_tags"/>
<field name="invoice_id" widget="many2one_tags"/>
</group>
<group string="费用信息">
<field name="hardware_parts" invisible="possible_causes == 'hardware'"/>
<field name="hardware_fee" invisible="possible_causes == 'hardware'"/>
<field name="software_parts" invisible="possible_causes == 'software'"/>
<field name="software_fee" invisible="possible_causes == 'software'"/>
</group>
<group string="人工费用">
<field name="duration_service"/>
<field name="service_fee"/>
<field name="service_fee_total"/>
<field name="service_fee_remark"/>
</group>
<group>
<field name="remake"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="property_report_repair_action" model="ir.actions.act_window">
<field name="name">报事报修审批</field>
<field name="res_model">property.report.repair</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -0,0 +1,59 @@
<odoo>
<record id="view_yuthon_maintain_desktop_tree" model="ir.ui.view">
<field name="name">yuthon.maintain.desktop.tree</field>
<field name="model">yuthon.maintain.desktop</field>
<field name="arch" type="xml">
<tree string="桌面">
<field name="name"/>
<field name="desktop_id"/>
<field name="account"/>
<field name="purchase_date"/>
<field name="users_id"/>
</tree>
</field>
</record>
<record id="view_yuthon_maintain_desktop_form" model="ir.ui.view">
<field name="name">yuthon.maintain.desktop.form</field>
<field name="model">yuthon.maintain.desktop</field>
<field name="arch" type="xml">
<form string="桌面">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group col="2">
<group>
<field name="desktop_id"/>
<field name="mac_address"/>
<field name="ip_address"/>
<field name="cpu"/>
<field name="memory"/>
<field name="hard_disk"/>
<field name="remake"/>
</group>
<group>
<field name="account"/>
<field name="password"/>
<field name="desktop_type"/>
<field name="purchase_date"/>
<field name="users_id"/>
</group>
</group>
<group>
<field name="qr_Image"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_yuthon_maintain_desktop_action" model="ir.actions.act_window">
<field name="name">桌面</field>
<field name="res_model">yuthon.maintain.desktop</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -0,0 +1,51 @@
<odoo>
<record id="view_yuthon_maintain_service_tree" model="ir.ui.view">
<field name="name">yuthon.maintain.service.tree</field>
<field name="model">yuthon.maintain.service</field>
<field name="arch" type="xml">
<tree string="服务器类">
<field name="name"/>
<field name="service_type_id"/>
<field name="mac_address"/>
<field name="ip_address"/>
<field name="service_state"/>
</tree>
</field> 、
</record>
<record id="view_yuthon_maintain_service_form" model="ir.ui.view">
<field name="name">yuthon.maintain.service.form</field>
<field name="model">yuthon.maintain.service</field>
<field name="arch" type="xml">
<form string="服务器类">
<sheet>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group col="2">
<group>
<field name="service_type_id"/>
<field name="mac_address"/>
<field name="ip_address"/>
</group>
<group>
<field name="time_purchase"/>
<field name="service_state"/>
<field name="updated"/>
</group>
</group>
<group>
<field name="qr_Image"/>
</group>
</sheet>
</form>
</field>
</record>
<record id="view_yuthon_maintain_service_action" model="ir.actions.act_window">
<field name="name">服务器类</field>
<field name="res_model">yuthon.maintain.service</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -6,7 +6,7 @@ class YuthonCareCondolences(models.Model):
_description = '关怀慰问'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='名称')
name = fields.Char(string='标题')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
care_type_id = fields.Many2one('yuthon.care.setting', string='类型')
@@ -6,7 +6,7 @@ class YuthonWorkCondolences(models.Model):
_description = '关怀慰问'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='名称')
name = fields.Char(string='标题')
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
work_type_id = fields.Many2one('yuthon.work.setting', string='类型')
@@ -20,36 +20,30 @@
<group>
<field name="code" readonly="1" string="流水号:"/>
</group>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group string="个人信息">
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="care_type_id"/>
<field name="date"/>
<field name="fees"/>
<group string="审批事项">
<field name="name"/>
<field name="users_id"/>
<field name="reason"/>
</group>
<group string="个人信息">
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="care_type_id"/>
<field name="date"/>
<field name="fees"/>
</group>
<group col="2">
<group>
<field name="marriage_cate_id" widget="preview_many2one"/>
<field name="born_cate_id" widget="preview_many2one"/>
<field name="discharge_summary_id" widget="preview_many2one"/>
<field name="retired_id" widget="preview_many2one"/>
</group>
<group col="2">
<group>
<field name="marriage_cate_id" widget="preview_many2one"/>
<field name="born_cate_id" widget="preview_many2one"/>
<field name="discharge_summary_id"/>
<field name="retired_id"/>
</group>
<group>
<field name="marriage_date"/>
<field name="born_date"/>
</group>
</group>
<group string="审批事项">
<field name="name"/>
<field name="reason"/>
<group>
<field name="marriage_date"/>
<field name="born_date"/>
</group>
</group>
</sheet>
</form>
</field>
@@ -20,25 +20,19 @@
<group>
<field name="code" readonly="1" string="流水号:"/>
</group>
<div class="oe_title">
<label for="name"/>
<h1>
<field name="name"/>
</h1>
</div>
<group string="个人信息">
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="work_type_id"/>
<field name="date"/>
<field name="fees"/>
</group>
<group string="审批事项">
<field name="name"/>
<field name="reason"/>
<field name="scheme_id" widget="preview_many2one"/>
<field name="meeting_id" widget="preview_many2one"/>
</group>
<group string="审批事项">
<field name="name"/>
<field name="reason"/>
<field name="scheme_id" widget="preview_many2one"/>
<field name="meeting_id" widget="preview_many2one"/>
</group>
<group string="个人信息">
<field name="users_id" invisible="1"/>
<field name="department_id" invisible="1"/>
<field name="work_type_id"/>
<field name="date"/>
<field name="fees"/>
</group>
</sheet>
</form>
</field>