diff --git a/yuthon_hr_attendance/models/go_approval.py b/yuthon_hr_attendance/models/go_approval.py
index c4c6896e9..38c28fc77 100644
--- a/yuthon_hr_attendance/models/go_approval.py
+++ b/yuthon_hr_attendance/models/go_approval.py
@@ -27,7 +27,7 @@ class GoApprovals(models.Model):
details = fields.Text(string="外出说明", default="1.可通过填写天数和小时,直接获得结束时间\n 2.一份外出单,可同时选择多人一次审批")
related_issues_id = fields.Many2one('issue.library', string="关联议题")
date_start = fields.Datetime(string="开始时间", default=fields.Datetime.now)
- date_end = fields.Datetime(string="结束时间")
+ date_end = fields.Datetime(string="结束时间", default=fields.Datetime.now)
meal = fields.Selection([('yes', '是'), ('no', '否')], string="误餐费", default=None)
days = fields.Integer(string="天数")
hours = fields.Integer(string="小时")
@@ -39,8 +39,8 @@ class GoApprovals(models.Model):
is_hour = fields.Boolean(string="按小时")
start_day_selection = fields.Selection([('half', '上半天'),('afternoon', '下半天')], string="天")
end_day_selection = fields.Selection([('half', '上半天'), ('afternoon', '下半天')], string="天")
- statr_date = fields.Date(string="开始日期")
- end_date = fields.Date(string="结束日期")
+ statr_date = fields.Date(string="开始日期", default=fields.Date.today)
+ end_date = fields.Date(string="结束日期", default=fields.Date.today)
def _get_default_name_title(self):
return self._description if self._description else self._name
diff --git a/yuthon_property/models/yuthon_property.py b/yuthon_property/models/yuthon_property.py
index 3d2857008..89de97c0d 100644
--- a/yuthon_property/models/yuthon_property.py
+++ b/yuthon_property/models/yuthon_property.py
@@ -230,8 +230,59 @@ class YuthonProperty(models.Model):
self._context.get('active_ids', self._context.get('active_id')))
form_id = self.env.ref('yuthon_property_approval.view_property_management_form').id
property_list = []
+ today = fields.Date.today()
+ first_record = property_ids[0]
+ # 获取第一条记录的有效purpose_id
+ valid_manage = first_record.manage_information_ids.filtered(
+ lambda m: m.start_time and m.start_time <= today and
+ (not m.end_date or m.end_date >= today)
+ )
+
+ if not valid_manage:
+ raise UserError(f"{first_record.name}该物业没有找到有效的管理信息!")
+ reference_purpose_id = valid_manage[0].purpose_id.id
+ # 参考值集合(tenure_type, company_id, admin_id, precinct_id, purpose_id)
+ reference_values = (
+ first_record.tenure_type,
+ first_record.company_id.id,
+ first_record.admin_id.id,
+ first_record.precinct_id.id,
+ reference_purpose_id
+ )
+ # 检查所有记录的属性是否与第一条记录一致
+ for record in property_ids[1:]:
+ # 获取当前记录的有效purpose_id
+ current_valid_manage = record.manage_information_ids.filtered(
+ lambda m: m.start_time and m.start_time <= today and
+ (not m.end_date or m.end_date >= today)
+ )
+
+ if not current_valid_manage:
+ raise UserError(f"{first_record.name}该物业没有找到有效的管理信息!")
+ current_purpose_id = current_valid_manage[0].purpose_id.id
+ # 当前记录的值集合
+ current_values = (
+ record.tenure_type,
+ record.company_id.id,
+ record.admin_id.id,
+ record.precinct_id.id,
+ current_purpose_id
+ )
+ # 如果有任何属性不一致,抛出统一错误
+ if current_values != reference_values:
+ raise UserError("所选记录的公司、管理类型、权属类型、管理员和所属片区必须完全一样!")
for record in property_ids:
- property_list.append([0, 0, {'property_id': record.id}])
+ for manage in record.manage_information_ids:
+ # 判断记录是否有效:start_time ≤ today ≤ end_date(或end_date为空)
+ if manage.start_time and manage.start_time <= today:
+ if not manage.end_date or manage.end_date >= today:
+ manage_id = manage
+ else:
+ manage_id = False
+ else:
+ manage_id = False
+ property_list.append([0, 0, {'property_id': record.id,
+ 'information_line_id': manage_id.id}])
return {
'name': '提交物业变更',
'view_mode': 'form',
@@ -239,6 +290,11 @@ class YuthonProperty(models.Model):
'type': 'ir.actions.act_window',
'views': [(form_id, 'form')],
"context": {
+ 'default_company_id': first_record.company_id.id,
+ 'default_purpose_id': reference_purpose_id,
+ 'default_admin_id_all': first_record.admin_id.id,
+ 'default_precinct_id': first_record.precinct_id.id,
+ 'default_tenure_type': first_record.tenure_type,
'default_management_line2_ids': property_list
}
}
diff --git a/yuthon_property_approval/models/property_management.py b/yuthon_property_approval/models/property_management.py
index f4b22f4d6..5921a5f2c 100644
--- a/yuthon_property_approval/models/property_management.py
+++ b/yuthon_property_approval/models/property_management.py
@@ -18,7 +18,6 @@ class PropertyManagement(models.Model):
department_id = fields.Many2one('hr.department', related='user_id.employee_id.department_id',string="申请人部门")
handling_opinions = fields.Text(string="经办意见")
management_line2_ids = fields.One2many('property.management.line2', 'property_management_id', string="原物业信息")
- new_property_ids = fields.One2many('property.information.detail.lines', 'new_property_id', string="新物业信息")
management_line_ids = fields.One2many('property.management.line', 'property_management_id', string="物业信息")
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
default='normal')
@@ -29,6 +28,12 @@ class PropertyManagement(models.Model):
active = fields.Boolean('Active', default=True, tracking=True)
work_end = fields.Boolean(string="结束")
+ company_id = fields.Many2one('yuthon.property.company', string="公司")
+ purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
+ admin_id_all = fields.Many2one('res.users', string="管理员")
+ precinct_id = fields.Many2one('yuthon.precinct.message', string="所属片区")
+ tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
+
def _get_default_name_title(self):
return self._description if self._description else self._name
@@ -53,7 +58,6 @@ class PropertyManagement(models.Model):
@api.onchange('management_line2_ids')
def _onchange_management_line2_ids(self):
self.management_line_ids = [(5, 0, 0)]
- self.new_property_ids = [(5, 0, 0)]
for line in self.management_line2_ids:
if line.property_id:
self.management_line_ids = [(0, 0, {
@@ -64,33 +68,29 @@ class PropertyManagement(models.Model):
'admin_id_all': line.admin_id_all.id,
'tenure_type': line.tenure_type
})]
- self.new_property_ids = [(0, 0, {
- 'property_id': line.property_id.id,
- })]
def approval_end(self):
for record in self:
- for line in record.new_property_ids:
+ for line in record.management_line2_ids:
line.property_id.write({
- 'company_id': line.company_id.id,
- 'purpose_id': line.purpose_id.id,
- 'precinct_id': line.precincts_id.id,
- 'admin_id': line.admin_id_all.id,
- 'tenure_type': line.tenure_type
+ 'company_id': record.company_id.id,
+ 'precinct_id': record.precinct_id.id,
+ 'admin_id': record.admin_id_all.id,
+ 'tenure_type': record.tenure_type
})
- record.write({'is_line': True})
-
-class PropertyInformationDetailLines(models.Model):
- _name = 'property.information.detail.lines'
- _description = '新物业信息'
-
- new_property_id = fields.Many2one('property.management', string="关联物业分配申请表")
- property_id = fields.Many2one('yuthon.property', string="物业名称")
- company_id = fields.Many2one('yuthon.property.company', string="公司")
- purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
- admin_id_all = fields.Many2one('res.users', string="管理员")
- precincts_id = fields.Many2one('yuthon.precinct.message', string="新片区")
- tenure_type = fields.Selection([('self', '自有'), ('agency', '代管')], string='权属类型')
+ line.information_line_id.write({'end_date': fields.Date.today()})
+ self.env['manage.information.line'].create({
+ 'yuthon_property_id': line.property_id.id,
+ 'purpose_id' : record.purpose_id.id,
+ 'precinct_id': record.precinct_id.id,
+ 'tenure_type': record.tenure_type,
+ 'management_area': line.information_line_id.management_area,
+ 'rent_area': line.information_line_id.rent_area,
+ 'admin_id' : record.admin_id_all.id,
+ 'company_id': record.company_id.id,
+ 'start_time': fields.Date.today(),
+ })
+ record.write({'is_line': True})
# 结果保留明细行
class PropertyManagementLine(models.Model):
@@ -99,6 +99,7 @@ class PropertyManagementLine(models.Model):
property_id = fields.Many2one('yuthon.property', string="物业名称")
property_management_id = fields.Many2one('property.management', string="关联物业分配申请表")
+ information_line_id = fields.Many2one('manage.information.line')
company_id = fields.Many2one('yuthon.property.company', string="公司")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
admin_id_all = fields.Many2one('res.users', string="管理员")
@@ -113,9 +114,12 @@ class PropertyManagementLine2(models.Model):
property_management_id = fields.Many2one('property.management', string="关联物业分配申请表")
property_id = fields.Many2one('yuthon.property', string="物业名称")
purpose_id = fields.Many2one('yuthon.resource.purpose', string="管理类型")
+ information_line_id = fields.Many2one('manage.information.line')
tenure_type = fields.Selection(related='property_id.tenure_type', string='权属类型')
company_id = fields.Many2one(related='property_id.company_id', string="公司")
admin_id_all = fields.Many2one(related='property_id.admin_id', string="管理员")
precinct_id = fields.Many2one(related='property_id.precinct_id', string="所属片区")
+class PropertyInformationDetailLines(models.Model):
+ _name = 'property.information.detail.lines'
\ No newline at end of file
diff --git a/yuthon_property_approval/security/ir.model.access.csv b/yuthon_property_approval/security/ir.model.access.csv
index a1efa2d8c..e373b451a 100644
--- a/yuthon_property_approval/security/ir.model.access.csv
+++ b/yuthon_property_approval/security/ir.model.access.csv
@@ -24,7 +24,6 @@ access_property_confirm,property_confirm,model_property_confirm,base.group_user,
access_property_move,property_move,model_property_move,base.group_user,1,1,1,1
access_property_record,property_record,model_property_record,base.group_user,1,1,1,1
access_property_equity,property_equity,model_property_equity,base.group_user,1,1,1,1
-access_property_information_detail_lines,property_information_detail_lines,model_property_information_detail_lines,base.group_user,1,1,1,1
access_property_lease_contract_line,property_lease_contract_line,model_property_lease_contract_line,base.group_user,1,1,1,1
access_property_rent_breakdown_line,property_rent_breakdown_line,model_property_rent_breakdown_line,base.group_user,1,1,1,1
access_property_water_fee_line,property_water_fee_line,model_property_water_fee_line,base.group_user,1,1,1,1
diff --git a/yuthon_property_approval/views/property_management.xml b/yuthon_property_approval/views/property_management.xml
index 1fd37c7e2..bd94b259d 100644
--- a/yuthon_property_approval/views/property_management.xml
+++ b/yuthon_property_approval/views/property_management.xml
@@ -71,6 +71,7 @@
+
@@ -84,21 +85,26 @@
+
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/yuthon_trade/__manifest__.py b/yuthon_trade/__manifest__.py
index 54982857e..8fd069cf4 100644
--- a/yuthon_trade/__manifest__.py
+++ b/yuthon_trade/__manifest__.py
@@ -28,6 +28,7 @@
'views/yuthon_none_views.xml',
'views/yuthon_mutual_approval_views.xml',
'views/yuthon_care_condolences_views.xml',
+ 'views/trade_project_approval_views.xml',
'views/yuthon_trade_setting_views.xml',
'views/yuthon_work_condolences_views.xml',
'views/yuthon_task_approval_views.xml',
@@ -36,7 +37,7 @@
'views/yuthon_trade_menu.xml',
],
'demo': [],
- 'depends': ['mail', 'documents', 'soong_workflow', 'yuthon_work_brand', 'hr', 'yuthon_hr_employee', 'yuthon_issue'],
+ 'depends': ['mail', 'documents', 'soong_workflow', 'yuthon_work_brand', 'hr', 'yuthon_hr_employee', 'yuthon_issue', 'project'],
'installable': True,
'application': True,
}
diff --git a/yuthon_trade/data/sale_renting_code_data.xml b/yuthon_trade/data/sale_renting_code_data.xml
index a38b56a33..1da61e2b7 100644
--- a/yuthon_trade/data/sale_renting_code_data.xml
+++ b/yuthon_trade/data/sale_renting_code_data.xml
@@ -1,5 +1,12 @@
+
+ 立项申请编号
+ trade_project_approval_code
+ LX%(y)s%(month)s%(day)s
+ 3
+
+
节日慰问编号
property_work_condolences_code
diff --git a/yuthon_trade/models/__init__.py b/yuthon_trade/models/__init__.py
index 6d2460466..1a70c1e69 100644
--- a/yuthon_trade/models/__init__.py
+++ b/yuthon_trade/models/__init__.py
@@ -23,3 +23,4 @@ from . import trade_reward_approval
from . import yuthon_seals_approval
from . import yuthon_business_approval
from . import inherit_workflow_record
+from . import trade_project_approval
diff --git a/yuthon_trade/models/trade_project_approval.py b/yuthon_trade/models/trade_project_approval.py
new file mode 100644
index 000000000..c9f747b03
--- /dev/null
+++ b/yuthon_trade/models/trade_project_approval.py
@@ -0,0 +1,52 @@
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+from odoo import models, fields, api, exceptions, _
+
+
+class TradeProjectApproval(models.Model):
+ _name = 'trade.project.approval'
+ _description = '立项申请'
+ _inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
+
+ code = fields.Char(string="流水号",
+ default=lambda self: self.env['ir.sequence'].next_by_code('trade_project_approval_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="申请部门")
+
+ urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
+ default='normal')
+ date_application = fields.Date(string="申请日期")
+ text = fields.Text(string='正文')
+ name = fields.Char(string="项目名称")
+ project_classify_id = fields.Many2one('project.classify.setting', string="项目分类")
+ start_date = fields.Date(string="计划开始")
+ end_date = fields.Date(string="计划完成")
+ plan_duration = fields.Integer(string="计划工期")
+ funding_id = fields.Many2one('project.funding.setting', string="资金来源")
+ employee_id = fields.Many2one('hr.employee', string="分管领导")
+ project_invest = fields.Float(string="项目总投资")
+ projected_earnings = fields.Float(string="预计投资收益")
+ project_content = fields.Text(string="项目概括")
+ project_goal = fields.Text(string="项目目标")
+ expected_results = fields.Text(string="预期成果")
+ document_ids = fields.Many2many('ir.attachment', string="立项文件")
+ work_end = fields.Boolean(string="结束")
+ active = fields.Boolean('Active', default=True, tracking=True)
+
+ def _get_default_name_title(self):
+ return self._description if self._description else self._name
+
+ name_title = fields.Char(default=_get_default_name_title)
+
+ # 项目归属
+ project_belong_id = fields.Many2one('res.users', string="项目负责人")
+ project_department_id = fields.Many2one('hr.department', string="项目部门")
+
+ def approval_end(self):
+ for rec in self:
+ self.env['project.project'].create({
+ 'name' : rec.name,
+ 'user_id' : rec.project_belong_id.id,
+ 'company_id': rec.user_id.employee_id.company_id.id,
+ })
+
+
diff --git a/yuthon_trade/models/trade_reward_approval.py b/yuthon_trade/models/trade_reward_approval.py
index fcd1d2df7..9ef435541 100644
--- a/yuthon_trade/models/trade_reward_approval.py
+++ b/yuthon_trade/models/trade_reward_approval.py
@@ -1,7 +1,7 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-
from odoo import models, fields, api, exceptions, _
+
class TradeRewardApproval(models.Model):
_name = 'trade.reward.approval'
_description = '奖励申报呈批表'
diff --git a/yuthon_trade/models/yuthon_trade_setting.py b/yuthon_trade/models/yuthon_trade_setting.py
index b488119ed..726df3234 100644
--- a/yuthon_trade/models/yuthon_trade_setting.py
+++ b/yuthon_trade/models/yuthon_trade_setting.py
@@ -14,20 +14,37 @@ class YuthonWorkSetting(models.Model):
name = fields.Char(string='名称')
+
class SealsTypeSetting(models.Model):
_name = 'seals.type.setting'
_description = '用章类型'
name = fields.Char(string='名称')
+
class SealsScopeSetting(models.Model):
_name = 'seals.scope.setting'
_description = '用章范围'
name = fields.Char(string='名称')
+
class SendingUnitSetting(models.Model):
_name = 'sending.unit.setting'
_description = '发送单位'
name = fields.Char(string='名称')
+
+
+class ProjectClassifySetting(models.Model):
+ _name = 'project.classify.setting'
+ _description = '项目分类'
+
+ name = fields.Char(string='名称')
+
+
+class ProjectFundingSetting(models.Model):
+ _name = 'project.funding.setting'
+ _description = '资金来源'
+
+ name = fields.Char(string='名称')
diff --git a/yuthon_trade/security/ir.model.access.csv b/yuthon_trade/security/ir.model.access.csv
index 9c82093bf..ac03a64b4 100644
--- a/yuthon_trade/security/ir.model.access.csv
+++ b/yuthon_trade/security/ir.model.access.csv
@@ -31,6 +31,9 @@ access_yuthon_reward_line,yuthon_reward_line,model_yuthon_reward_line,base.group
access_seals_type_setting,seals_type_setting,model_seals_type_setting,base.group_user,1,1,1,1
access_seals_scope_setting,seals_scope_setting,model_seals_scope_setting,base.group_user,1,1,1,1
access_sending_unit_setting,sending_unit_setting,model_sending_unit_setting,base.group_user,1,1,1,1
+access_trade_project_approval,trade_project_approval,model_trade_project_approval,base.group_user,1,1,1,1
+access_project_funding_setting,project_funding_setting,model_project_funding_setting,base.group_user,1,1,1,1
+access_project_classify_setting,project_classify_setting,model_project_classify_setting,base.group_user,1,1,1,1
diff --git a/yuthon_trade/views/trade_project_approval_views.xml b/yuthon_trade/views/trade_project_approval_views.xml
new file mode 100644
index 000000000..7bfd3f660
--- /dev/null
+++ b/yuthon_trade/views/trade_project_approval_views.xml
@@ -0,0 +1,103 @@
+
+
+
+ trade.project.approval.tree
+ trade.project.approval
+
+
+
+
+
+
+
+
+
+
+ trade.project.approval.form
+ trade.project.approval
+
+
+
+
+
+ 立项申请
+ trade.project.approval
+ tree,form
+
+
+
+
+
+
diff --git a/yuthon_trade/views/yuthon_trade_menu.xml b/yuthon_trade/views/yuthon_trade_menu.xml
index 195caaef3..ba734d7fc 100644
--- a/yuthon_trade/views/yuthon_trade_menu.xml
+++ b/yuthon_trade/views/yuthon_trade_menu.xml
@@ -108,6 +108,12 @@
parent="executive_trade_process_ment"
action="view_business_approval_action"
sequence="80"/>
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_trade/views/yuthon_trade_setting_views.xml b/yuthon_trade/views/yuthon_trade_setting_views.xml
index 1b73b014e..23aa3561d 100644
--- a/yuthon_trade/views/yuthon_trade_setting_views.xml
+++ b/yuthon_trade/views/yuthon_trade_setting_views.xml
@@ -70,4 +70,32 @@
sending.unit.setting
tree
+
+ 项目分类
+ project.classify.setting
+
+
+
+
+
+
+
+ 项目分类
+ project.classify.setting
+ tree
+
+
+ 资金来源
+ project.funding.setting
+
+
+
+
+
+
+
+ 资金来源
+ project.funding.setting
+ tree
+
\ No newline at end of file
diff --git a/yuthon_work_brand/views/executive_manage.xml b/yuthon_work_brand/views/executive_manage.xml
index 06dc3816d..2fabd11fe 100644
--- a/yuthon_work_brand/views/executive_manage.xml
+++ b/yuthon_work_brand/views/executive_manage.xml
@@ -3,7 +3,6 @@