@@ -802,6 +802,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
[('user_id', '=', record_id.log_ids[0].done_by.id)], limit=1)
|
||||
if workflow_record:
|
||||
workflow_record.write({
|
||||
'approve_state': 'end',
|
||||
'employee_ids': [(6, 0, [employee_id.id])],
|
||||
'soong_state': 'to_active',
|
||||
'node_id': False,
|
||||
@@ -830,8 +831,10 @@ class SoongWorkflowCommentWizard(models.TransientModel):
|
||||
'employee_ids': False,
|
||||
})
|
||||
else:
|
||||
if workflow_record:
|
||||
if workflow_record and self.node_btn_name == '结束':
|
||||
workflow_record.sudo().write({
|
||||
'approve_state': 'end',
|
||||
'employee_ids': False,
|
||||
'node_id': False,
|
||||
'soong_state': 'done',
|
||||
})
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
'views/yuthon_trade_purchase.xml',
|
||||
'views/yuthon_trade_premium.xml',
|
||||
'views/yuthon_business_approval_viwes.xml',
|
||||
'views/yuthon_union_business_approval_views.xml',
|
||||
'views/yuthon_seals_approval_views.xml',
|
||||
'views/yuthon_trade_refund.xml',
|
||||
'views/yuthon_trade_reimbursed.xml',
|
||||
@@ -44,6 +45,8 @@
|
||||
'views/yuthon_trade_menu.xml',
|
||||
'report/business_approval_print_report.xml',
|
||||
'report/business_approval_print_templates.xml',
|
||||
'report/union_business_approval_print_report.xml',
|
||||
'report/union_business_approval_print_templates.xml',
|
||||
],
|
||||
'demo': [],
|
||||
'depends': ['mail', 'documents', 'soong_workflow', 'hr', 'yuthon_hr_employee', 'yuthon_issue', 'project'],
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
<field name="padding">3</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
<record id="yuthon_union_business_approval_code_sequence" model="ir.sequence">
|
||||
<field name="name">业务审批编号(工会)</field>
|
||||
<field name="code">yuthon_union_business_approval_code</field>
|
||||
<field name="prefix">GHW%(y)s%(month)s%(day)s</field>
|
||||
<field name="padding">3</field>
|
||||
<field name="company_id" eval="False"/>
|
||||
</record>
|
||||
<record id="yuthon_social_transfer_code_sequence" model="ir.sequence">
|
||||
<field name="name">移交社会化审批编号</field>
|
||||
<field name="code">yuthon_social_transfer_code</field>
|
||||
|
||||
@@ -22,6 +22,7 @@ from . import yuthon_task_setting
|
||||
from . import trade_reward_approval
|
||||
from . import yuthon_seals_approval
|
||||
from . import yuthon_business_approval
|
||||
from . import yuthon_union_business_approval
|
||||
from . import inherit_workflow_record
|
||||
from . import trade_project_approval
|
||||
from . import parking_fee_approval
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from odoo import models, fields, api
|
||||
|
||||
|
||||
class YuthonUnionBusinessApproval(models.Model):
|
||||
_name = 'yuthon.union.business.approval'
|
||||
_description = '业务审批(工会)'
|
||||
_inherit = ['soong.workflow.mixin', 'mail.thread.main.attachment', 'mail.activity.mixin']
|
||||
|
||||
name = fields.Char(string='标题')
|
||||
code = fields.Char(string="流水号",
|
||||
default=lambda self: self.env['ir.sequence'].next_by_code('yuthon_union_business_approval_code'))
|
||||
users_id = fields.Many2one('res.users', string="申请人", default=lambda self: self.env.user.id)
|
||||
urgency_level = fields.Selection([('normal', '普件'), ('urgent', '急件'), ('emergency', '特急件')], string='紧急度',
|
||||
default='normal')
|
||||
department_id = fields.Many2one(related='users_id.employee_id.department_id', string="部门")
|
||||
is_issues = fields.Boolean(string='是否上会')
|
||||
issues_result = fields.Html(string="会议结果")
|
||||
related_issues_id = fields.Many2one('issue.library', string="关联议题")
|
||||
information_categories_ids = fields.Many2many(
|
||||
'yuthon.information.categories',
|
||||
relation='yuthon_union_biz_approval_info_cat_rel',
|
||||
column1='approval_id',
|
||||
column2='category_id',
|
||||
string='类型',
|
||||
)
|
||||
reason = fields.Text(string="正文")
|
||||
document_ids = fields.Many2many(
|
||||
'ir.attachment',
|
||||
relation='yuthon_union_biz_approval_attachment_rel',
|
||||
column1='approval_id',
|
||||
column2='attachment_id',
|
||||
string="附件",
|
||||
)
|
||||
is_chapter = fields.Selection([('yes', '是'), ('no', '否')], string="是否用章")
|
||||
type_stamp_ids = fields.Many2many('seals.type.setting', string='用章类型')
|
||||
scope_chapter_ids = fields.Many2many('seals.scope.setting', string='用章范围')
|
||||
active = fields.Boolean('Active', default=True, tracking=True)
|
||||
work_end = fields.Boolean(string="结束")
|
||||
receivable_amount = fields.Float(string="应收")
|
||||
payable_amount = fields.Float(string="应付")
|
||||
is_finance_business = fields.Boolean(string="是否经营业务(财务专用)", compute='_compute_is_finance_business', store=False)
|
||||
|
||||
@api.depends('information_categories_ids')
|
||||
def _compute_is_finance_business(self):
|
||||
for record in self:
|
||||
record.is_finance_business = any(
|
||||
cat.name == '经营业务(财务专用)' for cat in record.information_categories_ids
|
||||
)
|
||||
|
||||
def _get_default_name_title(self):
|
||||
return self._description if self._description else self._name
|
||||
|
||||
name_title = fields.Char(default=_get_default_name_title)
|
||||
self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
|
||||
|
||||
@api.onchange('is_issues')
|
||||
def _onchange_is_issues(self):
|
||||
if self.is_issues:
|
||||
issue_id = self.env['issue.library'].create({'name': self.name, 'is_invisible_workflow': True})
|
||||
self.related_issues_id = issue_id.id
|
||||
self.env['issue.library.approval.line'].create({
|
||||
'issue_library_id': issue_id.id,
|
||||
'workflow_name': self.name,
|
||||
'approval_type': self.workflow_id.name,
|
||||
'res_model': self._name,
|
||||
'res_id': self.id,
|
||||
'code': self.code,
|
||||
'approval_date': fields.Datetime.now(),
|
||||
})
|
||||
|
||||
def action_print_union_business_approval(self):
|
||||
"""打印业务审批单(工会)"""
|
||||
report_ref = self.env.ref('yuthon_trade.action_union_business_approval_print_report')
|
||||
return report_ref.report_action(self)
|
||||
@@ -14,6 +14,7 @@ access_yuthon_care_condolences,yuthon_care_condolences,model_yuthon_care_condole
|
||||
access_yuthon_work_condolences,yuthon_work_condolences,model_yuthon_work_condolences,base.group_user,1,1,1,1
|
||||
access_yuthon_seals_approval,yuthon_seals_approval,model_yuthon_seals_approval,base.group_user,1,1,1,1
|
||||
access_yuthon_business_approval,yuthon_business_approval,model_yuthon_business_approval,base.group_user,1,1,1,1
|
||||
access_yuthon_union_business_approval,yuthon_union_business_approval,model_yuthon_union_business_approval,base.group_user,1,1,1,1
|
||||
|
||||
access_yuthon_care_setting,yuthon_care_setting,model_yuthon_care_setting,base.group_user,1,1,1,1
|
||||
access_yuthon_work_setting,yuthon_work_setting,model_yuthon_work_setting,base.group_user,1,1,1,1
|
||||
|
||||
|
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="view_yuthon_union_business_approval_tree" model="ir.ui.view">
|
||||
<field name="name">yuthon.union.business.approval.tree</field>
|
||||
<field name="model">yuthon.union.business.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="业务审批(工会)">
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_yuthon_union_business_approval_form" model="ir.ui.view">
|
||||
<field name="name">yuthon.union.business.approval.form</field>
|
||||
<field name="model">yuthon.union.business.approval</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="业务审批(工会)">
|
||||
<header>
|
||||
<button name="action_print_union_business_approval"
|
||||
type="object"
|
||||
string="打印"
|
||||
class="btn-primary" invisible="not work_end"/>
|
||||
</header>
|
||||
<sheet>
|
||||
<group col="3">
|
||||
<group>
|
||||
<field name="code" string="流水号" readonly="1"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="urgency_level" readonly="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<div class="col-12 text-center">
|
||||
<h1>
|
||||
<field name="name_title" readonly="1"/>
|
||||
</h1>
|
||||
</div>
|
||||
<group string="审批事项" col="2">
|
||||
<group colspan="2">
|
||||
<field name="name" string="事项标题"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_chapter"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="is_back" invisible="1"/>
|
||||
<field name="work_end" invisible="1"/>
|
||||
<field name="users_id" options="{'no_create': True}" invisible="1"/>
|
||||
<field name="type_stamp_ids" widget="many2many_tags"
|
||||
options="{'no_create': True, 'no_open': True}"
|
||||
invisible="is_chapter in [False, 'no']" required="is_chapter"/>
|
||||
</group>
|
||||
<group>
|
||||
<field name="information_categories_ids" widget="many2many_tags"
|
||||
string="业务类型" options="{'no_create': True}"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="is_finance_business" invisible="1"/>
|
||||
<field name="receivable_amount" string="收款金额" invisible="not is_finance_business"/>
|
||||
<field name="payable_amount" string="付款金额" invisible="not is_finance_business"/>
|
||||
</group>
|
||||
</group>
|
||||
<group>
|
||||
<field name="reason" string="事项说明"/>
|
||||
<field name="document_ids" widget="preview_many2many" string="附件清单"/>
|
||||
</group>
|
||||
</sheet>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_union_business_approval_action" model="ir.actions.act_window">
|
||||
<field name="name">业务审批(工会)</field>
|
||||
<field name="res_model">yuthon.union.business.approval</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user