Merge pull request !1596 from 李鹏宇/dev
This commit is contained in:
李鹏宇
2025-02-26 10:38:17 +00:00
committed by Gitee
24 changed files with 348 additions and 13 deletions
+2
View File
@@ -28,6 +28,8 @@ class Room(models.Model):
# Technical/Statistics
access_token = fields.Char("Access Token", default=lambda self: str(uuid4()), copy=False, readonly=True, required=True)
bookings_count = fields.Integer("Bookings Count", compute="_compute_bookings_count")
yuthon_company = fields.Selection([('thtz', '天河投资集团'), ('thwg', '天河物管'), ('thlc', '天河粮储')],
string='公司')
is_available = fields.Boolean(string="Is Room Currently Available", compute="_compute_is_available")
next_booking_start = fields.Datetime("Next Booking Start", compute="_compute_next_booking_start")
room_booking_url = fields.Char("Room Booking URL", compute="_compute_room_booking_url")
+10
View File
@@ -13,7 +13,11 @@
<filter name="is_meet_video" string="视频" domain="[('is_meet_video', '=', True)]"/>
<filter name="meet_capacity" string="二十人以上" domain="[('meet_capacity', '&gt;', 20)]"/>
<filter name="meet_capacity" string="二十人以下" domain="[('meet_capacity', '&lt;', 20)]"/>
<group expand="0" string="group_by">
<filter name="group_yuthon_company" string="公司" context="{'group_by':'yuthon_company'}"/>
</group>
</search>
</field>
</record>
@@ -51,6 +55,10 @@
</t>
</div>
</div>
<div>
<span>公司:</span>
<field name="yuthon_company"/>
</div>
</div>
</div>
</t>
@@ -114,6 +122,7 @@
<field name="meet_document_id"/>
<field name="office_address"/>
<field name="department_id"/>
<field name="yuthon_company"/>
<field name="short_code" invisible="1"/>
</group>
<!-- <group>-->
@@ -163,6 +172,7 @@
<field name="name">会议室</field>
<field name="res_model">room.room</field>
<field name="view_mode">kanban,list,form</field>
<field name="context">{'search_default_group_yuthon_company': 1 }</field>
<field name="help" type="html">
<p class="o_view_nocontent_smiling_face">
Create Rooms
@@ -9,7 +9,7 @@
<attribute name="string">假期余额</attribute>
</xpath>
<xpath expr="//tree/field[@name='holiday_status_id']" position="attributes">
<attribute name="optional">show</attribute>
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//tree/field[@name='date_from']" position="attributes">
<attribute name="string">开始时间</attribute>
@@ -100,6 +100,7 @@ class HrAttendanceMonthDetail(models.Model):
work_overtime = fields.Integer(string="加班")
entry_date = fields.Date(string="入职时间")
expected_date = fields.Date(string="离职日期")
holiday_id = fields.Many2one('hr.leave.type', string="假期种类")
# todo 需要什么字段往上加什么
# 打卡
come_late = fields.Integer(string="迟到")
@@ -77,6 +77,7 @@
<!-- 请假-->
<field name="unpaid_leave" />
<!-- 其他-->
<field name="holiday_id"/>
<field name="note"/>
<field name="company_id"/>
<field name="state" widget="badge" decoration-info="state == 'unconfirmed'" decoration-success="state == 'confirmed'"/>
@@ -98,6 +99,7 @@
<field name="current_month" />
<field name="required_attendance_days"/>
<field name="actual_attendance_days"/>
<field name="holiday_id"/>
<!-- <field name="company_area"/>-->
</group>
<group>
@@ -77,7 +77,7 @@ class YuthonLesseeNotice(models.Model):
def no_sequence(self):
self.sequence = 0
def notice_publish(self):
def notice_lessee_publish(self):
if self.is_change_notice:
users_role_list = department_users_list = []
# 部门人员
@@ -30,7 +30,7 @@
<field name="arch" type="xml">
<form string="公告管理">
<header>
<button name="notice_publish" string="发布" type="object" class="btn-primary"/>
<button name="notice_lessee_publish" string="发布" type="object" class="btn-primary"/>
</header>
<sheet>
<group col="3">
+37 -5
View File
@@ -38,6 +38,7 @@ class YuthonNotice(models.Model):
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -84,24 +85,24 @@ class YuthonNotice(models.Model):
def no_sequence(self):
self.sequence = 0
def notice_publish(self):
def notice_publish(self, valid_employee_ids):
if self.is_change_notice:
menu_id = self.env['ir.ui.menu'].search([('name', '=', '我的通知公告')])
str = 'https://oa.thtzjt.com/web#id={}&cids=1&menu_id={}&action={}&model=yuthon.notice&view_type=form'.format(self.id, menu_id.id, menu_id.action.id)
conf_old = self.env['yuthon.confirm.users'].search([('notice_id', '=', self.id), ('employee_id', 'in', self.employee_ids.ids)])
for user in self.employee_ids.ids:
conf_old = self.env['yuthon.confirm.users'].search([('notice_id', '=', self.id), ('employee_id', 'in', list(valid_employee_ids))])
for employee_id in valid_employee_ids:
if conf_old:
for co in conf_old:
co.write({'state': 'no'})
else:
self.env['yuthon.confirm.users'].create({
'notice_id': self.id,
'employee_id': user,
'employee_id': employee_id,
'notice_code': self.code,
'notice_name': self.name,
'state': 'no',
})
we_id = self.env['hr.employee'].search([('id', '=', user)]).wecom_userid
we_id = self.env['hr.employee'].search([('id', '=', employee_id)]).wecom_userid
self.sudo().env["wecom.apps"].sync_send_message_textcard(category='notice', user_id=we_id, title="通知公告",
description=self.name + '发布人:' + self.users_id.name,
url=str, btntxt="详细信息")
@@ -126,3 +127,34 @@ class YuthonNotice(models.Model):
'notice_state': 'stop',
'end_date': fields.Date.today(),
})
def notice_users_publish(self):
# 获取 self.employee_ids 中的用户
employee_user_ids = {user.user_id.id for user in self.employee_ids if user.user_id}
# 获取部门用户
def get_department_employees(department_id):
valid_user_ids = set()
employee_ids = self.env['hr.employee'].search([('department_id', '=', department_id.id)])
valid_user_ids.update([user.user_id.id for user in employee_ids if user.user_id])
child_ids = self.env['hr.department'].search([('parent_id', '=', department_id.id)])
for child in child_ids:
valid_user_ids.update(get_department_employees(child))
return valid_user_ids
department_user_ids = set()
for department_id in self.department_ids:
department_user_ids.update(get_department_employees(department_id))
# 获取 user_role_ids 中的用户
role_user_ids = set()
for user_role in self.users_role_ids:
user_employee_ids = self.env['hr.employee'].search(
['|', ('user_role_id', '=', user_role.id), ('user_role_ids', 'in', [user_role.id])])
role_user_ids.update([user.user_id.id for user in user_employee_ids if user.user_id])
# 取三个ids的用户交集
valid_user_ids = employee_user_ids & department_user_ids & role_user_ids
# 查询所有符合条件的 hr.employee 记录
valid_employees = self.env['hr.employee'].search([('user_id', 'in', list(valid_user_ids))])
# 提取 employee_id
valid_employee_ids = {employee.id for employee in valid_employees}
self.notice_publish(valid_employee_ids)
+1
View File
@@ -25,6 +25,7 @@
'views/yuthon_resource_mgmt_config_views.xml',
'views/property_message_fee_views.xml',
'views/property_meter_archives_views.xml',
'views/property_subject_form_views.xml',
'views/property_meter_water_views.xml',
'views/property_tenant_information_views.xml',
'views/yuthon_property_setting_views.xml',
+2 -1
View File
@@ -39,4 +39,5 @@ from . import property_water_reading
from . import property_deposit_list
from . import property_accounts_receivable
from . import property_construction_unit
from . import property_accounting_unit
from . import property_accounting_unit
from . import property_subject_form
@@ -0,0 +1,11 @@
from odoo import models, fields, api
class PropertySubjectForm(models.Model):
_name = 'property.subject.form'
_description = '预算科目表'
code = fields.Char(string='科目代码')
name = fields.Char(string='科目名称')
subject_description = fields.Text(string='科目描述')
department_ids = fields.Many2many('hr.department', string="所属部门")
+2 -1
View File
@@ -74,4 +74,5 @@ access_property_construction_unit,property_construction_unit,model_property_cons
access_property_accounting_unit,property_accounting_unit,model_property_accounting_unit,base.group_user,1,1,1,1
access_property_billing_method_line,property_billing_method_line,model_property_billing_method_line,base.group_user,1,1,1,1
access_property_account_setting,property_account_setting,model_property_account_setting,base.group_user,1,1,1,1
access_property_project_setting,property_project_setting,model_property_project_setting,base.group_user,1,1,1,1
access_property_project_setting,property_project_setting,model_property_project_setting,base.group_user,1,1,1,1
access_property_subject_form,property_subject_form,model_property_subject_form,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
74 access_property_accounting_unit property_accounting_unit model_property_accounting_unit base.group_user 1 1 1 1
75 access_property_billing_method_line property_billing_method_line model_property_billing_method_line base.group_user 1 1 1 1
76 access_property_account_setting property_account_setting model_property_account_setting base.group_user 1 1 1 1
77 access_property_project_setting property_project_setting model_property_project_setting base.group_user 1 1 1 1
78 access_property_subject_form property_subject_form model_property_subject_form base.group_user 1 1 1 1
+5
View File
@@ -146,6 +146,11 @@
name="应收账单"
parent="yuthon_financial_management_menu"
action="property_accounts_receivable_action"/>
<menuitem id="yuthon_subject_form_menu"
sequence="5"
name="预算科目表"
parent="yuthon_financial_management_menu"
action="view_property_subject_action"/>
<menuitem id="yuthon_bank_statement_menu"
sequence="23"
name="银行流水"
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_property_subject_tree" model="ir.ui.view">
<field name="name">property.subject.form.tree</field>
<field name="model">property.subject.form</field>
<field name="arch" type="xml">
<tree string="预算科目表" editable="bottom">
<field name="code"/>
<field name="name"/>
<field name="subject_description"/>
<field name="department_ids" widget="many2many_tags"/>
</tree>
</field>
</record>
<record id="view_property_subject_action" model="ir.actions.act_window">
<field name="name">预算科目表</field>
<field name="res_model">property.subject.form</field>
<field name="view_mode">tree</field>
</record>
</odoo>
+2
View File
@@ -26,6 +26,8 @@
'views/property_lease_contract.xml',
'views/property_lease_extension.xml',
'views/property_lease_renewal.xml',
'views/perperty_claim_approval_views.xml',
'views/property_borrowing_approval_views.xml',
'views/property_management.xml',
'views/property_management_fee.xml',
'views/property_material_procurement.xml',
@@ -299,4 +299,9 @@
<field name="code">property_reimbursement_form_code</field>
<field name="prefix">BX%(y)s%(month)s%(day)s</field>
</record>
<record id="property_claim_approval_sequence" model="ir.sequence">
<field name="name">业务报销编号</field>
<field name="code">property_claim_approval_code</field>
<field name="prefix">YW%(y)s%(month)s%(day)s</field>
</record>
</odoo>
+3 -1
View File
@@ -47,4 +47,6 @@ from . import property_construction_approval
from . import property_project_approval
from . import property_design_approval
from . import property_supervising_approval
from . import property_reimbursement_form
from . import property_reimbursement_form
from . import property_borrowing_approval
from . import perperty_claim_approval
@@ -0,0 +1,39 @@
from odoo import models, fields, api
class PropertyClaimApproval(models.Model):
_name = 'property.claim.approval'
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = '业务报销单'
name = fields.Char(string='名称', required=True)
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code(
'property_claim_approval_code'))
users_id = fields.Many2one('res.users', string="报销人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
reason = fields.Html(string="事由")
total_received = fields.Float(string='总额')
work_fee = fields.Float(string='办公费')
manage_fee = fields.Float(string='管理费')
pay_tissue = fields.Char(string="付款组织")
collection_account = fields.Char(string="收款账号")
loan_amount = fields.Float(string='借款金额')
contract_id = fields.Many2one('property.lease.contract', string="关联合同流程")
borrowing_approval_id = fields.Many2one('property.borrowing.approval', string="关联借支流程")
claim_line_ids = fields.One2many('property.claim.line', 'claim_id', string="报销明细")
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
class PropertyClaimLine(models.Model):
_name = 'property.claim.line'
_description = '业务报销单明细'
claim_id = fields.Many2one('property.claim.approval', string="关联业务报销单")
sequence = fields.Integer(string='序号')
account_id = fields.Many2one('property.subject.form', string="科目")
amount = fields.Float(string="报销余额")
documents_id = fields.Many2many('ir.attachment', string="发票信息")
@@ -0,0 +1,35 @@
from odoo import models, fields, api
class PropertyBorrowingApproval(models.Model):
_name = 'property.borrowing.approval'
_description = '借支审批'
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
name = fields.Char(string='名称', required=True)
code = fields.Char(string="编号",
default=lambda self: self.env['ir.sequence'].next_by_code(
'property_personal_condolences_code_sequence'))
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
department_id = fields.Many2one('hr.department', string="部门")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度', default='normal')
reason = fields.Html(string="事由")
pay_tissue = fields.Char(string="付款组织")
collection_account = fields.Char(string="收款账号")
total_received = fields.Float(string='总额')
trade_date = fields.Date(string="报销日期")
contract_id = fields.Many2one('property.lease.contract', string="关联合同流程")
borrowing_line_ids = fields.One2many('yuthon.borrowing.line', 'borrowing_id', string="借支明细")
def _get_default_name_title(self):
return self._description if self._description else self._name
name_title = fields.Char(default=_get_default_name_title)
class YuthonBorrowingLine(models.Model):
_name = 'yuthon.borrowing.line'
_description = '借支明细'
borrowing_id = fields.Many2one('property.borrowing.approval', string="关联借支单")
sequence = fields.Integer(string='序号')
account_id = fields.Many2one('property.subject.form', string="科目")
amount = fields.Float(string="申请余额")
@@ -8,7 +8,7 @@ from odoo.exceptions import UserError, ValidationError
class PropertyReimbursementForm(models.Model):
_name = 'property.reimbursement.form'
_inherit = ['mail.thread', 'mail.activity.mixin']
_description = '报销单审批'
_description = '体检费报销单审批'
name = fields.Char(string='标题')
code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_reimbursement_form_code'))
@@ -84,4 +84,8 @@ access_property_reimbursement_form,property_reimbursement_form,model_property_re
access_property_expense_line,property_expense_line,model_property_expense_line,base.group_user,1,1,1,1
access_property_physical_line,property_physical_line,model_property_physical_line,base.group_user,1,1,1,1
access_property_physical_wizard,property_physical_wizard,model_property_physical_wizard,base.group_user,1,1,1,1
access_property_borrowing_approval,property_borrowing_approval,model_property_borrowing_approval,base.group_user,1,1,1,1
access_yuthon_borrowing_line,yuthon_borrowing_line,model_yuthon_borrowing_line,base.group_user,1,1,1,1
access_property_claim_approval,property_claim_approval,model_property_claim_approval,base.group_user,1,1,1,1
access_property_claim_line,property_claim_line,model_property_claim_line,base.group_user,1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
84 access_property_physical_line property_physical_line model_property_physical_line base.group_user 1 1 1 1
85 access_property_physical_wizard property_physical_wizard model_property_physical_wizard base.group_user 1 1 1 1
86 access_property_borrowing_approval property_borrowing_approval model_property_borrowing_approval base.group_user 1 1 1 1
87 access_yuthon_borrowing_line yuthon_borrowing_line model_yuthon_borrowing_line base.group_user 1 1 1 1
88 access_property_claim_approval property_claim_approval model_property_claim_approval base.group_user 1 1 1 1
89 access_property_claim_line property_claim_line model_property_claim_line base.group_user 1 1 1 1
90
91
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_property_claim_approval_tree" model="ir.ui.view">
<field name="name">property.claim.approval.tree</field>
<field name="model">property.claim.approval</field>
<field name="arch" type="xml">
<tree string="业务报销审批">
<field name="name"/>
<field name="users_id"/>
<field name="total_received"/>
</tree>
</field>
</record>
<record id="view_property_claim_approval_form" model="ir.ui.view">
<field name="name">property.claim.approval.form</field>
<field name="model">property.claim.approval</field>
<field name="arch" type="xml">
<form string="业务报销审批">
<sheet>
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
invisible="urgency_level != 'normal'"/>
<widget name="web_ribbon" title="急件" bg_color="text-bg-warning"
invisible="urgency_level != 'urgent'"/>
<widget name="web_ribbon" title="特级" bg_color="text-bg-danger"
invisible="urgency_level != 'emergency'"/>
<group col="3">
<group>
<field name="code" string="流水号" readonly="1"/>
</group>
<group>
<field name="urgency_level" readonly="1"/>
</group>
<group/>
</group>
<div class="col-12 text-center">
<h1>
<field name="name_title" readonly="1"/>
</h1>
</div>
<group string="审批事项">
<field name="name"/>
<field name="users_id"/>
<field name="department_id"/>
<field name="reason"/>
<field name="total_received"/>
<field name="contract_id"/>
<field name="borrowing_approval_id"/>
</group>
<group string="付收款信息">
<field name="work_fee"/>
<field name="manage_fee"/>
<field name="pay_tissue"/>
<field name="collection_account"/>
<field name="loan_amount"/>
</group>
<notebook>
<page string="明细信息">
<field name="claim_line_ids">
<tree editable="bottom">
<field name="claim_id" column_invisible="1"/>
<field name="sequence"/>
<field name="account_id"/>
<field name="amount"/>
<field name="documents_id" widget="preview_many2one"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_property_claim_approval_action" model="ir.actions.act_window">
<field name="name">业务报销审批</field>
<field name="res_model">property.claim.approval</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_property_borrowing_approval_tree" model="ir.ui.view">
<field name="name">property.borrowing.approval.tree</field>
<field name="model">property.borrowing.approval</field>
<field name="arch" type="xml">
<tree string="借支审批">
<field name="name"/>
<field name="users_id"/>
<field name="total_received"/>
<field name="trade_date"/>
</tree>
</field>
</record>
<record id="view_property_borrowing_approval_form" model="ir.ui.view">
<field name="name">property.borrowing.approval.form</field>
<field name="model">property.borrowing.approval</field>
<field name="arch" type="xml">
<form string="借支审批">
<sheet>
<widget name="web_ribbon" title="普件" bg_color="text-bg-success"
invisible="urgency_level != 'normal'"/>
<widget name="web_ribbon" title="急件" bg_color="text-bg-warning"
invisible="urgency_level != 'urgent'"/>
<widget name="web_ribbon" title="特级" bg_color="text-bg-danger"
invisible="urgency_level != 'emergency'"/>
<group col="3">
<group>
<field name="code" string="流水号" readonly="1"/>
</group>
<group>
<field name="urgency_level" readonly="1"/>
</group>
<group/>
</group>
<div class="col-12 text-center">
<h1>
<field name="name_title" readonly="1"/>
</h1>
</div>
<group string="审批事项">
<field name="name"/>
<field name="users_id"/>
<field name="department_id"/>
<field name="reason"/>
<field name="total_received"/>
<field name="contract_id"/>
</group>
<group string="付收款信息">
<field name="pay_tissue"/>
<field name="collection_account"/>
</group>
<notebook>
<page string="明细信息">
<field name="borrowing_line_ids">
<tree string="明细信息" editable="bottom">
<field name="borrowing_id" column_invisible="1"/>
<field name="sequence"/>
<field name="account_id"/>
<field name="amount"/>
</tree>
</field>
</page>
</notebook>
</sheet>
</form>
</field>
</record>
<record id="view_property_borrowing_approval_action" model="ir.actions.act_window">
<field name="name">借支审批</field>
<field name="res_model">property.borrowing.approval</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -270,9 +270,19 @@
action="property_penalty_proportion_action"/>
<menuitem id="property_reimbursement_form_menu"
sequence="19"
name="报销单"
name="体检费报销单"
parent="yuthon_property_process"
action="view_property_reimbursement_form_action"/>
<menuitem id="property_claim_form_menu"
sequence="20"
name="业务报销单"
parent="yuthon_property_process"
action="view_property_claim_approval_action"/>
<menuitem id="property_borrowing_approval_menu"
sequence="21"
name="借支申请表"
parent="yuthon_property_process"
action="view_property_borrowing_approval_action"/>
<menuitem id="yuthon_property_process_setting"
sequence="99"
name="配置"