Merge remote-tracking branch 'origin/18.0' into 18.0

This commit is contained in:
Ivan Office
2025-01-17 18:37:57 +08:00
8 changed files with 38 additions and 17 deletions

View File

@@ -9,17 +9,17 @@
{ {
'name': '2025最新中国会计科目表.企业标准会计.Latest Chinese Accounting for odoo18', 'name': '2025最新中国会计科目表.企业标准会计.Latest Chinese Accounting for odoo18',
'version': '18.0.24.12.13', 'version': '18.0.25.01.15',
'author': 'odooai.cn', 'author': 'odooai.cn',
'category': 'Accounting/Localizations/Account Charts', 'category': 'Accounting/Localizations/Account Charts',
'website': 'https://www.odooai.cn', 'website': 'https://www.odooai.cn',
'live_test_url': 'https://demo.odooapp.cn', 'live_test_url': 'https://demo.odooapp.cn',
'license': 'LGPL-3', 'license': 'LGPL-3',
'sequence': 12, 'sequence': 12,
'summary': """ 'summary': """
Multi level account chart. Chinese enhance. Focus on account chart. Multi level account chart. Chinese enhance. Focus on account chart.
Add account chart group data. Account group, Chinese tax. Add account chart group data. Account group, Chinese tax.
Set chinese account report. Set chinese account report.
""", """,
'description': """ 'description': """
最新中国化财务,主要针对标准会计科目表作了优化。 最新中国化财务,主要针对标准会计科目表作了优化。

View File

@@ -27,10 +27,10 @@ def pre_init_hook(env):
def post_init_hook(env): def post_init_hook(env):
""" """
数据初始化,只在安装后执行,更新时不执行 数据初始化,只在安装后执行,更新时不执行
注意 account.account 中 code 处理已不同,主要用 json 存在 code_store 中,故要不可使用 sql 中国公司,会计科目表非本模块中国企业会计科目表时,重载
同时 group_id 已为 compute 字段,无需设置
""" """
env['res.company'].search(['|', ('country_id', '=', env.ref('base.cn')), ('country_id.code', '=', 'CN')]).app_set_to_odooai_cn()
# cr.execute("UPDATE account_account_template set group_id = " # cr.execute("UPDATE account_account_template set group_id = "
# "(select id from account_group where account_group.code_prefix_start=trim(substring(account_account_template.code from 1 for 1)) limit 1);") # "(select id from account_group where account_group.code_prefix_start=trim(substring(account_account_template.code from 1 for 1)) limit 1);")

View File

@@ -6,7 +6,4 @@ 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 from . import account_move
from . import res_company

View File

@@ -11,18 +11,18 @@ except ImportError:
class AccountMove(models.Model): class AccountMove(models.Model):
_inherit = 'account.move' _inherit = 'account.move'
@api.model @api.model
def check_cn2an(self): def check_cn2an(self):
return an2cn return an2cn
@api.model @api.model
def _convert_to_amount_in_word(self, number): def _convert_to_amount_in_word(self, number):
"""Convert number to ``amount in words`` for Chinese financial usage.""" """Convert number to ``amount in words`` for Chinese financial usage."""
if not self.check_cn2an(): if not self.check_cn2an():
return None return None
return an2cn(number, 'rmb') return an2cn(number, 'rmb')
def _count_attachments(self): def _count_attachments(self):
domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.id)]] domains = [[('res_model', '=', 'account.move'), ('res_id', '=', self.id)]]
statement_ids = self.line_ids.mapped('statement_id') statement_ids = self.line_ids.mapped('statement_id')

View File

@@ -6,4 +6,3 @@ class AccountTaxGroup(models.Model):
_inherit = 'account.tax.group' _inherit = 'account.tax.group'
active = fields.Boolean(default=True, help="Set active to false to hide the tax without removing it.") active = fields.Boolean(default=True, help="Set active to false to hide the tax without removing it.")

View File

@@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
import logging
from odoo import models, fields, api, _
_logger = logging.getLogger(__name__)
class ResCompany(models.Model):
_inherit = 'res.company'
def app_set_to_odooai_cn(self):
for rec in self:
if rec.country_id.code == 'CN' and rec.chart_template != 'cn_standard':
has_accounting_entries = rec.root_id._existing_accounting()
if not has_accounting_entries:
unaffected_earnings_type = "equity_unaffected"
account = self.env['account.account'].with_company(rec).search([
*self.env['account.account']._check_company_domain(rec),
('account_type', '=', unaffected_earnings_type),
], limit=1)
if account:
account.unlink()
rec.chart_template = 'cn_standard'
self.env['account.chart.template'].try_loading(rec.chart_template, company=rec)

View File

@@ -16,7 +16,7 @@ class AccountChartTemplate(models.AbstractModel):
# 'account.reconcile.model', # 'account.reconcile.model',
# 'account.fiscal.position', # 'account.fiscal.position',
# ) # )
@template('cn_standard') @template('cn_standard')
def _get_cn_standard_template_data(self): def _get_cn_standard_template_data(self):
return { return {
@@ -57,7 +57,7 @@ class AccountChartTemplate(models.AbstractModel):
'account_journal_early_pay_discount_loss_account_id': 'account_6603', 'account_journal_early_pay_discount_loss_account_id': 'account_6603',
}, },
} }
@template('cn_standard', 'account.journal') @template('cn_standard', 'account.journal')
def _get_cn_account_journal(self): def _get_cn_account_journal(self):
return { return {

View File

@@ -17,7 +17,7 @@
<div class="oe_row oe_spaced"> <div class="oe_row oe_spaced">
<div class="row"> <div class="row">
<div class="oe_row"> <div class="oe_row">
<h3>Lastest update: v18.24.12.13</h3> <h3>Lastest update: v18.25.01.15</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>