From 3417077f730fdc236bfdf37b2c34e833755d71ba Mon Sep 17 00:00:00 2001 From: zhou <123@> Date: Tue, 21 Jan 2025 15:58:51 +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 --- .../views/yuthon_official_labor_views.xml | 6 +-- yuthon_property/__manifest__.py | 1 - yuthon_property/models/__init__.py | 1 - yuthon_property/models/property_assess.py | 3 ++ .../models/property_transaction_confirmed.py | 15 ------ yuthon_property/security/ir.model.access.csv | 1 - yuthon_property/views/menuitem.xml | 6 --- yuthon_property_approval/__manifest__.py | 4 +- .../data/sale_renting_code_data.xml | 10 ++++ yuthon_property_approval/models/__init__.py | 1 + .../models/property_approval.py | 54 +++++++++++++++++-- .../models/property_capacity.py | 28 ++++++++-- .../models/property_early_quitting.py | 24 ++++++++- .../models/property_evaluate_application.py | 23 +++++++- .../models/property_handover.py | 23 ++++++++ .../models/property_lease_extension.py | 23 ++++++++ .../models/property_management_fee.py | 3 ++ .../models/property_merge_approval.py | 20 +++++++ .../models/property_offline_registration.py | 24 ++++++++- .../models/property_penalty_proportion.py | 2 + .../models/property_penalty_relief.py | 30 +++++++++-- .../models/property_record.py | 24 +++++++++ .../models/property_rent_relief.py | 35 +++++++++--- .../models/property_rental_conditions.py | 3 +- .../models/property_rental_form.py | 6 ++- .../models/property_transaction_confirmed.py | 40 ++++++++++++++ .../security/ir.model.access.csv | 2 + .../views/property_approval_views.xml | 24 ++++----- .../views/property_capacity.xml | 10 ++-- .../views/property_early_quitting.xml | 32 ++++++----- .../views/property_eligibility.xml | 18 +++---- .../property_evaluate_application_views.xml | 10 ++-- .../views/property_handover_views.xml | 18 +++---- .../views/property_intention_views.xml | 16 +++--- .../views/property_lease_extension.xml | 32 ++++++----- .../views/property_management_fee.xml | 6 ++- .../views/property_menu_all.xml | 8 ++- .../views/property_merge_approval_views.xml | 5 +- .../views/property_offline_registration.xml | 11 ++-- .../views/property_penalty_proportion.xml | 6 ++- .../views/property_penalty_relief.xml | 36 +++++++------ .../views/property_record_views.xml | 7 +++ .../views/property_rent_relief.xml | 26 +++++---- .../views/property_rental_conditions.xml | 14 ++--- .../views/property_rental_form_views.xml | 34 ++++++------ .../views/property_split_approval_views.xml | 1 + .../views/property_transaction_confirmed.xml | 22 ++++---- .../views/property_transfer_views.xml | 3 +- yuthon_property_approval/wizard/__init__.py | 1 + .../wizard/property_add_wizard.py | 51 ++++++++++++++++++ .../wizard/property_add_wizard_views.xml | 35 ++++++++++++ 51 files changed, 641 insertions(+), 197 deletions(-) delete mode 100644 yuthon_property/models/property_transaction_confirmed.py create mode 100644 yuthon_property_approval/models/property_transaction_confirmed.py rename {yuthon_property => yuthon_property_approval}/views/property_transaction_confirmed.xml (64%) create mode 100644 yuthon_property_approval/wizard/property_add_wizard.py create mode 100644 yuthon_property_approval/wizard/property_add_wizard_views.xml diff --git a/yuthon_official/views/yuthon_official_labor_views.xml b/yuthon_official/views/yuthon_official_labor_views.xml index 0a65a133d..50d838c0d 100644 --- a/yuthon_official/views/yuthon_official_labor_views.xml +++ b/yuthon_official/views/yuthon_official_labor_views.xml @@ -21,6 +21,9 @@
+ + +
- - - diff --git a/yuthon_property/__manifest__.py b/yuthon_property/__manifest__.py index 0c203f337..c14c3d340 100644 --- a/yuthon_property/__manifest__.py +++ b/yuthon_property/__manifest__.py @@ -22,7 +22,6 @@ 'views/yuthon_expert_database_views.xml', 'views/yuthon_property_message_views.xml', 'views/yuthon_precinct_message_views.xml', - 'views/property_transaction_confirmed.xml', 'views/yuthon_resource_mgmt_config_views.xml', 'views/property_message_fee_views.xml', 'views/property_meter_archives_views.xml', diff --git a/yuthon_property/models/__init__.py b/yuthon_property/models/__init__.py index 644a0ff33..00042ae54 100644 --- a/yuthon_property/models/__init__.py +++ b/yuthon_property/models/__init__.py @@ -8,7 +8,6 @@ from . import yuthon_resource_mgmt_config from . import yuthon_draw_result from . import yuthon_expert_database from . import yuthon_property_evaluation -from . import property_transaction_confirmed from . import property_meter_archives from . import property_meter_water from . import property_assess diff --git a/yuthon_property/models/property_assess.py b/yuthon_property/models/property_assess.py index 7be99361c..3d2ba56ab 100644 --- a/yuthon_property/models/property_assess.py +++ b/yuthon_property/models/property_assess.py @@ -29,3 +29,6 @@ class PropertyMeterReading(models.Model): code = fields.Char(string="Code") current_meter = fields.Float(string='本次') + +class PropertyTransactionConfirmed(models.Model): + _name = 'property.transaction.confirmed' diff --git a/yuthon_property/models/property_transaction_confirmed.py b/yuthon_property/models/property_transaction_confirmed.py deleted file mode 100644 index 3891a9447..000000000 --- a/yuthon_property/models/property_transaction_confirmed.py +++ /dev/null @@ -1,15 +0,0 @@ -from odoo import models, fields, api, exceptions, _ -from datetime import datetime -from odoo.exceptions import UserError, ValidationError - - -class PropertyTransactionConfirmed(models.Model): - _name = 'property.transaction.confirmed' - _description = '成交确认书' - - - name = fields.Char(string='标题') - property_id = fields.Char(string='物业') #后续many2many字段 - lessee = fields.Char(string='承租人') - entity_type = fields.Selection([('person', '个人'), ('enterprise', '企业')], string='实体类型') - details = fields.Text(string='详情') #这里可以完善承租方信息,为租赁合同服务 diff --git a/yuthon_property/security/ir.model.access.csv b/yuthon_property/security/ir.model.access.csv index 1c6113c39..c0d577fb7 100644 --- a/yuthon_property/security/ir.model.access.csv +++ b/yuthon_property/security/ir.model.access.csv @@ -14,7 +14,6 @@ access_yuthon_resource_house_type,yuthon_resource_house_type,model_yuthon_resour access_yuthon_resource_purpose,yuthon_resource_purpose,model_yuthon_resource_purpose,base.group_user,1,1,1,1 access_yuthon_resource_management_type,yuthon_resource_management_type,model_yuthon_resource_management_type,base.group_user,1,1,1,1 access_yuthon_resource_billing_type,yuthon_resource_billing_type,model_yuthon_resource_billing_type,base.group_user,1,1,1,1 -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_title_information_line,title_information_line,model_title_information_line,base.group_user,1,1,1,1 diff --git a/yuthon_property/views/menuitem.xml b/yuthon_property/views/menuitem.xml index 9814ff9c2..ab1e01cbe 100644 --- a/yuthon_property/views/menuitem.xml +++ b/yuthon_property/views/menuitem.xml @@ -55,12 +55,6 @@ name="招租" parent="yuthon_property_menu_root"/> - - property_delegated_agent_code LS%(y)s%(month)s%(day)s + + 物业备案编号 + property_record_code + BA%(y)s%(month)s%(day)s + + + 交易确认编号 + property_transaction_confirmed_code + JY%(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 db238f69d..4368e4e0e 100644 --- a/yuthon_property_approval/models/__init__.py +++ b/yuthon_property_approval/models/__init__.py @@ -34,6 +34,7 @@ from . import property_offline_registration from . import property_rental_form from . import property_rental_conditions from . import property_merge_approval +from . import property_transaction_confirmed from . import property_split_approval from . import property_intention_approval from . import property_transfer_approval diff --git a/yuthon_property_approval/models/property_approval.py b/yuthon_property_approval/models/property_approval.py index 49f9f7cd2..f0c6d4f54 100644 --- a/yuthon_property_approval/models/property_approval.py +++ b/yuthon_property_approval/models/property_approval.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError class PropertyApproval(models.Model): @@ -11,8 +12,12 @@ class PropertyApproval(models.Model): name = fields.Char(string='标题') tip_description = fields.Html('正文') + 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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_approval_code')) + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") property_documents_ids = fields.Many2many('documents.document', string="附件") source = fields.Many2one('yuthon.property.source', string="物业来源") property_massage_ids = fields.One2many('property.approval.line', 'property_approval_id', string="审批信息") @@ -21,11 +26,52 @@ class PropertyApproval(models.Model): return { "type": "ir.actions.act_window", "name": "批量更新物业信息", - "res_model": "property.inducts.wizard", + "res_model": "property.add.wizard", "view_mode": "form", "target": "new", + "context": { + 'default_property_approval_id': self.id + } } + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + + # 审批触发按钮 + def button_property_approval(self): + for massage_id in self.property_massage_ids: + property_message_id = self.env['yuthon.property.message'].search([('name', '=', massage_id.property_address)]) + if not property_message_id: + property_message_id = self.env['yuthon.property.message'].create({ + 'name': massage_id.property_address, + 'owner_id': massage_id.owner_id.id, + 'equity_area': massage_id.area, + 'title_certificate': massage_id.title_number, + 'registered_id': massage_id.registered_id.id, + }) + property_id = self.env['yuthon.property'].create({ + 'name': massage_id.property_address, + 'is_confirm_authorization': massage_id.is_affirmation, + }) + self.env['title.information.line'].create({ + 'yuthon_property_id': property_id.id, + 'property_message_id': property_message_id.id, + }) + class PropertyApprovalLine(models.Model): _name = 'property.approval.line' _description = '新增物业审批明细行' @@ -33,9 +79,9 @@ class PropertyApprovalLine(models.Model): property_approval_id = fields.Many2one('property.approval', string="审批信息") property_address = fields.Text(string="物业地址") is_affirmation = fields.Boolean(string="是否确权") - owner = fields.Char(string="权属人") + owner_id = fields.Many2one('yuthon.owner.message', string="权属人") title_number = fields.Char(string="产权编号") area = fields.Float(string="面积") - purposes = fields.Char(string="用途") - state = fields.Selection([('rental', '出租中'), ('vacant', '空置中'), ('rented', '待出租')], string="状态", + registered_id = fields.Many2one('yuthon.purpose.evidence', string='用途') + condition = fields.Selection([('rental', '出租中'), ('vacant', '空置中'), ('rented', '待出租')], string="状态", default="rented") diff --git a/yuthon_property_approval/models/property_capacity.py b/yuthon_property_approval/models/property_capacity.py index 2543b0148..fa909fd64 100644 --- a/yuthon_property_approval/models/property_capacity.py +++ b/yuthon_property_approval/models/property_capacity.py @@ -13,10 +13,30 @@ class PropertyCapacity(models.Model): name = fields.Char(string='标题') code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_capacity_code')) - address = fields.Char(string="地址") - lessee = fields.Char(string="承租方") + address_id = fields.Many2one('yuthon.property', string="物业地址") + users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) + department_id = fields.Many2one('hr.department', string="部门", related='users_id.employee_id.department_id') + lessee_id = fields.Many2one('property.tenant.information', string='承租方') contact = fields.Char(string="联系人") phone = fields.Char(string="联系电话") - #增容类型 + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") is_water = fields.Boolean(string="水") - is_electricity = fields.Boolean(string="电") \ No newline at end of file + is_electricity = fields.Boolean(string="电") + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") \ No newline at end of file diff --git a/yuthon_property_approval/models/property_early_quitting.py b/yuthon_property_approval/models/property_early_quitting.py index eaae6aa0c..9680db6f3 100644 --- a/yuthon_property_approval/models/property_early_quitting.py +++ b/yuthon_property_approval/models/property_early_quitting.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError class PropertyEarlyQuitting(models.Model): @@ -14,6 +15,8 @@ class PropertyEarlyQuitting(models.Model): code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_early_quitting_code')) property_documents_ids = fields.Many2many('ir.attachment', 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="部门") lessee_id = fields.Many2one(related='address_id.lessee_id', string="承租方") address_id = fields.Many2one('yuthon.property', string="物业地址") start_data = fields.Date(string="合同开始日期") @@ -21,9 +24,28 @@ class PropertyEarlyQuitting(models.Model): early_quitting_date = fields.Date(string="提前退租日期") original_contract_id = fields.Many2one('ir.attachment', string="合同") contract_id = fields.Many2one('property.lease.contract', string="合同") - reason = fields.Char(string="退租原因") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") + reason = fields.Text(string="退租原因") def button_approval(self): for rec in self: rec.contract_id.write({ 'actual_end_time': rec.new_end_date}) + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") diff --git a/yuthon_property_approval/models/property_evaluate_application.py b/yuthon_property_approval/models/property_evaluate_application.py index 57a548411..42bdf08ce 100644 --- a/yuthon_property_approval/models/property_evaluate_application.py +++ b/yuthon_property_approval/models/property_evaluate_application.py @@ -1,4 +1,5 @@ from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError class PropertyEvaluateApplication(models.Model): @@ -11,7 +12,10 @@ class PropertyEvaluateApplication(models.Model): code = fields.Char(string='编号', required=True, copy=False, default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_property_code')) main_text = fields.Html(string='正文') - is_meet = fields.Boolean(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="部门") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") is_experts = fields.Boolean(string="是否需要专家评审") notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件') issue_library_id = fields.Many2one('issue.library', string='关联议题') @@ -41,6 +45,23 @@ class PropertyEvaluateApplication(models.Model): } } + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + class EvaluateApplicationLine(models.Model): _name = 'evaluate.application.line' _description = '物业信息明细行' diff --git a/yuthon_property_approval/models/property_handover.py b/yuthon_property_approval/models/property_handover.py index e8b1df0d6..0959ed040 100644 --- a/yuthon_property_approval/models/property_handover.py +++ b/yuthon_property_approval/models/property_handover.py @@ -1,4 +1,5 @@ from odoo import models, fields, api, exceptions +from odoo.exceptions import UserError, ValidationError class PropertyHandover(models.Model): @@ -8,12 +9,34 @@ class PropertyHandover(models.Model): name = fields.Char(string='标题') tip_description = fields.Html('正文') + 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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_handover_code')) property_documents_ids = fields.Many2many('documents.document', string="附件") source = fields.Char(string="移交单位") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") property_handover_ids = fields.One2many('property.handover.line', 'property_handover_id', string="移交申请") + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + + class PropertyHandoverLine(models.Model): _name = 'property.handover.line' _description = '移交申请明细' diff --git a/yuthon_property_approval/models/property_lease_extension.py b/yuthon_property_approval/models/property_lease_extension.py index 11527cf40..61c32457c 100644 --- a/yuthon_property_approval/models/property_lease_extension.py +++ b/yuthon_property_approval/models/property_lease_extension.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError class PropertyLeaseExtension(models.Model): @@ -11,6 +12,9 @@ class PropertyLeaseExtension(models.Model): _rec_name = 'name' name = fields.Char(string='标题') + reason = fields.Html(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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_lease_extension_code')) property_documents_ids = fields.Many2many('ir.attachment', string="延租文件") @@ -21,8 +25,27 @@ class PropertyLeaseExtension(models.Model): end_date = fields.Date(string="原到期时间") new_end_date = fields.Date(string="延期至") reason_extension = fields.Char(string="延期原因") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") def button_approval(self): for rec in self: rec.contract_id.write({ 'actual_end_time': rec.new_end_date}) + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") \ No newline at end of file diff --git a/yuthon_property_approval/models/property_management_fee.py b/yuthon_property_approval/models/property_management_fee.py index 796780566..a578df4b3 100644 --- a/yuthon_property_approval/models/property_management_fee.py +++ b/yuthon_property_approval/models/property_management_fee.py @@ -11,11 +11,14 @@ class PropertyManagementFee(models.Model): _rec_name = 'name' 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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_management_fee_code')) property_documents_ids = fields.Many2many('documents.document', string="管理费整理材料") start_date = fields.Date(string="生效日期") + #类型 is_water_fee = fields.Boolean(string="水费") is_electricity_fee = fields.Boolean(string="电费") diff --git a/yuthon_property_approval/models/property_merge_approval.py b/yuthon_property_approval/models/property_merge_approval.py index 424f12664..ab1a5c0c6 100644 --- a/yuthon_property_approval/models/property_merge_approval.py +++ b/yuthon_property_approval/models/property_merge_approval.py @@ -1,4 +1,5 @@ from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError class PropertyMergeApproval(models.Model): @@ -9,6 +10,8 @@ class PropertyMergeApproval(models.Model): name = fields.Char(string='标题') reason = fields.Html(string="正文") notice_documents_ids = fields.Many2many('ir.attachment', 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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_merge_approval_code')) property_merge_approval_line_ids = fields.One2many('property.merge.approval.line', 'property_merge_approval_id', string='关联物业合并审批行') @@ -53,6 +56,23 @@ class PropertyMergeApproval(models.Model): 'property_id': record.property_id.id}]) property_id.write({'disassembly_information_ids': property_list}) + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + class PropertyMergeApprovalLine(models.Model): _name = 'property.merge.approval.line' diff --git a/yuthon_property_approval/models/property_offline_registration.py b/yuthon_property_approval/models/property_offline_registration.py index 3779479e4..f94686794 100644 --- a/yuthon_property_approval/models/property_offline_registration.py +++ b/yuthon_property_approval/models/property_offline_registration.py @@ -1,12 +1,16 @@ from odoo import models, fields, api +from odoo.exceptions import UserError, ValidationError class PropertyOfflineRegistration(models.Model): _name = 'property.offline.registration' _description = '线下意向承租方报名表' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence']. next_by_code('property_offline_registration_code')) + 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="部门") property_id = fields.Many2one('yuthon.property',string='物业名称') address = fields.Char(related='property_id.name',string='物业地址') area = fields.Float(related='property_id.rent_area',string='面积(m²)') @@ -21,12 +25,30 @@ class PropertyOfflineRegistration(models.Model): is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + + class QuoteMessageLine(models.Model): _name = 'quote.message.line' _description = '报价信息明细行' property_offline_registration_id = fields.Many2one('property.offline.registration', string='关联线下报表表') - name = fields.Char(string='客户名称', required=True) + lessee_id = fields.Many2one('property.tenant.information', string='承租方') start_data = fields.Date(string="报价日期") lease = fields.Char(string='租期') quote = fields.Float(string='报价(元/m²)') diff --git a/yuthon_property_approval/models/property_penalty_proportion.py b/yuthon_property_approval/models/property_penalty_proportion.py index 7f7c0ef08..6b92e93e8 100644 --- a/yuthon_property_approval/models/property_penalty_proportion.py +++ b/yuthon_property_approval/models/property_penalty_proportion.py @@ -11,6 +11,8 @@ class PropertyPenaltyProportion(models.Model): _rec_name = 'name' 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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_penalty_proportion_code')) calculate_time_point = fields.Char(string='违约金计算时间点') diff --git a/yuthon_property_approval/models/property_penalty_relief.py b/yuthon_property_approval/models/property_penalty_relief.py index b50fe0ddb..cf70e1c54 100644 --- a/yuthon_property_approval/models/property_penalty_relief.py +++ b/yuthon_property_approval/models/property_penalty_relief.py @@ -2,6 +2,8 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError + class PropertyPenaltyRelief(models.Model): _name = 'property.penalty.relief' @@ -10,16 +12,36 @@ class PropertyPenaltyRelief(models.Model): _rec_name = 'name' name = fields.Char(string='标题') + reason = fields.Html(string="正文") + users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id) + department_id = fields.Many2one('hr.department', string="部门", related='users_id.employee_id.department_id') code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_rent_relief_code')) property_documents_ids = fields.Many2many('documents.document', string="违约金减免文件") reason_abatement = fields.Char(string="减免原因") - contract_id = fields.Many2one('documents.document', string="合同") - lessee = fields.Char(string="承租方") - property_name = fields.Char(string="物业名称") + contract_id = fields.Many2one('property.lease.contract', string="合同") + lessee_id = fields.Many2one('property.tenant.information', string='承租方') + property_id = fields.Many2one('yuthon.property', string='物业') + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") penalty_relief_line_ids = fields.One2many('property.penalty.relief.line', 'penalty_relief_id', string="违约金列表") - + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") class PropertyPenaltyReliefLine(models.Model): _name = 'property.penalty.relief.line' diff --git a/yuthon_property_approval/models/property_record.py b/yuthon_property_approval/models/property_record.py index 91df0a745..0d8c565bb 100644 --- a/yuthon_property_approval/models/property_record.py +++ b/yuthon_property_approval/models/property_record.py @@ -2,6 +2,7 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError class PropertyRecord(models.Model): @@ -11,15 +12,38 @@ class PropertyRecord(models.Model): _rec_name = 'name' name = fields.Char(string='标题') + code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_record_code')) other_company_id = fields.Many2one('res.company', string="评估单位") evaluation_code = fields.Char(string="评估编号") evaluation_way = fields.Char(string='评估方法') base_date = fields.Date(string="基准日") + is_issues = fields.Boolean(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="部门") + related_issues_id = fields.Many2one('issue.library', string="关联议题") expert_review_time = fields.Date(string="专家评审时间") notice_documents_ids = fields.Many2many('ir.attachment', string='议题附件') evaluate_application_ids = fields.One2many('evaluated.application.line', 'yuthon_property_evaluated_id', string='关联物业信息明细行') + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + + class EvaluatedApplicationLine(models.Model): _name = 'evaluated.application.line' _description = '物业信息明细行(已评估)' diff --git a/yuthon_property_approval/models/property_rent_relief.py b/yuthon_property_approval/models/property_rent_relief.py index 8274f9507..59dc26da9 100644 --- a/yuthon_property_approval/models/property_rent_relief.py +++ b/yuthon_property_approval/models/property_rent_relief.py @@ -1,7 +1,8 @@ # -*- coding: utf-8 -*- # Part of Odoo. See LICENSE file for full copyright and licensing details. - from odoo import models, fields, api, exceptions, _ +from odoo.exceptions import UserError, ValidationError + class PropertyRentRelief(models.Model): _name = 'property.rent.relief' @@ -10,16 +11,38 @@ class PropertyRentRelief(models.Model): _rec_name = 'name' name = fields.Char(string='标题') + reason = fields.Html(string="正文") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence'].next_by_code('property_penalty_relief_code')) - - contract_id = fields.Many2one('documents.document', string="合同") - lessee = fields.Char(string="承租方") - property_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="部门") + contract_id = fields.Many2one('property.lease.contract', string="合同") + lessee_id = fields.Many2one('property.tenant.information', string='承租方') + property_id = fields.Many2one('yuthon.property', string='物业') + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") abatement_reason = fields.Text(string="减免原因") - property_documents_ids = fields.Many2many('documents.document', string="减免材料") + property_documents_ids = fields.Many2many('ir.document', string="附件") property_rent_relief_ids = fields.One2many('property.rent.relief.line', 'property_rent_relief_id', string="租金列表") + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") + + class PropertyRentReliefLine(models.Model): _name = 'property.rent.relief.line' _description = '租金列表' diff --git a/yuthon_property_approval/models/property_rental_conditions.py b/yuthon_property_approval/models/property_rental_conditions.py index a40350087..68d916eb3 100644 --- a/yuthon_property_approval/models/property_rental_conditions.py +++ b/yuthon_property_approval/models/property_rental_conditions.py @@ -6,7 +6,8 @@ class PropertyRentalConditions(models.Model): _description = '出租调整表' property_id = fields.Many2one('yuthon.property',string='物业名称') - address = fields.Char(related='property_id.name',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="部门") code = fields.Char(string="编号", default=lambda self: self.env['ir.sequence']. next_by_code('property_rental_conditions_code')) registered_id = fields.Many2one(related='property_id.registered_id',string='证载用途') diff --git a/yuthon_property_approval/models/property_rental_form.py b/yuthon_property_approval/models/property_rental_form.py index 2b76707fd..0756c9620 100644 --- a/yuthon_property_approval/models/property_rental_form.py +++ b/yuthon_property_approval/models/property_rental_form.py @@ -5,8 +5,13 @@ class PropertyRentalForm(models.Model): _name = 'property.rental.form' _description = '出租申报表' _rec_name = 'name' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] name = fields.Char(string="名称", required=True) + reason = fields.Html(string="正文") + documents_ids = fields.Many2many('ir.attachment', 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="部门") property_rental_form_line_ids = fields.One2many('property.rental.form.line', 'property_rental_form_id', string="关联出租申报表明细行") is_issues = fields.Boolean(string='是否上会') related_issues_id = fields.Many2one('issue.library', string="关联议题") @@ -20,7 +25,6 @@ class PropertyRentalFormLine(models.Model): property_rental_form_id = fields.Many2one('property.rental.form', string="关联出租申报表") property_id = fields.Many2one('yuthon.property', string='物业名称', required=True) - property_address = fields.Char(related='property_id.name', string='物业地址') registered_id = fields.Many2one(related='property_id.registered_id', string='证载用途') evaluation_area = fields.Float(related='property_id.evaluation_area', string='出租面积(m²)') current_status = fields.Date(related='property_id.current_status', string='租聘到期日') diff --git a/yuthon_property_approval/models/property_transaction_confirmed.py b/yuthon_property_approval/models/property_transaction_confirmed.py new file mode 100644 index 000000000..dff4c2dd5 --- /dev/null +++ b/yuthon_property_approval/models/property_transaction_confirmed.py @@ -0,0 +1,40 @@ +from odoo import models, fields, api, exceptions, _ +from datetime import datetime +from odoo.exceptions import UserError, ValidationError + + +class PropertyTransactionConfirmed(models.Model): + _name = 'property.transaction.confirmed' + _description = '成交确认书' + _inherit = ['mail.thread.main.attachment', 'mail.activity.mixin', 'soong.workflow.mixin'] + + name = fields.Char(string='标题') + code = fields.Char(string="编号", + default=lambda self: self.env['ir.sequence'].next_by_code('property_transaction_confirmed_code')) + property_ids = fields.Many2many('yuthon.property', string='物业') #后续many2many字段 + lessee_id = fields.Many2one('property.tenant.information', string='承租方') + entity_type = fields.Selection([('person', '个人'), ('enterprise', '企业')], string='实体类型') + details = fields.Text(string='详情') #这里可以完善承租方信息,为租赁合同服务 + reason = fields.Html(string="正文") + documents_ids = fields.Many2many('ir.attachment', 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="部门") + is_issues = fields.Boolean(string='是否上会') + related_issues_id = fields.Many2one('issue.library', string="关联议题") + + @api.onchange('is_issues') + def _onchange_is_issues(self): + if self.is_issues: + issue_id = self.env['issue.library'].create({'name': self.name}) + self.related_issues_id = issue_id.id + workflow_record_id = self.env["soong.workflow.record"].search( + [("res_model", "=", self._name), ("res_id", "=", self.id)]) + self.env['issue.library.approval.line'].create({ + 'issue_library_id': issue_id.id, + 'workflow_record_id': workflow_record_id.id, + 'approval_type': workflow_record_id.workflow_id.id, + 'code': self.code, + 'approval_date': fields.Datetime.now(), + }) + elif self.related_issues_id: + raise UserError("已经创建了相关的上会记录,不能取消勾选") diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv index 8cc140ff1..16007711b 100644 --- a/yuthon_property_approval/security/ir.model.access.csv +++ b/yuthon_property_approval/security/ir.model.access.csv @@ -65,6 +65,8 @@ access_property_sporadic_works,property_sporadic_works,model_property_sporadic_w access_payment_methods_line,payment.methods.line,model_payment_methods_line,base.group_user,1,1,1,1 access_property_project_works,property_project_works,model_property_project_works,base.group_user,1,1,1,1 access_property_delegated_agent,property_delegated_agent,model_property_delegated_agent,base.group_user,1,1,1,1 +access_property_transaction_confirmed,property_transaction_confirmed,model_property_transaction_confirmed,base.group_user,1,1,1,1 +access_property_add_wizard,property_add_wizard,model_property_add_wizard,base.group_user,1,1,1,1 access_property_contract_line,property_contract_line,model_property_contract_line,base.group_user,1,1,1,1 access_choose_property_wizard,choose_property_wizard,model_choose_property_wizard,base.group_user,1,1,1,1 diff --git a/yuthon_property_approval/views/property_approval_views.xml b/yuthon_property_approval/views/property_approval_views.xml index 608429a10..5142f8cab 100644 --- a/yuthon_property_approval/views/property_approval_views.xml +++ b/yuthon_property_approval/views/property_approval_views.xml @@ -18,22 +18,22 @@
+ + +
- - - - - - - - - + + + + + + @@ -46,11 +46,11 @@ - + - - + + diff --git a/yuthon_property_approval/views/property_capacity.xml b/yuthon_property_approval/views/property_capacity.xml index fe36d395f..7d86f8f1d 100644 --- a/yuthon_property_approval/views/property_capacity.xml +++ b/yuthon_property_approval/views/property_capacity.xml @@ -16,6 +16,9 @@ + + +
- - + + + - + diff --git a/yuthon_property_approval/views/property_early_quitting.xml b/yuthon_property_approval/views/property_early_quitting.xml index 157109a00..63824f358 100644 --- a/yuthon_property_approval/views/property_early_quitting.xml +++ b/yuthon_property_approval/views/property_early_quitting.xml @@ -6,7 +6,9 @@ - + + + @@ -17,26 +19,29 @@ -
-
- + + + + + + + + + + + + - + + + - - - - @@ -44,7 +49,6 @@
- 提前退租审批 property.early.quitting diff --git a/yuthon_property_approval/views/property_eligibility.xml b/yuthon_property_approval/views/property_eligibility.xml index 9f1584442..5061b967c 100644 --- a/yuthon_property_approval/views/property_eligibility.xml +++ b/yuthon_property_approval/views/property_eligibility.xml @@ -22,19 +22,15 @@ + + - - - - - - - - - - - + + + + + diff --git a/yuthon_property_approval/views/property_evaluate_application_views.xml b/yuthon_property_approval/views/property_evaluate_application_views.xml index 852609d09..1e8b5e8db 100644 --- a/yuthon_property_approval/views/property_evaluate_application_views.xml +++ b/yuthon_property_approval/views/property_evaluate_application_views.xml @@ -26,11 +26,14 @@ + + - - + + + @@ -56,9 +59,6 @@
- - -
diff --git a/yuthon_property_approval/views/property_handover_views.xml b/yuthon_property_approval/views/property_handover_views.xml index c289508eb..acb6c60dd 100644 --- a/yuthon_property_approval/views/property_handover_views.xml +++ b/yuthon_property_approval/views/property_handover_views.xml @@ -18,22 +18,22 @@
+ + +
- - - - - - - - - + + + + + + diff --git a/yuthon_property_approval/views/property_intention_views.xml b/yuthon_property_approval/views/property_intention_views.xml index 1726ad5da..d14e96128 100644 --- a/yuthon_property_approval/views/property_intention_views.xml +++ b/yuthon_property_approval/views/property_intention_views.xml @@ -23,18 +23,14 @@ + + - - - - - - - - - - + + + + diff --git a/yuthon_property_approval/views/property_lease_extension.xml b/yuthon_property_approval/views/property_lease_extension.xml index 2d19761fe..7af61878e 100644 --- a/yuthon_property_approval/views/property_lease_extension.xml +++ b/yuthon_property_approval/views/property_lease_extension.xml @@ -6,7 +6,9 @@ - + + + @@ -17,25 +19,29 @@ -
-
- + + + + + + + + + + + + - + + + - - + - - diff --git a/yuthon_property_approval/views/property_management_fee.xml b/yuthon_property_approval/views/property_management_fee.xml index 087b49de2..e9ab0dcdb 100644 --- a/yuthon_property_approval/views/property_management_fee.xml +++ b/yuthon_property_approval/views/property_management_fee.xml @@ -17,6 +17,9 @@ + + +
- + + diff --git a/yuthon_property_approval/views/property_menu_all.xml b/yuthon_property_approval/views/property_menu_all.xml index 909782ce0..2fe4ac94c 100644 --- a/yuthon_property_approval/views/property_menu_all.xml +++ b/yuthon_property_approval/views/property_menu_all.xml @@ -162,8 +162,14 @@ parent="yuthon_property.yuthon_property_menu_data" action="property_offline_registration_action"/> - + + diff --git a/yuthon_property_approval/views/property_merge_approval_views.xml b/yuthon_property_approval/views/property_merge_approval_views.xml index e3531fcef..23054c336 100644 --- a/yuthon_property_approval/views/property_merge_approval_views.xml +++ b/yuthon_property_approval/views/property_merge_approval_views.xml @@ -26,9 +26,12 @@
+ + - + + diff --git a/yuthon_property_approval/views/property_offline_registration.xml b/yuthon_property_approval/views/property_offline_registration.xml index a493b91eb..1694515b3 100644 --- a/yuthon_property_approval/views/property_offline_registration.xml +++ b/yuthon_property_approval/views/property_offline_registration.xml @@ -19,17 +19,20 @@ + + + - - + + - + @@ -43,7 +46,7 @@ - + diff --git a/yuthon_property_approval/views/property_penalty_proportion.xml b/yuthon_property_approval/views/property_penalty_proportion.xml index eedd4b092..58ea43e6e 100644 --- a/yuthon_property_approval/views/property_penalty_proportion.xml +++ b/yuthon_property_approval/views/property_penalty_proportion.xml @@ -17,6 +17,9 @@ + + +
- + + diff --git a/yuthon_property_approval/views/property_penalty_relief.xml b/yuthon_property_approval/views/property_penalty_relief.xml index 99ff247e7..afaf1bebd 100644 --- a/yuthon_property_approval/views/property_penalty_relief.xml +++ b/yuthon_property_approval/views/property_penalty_relief.xml @@ -17,21 +17,22 @@ -
-
- - - - - - - - - + + + + + + + + + + + + + + + + @@ -47,8 +48,9 @@
- - + + +
diff --git a/yuthon_property_approval/views/property_record_views.xml b/yuthon_property_approval/views/property_record_views.xml index 933223b27..68e72e962 100644 --- a/yuthon_property_approval/views/property_record_views.xml +++ b/yuthon_property_approval/views/property_record_views.xml @@ -20,6 +20,9 @@
+ + +
+ + @@ -40,6 +45,8 @@ + + diff --git a/yuthon_property_approval/views/property_rent_relief.xml b/yuthon_property_approval/views/property_rent_relief.xml index b5ac33d7b..9ef83e368 100644 --- a/yuthon_property_approval/views/property_rent_relief.xml +++ b/yuthon_property_approval/views/property_rent_relief.xml @@ -6,7 +6,9 @@ - + + + @@ -17,22 +19,24 @@ -
-
+ + + + + + + + + + - + - - - + diff --git a/yuthon_property_approval/views/property_rental_conditions.xml b/yuthon_property_approval/views/property_rental_conditions.xml index 82d97e99e..89b92b713 100644 --- a/yuthon_property_approval/views/property_rental_conditions.xml +++ b/yuthon_property_approval/views/property_rental_conditions.xml @@ -20,22 +20,22 @@ -
-
+ + + - + + + + diff --git a/yuthon_property_approval/views/property_rental_form_views.xml b/yuthon_property_approval/views/property_rental_form_views.xml index a6daece73..1d3e95b6e 100644 --- a/yuthon_property_approval/views/property_rental_form_views.xml +++ b/yuthon_property_approval/views/property_rental_form_views.xml @@ -16,14 +16,17 @@ -
-
- + + + + + + + + + + @@ -31,19 +34,18 @@ - - - + + - + - + - - - - + + + +
diff --git a/yuthon_property_approval/views/property_split_approval_views.xml b/yuthon_property_approval/views/property_split_approval_views.xml index 04fcbd82a..09129b20c 100644 --- a/yuthon_property_approval/views/property_split_approval_views.xml +++ b/yuthon_property_approval/views/property_split_approval_views.xml @@ -29,6 +29,7 @@ +
diff --git a/yuthon_property/views/property_transaction_confirmed.xml b/yuthon_property_approval/views/property_transaction_confirmed.xml similarity index 64% rename from yuthon_property/views/property_transaction_confirmed.xml rename to yuthon_property_approval/views/property_transaction_confirmed.xml index 5e0ee31a2..970024d70 100644 --- a/yuthon_property/views/property_transaction_confirmed.xml +++ b/yuthon_property_approval/views/property_transaction_confirmed.xml @@ -6,8 +6,7 @@ - - + @@ -18,14 +17,19 @@ -
-

- -

-
- - + + + + + + + + + + + + diff --git a/yuthon_property_approval/views/property_transfer_views.xml b/yuthon_property_approval/views/property_transfer_views.xml index 5dd22a7aa..9d641c046 100644 --- a/yuthon_property_approval/views/property_transfer_views.xml +++ b/yuthon_property_approval/views/property_transfer_views.xml @@ -6,8 +6,9 @@ - + + diff --git a/yuthon_property_approval/wizard/__init__.py b/yuthon_property_approval/wizard/__init__.py index 84d2716c9..3ff98c423 100644 --- a/yuthon_property_approval/wizard/__init__.py +++ b/yuthon_property_approval/wizard/__init__.py @@ -1,3 +1,4 @@ from . import property_contract_wizard from . import choose_property_wizard from . import property_rental_wizard +from . import property_add_wizard \ No newline at end of file diff --git a/yuthon_property_approval/wizard/property_add_wizard.py b/yuthon_property_approval/wizard/property_add_wizard.py new file mode 100644 index 000000000..fd2507903 --- /dev/null +++ b/yuthon_property_approval/wizard/property_add_wizard.py @@ -0,0 +1,51 @@ +from odoo import models, fields, api, _, SUPERUSER_ID +from odoo.exceptions import ValidationError, UserError +import xlrd +import base64 +import datetime +from datetime import datetime +import pandas as pd + + +class PropertyAddWizard(models.Model): + _name = 'property.add.wizard' + + excel_file = fields.Binary(string="上传Excel表") + property_approval_id = fields.Many2one('property.approval', string="新增物业审批") + excel_name = fields.Char(string="文件名") + + def confirm(self): + """ + 导入excel文件,按行读取数据并处理 + """ + if not self.excel_file: + raise ValidationError('请上传文件。') + book = xlrd.open_workbook(file_contents=base64.decodebytes(self.excel_file)) + sh = book.sheet_by_index(0) + for rx in range(1, sh.nrows): + row = sh.row(rx) + self.yuthon_property_add_data(row) + + def yuthon_property_add_data(self, row): + name = row[0].value + is_affirmation = row[1].value + owner_id = self.env['yuthon.owner.message'].search([('name', '=', row[2].value)]) + title_number = row[3].value + rent_area = row[4].value + condition_data = {'出租中': 'rental', '空置中': 'vacant', '待出租': 'rented'} + condition = condition_data.get(row[6].value) + registered_id = self.env['yuthon.purpose.evidence'].search([('name', '=', row[5].value)]) + if not registered_id: + self.env['yuthon.purpose.evidence'].create({'name': row[5].value}) + approval_list =[] + approval_list.append({ + 'property_approval_id': self.property_approval_id.id, + 'name': name, + 'is_affirmation': is_affirmation, + 'owner': owner_id.id, + 'title_number': title_number, + 'area': rent_area, + 'condition': condition, + 'registered_id':registered_id.id, + }) + self.env['yuthon.property.approval.line'].create(approval_list) diff --git a/yuthon_property_approval/wizard/property_add_wizard_views.xml b/yuthon_property_approval/wizard/property_add_wizard_views.xml new file mode 100644 index 000000000..87179faa9 --- /dev/null +++ b/yuthon_property_approval/wizard/property_add_wizard_views.xml @@ -0,0 +1,35 @@ + + + + 物业模板 + self + ... + + + + 薪资物业合同 + property.add.wizard + + + +
+
+ + + + + + + + +
+ + +
+
+
\ No newline at end of file