!12165 添加功能

Merge pull request !12165 from 李鹏宇/dev_zhou
This commit is contained in:
李鹏宇
2026-06-17 09:17:43 +00:00
committed by Gitee
8 changed files with 252 additions and 0 deletions
+3
View File
@@ -25,6 +25,7 @@
'views/yuthon_trade_premium.xml',
'views/yuthon_business_approval_viwes.xml',
'views/yuthon_union_business_approval_views.xml',
'views/yuthon_party_business_approval_views.xml',
'views/yuthon_seals_approval_views.xml',
'views/yuthon_trade_refund.xml',
'views/yuthon_trade_reimbursed.xml',
@@ -47,6 +48,8 @@
'report/business_approval_print_templates.xml',
'report/union_business_approval_print_report.xml',
'report/union_business_approval_print_templates.xml',
'report/party_business_approval_print_report.xml',
'report/party_business_approval_print_templates.xml',
],
'demo': [],
'depends': ['mail', 'documents', 'soong_workflow', 'hr', 'yuthon_hr_employee', 'yuthon_issue', 'project'],
@@ -35,6 +35,13 @@
<field name="padding">3</field>
<field name="company_id" eval="False"/>
</record>
<record id="yuthon_party_business_approval_code_sequence" model="ir.sequence">
<field name="name">业务审批编号(党)</field>
<field name="code">yuthon_party_business_approval_code</field>
<field name="prefix">DW%(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>
+1
View File
@@ -23,6 +23,7 @@ from . import trade_reward_approval
from . import yuthon_seals_approval
from . import yuthon_business_approval
from . import yuthon_union_business_approval
from . import yuthon_party_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 YuthonPartyBusinessApproval(models.Model):
_name = 'yuthon.party.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_party_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_party_biz_approval_info_cat_rel',
column1='approval_id',
column2='category_id',
string='类型',
)
reason = fields.Text(string="正文")
document_ids = fields.Many2many(
'ir.attachment',
relation='yuthon_party_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_party_business_approval(self):
"""打印业务审批单(党)"""
report_ref = self.env.ref('yuthon_trade.action_party_business_approval_print_report')
return report_ref.report_action(self)
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<data>
<record id="action_party_business_approval_print_report" model="ir.actions.report">
<field name="name">业务审批单(党)</field>
<field name="paperformat_id" ref="yuthon_trade.paperformat_label_sheet_a44"/>
<field name="model">yuthon.party.business.approval</field>
<field name="report_type">qweb-pdf</field>
<field name="report_name">yuthon_trade.party_business_approval_print_report_document</field>
<field name="report_file">yuthon_trade.party_business_approval_print_report_document</field>
<field name="binding_model_id" ref="model_yuthon_party_business_approval"/>
<field name="binding_type">report</field>
<field name="print_report_name">'业务审批单(党)%s_%s_%s' % (object.name or '', object.users_id.name or '', ((object.log_ids.filtered(lambda l: l.name == '归档')[-1].lase_click_date or object.log_ids.filtered(lambda l: l.name == '归档')[-1].date_create).strftime('%Y-%m-%d') if object.log_ids.filtered(lambda l: l.name == '归档') else ''))</field>
</record>
</data>
</odoo>
@@ -0,0 +1,73 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>
<data>
<template id="party_business_approval_print_report_document">
<t t-call="web.html_container">
<t t-foreach="docs" t-as="doc">
<t t-call="web.external_layout">
<style type="text/css">
td { border:1px solid #000; padding:6px; }
table { border-collapse: collapse; width: 100%; max-width: 800px; margin: 0 auto; table-layout: fixed; }
.title { text-align:center; font-weight:bold; font-size:22px; padding: 12px 0; }
.section-title { font-weight:bold; font-size:16px; margin:0; background-color: #e8f4f8; padding: 8px; border-left: 4px solid #2c5f8d; }
.hdr { background: #f0f0f0; font-weight: bold; width: 6em; text-align: center; vertical-align: middle; }
.section { text-align: center; font-weight: bold; background: #d4e6f1; }
.cell-content { text-align: left; word-wrap: break-word; word-break: break-all; vertical-align: middle; }
.approval-name { text-align: center; }
.approval-col1 { width: 20%; }
.approval-col2 { width: 55%; }
.approval-col3 { width: 25%; }
.no-right-border { border-right: none !important; }
.no-left-border { border-left: none !important; }
.approval-center { text-align: center !important; }
.approval-pull-left { padding-left: 0 !important; }
.dept-container { width: 100%; max-width: 800px; margin: 0 auto 10px auto; font-weight:bold; text-align:left; border: none !important; }
.attachment-list { text-align: left !important; }
</style>
<div class="title" style="text-align:center; font-weight:bold; font-size:22px; padding:12px 0; margin-bottom:10px;">业务审批单(党)</div>
<div style="margin-bottom:8px; text-align:left;">
部门:<span t-esc="doc.department_id.name or ''"/>
<span style="margin-left:40px;">流水号:<span t-esc="doc.code or ''"/></span>
</div>
<table>
<colgroup>
<col style="width:6em"/>
<col style="width:55%"/>
<col style="width:25%"/>
</colgroup>
<tr><td class="hdr"><strong>事项标题</strong></td><td colspan="2" class="cell-content"><span t-esc="doc.name"/></td></tr>
<tr><td class="hdr"><strong>业务类型</strong></td><td colspan="2" class="cell-content">
<t t-foreach="doc.information_categories_ids" t-as="category">
<span t-esc="category.name"/><t t-if="not category_last">、</t>
</t>
</td></tr>
<tr><td class="hdr"><strong>事项说明</strong></td><td colspan="2" class="cell-content"><span t-esc="doc.reason"/></td></tr>
<tr t-if="doc.is_chapter == 'yes'"><td class="hdr"><strong>用章类型</strong></td><td colspan="2" class="cell-content">
<t t-foreach="doc.type_stamp_ids" t-as="stamp">
<span t-esc="stamp.display_name"/><t t-if="not stamp_last">、</t>
</t>
</td></tr>
<tr><td class="hdr"><strong>附件清单</strong></td><td colspan="2" class="cell-content attachment-list">
<t t-foreach="doc.document_ids" t-as="att"><div><t t-esc="att.name"/></div></t>
</td></tr>
<tr><td class="section" colspan="3"><strong>审批详情</strong></td></tr>
<t t-set="logs_ordered" t-value="doc.get_logs_for_print(True)"/>
<t t-foreach="logs_ordered" t-as="log">
<tr>
<td class="cell-content approval-name approval-col1"><span t-esc="log.name"/></td>
<td class="cell-content approval-col2 no-right-border approval-center"><span t-esc="log.comment"/></td>
<td class="cell-content approval-col3 no-left-border approval-center approval-pull-left">
<t t-if="log.done_by">
<span t-esc="log.done_by.name"/>
<span t-esc="log.lase_click_date and log.lase_click_date.strftime('%Y-%m-%d') or ''"/>
</t>
</td>
</tr>
</t>
</table>
</t>
</t>
</t>
</template>
</data>
</odoo>
@@ -15,6 +15,7 @@ access_yuthon_work_condolences,yuthon_work_condolences,model_yuthon_work_condole
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_party_business_approval,yuthon_party_business_approval,model_yuthon_party_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
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
15 access_yuthon_seals_approval yuthon_seals_approval model_yuthon_seals_approval base.group_user 1 1 1 1
16 access_yuthon_business_approval yuthon_business_approval model_yuthon_business_approval base.group_user 1 1 1 1
17 access_yuthon_union_business_approval yuthon_union_business_approval model_yuthon_union_business_approval base.group_user 1 1 1 1
18 access_yuthon_party_business_approval yuthon_party_business_approval model_yuthon_party_business_approval base.group_user 1 1 1 1
19 access_yuthon_care_setting yuthon_care_setting model_yuthon_care_setting base.group_user 1 1 1 1
20 access_yuthon_work_setting yuthon_work_setting model_yuthon_work_setting base.group_user 1 1 1 1
21 access_yuthon_message_approval yuthon_message_approval model_yuthon_message_approval base.group_user 1 1 1 1
@@ -0,0 +1,76 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_yuthon_party_business_approval_tree" model="ir.ui.view">
<field name="name">yuthon.party.business.approval.tree</field>
<field name="model">yuthon.party.business.approval</field>
<field name="arch" type="xml">
<tree string="业务审批(党)">
<field name="name"/>
</tree>
</field>
</record>
<record id="view_yuthon_party_business_approval_form" model="ir.ui.view">
<field name="name">yuthon.party.business.approval.form</field>
<field name="model">yuthon.party.business.approval</field>
<field name="arch" type="xml">
<form string="业务审批(党)">
<header>
<button name="action_print_party_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_party_business_approval_action" model="ir.actions.act_window">
<field name="name">业务审批(党)</field>
<field name="res_model">yuthon.party.business.approval</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>