From a613cb58a10f46ae3fc41fe29067ec6534bda292 Mon Sep 17 00:00:00 2001 From: zhouzhou <123@qq.com> Date: Tue, 19 Nov 2024 19:09:29 +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 --- yuthon_hr_attendance/models/hr_attendance.py | 2 +- .../models/yuthon_recruitment_approval.py | 7 +++ yuthon_property/__manifest__.py | 2 - yuthon_property/models/__init__.py | 3 +- .../models/property_intention_information.py | 7 ++- .../models/property_prospective_customers.py | 15 ------ .../models/property_tenant_information.py | 3 +- .../models/yuthon_property_lessee.py | 13 ++--- yuthon_property/security/ir.model.access.csv | 2 - yuthon_property/views/menuitem.xml | 33 +++--------- .../views/property_intention_information.xml | 10 ++-- .../views/property_prospective_customers.xml | 51 ------------------ .../property_tenant_information_views.xml | 1 + .../views/yuthon_property_lessee_views.xml | 54 ------------------- .../views/property_menu_all.xml | 26 +++++---- .../views/property_transfer_views.xml | 10 ++-- yuthon_will_task/__manifest__.py | 1 + yuthon_will_task/data/will_task_time_data.xml | 18 +++++++ yuthon_will_task/models/yuthon_will_task.py | 26 +++++++++ 19 files changed, 96 insertions(+), 188 deletions(-) delete mode 100644 yuthon_property/models/property_prospective_customers.py delete mode 100644 yuthon_property/views/property_prospective_customers.xml delete mode 100644 yuthon_property/views/yuthon_property_lessee_views.xml create mode 100644 yuthon_will_task/data/will_task_time_data.xml diff --git a/yuthon_hr_attendance/models/hr_attendance.py b/yuthon_hr_attendance/models/hr_attendance.py index f3a5e6afd..9cf766b1a 100644 --- a/yuthon_hr_attendance/models/hr_attendance.py +++ b/yuthon_hr_attendance/models/hr_attendance.py @@ -33,7 +33,7 @@ class HrAttendance(models.Model): raise ("请同步{}的企业微信".format(self.name)) url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.hr_attendance, self.employee_id.id) self.sudo().env["wecom.apps"].sync_send_message_textcard(category='attendance', user_id=self.wecom_userid, - title="打卡异常提醒", description="您有一条打卡异常请及时查看", + title="打卡异常提醒", description="测试消息请忽略", url=url, btntxt="详细信息") @api.depends('is_no_card', 'is_early_card', 'is_late_card') diff --git a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py index ce46b8bfc..157cf9dcf 100644 --- a/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py +++ b/yuthon_hr_employee_approval/models/yuthon_recruitment_approval.py @@ -44,3 +44,10 @@ class YuthonRecruitmentApproval(models.Model): for recruitment in record.recruitment_ids: recruitment.website_published = True + @api.onchange('recruitment_ids') + def _onchange_recruitment_ids(self): + name_list = [] + if self.recruitment_ids: + for record in self.recruitment_ids: + name_list.append(record.name) + self.name = self.department_id.name +', '.join(name_list)+'的招聘需求申请表' \ No newline at end of file diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 35b5b27c6..c5c6c34de 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -25,8 +25,6 @@ 'views/property_meter_water_views.xml', 'views/property_tenant_information_views.xml', 'views/property_intention_information.xml', - 'views/property_prospective_customers.xml', - 'views/yuthon_property_lessee_views.xml', 'views/menuitem.xml', ], 'demo': [], diff --git a/yuthon_property/models/__init__.py b/yuthon_property/models/__init__.py index 80bdf703a..104d8cb67 100644 --- a/yuthon_property/models/__init__.py +++ b/yuthon_property/models/__init__.py @@ -11,8 +11,7 @@ from . import yuthon_property_evaluation from . import property_transaction_confirmed from . import property_meter_archives from . import property_meter_water -from . import property_prospective_customers -from . import yuthon_property_lessee from . import property_assess from . import property_tenant_information from . import property_intention_information +from . import yuthon_property_lessee \ No newline at end of file diff --git a/yuthon_property/models/property_intention_information.py b/yuthon_property/models/property_intention_information.py index 86fdb0941..d1ffd66bb 100644 --- a/yuthon_property/models/property_intention_information.py +++ b/yuthon_property/models/property_intention_information.py @@ -6,6 +6,9 @@ class PropertyIntentionInformation(models.Model): _description = '意向客户列表' name = fields.Char(string='姓名') - sincerity_gold = fields.Float(string='诚意金') card_id = fields.Many2one('documents.document', string="身份证") - license_id = fields.Many2one('documents.document',string='营业执照') \ No newline at end of file + license_id = fields.Many2one('documents.document',string='营业执照') + entity_type = fields.Selection([('person', '个人'), ('company', '企业')], string='实体类型') + phone = fields.Char(string='联系人') + phone_number = fields.Char(string='联系电话') + industry = fields.Char(string='行业') diff --git a/yuthon_property/models/property_prospective_customers.py b/yuthon_property/models/property_prospective_customers.py deleted file mode 100644 index 0315d996c..000000000 --- a/yuthon_property/models/property_prospective_customers.py +++ /dev/null @@ -1,15 +0,0 @@ -from odoo import models, fields, api - - -class PropertyProspectiveCustomers(models.Model): - _name = 'property.prospective.customers' - _description = '意向客户列表' - - name = fields.Char(string='标题') - customer_name = fields.Char(string='意向客户名称') - entity_type = fields.Selection([('person', '个人'), ('company', '企业')],string='实体类型') - phone = fields.Char(string='联系人') - phone_number = fields.Char(string='联系电话') - industry = fields.Char(string='行业') - - diff --git a/yuthon_property/models/property_tenant_information.py b/yuthon_property/models/property_tenant_information.py index 9258633ec..5e9ddc650 100644 --- a/yuthon_property/models/property_tenant_information.py +++ b/yuthon_property/models/property_tenant_information.py @@ -7,6 +7,7 @@ class PropertyTenantInformation(models.Model): name = fields.Char(string='姓名') guarantor = fields.Char(string='担保人') + entity_type = fields.Selection([('person', '个人'), ('company', '企业')], string='实体类型') contact = fields.Char(string='联系人') phone = fields.Char(string='联系电话') email = fields.Char(string='电子邮箱') @@ -15,4 +16,4 @@ class PropertyTenantInformation(models.Model): rental_purposes = fields.Many2one('yuthon.rental.purpose', string="出租用途") invoicing_begins = fields.Char(string="开票抬头") tax_number = fields.Char(string="税号") - industry = fields.Char(string="行业") \ No newline at end of file + industry = fields.Char(string="行业") diff --git a/yuthon_property/models/yuthon_property_lessee.py b/yuthon_property/models/yuthon_property_lessee.py index 162d8c0f1..b2df76bb8 100644 --- a/yuthon_property/models/yuthon_property_lessee.py +++ b/yuthon_property/models/yuthon_property_lessee.py @@ -1,15 +1,8 @@ from odoo import models, fields, api -class YuthonPropertyLessee(models.Model): +class PropertyLessee(models.Model): _name = 'yuthon.property.lessee' - _description = '承租方列表' - - name = fields.Char(string='标题') - customer_name = fields.Char(string='承租方名称') - entity_type = fields.Selection([('person', '个人'), ('company', '企业')], string='实体类型') - phone = fields.Char(string='联系人') - phone_number = fields.Char(string='联系电话') - industry = fields.Char(string='行业') - invoicing_type = fields.Char(string='开票类型') + _description = 'Property Lessee' + name = fields.Char(string='Lessee Name', required=True) diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 6a8645463..9510876f7 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -17,8 +17,6 @@ access_yuthon_resource_billing_type,yuthon_resource_billing_type,model_yuthon_re access_property_transaction_confirmed,property_transaction_confirmed,model_property_transaction_confirmed,base.group_user,1,1,1,1 access_property_meter_archives,property_meter_archives,model_property_meter_archives,base.group_user,1,1,1,1 access_property_meter_water,property_meter_water,model_property_meter_water,base.group_user,1,1,1,1 -access_yuthon_property_lessee,yuthon_property_lessee,model_yuthon_property_lessee,base.group_user,1,1,1,1 -access_property_prospective_customers,property_prospective_customers,model_property_prospective_customers,base.group_user,1,1,1,1 access_title_information_line,title_information_line,model_title_information_line,base.group_user,1,1,1,1 access_manage_information_line,manage_information_line,model_manage_information_line,base.group_user,1,1,1,1 access_disassembly_information_line,disassembly_information_line,model_disassembly_information_line,base.group_user,1,1,1,1 diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml index c4e22bc0f..ef85af596 100644 --- a/yuthon_property/views/menuitem.xml +++ b/yuthon_property/views/menuitem.xml @@ -64,17 +64,16 @@ sequence="8" name="客户管理" parent="yuthon_property_menu_root"/> - + - - + action="property_tenant_information_action" + sequence="3"/> - - - - - + + @@ -19,16 +20,19 @@
- + + + + diff --git a/yuthon_property/views/property_prospective_customers.xml b/yuthon_property/views/property_prospective_customers.xml deleted file mode 100644 index cb3a59cf3..000000000 --- a/yuthon_property/views/property_prospective_customers.xml +++ /dev/null @@ -1,51 +0,0 @@ - - - - property.prospective.customers.tree - property.prospective.customers - - - - - - - - - - - - - property.prospective.customers.form - property.prospective.customers - -
- -
-
- - - - - - - - - - - - - -
-
-
-
- - 意向客户列表 - property.prospective.customers - tree,form - -
diff --git a/yuthon_property/views/property_tenant_information_views.xml b/yuthon_property/views/property_tenant_information_views.xml index 86c9c78dd..c85321d07 100644 --- a/yuthon_property/views/property_tenant_information_views.xml +++ b/yuthon_property/views/property_tenant_information_views.xml @@ -27,6 +27,7 @@ + diff --git a/yuthon_property/views/yuthon_property_lessee_views.xml b/yuthon_property/views/yuthon_property_lessee_views.xml deleted file mode 100644 index 14a2f2599..000000000 --- a/yuthon_property/views/yuthon_property_lessee_views.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - yuthon.property.lessee.tree - yuthon.property.lessee - - - - - - - - - - - - - - yuthon.property.lessee.form - yuthon.property.lessee - -
- -
-
- - - - - - - - - - - - - - -
-
-
-
- - 承租方信息 - yuthon.property.lessee - tree,form - -
- diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml index 42c6b8c4c..9aa50c2b4 100644 --- a/yuthon_property_approval/views/property_menu_all.xml +++ b/yuthon_property_approval/views/property_menu_all.xml @@ -64,14 +64,6 @@ name="续租审批审批" action="property_lease_alter_action" sequence="29"/> - - - - + + + + \ No newline at end of file diff --git a/yuthon_property_approval/views/property_transfer_views.xml b/yuthon_property_approval/views/property_transfer_views.xml index c5549d920..f8b53e090 100644 --- a/yuthon_property_approval/views/property_transfer_views.xml +++ b/yuthon_property_approval/views/property_transfer_views.xml @@ -29,6 +29,11 @@
+
+ + + + @@ -99,11 +104,6 @@ - - - - - diff --git a/yuthon_will_task/__manifest__.py b/yuthon_will_task/__manifest__.py index 9dd9ede85..f447d61f5 100644 --- a/yuthon_will_task/__manifest__.py +++ b/yuthon_will_task/__manifest__.py @@ -7,6 +7,7 @@ 'version': '0.1', 'license': 'LGPL-3', 'data': [ + 'data/will_task_time_data.xml', 'security/yuthon_will_task_security.xml', 'security/ir.model.access.csv', 'views/task_type_setting_views.xml', diff --git a/yuthon_will_task/data/will_task_time_data.xml b/yuthon_will_task/data/will_task_time_data.xml new file mode 100644 index 000000000..7a1c5653a --- /dev/null +++ b/yuthon_will_task/data/will_task_time_data.xml @@ -0,0 +1,18 @@ + + + + + 定时任务:待办任务提醒 + + code + model.will_task_time() + + + 2 + minutes + + -1 + + + + diff --git a/yuthon_will_task/models/yuthon_will_task.py b/yuthon_will_task/models/yuthon_will_task.py index d28151b35..13a8b44f1 100644 --- a/yuthon_will_task/models/yuthon_will_task.py +++ b/yuthon_will_task/models/yuthon_will_task.py @@ -1,5 +1,6 @@ from odoo import api, fields, models, modules import datetime +from datetime import datetime, timedelta class YuthonWillTask(models.Model): @@ -18,3 +19,28 @@ class YuthonWillTask(models.Model): ('two_hour', '提醒-2小时'), ('one_day', '提醒-1天')], string='提醒') start_time = fields.Datetime(string='开始时间') end_time = fields.Datetime(string='结束时间') + + remind_mapping = { + 'fifteen': timedelta(minutes=15), + 'thirty': timedelta(minutes=30), + 'one_hour': timedelta(hours=1), + 'two_hour': timedelta(hours=2), + 'one_day': timedelta(days=1), + } + + def will_task_time(self): + for task in self.env['yuthon.will.task'].search([]): + time_difference = task.end_time - datetime.now() + for remind, duration in self.remind_mapping.items(): + if task.remind == remind and time_difference <= duration: + task.add_comment() + + def add_comment(self): + self.ensure_one() + if not self.wecom_userid: + raise ("请同步{}的企业微信".format(self.name)) + for employee_id in self.employee_ids: + url = "https://oa.thtzjt.com/mail/view?model={}&res_id={}".format(self.yuthon_will_task,employee_id.id) + self.sudo().env["wecom.apps"].sync_send_message_textcard(category='attendance', user_id=self.wecom_userid, + title="待办事项", description="测试消息请忽略", + url=url, btntxt="详细信息") \ No newline at end of file