From 992efe4233db9437f12237e9453a84c61a2c5341 Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Wed, 26 Feb 2025 18:37:09 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- room/models/room_room.py | 2 + room/views/room_room_views.xml | 10 +++ .../inherit_hr_leave_allocation_views.xml | 2 +- .../models/hr_attendance_month.py | 1 + .../views/hr_attendance_month_views.xml | 2 + .../models/yuthon_lessee_notice.py | 2 +- .../views/yuthon_lessee_notice.xml | 2 +- yuthon_notice/models/yuthon_notice.py | 42 ++++++++-- yuthon_property/__manifest__.py | 1 + yuthon_property/models/__init__.py | 3 +- .../models/property_subject_form.py | 11 +++ yuthon_property/security/ir.model.access.csv | 3 +- yuthon_property/views/menuitem.xml | 5 ++ .../views/property_subject_form_views.xml | 20 +++++ yuthon_property_approval/__manifest__.py | 2 + .../data/sale_renting_code_data.xml | 5 ++ yuthon_property_approval/models/__init__.py | 4 +- .../models/perperty_claim_approval.py | 39 ++++++++++ .../models/property_borrowing_approval.py | 35 +++++++++ .../models/property_reimbursement_form.py | 2 +- .../security/ir.model.access.csv | 4 + .../views/perperty_claim_approval_views.xml | 78 +++++++++++++++++++ .../property_borrowing_approval_views.xml | 74 ++++++++++++++++++ .../views/property_menu_all.xml | 12 ++- 24 files changed, 348 insertions(+), 13 deletions(-) create mode 100644 yuthon_property/models/property_subject_form.py create mode 100644 yuthon_property/views/property_subject_form_views.xml create mode 100644 yuthon_property_approval/models/perperty_claim_approval.py create mode 100644 yuthon_property_approval/models/property_borrowing_approval.py create mode 100644 yuthon_property_approval/views/perperty_claim_approval_views.xml create mode 100644 yuthon_property_approval/views/property_borrowing_approval_views.xml diff --git a/room/models/room_room.py b/room/models/room_room.py index 126f64ae7..9afe42073 100644 --- a/room/models/room_room.py +++ b/room/models/room_room.py @@ -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") diff --git a/room/views/room_room_views.xml b/room/views/room_room_views.xml index 748ca97e7..69f3394ce 100644 --- a/room/views/room_room_views.xml +++ b/room/views/room_room_views.xml @@ -13,7 +13,11 @@ + + + + @@ -51,6 +55,10 @@ +
+ 公司: + +
@@ -114,6 +122,7 @@ + @@ -163,6 +172,7 @@ 会议室 room.room kanban,list,form + {'search_default_group_yuthon_company': 1 }

Create Rooms diff --git a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml index c1e95d16c..0daba141f 100644 --- a/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml +++ b/yuthon_holiday/views/inherit_hr_leave_allocation_views.xml @@ -9,7 +9,7 @@ 假期余额 - show + hide 开始时间 diff --git a/yuthon_hr_attendance/models/hr_attendance_month.py b/yuthon_hr_attendance/models/hr_attendance_month.py index d23a8335e..79a676c44 100644 --- a/yuthon_hr_attendance/models/hr_attendance_month.py +++ b/yuthon_hr_attendance/models/hr_attendance_month.py @@ -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="迟到") diff --git a/yuthon_hr_attendance/views/hr_attendance_month_views.xml b/yuthon_hr_attendance/views/hr_attendance_month_views.xml index fb9f809d9..d8bf5db38 100644 --- a/yuthon_hr_attendance/views/hr_attendance_month_views.xml +++ b/yuthon_hr_attendance/views/hr_attendance_month_views.xml @@ -77,6 +77,7 @@ + @@ -98,6 +99,7 @@ + diff --git a/yuthon_lessee_service/models/yuthon_lessee_notice.py b/yuthon_lessee_service/models/yuthon_lessee_notice.py index 3bbe65e3c..2202b906d 100644 --- a/yuthon_lessee_service/models/yuthon_lessee_notice.py +++ b/yuthon_lessee_service/models/yuthon_lessee_notice.py @@ -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 = [] # 部门人员 diff --git a/yuthon_lessee_service/views/yuthon_lessee_notice.xml b/yuthon_lessee_service/views/yuthon_lessee_notice.xml index 0f0bbac03..1ec0d2d64 100644 --- a/yuthon_lessee_service/views/yuthon_lessee_notice.xml +++ b/yuthon_lessee_service/views/yuthon_lessee_notice.xml @@ -30,7 +30,7 @@

-
diff --git a/yuthon_notice/models/yuthon_notice.py b/yuthon_notice/models/yuthon_notice.py index 36da9457f..6e88b115c 100644 --- a/yuthon_notice/models/yuthon_notice.py +++ b/yuthon_notice/models/yuthon_notice.py @@ -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) \ No newline at end of file diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index c14c3d340..5e5354f95 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -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', diff --git a/yuthon_property/models/__init__.py b/yuthon_property/models/__init__.py index 00042ae54..c66541ca1 100644 --- a/yuthon_property/models/__init__.py +++ b/yuthon_property/models/__init__.py @@ -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 \ No newline at end of file +from . import property_accounting_unit +from . import property_subject_form \ No newline at end of file diff --git a/yuthon_property/models/property_subject_form.py b/yuthon_property/models/property_subject_form.py new file mode 100644 index 000000000..248cf3366 --- /dev/null +++ b/yuthon_property/models/property_subject_form.py @@ -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="所属部门") \ No newline at end of file diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 9e317ff1a..293b46848 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -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 \ No newline at end of file +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 \ No newline at end of file diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml index 00b7a8692..e8b6ed123 100644 --- a/yuthon_property/views/menuitem.xml +++ b/yuthon_property/views/menuitem.xml @@ -146,6 +146,11 @@ name="应收账单" parent="yuthon_financial_management_menu" action="property_accounts_receivable_action"/> + + + + property.subject.form.tree + property.subject.form + + + + + + + + + + + 预算科目表 + property.subject.form + tree + + \ No newline at end of file diff --git a/yuthon_property_approval/__manifest__.py b/yuthon_property_approval/__manifest__.py index d91394923..5e6441acd 100644 --- a/yuthon_property_approval/__manifest__.py +++ b/yuthon_property_approval/__manifest__.py @@ -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', diff --git a/yuthon_property_approval/data/sale_renting_code_data.xml b/yuthon_property_approval/data/sale_renting_code_data.xml index 09be5606b..692c5c220 100644 --- a/yuthon_property_approval/data/sale_renting_code_data.xml +++ b/yuthon_property_approval/data/sale_renting_code_data.xml @@ -299,4 +299,9 @@ property_reimbursement_form_code BX%(y)s%(month)s%(day)s + + 业务报销编号 + property_claim_approval_code + YW%(y)s%(month)s%(day)s + \ No newline at end of file diff --git a/yuthon_property_approval/models/__init__.py b/yuthon_property_approval/models/__init__.py index 669bbb14d..785adb263 100644 --- a/yuthon_property_approval/models/__init__.py +++ b/yuthon_property_approval/models/__init__.py @@ -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 \ No newline at end of file +from . import property_reimbursement_form +from . import property_borrowing_approval +from . import perperty_claim_approval \ No newline at end of file diff --git a/yuthon_property_approval/models/perperty_claim_approval.py b/yuthon_property_approval/models/perperty_claim_approval.py new file mode 100644 index 000000000..e3081ba4f --- /dev/null +++ b/yuthon_property_approval/models/perperty_claim_approval.py @@ -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="发票信息") \ No newline at end of file diff --git a/yuthon_property_approval/models/property_borrowing_approval.py b/yuthon_property_approval/models/property_borrowing_approval.py new file mode 100644 index 000000000..32db5d362 --- /dev/null +++ b/yuthon_property_approval/models/property_borrowing_approval.py @@ -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="申请余额") \ No newline at end of file diff --git a/yuthon_property_approval/models/property_reimbursement_form.py b/yuthon_property_approval/models/property_reimbursement_form.py index 8510c635e..adf6fc7ee 100644 --- a/yuthon_property_approval/models/property_reimbursement_form.py +++ b/yuthon_property_approval/models/property_reimbursement_form.py @@ -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')) diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv index 0616ac5d0..3ef1b75c5 100644 --- a/yuthon_property_approval/security/ir.model.access.csv +++ b/yuthon_property_approval/security/ir.model.access.csv @@ -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 diff --git a/yuthon_property_approval/views/perperty_claim_approval_views.xml b/yuthon_property_approval/views/perperty_claim_approval_views.xml new file mode 100644 index 000000000..439decda7 --- /dev/null +++ b/yuthon_property_approval/views/perperty_claim_approval_views.xml @@ -0,0 +1,78 @@ + + + + property.claim.approval.tree + property.claim.approval + + + + + + + + + + property.claim.approval.form + property.claim.approval + + + + + + + + + + + + + + + +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+
+ + 业务报销审批 + property.claim.approval + tree,form + +
\ No newline at end of file diff --git a/yuthon_property_approval/views/property_borrowing_approval_views.xml b/yuthon_property_approval/views/property_borrowing_approval_views.xml new file mode 100644 index 000000000..9c560efe4 --- /dev/null +++ b/yuthon_property_approval/views/property_borrowing_approval_views.xml @@ -0,0 +1,74 @@ + + + + property.borrowing.approval.tree + property.borrowing.approval + + + + + + + + + + + property.borrowing.approval.form + property.borrowing.approval + +
+ + + + + + + + + + + + + +
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+
+ + 借支审批 + property.borrowing.approval + tree,form + +
\ No newline at end of file diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml index be92c284c..c760a9886 100644 --- a/yuthon_property_approval/views/property_menu_all.xml +++ b/yuthon_property_approval/views/property_menu_all.xml @@ -270,9 +270,19 @@ action="property_penalty_proportion_action"/> + +