添加功能

This commit is contained in:
李鹏宇
2025-11-29 16:59:57 +08:00
parent a31591db25
commit 38283cd480
5 changed files with 110 additions and 6 deletions
@@ -1,4 +1,5 @@
from odoo import fields, models, api
import json
class FinancialSheetCollection(models.Model):
@@ -13,6 +13,18 @@ class SheetCollectionSetting(models.Model):
user_role_id = fields.Many2one('soong.user.role', string="角色")
start_date = fields.Date(string="生效日期", default=fields.Datetime.today())
end_date = fields.Date(string="失效日期")
is_enable = fields.Boolean(string="是否启用", compute="compute_is_enable")
@api.depends('start_date', 'end_date')
def compute_is_enable(self):
today = fields.Date.today()
for record in self:
if not record.start_date:
record.is_enable = False
elif not record.end_date:
record.is_enable = record.start_date <= today
else:
record.is_enable = record.start_date <= today <= record.end_date
class SummaryTableSetting(models.Model):
@@ -25,4 +37,16 @@ class SummaryTableSetting(models.Model):
company_id = fields.Many2one('res.company', string="公司")
start_date = fields.Date(string="生效日期", default=fields.Datetime.today())
end_date = fields.Date(string="失效日期")
is_enable = fields.Boolean(string="是否启用", compute="compute_is_enable")
@api.depends('start_date', 'end_date')
def compute_is_enable(self):
today = fields.Date.today()
for record in self:
if not record.start_date:
record.is_enable = False
elif not record.end_date:
record.is_enable = record.start_date <= today
else:
record.is_enable = record.start_date <= today <= record.end_date
@@ -13,9 +13,10 @@
<field name="account_type"
decoration-danger="account_type == 'to'"
decoration-success="account_type == 'ok'"
/>
<button name="button_put" string="发送" type="object" class="oe_highlight" invisible="account_type == 'ok'"/>
<button name="open_record" type="object" string="详情" class="btn-primary"/>
/>
<button name="button_put" string="发送" type="object" class="oe_highlight"
invisible="account_type == 'ok'"/>
<button name="open_record" type="object" string="详情" class="btn-primary"/>
</tree>
</field>
</record>
@@ -38,7 +39,8 @@
</group>
<notebook>
<page string="财务数据表明细">
<field name="sheet_line_ids">
<field name="sheet_line_ids" mode="kanban,tree"
context="{'kanban_view_ref':'yuthon_account_report.financial_sheet_line_kanban'}">
<tree editable="bottom">
<field name="sheet_id" column_invisible="1"/>
<field name="collection_id"/>
@@ -53,6 +55,46 @@
</form>
</field>
</record>
<record id="financial_sheet_line_kanban" model="ir.ui.view">
<field name="name">financial.sheet.line.kanban</field>
<field name="model">financial.sheet.line</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="collection_id"/>
<field name="this_issue_number"/>
<field name="same_last_year"/>
<field name="remake"/>
<templates>
<t t-name="kanban-box">
<div class="o_kanban_record d-md-none card h-100">
<div class="card-body">
<div class="mb-2">
<small>
项目:<field name="collection_id"/>
</small>
</div>
<div class="mb-2">
<small>
本期数:<field name="this_issue_number"/>
</small>
</div>
<div class="mb-2">
<small>
上年同期数:<field name="same_last_year"/>
</small>
</div>
<div class="mb-2">
<small>
说明:<field name="remake"/>
</small>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="financial_sheet_collection_action" model="ir.actions.act_window">
<field name="name">财务数据表收集</field>
<field name="res_model">financial.sheet.collection</field>
@@ -38,7 +38,8 @@
<notebook>
<page string="信息汇总明细">
<field name="summary_line">
<tree editable="bottom">
<tree editable="bottom"
context="{'kanban_view_ref':'yuthon_account_report.information_summary_line_kanban'}">
<field name="summary_id" column_invisible="1"/>
<field name="table_id"/>
<field name="this_year"/>
@@ -51,9 +52,43 @@
</form>
</field>
</record>
<record id="information_summary_line_kanban" model="ir.ui.view">
<field name="name">information.summary.line.kanban</field>
<field name="model">information.summary.line</field>
<field name="arch" type="xml">
<kanban class="o_kanban_mobile">
<field name="table_id"/>
<field name="this_year"/>
<field name="remake"/>
<templates>
<t t-name="kanban-box">
<div class="o_kanban_record d-md-none card h-100">
<div class="card-body">
<div class="mb-2">
<small>
项目:<field name="table_id"/>
</small>
</div>
<div class="mb-2">
<small>
本年底:<field name="this_year"/>
</small>
</div>
<div class="mb-2">
<small>
说明:<field name="remake"/>
</small>
</div>
</div>
</div>
</t>
</templates>
</kanban>
</field>
</record>
<record id="information_summary_table_action" model="ir.actions.act_window">
<field name="name">信息汇总表</field>
<field name="res_model">information.summary.table</field>
<field name="view_mode">tree</field>
<field name="view_mode">tree,form</field>
</record>
</odoo>
@@ -10,6 +10,7 @@
<field name="user_role_id"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="is_enable"/>
</tree>
</field>
</record>
@@ -28,6 +29,7 @@
<field name="company_id"/>
<field name="start_date"/>
<field name="end_date"/>
<field name="is_enable"/>
</tree>
</field>
</record>