Merge pull request !10490 from 李鹏宇/dev_wang
This commit is contained in:
李鹏宇
2026-04-01 11:57:58 +00:00
committed by Gitee
10 changed files with 154 additions and 5 deletions
+4
View File
@@ -55,6 +55,10 @@
'wizard/select_delete_wizard_viwes.xml',
'wizard/put_return_wizard_viwes.xml',
'wizard/salary_print_wizard_views.xml',
'wizard/meal_expenses_review_wizard_views.xml',
'wizard/party_expenses_review_wizard_views.xml',
],
'assets': {
'web.assets_backend': [
+23 -1
View File
@@ -21,7 +21,12 @@ class YuthonMealExpenses(models.Model):
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2040)], string='年份',
default=lambda self: str(datetime.now().year))
meal_state = fields.Selection([('to_do', '待发送'), ('done', '已发送')], string='状态', default='to_do')
toll_state = fields.Selection([('to_do', '待缴'), ('done', '已缴')], string='缴费状态', default='to_do')
toll_state = fields.Selection([
('to_do', '待缴'),
('done', '待复核确认'),
('paid', '已缴费'),
], string='缴费状态', default='to_do')
def _get_date_range(self):
@@ -63,6 +68,23 @@ class YuthonMealExpenses(models.Model):
def toll_confirm(self):
self.toll_state = 'done'
def action_review_confirm(self):
"""打开缴费复核确认弹窗,只对状态为待复核确认的记录生效"""
self.ensure_one()
if self.toll_state != 'done':
return
return {
'type': 'ir.actions.act_window',
'name': '复核确认',
'res_model': 'meal.expenses.review.wizard',
'view_mode': 'form',
'target': 'new',
'context': {
'default_meal_id': self.id,
},
}
def _get_default_month(self):
current_month = datetime.now().month
return str(current_month)
+23 -1
View File
@@ -20,11 +20,33 @@ class YuthonSalaryParty(models.Model):
select_year = fields.Selection(selection=[(str(i), str(i)) for i in range(2024, 2040)], string='年份',
default=lambda self: str(datetime.now().year))
party_state = fields.Selection([('to_do', '待发送'), ('done', '已发送')], string='状态', default='to_do')
toll_state = fields.Selection([('to_do', '待缴'), ('done', '已缴')], string='缴费状态', default='to_do')
toll_state = fields.Selection([
('to_do', '待缴'),
('done', '待复核确认'),
('paid', '已缴费'),
], string='缴费状态', default='to_do')
def toll_confirm(self):
# 员工确认已缴费,状态进入待复核确认
self.toll_state = 'done'
def action_party_review_confirm(self):
"""打开党费缴费复核确认弹窗,只对状态为待复核确认的记录生效"""
self.ensure_one()
if self.toll_state != 'done':
return
return {
'type': 'ir.actions.act_window',
'name': '复核确认',
'res_model': 'party.expenses.review.wizard',
'view_mode': 'form',
'target': 'new',
'context': {
'default_party_id': self.id,
},
}
def _get_default_month(self):
current_month = datetime.now().month
return str(current_month)
@@ -39,6 +39,8 @@
<field name="meal_state"/>
<button name="action_view_detail" string="明细" type="object" class="btn btn-blue"/>
<button name="send_meal" string="发送" type="object" class="btn btn-blue"/>
<button name="action_review_confirm" string="复核确认" type="object" class="btn btn-primary" invisible="toll_state != 'done'"/>
</tree>
</field>
</record>
@@ -55,7 +57,10 @@
<field name="total_payment" readonly="1"/>
<field name="company_id" column_invisible="1"/>
<field name="toll_state"/>
<button name="toll_confirm" string="确认已缴费" type="object" class="oe_highlight" confirm="注意:交完费了才点这个确认,是否确认?" invisible="toll_state == 'done'"/>
<button name="toll_confirm" string="缴费确认" type="object" class="btn btn-blue" confirm="已缴费才点,由餐费管理员复核确认" invisible="toll_state != 'to_do'"/>
<!-- <button name="action_review_confirm" string="复核确认" type="object" class="btn btn-primary" invisible="toll_state != 'done'"/>-->
</tree>
</field>
</record>
@@ -16,6 +16,8 @@
<field name="card"/>
<field name="company_id" column_invisible="True"/>
<button name="send_party" string="发送" type="object" class="oe_highlight" invisible="party_state == 'done'"/>
<button name="action_party_review_confirm" string="复核确认" type="object" class="btn btn-blue" invisible="toll_state != 'done'"/>
</tree>
</field>
</record>
@@ -32,7 +34,9 @@
<field name="total_payment"/>
<field name="company_id" column_invisible="1"/>
<field name="toll_state"/>
<button name="toll_confirm" string="确认已缴费" type="object" class="oe_highlight" confirm="注意:交完费了才点这个确认,是否确认?" invisible="toll_state == 'done'"/>
<button name="toll_confirm" string="缴费确认" type="object" class="btn btn-blue" confirm="注意:交完费了才点这个确认,是否确认?" invisible="toll_state != 'to_do'"/>
</tree>
</field>
</record>
+4 -1
View File
@@ -18,4 +18,7 @@ from . import salary_import_wizard
from . import party_send_wizard
from . import party_meal_wizard
from . import salary_meal_wizard
from . import salary_active_wizard
from . import salary_active_wizard
from . import party_expenses_review_wizard
from . import meal_expenses_review_wizard
@@ -0,0 +1,22 @@
from odoo import models, fields
class MealExpensesReviewWizard(models.TransientModel):
_name = 'meal.expenses.review.wizard'
_description = '餐费缴费复核确认向导'
meal_id = fields.Many2one('yuthon.meal.expenses', string='餐费记录', required=True)
def action_confirm_paid(self):
"""确认已复核:将缴费状态改为已缴费"""
self.ensure_one()
if self.meal_id:
self.meal_id.toll_state = 'paid'
return {'type': 'ir.actions.act_window_close'}
def action_return_to_todo(self):
"""退回:将缴费状态改回待缴"""
self.ensure_one()
if self.meal_id:
self.meal_id.toll_state = 'to_do'
return {'type': 'ir.actions.act_window_close'}
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_meal_expenses_review_wizard_form" model="ir.ui.view">
<field name="name">meal.expenses.review.wizard.form</field>
<field name="model">meal.expenses.review.wizard</field>
<field name="arch" type="xml">
<form string="复核确认">
<group col="1">
<p>确认:确认“已缴费”。</p>
<p>退回:恢复缴费状态为“待缴”,员工可再次确认。</p>
</group>
<footer>
<button name="action_confirm_paid" string="确认" type="object" class="btn-primary"/>
<button name="action_return_to_todo" string="退回" type="object" class="btn-secondary"/>
<button string="取消" special="cancel" class="btn-secondary"/>
</footer>
</form>
</field>
</record>
</odoo>
@@ -0,0 +1,22 @@
from odoo import models, fields
class PartyExpensesReviewWizard(models.TransientModel):
_name = 'party.expenses.review.wizard'
_description = '党费缴费复核确认向导'
party_id = fields.Many2one('yuthon.salary.party', string='党费记录', required=True)
def action_confirm_paid(self):
"""确认已复核:将缴费状态改为已缴费"""
self.ensure_one()
if self.party_id:
self.party_id.toll_state = 'paid'
return {'type': 'ir.actions.act_window_close'}
def action_return_to_todo(self):
"""退回:将缴费状态改回待缴"""
self.ensure_one()
if self.party_id:
self.party_id.toll_state = 'to_do'
return {'type': 'ir.actions.act_window_close'}
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_party_expenses_review_wizard_form" model="ir.ui.view">
<field name="name">party.expenses.review.wizard.form</field>
<field name="model">party.expenses.review.wizard</field>
<field name="arch" type="xml">
<form string="复核确认">
<group col="1">
<p>确认:确认“已缴费”。</p>
<p>退回:恢复缴费状态为“待缴”,员工可再次确认。</p>
</group>
<footer>
<button name="action_confirm_paid" string="确认" type="object" class="btn-primary"/>
<button name="action_return_to_todo" string="退回" type="object" class="btn-secondary"/>
<button string="取消" special="cancel" class="btn-secondary"/>
</footer>
</form>
</field>
</record>
</odoo>