mirror of
https://github.com/guohuadeng/app-odoo.git
synced 2025-02-23 04:11:36 +02:00
增加中文数字和阿拉伯数字转换
This commit is contained in:
@@ -30,7 +30,8 @@
|
|||||||
4. 更新税信息。
|
4. 更新税信息。
|
||||||
5. 增加树状结构,支持二级科目,可设置上级科目,配合 "app_web_superbar" 使用可轻易实现树状导航。
|
5. 增加树状结构,支持二级科目,可设置上级科目,配合 "app_web_superbar" 使用可轻易实现树状导航。
|
||||||
6. 使用金蝶的会计科目命名法对多级科目进行初始化。可自行调整为用友科目命名法
|
6. 使用金蝶的会计科目命名法对多级科目进行初始化。可自行调整为用友科目命名法
|
||||||
7. 注意,必须在没有业务数据,没有会计科目的初始环境。可以使用 "app_odoo_customize" 模块清除财务数据,重置会计科目。
|
7. 增加中文数字和阿拉伯数字的转换(需安装cn2an库,pip3 install cn2an)
|
||||||
|
8. 注意,必须在没有业务数据,没有会计科目的初始环境。可以使用 "app_odoo_customize" 模块清除财务数据,重置会计科目。
|
||||||
|
|
||||||
如果是多语种环境需要自行更改翻译,主要体现在3%,6%,13%增值税处理。
|
如果是多语种环境需要自行更改翻译,主要体现在3%,6%,13%增值税处理。
|
||||||
中国财务,中国会计,中国城市
|
中国财务,中国会计,中国城市
|
||||||
@@ -56,9 +57,14 @@
|
|||||||
'views/account_account_views.xml',
|
'views/account_account_views.xml',
|
||||||
'views/account_views.xml',
|
'views/account_views.xml',
|
||||||
'data/account_account_tag_data.xml',
|
'data/account_account_tag_data.xml',
|
||||||
|
'report/account_report.xml',
|
||||||
|
'report/report_voucher.xml',
|
||||||
],
|
],
|
||||||
'post_init_hook': 'post_init_hook',
|
'post_init_hook': 'post_init_hook',
|
||||||
'installable': True,
|
'installable': True,
|
||||||
'application': True,
|
'application': True,
|
||||||
'auto_install': False,
|
'auto_install': False,
|
||||||
|
'external_dependencies': {
|
||||||
|
'python': ['cn2an']
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ from . import account_account
|
|||||||
from . import account_tax_group
|
from . import account_tax_group
|
||||||
from . import account_journal
|
from . import account_journal
|
||||||
from . import res_currency
|
from . import res_currency
|
||||||
|
from . import account_move
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
34
l10n_cn_standard_latest/models/account_move.py
Normal file
34
l10n_cn_standard_latest/models/account_move.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from odoo import api, fields, models, _
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
from odoo.osv import expression
|
||||||
|
|
||||||
|
try:
|
||||||
|
from cn2an import an2cn
|
||||||
|
except ImportError:
|
||||||
|
an2cn = None
|
||||||
|
|
||||||
|
class AccountMove(models.Model):
|
||||||
|
_inherit = 'account.move'
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def check_cn2an(self):
|
||||||
|
return an2cn
|
||||||
|
|
||||||
|
@api.model
|
||||||
|
def _convert_to_amount_in_word(self, number):
|
||||||
|
"""Convert number to ``amount in words`` for Chinese financial usage."""
|
||||||
|
if not self.check_cn2an():
|
||||||
|
return None
|
||||||
|
return an2cn(number, 'rmb')
|
||||||
|
|
||||||
|
def _count_attachments(self):
|
||||||
|
domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.id)]]
|
||||||
|
statement_ids = self.line_ids.mapped('statement_id')
|
||||||
|
payment_ids = self.line_ids.mapped('payment_id')
|
||||||
|
if statement_ids:
|
||||||
|
domains.append([('res_model', '=', 'account.bank.statement'), ('res_id', 'in', statement_ids.ids)])
|
||||||
|
if payment_ids:
|
||||||
|
domains.append([('res_model', '=', 'account.payment'), ('res_id', 'in', payment_ids.ids)])
|
||||||
|
return self.env['ir.attachment'].search_count(expression.OR(domains))
|
||||||
16
l10n_cn_standard_latest/report/account_report.xml
Normal file
16
l10n_cn_standard_latest/report/account_report.xml
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<!-- QWeb Reports -->
|
||||||
|
<record id="account_voucher_cn" model="ir.actions.report">
|
||||||
|
<field name="name">Voucher</field>
|
||||||
|
<field name="model">account.move</field>
|
||||||
|
<field name="report_type">qweb-pdf</field>
|
||||||
|
<field name="report_name">l10n_cn_standard_latest.report_voucher</field>
|
||||||
|
<field name="report_file">l10n_cn_standard_latest.report_voucher</field>
|
||||||
|
<field name="print_report_name">'Voucher_%s' % (object.name)</field>
|
||||||
|
<field name="binding_view_types">form</field>
|
||||||
|
<field name="binding_model_id" ref="model_account_move"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
121
l10n_cn_standard_latest/report/report_voucher.xml
Normal file
121
l10n_cn_standard_latest/report/report_voucher.xml
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<odoo>
|
||||||
|
<data>
|
||||||
|
<template id="external_layout_boxed" inherit_id="web.external_layout_boxed" primary="True">
|
||||||
|
<xpath expr="//div[hasclass('o_boxed_header')]" position="replace">
|
||||||
|
<div class="o_boxed_header">
|
||||||
|
<div class="row mb8">
|
||||||
|
<div class="col-3 mb4">
|
||||||
|
<img t-if="company.logo" t-att-src="image_data_uri(company.logo)" style="max-height: 45px;" alt="Logo"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="report_voucher_document">
|
||||||
|
<t t-set="o" t-value="o.with_context(lang=lang)" />
|
||||||
|
<t t-set="company" t-value="o.company_id"/>
|
||||||
|
|
||||||
|
<t t-call="l10n_cn_standard_latest.external_layout_boxed">
|
||||||
|
<div class="page">
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
<h2>
|
||||||
|
<span>Accounting Voucher</span>
|
||||||
|
</h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="company" class="row col-auto">
|
||||||
|
<span t-field="o.company_id.name"/>
|
||||||
|
</div>
|
||||||
|
<div id="informations" class="row">
|
||||||
|
<!-- offset intentionally for period -->
|
||||||
|
<div class="col-3 offset-3" name="date">
|
||||||
|
<strong>Date:</strong>
|
||||||
|
<span t-field="o.date"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-4" t-if="o.name" name="name">
|
||||||
|
<strong>Reference:</strong>
|
||||||
|
<span t-field="o.name"/>
|
||||||
|
</div>
|
||||||
|
<div class="col-2">
|
||||||
|
<strong>Number of attachments:</strong>
|
||||||
|
<span t-esc="o._count_attachments()"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class="table table-sm o_main_table table-striped" name="entry_line_table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<t t-set="colspan" t-value="4"/>
|
||||||
|
<th name="th_description" class="text-center"><span>Balance</span></th>
|
||||||
|
<th name="th_account" class="text-center"><span>Account</span></th>
|
||||||
|
<th name="th_debit" class="text-center"><span>Debit</span></th>
|
||||||
|
<th name="th_credit" class="text-center"><span>Credit</span></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="invoice_tbody">
|
||||||
|
<t t-set="total_debit" t-value="0"/>
|
||||||
|
<t t-set="total_credit" t-value="0"/>
|
||||||
|
|
||||||
|
<t t-foreach="o.line_ids" t-as="line">
|
||||||
|
<t t-set="total_debit" t-value="total_debit + line.debit"/>
|
||||||
|
<t t-set="total_credit" t-value="total_credit + line.credit"/>
|
||||||
|
<tr>
|
||||||
|
<t name="account_move_line">
|
||||||
|
<td name="description">
|
||||||
|
<span t-field="line.name" t-options="{'widget': 'text'}"/>
|
||||||
|
</td>
|
||||||
|
<td name="account">
|
||||||
|
<span t-field="line.account_id.display_name" t-options="{'widget': 'text'}"/>
|
||||||
|
</td>
|
||||||
|
<td name="debit">
|
||||||
|
<span t-if="line.debit != 0" t-field="line.debit"/>
|
||||||
|
</td>
|
||||||
|
<td name="credit">
|
||||||
|
<span t-if="line.credit != 0" t-field="line.credit"/>
|
||||||
|
</td>
|
||||||
|
</t>
|
||||||
|
</tr>
|
||||||
|
</t>
|
||||||
|
<t>
|
||||||
|
<td name="total" colspan="2">
|
||||||
|
<span>Total:</span>
|
||||||
|
<span t-esc="o._convert_to_amount_in_word(total_debit)" />
|
||||||
|
</td>
|
||||||
|
<td name="total_debit">
|
||||||
|
<span t-esc="total_debit" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||||
|
</td>
|
||||||
|
<td name="total_credit">
|
||||||
|
<span t-esc="total_credit" t-options='{"widget": "monetary", "display_currency": o.currency_id}'/>
|
||||||
|
</td>
|
||||||
|
</t>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div id="staff" class="row" style="color:black">
|
||||||
|
<div class="col-4">
|
||||||
|
<strong>Validator:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<strong>Poster:</strong>
|
||||||
|
</div>
|
||||||
|
<div class="col-4">
|
||||||
|
<strong>Salesperson:</strong>
|
||||||
|
<span t-esc="o.invoice_user_id.name"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</t>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<template id="report_voucher">
|
||||||
|
<t t-call="web.html_container">
|
||||||
|
<t t-foreach="docs" t-as="o">
|
||||||
|
<t t-call="l10n_cn_standard_latest.report_voucher_document" t-lang="lang"/>
|
||||||
|
</t>
|
||||||
|
</t>
|
||||||
|
</template>
|
||||||
|
</data>
|
||||||
|
</odoo>
|
||||||
@@ -4,7 +4,7 @@
|
|||||||
<h2 class="oe_slogan">App Latest Chinese Account chart 2021.</h2>
|
<h2 class="oe_slogan">App Latest Chinese Account chart 2021.</h2>
|
||||||
<h3 class="oe_slogan">Set all chinese default value. Like Default country, timezone, currency, partner... </h3>
|
<h3 class="oe_slogan">Set all chinese default value. Like Default country, timezone, currency, partner... </h3>
|
||||||
<div class="oe_row">
|
<div class="oe_row">
|
||||||
<h3>Lastest update: v17.24.02.26</h3>
|
<h3>Lastest update: v17.24.02.27</h3>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<img class="oe_demo oe_screenshot img img-fluid" src="banner.png">
|
<img class="oe_demo oe_screenshot img img-fluid" src="banner.png">
|
||||||
</div>
|
</div>
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
<ul class="list-unstyled">
|
<ul class="list-unstyled">
|
||||||
<li>
|
<li>
|
||||||
<i class="fa fa-check-square-o text-primary"></i>
|
<i class="fa fa-check-square-o text-primary"></i>
|
||||||
The Latest Account Chart for Odoo16.
|
The Latest Account Chart for Odoo17.
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user