mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-25 10:02:07 +02:00
19.0 vanilla
This commit is contained in:
parent
7dc55599c6
commit
7f43bbbfcc
650 changed files with 45260 additions and 33436 deletions
|
|
@ -10,35 +10,15 @@ pip install odoo-bringout-oca-ocb-l10n_hk
|
|||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- account_qr_code_emv
|
||||
- account
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: Hong Kong - Accounting
|
||||
- **Version**: 1.0
|
||||
- **Category**: Accounting/Localizations/Account Charts
|
||||
- **License**: LGPL-3
|
||||
- **Installable**: False
|
||||
|
||||
## Source
|
||||
|
||||
Based on [OCA/OCB](https://github.com/OCA/OCB) branch 16.0, addon `l10n_hk`.
|
||||
- Repository: https://github.com/OCA/OCB
|
||||
- Branch: 19.0
|
||||
- Path: addons/l10n_hk
|
||||
|
||||
## License
|
||||
|
||||
This package maintains the original LGPL-3 license from the upstream Odoo project.
|
||||
|
||||
## Documentation
|
||||
|
||||
- Overview: doc/OVERVIEW.md
|
||||
- Architecture: doc/ARCHITECTURE.md
|
||||
- Models: doc/MODELS.md
|
||||
- Controllers: doc/CONTROLLERS.md
|
||||
- Wizards: doc/WIZARDS.md
|
||||
- Install: doc/INSTALL.md
|
||||
- Usage: doc/USAGE.md
|
||||
- Configuration: doc/CONFIGURATION.md
|
||||
- Dependencies: doc/DEPENDENCIES.md
|
||||
- Troubleshooting: doc/TROUBLESHOOTING.md
|
||||
- FAQ: doc/FAQ.md
|
||||
This package preserves the original LGPL-3 license.
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import models
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Hong Kong - Accounting',
|
||||
'website': 'https://www.odoo.com/documentation/latest/applications/finance/fiscal_localizations/hong_kong.html',
|
||||
'icon': '/account/static/description/l10n.png',
|
||||
'countries': ['hk'],
|
||||
'version': '1.0',
|
||||
'category': 'Accounting/Localizations/Account Charts',
|
||||
'description': """ This is the base module to manage chart of accounting and localization for Hong Kong """,
|
||||
'author': 'Odoo SA',
|
||||
'depends': ['account'],
|
||||
'description': ' This is the base module to manage chart of accounting and localization for Hong Kong ',
|
||||
'depends': [
|
||||
'account_qr_code_emv',
|
||||
'account',
|
||||
],
|
||||
'auto_install': ['account'],
|
||||
'data': [
|
||||
'data/account_chart_template_data.xml',
|
||||
'data/account.account.template.csv',
|
||||
'data/l10n_hk_chart_data.xml',
|
||||
'data/account_chart_template_configure_data.xml',
|
||||
'views/res_bank_views.xml',
|
||||
],
|
||||
'demo': [
|
||||
'demo/demo_company.xml',
|
||||
],
|
||||
'author': 'Odoo S.A.',
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,73 +0,0 @@
|
|||
"id","name","code","account_type","chart_template_id/id","tag_ids/id","reconcile"
|
||||
"l10n_hk_11","Fixed Assets","11","asset_fixed","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1110","Furniture and Fixtures","1110","asset_non_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1130","Equipment","1130","asset_non_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1140","Decoration","1140","asset_non_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1160","Investments","1160","asset_non_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_12","Current Assets","12","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1240","Account Receivable","1240","asset_receivable","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_1241","Utility & Rental Deposit","1241","asset_current","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_1242","Supplier Prepayments","1242","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1243","Account Receivable (PoS)","1243","asset_receivable","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_1245","Sundry Deposits","1245","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1246","Other Receivable","1246","asset_receivable","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_1250","Stock Interim Account (Received)","1250","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1260","Stock Interim Account (Delivered)","1260","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_1270","Stock Valuation Account","1270","asset_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_21","Non-current Liabilities","21","liability_non_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_22","Current Liabilities","22","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_2210","Accruals","2210","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_221001","MPF (Employer)","221001","liability_current","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_221002","MPF (Employee)","221002","liability_current","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_2211","Account Payable","2211","liability_payable","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_2212","Receipt in Advance (Customer Prepayments)","2212","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_2214","Provision for Taxation","2214","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_2215","Proposed Dividend","2215","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_2216","Other Payable","2216","liability_payable","l10n_hk.l10n_hk_chart_template","","True"
|
||||
"l10n_hk_31","Paid Capital","31","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_32","Accumulated Profit & Loss","32","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_33","Profit & Loss Account","33","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_34","Short-term Borrowing","34","liability_current","l10n_hk.l10n_hk_chart_template","","False"
|
||||
"l10n_hk_41","Trade Income","41","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_42","Other Income and Gains","42","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_4210","Sundry Income","4210","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_4220","Exchange Adjustment","4220","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_4230","Bank Interest Income","4230","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_4240","Foreign Exchange Gain","4240","income","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_4250","Cash Discount Gain","4250","income_other","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_51","Costs","51","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5101","Trade Costs","5101","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5105","Misc. Costs","5105","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5106","Costs of Transportation","5106","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5111","Declaration Fees","5111","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5112","Packing Fees","5112","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_52","Expenses","52","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5201","Bank Charges","5201","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5202","Entertainment","5202","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5203","Electricity & Water Fees","5203","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5205","Postage & Stamps","5205","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5206","Printing & Stationery","5206","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5207","Rent & Rates","5207","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5208","Sundry Expenses","5208","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5209","Telecommunication Expenses","5209","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5210","Traffic Fees","5210","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5211","IT Expenses","5211","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5214","Insurance","5214","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5215","Sales Commission","5215","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5216","Overseas Traveling","5216","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5217","MPF Contribution","5217","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5218","Wages & Salaries","5218","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5219","Bonus Payment","5219","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5221","Taxation","5221","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5222","Local Delivery","5222","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5223","Management Fees","5223","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5224","Depreciation","5224","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5225","Audit Fees","5225","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5226","Bad Debts","5226","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5228","Legal & Professional Fees","5228","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5229","Dividend","5229","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5231","Disposal","5231","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5234","Repair and Maintenance","5234","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5235","Advertising","5235","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5240","Foreign Exchange Loss","5240","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
"l10n_hk_5250","Cash Discount Loss","5250","expense","l10n_hk.l10n_hk_chart_template","account.account_tag_operating","False"
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo noupdate="1">
|
||||
<function model="account.chart.template" name="try_loading">
|
||||
<value eval="[ref('l10n_hk.l10n_hk_chart_template')]"/>
|
||||
</function>
|
||||
</odoo>
|
||||
|
|
@ -1,17 +1,8 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="base.CNY" model="res.currency">
|
||||
<field name="active" eval="True" />
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
|
||||
<!-- Account Chart template -->
|
||||
<record id="l10n_hk_chart_template" model="account.chart.template">
|
||||
<field name="name">Hong Kong - Chart of Accounts</field>
|
||||
<field name="bank_account_code_prefix">1200</field>
|
||||
<field name="cash_account_code_prefix">1210</field>
|
||||
<field name="transfer_account_code_prefix">111220</field>
|
||||
<field name="code_digits">6</field>
|
||||
<field name="currency_id" ref="base.HKD" />
|
||||
<field name="country_id" ref="base.hk"/>
|
||||
</record>
|
||||
</odoo>
|
||||
</odoo>
|
||||
|
|
|
|||
|
|
@ -1,19 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<!-- Account Chart Template -->
|
||||
<record id="l10n_hk_chart_template" model="account.chart.template">
|
||||
<field name="name">Hong Kong - Chart of Accounts</field>
|
||||
<field name="property_account_receivable_id" ref="l10n_hk_1240"/>
|
||||
<field name="property_account_payable_id" ref="l10n_hk_2211"/>
|
||||
<field name="property_account_income_categ_id" ref="l10n_hk_41"/>
|
||||
<field name="property_account_expense_categ_id" ref="l10n_hk_51"/>
|
||||
<field name="expense_currency_exchange_account_id" ref="l10n_hk_5240"/>
|
||||
<field name="income_currency_exchange_account_id" ref="l10n_hk_4240"/>
|
||||
<field name="default_pos_receivable_account_id" ref="l10n_hk_1243"/>
|
||||
<field name="account_journal_early_pay_discount_loss_account_id" ref="l10n_hk_5250"/>
|
||||
<field name="account_journal_early_pay_discount_gain_account_id" ref="l10n_hk_4250"/>
|
||||
<field name="use_anglo_saxon" eval="True"/>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
"id","name","code","account_type","tag_ids","reconcile"
|
||||
"l10n_hk_11","Fixed Assets","11","asset_fixed","","False"
|
||||
"l10n_hk_1110","Furniture and Fixtures","1110","asset_non_current","","False"
|
||||
"l10n_hk_1130","Equipment","1130","asset_non_current","","False"
|
||||
"l10n_hk_1140","Decoration","1140","asset_non_current","","False"
|
||||
"l10n_hk_1160","Investments","1160","asset_non_current","","False"
|
||||
"l10n_hk_12","Current Assets","12","asset_current","","False"
|
||||
"l10n_hk_1240","Account Receivable","1240","asset_receivable","","True"
|
||||
"l10n_hk_1241","Utility & Rental Deposit","1241","asset_current","","True"
|
||||
"l10n_hk_1242","Supplier Prepayments","1242","asset_current","","False"
|
||||
"l10n_hk_1243","Account Receivable (PoS)","1243","asset_receivable","","True"
|
||||
"l10n_hk_1245","Sundry Deposits","1245","asset_current","","False"
|
||||
"l10n_hk_1246","Other Receivable","1246","asset_receivable","","True"
|
||||
"l10n_hk_1250","Stock Interim Account (Received)","1250","asset_current","","False"
|
||||
"l10n_hk_1260","Stock Interim Account (Delivered)","1260","asset_current","","False"
|
||||
"l10n_hk_1270","Stock Valuation Account","1270","asset_current","","False"
|
||||
"l10n_hk_1400","Prepaid Expenses","1400","asset_current","","False"
|
||||
"l10n_hk_21","Non-current Liabilities","21","liability_non_current","","False"
|
||||
"l10n_hk_2107","Unearned Income from System","2107","liability_current","","False"
|
||||
"l10n_hk_22","Current Liabilities","22","liability_current","","False"
|
||||
"l10n_hk_2210","Accruals","2210","liability_current","","False"
|
||||
"l10n_hk_221001","MPF Accrued (Employer)","221001","liability_current","","False"
|
||||
"l10n_hk_221002","MPF Witheld (Employee)","221002","liability_current","","False"
|
||||
"l10n_hk_2211","Account Payable","2211","liability_payable","","True"
|
||||
"l10n_hk_2212","Receipt in Advance (Customer Prepayments)","2212","liability_current","","False"
|
||||
"l10n_hk_2214","Provision for Taxation","2214","liability_current","","False"
|
||||
"l10n_hk_2215","Proposed Dividend","2215","liability_current","","False"
|
||||
"l10n_hk_2216","Other Payable","2216","liability_payable","","True"
|
||||
"l10n_hk_2217","Salaries & Wages Payable","2217","liability_current","","True"
|
||||
"l10n_hk_31","Paid Capital","31","liability_current","","False"
|
||||
"l10n_hk_32","Accumulated Profit & Loss","32","liability_current","","False"
|
||||
"l10n_hk_33","Profit & Loss Account","33","liability_current","","False"
|
||||
"l10n_hk_34","Short-term Borrowing","34","liability_current","","False"
|
||||
"l10n_hk_41","Trade Income","41","income","account.account_tag_operating","False"
|
||||
"l10n_hk_42","Other Income and Gains","42","income","account.account_tag_operating","False"
|
||||
"l10n_hk_4210","Sundry Income","4210","income","account.account_tag_operating","False"
|
||||
"l10n_hk_4220","Exchange Adjustment","4220","income","account.account_tag_operating","False"
|
||||
"l10n_hk_4230","Bank Interest Income","4230","income","account.account_tag_operating","False"
|
||||
"l10n_hk_4240","Foreign Exchange Gain","4240","income","account.account_tag_operating","False"
|
||||
"l10n_hk_4250","Cash Discount Gain","4250","income_other","account.account_tag_operating","False"
|
||||
"l10n_hk_51","Costs","51","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5101","Trade Costs","5101","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5105","Misc. Costs","5105","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5106","Costs of Transportation","5106","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5111","Declaration Fees","5111","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5112","Packing Fees","5112","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_52","Expenses","52","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5201","Bank Charges","5201","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5202","Entertainment","5202","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5203","Electricity & Water Fees","5203","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5205","Postage & Stamps","5205","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5206","Printing & Stationery","5206","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5207","Rent & Rates","5207","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5208","Sundry Expenses","5208","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5209","Telecommunication Expenses","5209","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5210","Traffic Fees","5210","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5211","IT Expenses","5211","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5214","Insurance","5214","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5215","Sales Commission","5215","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5216","Overseas Traveling","5216","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5217","MPF Contribution (Employer)","5217","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5218","Wages & Salaries","5218","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5219","Bonus Payment","5219","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5221","Taxation","5221","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5222","Local Delivery","5222","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5223","Management Fees","5223","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5224","Depreciation","5224","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5225","Audit Fees","5225","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5226","Bad Debts","5226","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5228","Legal & Professional Fees","5228","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5229","Dividend","5229","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5231","Disposal","5231","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5234","Repair and Maintenance","5234","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5235","Advertising","5235","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5240","Foreign Exchange Loss","5240","expense","account.account_tag_operating","False"
|
||||
"l10n_hk_5250","Cash Discount Loss","5250","expense","account.account_tag_operating","False"
|
||||
|
|
|
@ -1,35 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="partner_demo_company_hk" model="res.partner">
|
||||
<record id="base.partner_demo_company_hk" model="res.partner" forcecreate="1">
|
||||
<field name="name">HK Company</field>
|
||||
<field name="vat"></field>
|
||||
<field name="vat"/>
|
||||
<field name="street">118 Connaught Road West</field>
|
||||
<field name="street2">Unit 07 - 10, 38/F Yat Chau International Plaza</field>
|
||||
<field name="city">Sai Ying Pun</field>
|
||||
<field name="country_id" ref="base.hk"/>
|
||||
|
||||
<field name="zip"></field>
|
||||
<field name="zip"/>
|
||||
<field name="phone">+852 5123 4567</field>
|
||||
<field name="email">info@company.hkexample.com</field>
|
||||
<field name="website">www.hkexample.com</field>
|
||||
<field name="is_company" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record id="demo_company_hk" model="res.company">
|
||||
<record id="base.demo_company_hk" model="res.company" forcecreate="1">
|
||||
<field name="name">HK Company</field>
|
||||
<field name="partner_id" ref="partner_demo_company_hk"/>
|
||||
<field name="partner_id" ref="base.partner_demo_company_hk"/>
|
||||
</record>
|
||||
|
||||
<function model="res.company" name="_onchange_country_id">
|
||||
<value eval="[ref('demo_company_hk')]"/>
|
||||
<value eval="[ref('base.demo_company_hk')]"/>
|
||||
</function>
|
||||
|
||||
<function model="res.users" name="write">
|
||||
<value eval="[ref('base.user_root'), ref('base.user_admin'), ref('base.user_demo')]"/>
|
||||
<value eval="{'company_ids': [(4, ref('l10n_hk.demo_company_hk'))]}"/>
|
||||
<value eval="{'company_ids': [(4, ref('base.demo_company_hk'))]}"/>
|
||||
</function>
|
||||
|
||||
<function model="account.chart.template" name="try_loading">
|
||||
<value eval="[ref('l10n_hk.l10n_hk_chart_template')]"/>
|
||||
<value model="res.company" eval="obj().env.ref('l10n_hk.demo_company_hk')"/>
|
||||
<value eval="[]"/>
|
||||
<value>hk</value>
|
||||
<value model="res.company" eval="obj().env.ref('base.demo_company_hk')"/>
|
||||
<value name="install_demo" eval="True"/>
|
||||
</function>
|
||||
</odoo>
|
||||
|
|
|
|||
108
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/i18n/l10n_hk.pot
Normal file
108
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/i18n/l10n_hk.pot
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * l10n_hk
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 19.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-12-30 19:07+0000\n"
|
||||
"PO-Revision-Date: 2025-12-30 19:07+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model,name:l10n_hk.model_account_chart_template
|
||||
msgid "Account Chart Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model,name:l10n_hk.model_res_partner_bank
|
||||
msgid "Bank Accounts"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid "Can't generate a FPS QR code with a currency other than HKD or CNY."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_chart_template__display_name
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__display_name
|
||||
msgid "Display Name"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model_terms:ir.ui.view,arch_db:l10n_hk.view_partner_bank_form_inherit_account
|
||||
msgid "Documentation"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__email
|
||||
msgid "Email Address"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__id
|
||||
msgid "FPS ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_chart_template__id
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__id
|
||||
msgid "ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid Email! Please enter a valid email address for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid FPS ID! Please enter a valid FPS ID with length 7 or 9 for account "
|
||||
"number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid Mobile! Please enter a valid mobile number with format +852-67891234"
|
||||
" for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__mobile
|
||||
msgid "Mobile Number"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_setup_bank_manual_config__proxy_type
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__proxy_type
|
||||
msgid "Proxy Type"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"The FPS Type must be either ID, Mobile or Email to generate a FPS QR code "
|
||||
"for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"The FPS Type must be either ID, Mobile or Email to generate a FPS QR code."
|
||||
msgstr ""
|
||||
112
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/i18n/zh_TW.po
Normal file
112
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/i18n/zh_TW.po
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * l10n_hk
|
||||
#
|
||||
# Weblate <noreply-mt-weblate@weblate.org>, 2025.
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 19.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2025-12-30 19:07+0000\n"
|
||||
"PO-Revision-Date: 2025-11-17 03:11+0000\n"
|
||||
"Last-Translator: Weblate <noreply-mt-weblate@weblate.org>\n"
|
||||
"Language-Team: Chinese (Traditional Han script) <https://translate.odoo.com/"
|
||||
"projects/odoo-19-l10n/l10n_hk/zh_Hant/>\n"
|
||||
"Language: zh_TW\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
"X-Generator: Weblate 5.12.2\n"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model,name:l10n_hk.model_account_chart_template
|
||||
msgid "Account Chart Template"
|
||||
msgstr "賬目總表範本"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model,name:l10n_hk.model_res_partner_bank
|
||||
msgid "Bank Accounts"
|
||||
msgstr "銀行帳戶"
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid "Can't generate a FPS QR code with a currency other than HKD or CNY."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_chart_template__display_name
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__display_name
|
||||
msgid "Display Name"
|
||||
msgstr "顯示名稱"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model_terms:ir.ui.view,arch_db:l10n_hk.view_partner_bank_form_inherit_account
|
||||
msgid "Documentation"
|
||||
msgstr "系統使用說明"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__email
|
||||
msgid "Email Address"
|
||||
msgstr "電子郵件地址"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__id
|
||||
msgid "FPS ID"
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_chart_template__id
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__id
|
||||
msgid "ID"
|
||||
msgstr "識別號"
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid Email! Please enter a valid email address for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid FPS ID! Please enter a valid FPS ID with length 7 or 9 for account "
|
||||
"number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"Invalid Mobile! Please enter a valid mobile number with format +852-67891234 "
|
||||
"for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields.selection,name:l10n_hk.selection__res_partner_bank__proxy_type__mobile
|
||||
msgid "Mobile Number"
|
||||
msgstr "流動電話號碼"
|
||||
|
||||
#. module: l10n_hk
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_account_setup_bank_manual_config__proxy_type
|
||||
#: model:ir.model.fields,field_description:l10n_hk.field_res_partner_bank__proxy_type
|
||||
msgid "Proxy Type"
|
||||
msgstr "代理類型"
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"The FPS Type must be either ID, Mobile or Email to generate a FPS QR code "
|
||||
"for account number %s."
|
||||
msgstr ""
|
||||
|
||||
#. module: l10n_hk
|
||||
#. odoo-python
|
||||
#: code:addons/l10n_hk/models/res_bank.py:0
|
||||
msgid ""
|
||||
"The FPS Type must be either ID, Mobile or Email to generate a FPS QR code."
|
||||
msgstr ""
|
||||
3
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/__init__.py
Normal file
3
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from . import res_bank
|
||||
from . import template_hk
|
||||
76
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/res_bank.py
Normal file
76
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/res_bank.py
Normal file
|
|
@ -0,0 +1,76 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import re
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.tools import single_email_re
|
||||
|
||||
|
||||
class ResPartnerBank(models.Model):
|
||||
_inherit = 'res.partner.bank'
|
||||
|
||||
proxy_type = fields.Selection(selection_add=[('id', "FPS ID"), ('mobile', "Mobile Number"), ('email', "Email Address")],
|
||||
ondelete={'id': 'set default', 'mobile': 'set default', 'email': 'set default'})
|
||||
|
||||
@api.constrains('proxy_type', 'proxy_value', 'partner_id')
|
||||
def _check_hk_proxy(self):
|
||||
auto_mobn_re = re.compile(r"^[+]\d{1,3}-\d{6,12}$")
|
||||
for bank in self.filtered(lambda b: b.country_code == 'HK'):
|
||||
if bank.proxy_type not in ['id', 'mobile', 'email', 'none', False]:
|
||||
raise ValidationError(_("The FPS Type must be either ID, Mobile or Email to generate a FPS QR code for account number %s.", bank.acc_number))
|
||||
if bank.proxy_type == 'id' and (not bank.proxy_value or len(bank.proxy_value) not in [7, 9]):
|
||||
raise ValidationError(_("Invalid FPS ID! Please enter a valid FPS ID with length 7 or 9 for account number %s.", bank.acc_number))
|
||||
if bank.proxy_type == 'mobile' and (not bank.proxy_value or not auto_mobn_re.match(bank.proxy_value)):
|
||||
raise ValidationError(_("Invalid Mobile! Please enter a valid mobile number with format +852-67891234 for account number %s.", bank.acc_number))
|
||||
if bank.proxy_type == 'email' and (not bank.proxy_value or not single_email_re.match(bank.proxy_value)):
|
||||
raise ValidationError(_("Invalid Email! Please enter a valid email address for account number %s.", bank.acc_number))
|
||||
|
||||
@api.depends('country_code')
|
||||
def _compute_country_proxy_keys(self):
|
||||
bank_hk = self.filtered(lambda b: b.country_code == 'HK')
|
||||
bank_hk.country_proxy_keys = 'id,mobile,email'
|
||||
super(ResPartnerBank, self - bank_hk)._compute_country_proxy_keys()
|
||||
|
||||
@api.depends('country_code')
|
||||
def _compute_display_qr_setting(self):
|
||||
bank_hk = self.filtered(lambda b: b.country_code == 'HK')
|
||||
bank_hk.display_qr_setting = True
|
||||
super(ResPartnerBank, self - bank_hk)._compute_display_qr_setting()
|
||||
|
||||
# Follow the documentation of FPS QR Code Standard [1]
|
||||
# [1]: https://www.hkma.gov.hk/media/eng/doc/key-functions/financial-infrastructure/infrastructure/retail-payment-initiatives/Common_QR_Code_Specification.pdf
|
||||
def _get_merchant_account_info(self):
|
||||
if self.country_code == 'HK':
|
||||
fps_type_mapping = {
|
||||
'id': 2,
|
||||
'mobile': 3,
|
||||
'email': 4,
|
||||
}
|
||||
fps_type = fps_type_mapping[self.proxy_type]
|
||||
merchant_account_vals = [
|
||||
(0, 'hk.com.hkicl'), # GUID
|
||||
(fps_type, self.proxy_value), # Proxy Type and Proxy Value
|
||||
]
|
||||
merchant_account_info = ''.join([self._serialize(*val) for val in merchant_account_vals])
|
||||
return (26, merchant_account_info)
|
||||
return super()._get_merchant_account_info()
|
||||
|
||||
def _get_additional_data_field(self, comment):
|
||||
if self.country_code == 'HK':
|
||||
return self._serialize(5, comment)
|
||||
return super()._get_additional_data_field(comment)
|
||||
|
||||
def _get_error_messages_for_qr(self, qr_method, debtor_partner, currency):
|
||||
if qr_method == 'emv_qr' and self.country_code == 'HK':
|
||||
if currency.name not in ['HKD', 'CNY']:
|
||||
return _("Can't generate a FPS QR code with a currency other than HKD or CNY.")
|
||||
return None
|
||||
|
||||
return super()._get_error_messages_for_qr(qr_method, debtor_partner, currency)
|
||||
|
||||
def _check_for_qr_code_errors(self, qr_method, amount, currency, debtor_partner, free_communication, structured_communication):
|
||||
if qr_method == 'emv_qr' and self.country_code == 'HK' and self.proxy_type not in ['id', 'mobile', 'email']:
|
||||
return _("The FPS Type must be either ID, Mobile or Email to generate a FPS QR code.")
|
||||
|
||||
return super()._check_for_qr_code_errors(qr_method, amount, currency, debtor_partner, free_communication, structured_communication)
|
||||
44
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/template_hk.py
Normal file
44
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/models/template_hk.py
Normal file
|
|
@ -0,0 +1,44 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo import models
|
||||
from odoo.addons.account.models.chart_template import template
|
||||
|
||||
|
||||
class AccountChartTemplate(models.AbstractModel):
|
||||
_inherit = 'account.chart.template'
|
||||
|
||||
@template('hk')
|
||||
def _get_hk_template_data(self):
|
||||
return {
|
||||
'property_account_receivable_id': 'l10n_hk_1240',
|
||||
'property_account_payable_id': 'l10n_hk_2211',
|
||||
'code_digits': '6',
|
||||
}
|
||||
|
||||
@template('hk', 'res.company')
|
||||
def _get_hk_res_company(self):
|
||||
return {
|
||||
self.env.company.id: {
|
||||
'anglo_saxon_accounting': True,
|
||||
'account_fiscal_country_id': 'base.hk',
|
||||
'bank_account_code_prefix': '1200',
|
||||
'cash_account_code_prefix': '1210',
|
||||
'transfer_account_code_prefix': '111220',
|
||||
'account_default_pos_receivable_account_id': 'l10n_hk_1243',
|
||||
'income_currency_exchange_account_id': 'l10n_hk_4240',
|
||||
'expense_currency_exchange_account_id': 'l10n_hk_5240',
|
||||
'account_journal_early_pay_discount_loss_account_id': 'l10n_hk_5250',
|
||||
'account_journal_early_pay_discount_gain_account_id': 'l10n_hk_4250',
|
||||
'income_account_id': 'l10n_hk_41',
|
||||
'expense_account_id': 'l10n_hk_51',
|
||||
'account_stock_journal_id': 'inventory_valuation',
|
||||
'account_stock_valuation_id': 'l10n_hk_1270',
|
||||
},
|
||||
}
|
||||
|
||||
@template('hk', 'account.account')
|
||||
def _get_hk_account_account(self):
|
||||
return {
|
||||
'l10n_hk_1270': {
|
||||
'account_stock_variation_id': 'l10n_hk_51',
|
||||
},
|
||||
}
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 2.4 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 39 KiB |
1
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/tests/__init__.py
Normal file
1
odoo-bringout-oca-ocb-l10n_hk/l10n_hk/tests/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import test_l10n_hk_emv_qr
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.exceptions import UserError
|
||||
from odoo.fields import Command
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
|
||||
@tagged('post_install_l10n', 'post_install', '-at_install')
|
||||
class TestL10nHKEmvQrCode(AccountTestInvoicingCommon):
|
||||
""" Test the generation of the EMV QR Code on invoices """
|
||||
|
||||
@classmethod
|
||||
def setup_armageddon_tax(cls, tax_name, company_data):
|
||||
# Hong Kong doesn't have any tax, so this methods will throw errors if we don't return None
|
||||
return None
|
||||
|
||||
@classmethod
|
||||
@AccountTestInvoicingCommon.setup_country('hk')
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.company_data['company'].qr_code = True
|
||||
cls.company_data['company'].partner_id.city = 'HK'
|
||||
|
||||
cls.acc_emv_hk = cls.env['res.partner.bank'].create({
|
||||
'acc_number': '123456789012345678',
|
||||
'partner_id': cls.company_data['company'].partner_id.id,
|
||||
'proxy_type': 'mobile',
|
||||
'proxy_value': '+852-67891234',
|
||||
'include_reference': True,
|
||||
})
|
||||
|
||||
cls.acc_emv_hk_without_fps_info = cls.env['res.partner.bank'].create({
|
||||
'acc_number': '1234567890',
|
||||
'partner_id': cls.company_data['company'].partner_id.id,
|
||||
})
|
||||
|
||||
cls.emv_qr_invoice = cls.env['account.move'].create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'currency_id': cls.env.ref('base.HKD').id,
|
||||
'partner_bank_id': cls.acc_emv_hk.id,
|
||||
'company_id': cls.company_data['company'].id,
|
||||
'invoice_line_ids': [Command.create({'quantity': 1, 'price_unit': 100})],
|
||||
})
|
||||
|
||||
cls.emv_qr_invoice_with_non_integer_amount = cls.env['account.move'].create({
|
||||
'move_type': 'out_invoice',
|
||||
'partner_id': cls.partner_a.id,
|
||||
'currency_id': cls.env.ref('base.HKD').id,
|
||||
'partner_bank_id': cls.acc_emv_hk.id,
|
||||
'company_id': cls.company_data['company'].id,
|
||||
'invoice_line_ids': [Command.create({'quantity': 1, 'price_unit': 100.5})],
|
||||
})
|
||||
|
||||
def test_emv_qr_code_generation(self):
|
||||
self.emv_qr_invoice.qr_code_method = 'emv_qr'
|
||||
self.emv_qr_invoice._generate_qr_code()
|
||||
|
||||
# Using invoice currency other than HKD or CNY should fail
|
||||
self.emv_qr_invoice.currency_id = self.env.ref('base.USD')
|
||||
with self.assertRaises(UserError, msg="The chosen QR-code type is not eligible for this invoice."):
|
||||
self.emv_qr_invoice._generate_qr_code()
|
||||
|
||||
# Without company partner city should fail
|
||||
self.emv_qr_invoice.currency_id = self.env.ref('base.HKD')
|
||||
self.company_data['company'].partner_id.city = False
|
||||
with self.assertRaises(UserError, msg="Missing Merchant City."):
|
||||
self.emv_qr_invoice._generate_qr_code()
|
||||
|
||||
# Without fps infomation should fail
|
||||
self.company_data['company'].partner_id.city = 'HK'
|
||||
self.emv_qr_invoice.partner_bank_id = self.acc_emv_hk_without_fps_info
|
||||
with self.assertRaises(UserError, msg="The account receiving the payment must have a FPS type and a FPS identifier set."):
|
||||
self.emv_qr_invoice._generate_qr_code()
|
||||
|
||||
def test_emv_qr_vals(self):
|
||||
self.emv_qr_invoice.qr_code_method = 'emv_qr'
|
||||
demo_payment_reference = 'INV/TEST/0001'
|
||||
emv_qr_vals = self.emv_qr_invoice.partner_bank_id._get_qr_vals(
|
||||
qr_method=self.emv_qr_invoice.qr_code_method,
|
||||
amount=self.emv_qr_invoice.amount_residual,
|
||||
currency=self.emv_qr_invoice.currency_id,
|
||||
debtor_partner=self.emv_qr_invoice.partner_id,
|
||||
free_communication=demo_payment_reference,
|
||||
structured_communication=demo_payment_reference,
|
||||
)
|
||||
|
||||
# Check the whole qr code string
|
||||
qr_code_string = ''.join(emv_qr_vals)
|
||||
self.assertEqual(qr_code_string, '00020101021226330012hk.com.hkicl0313+852-6789123452040000530334454031005802HK5914company_1_data6002HK62170513INV/TEST/00016304A154')
|
||||
|
||||
def test_emv_qr_vals_with_non_integer_amount(self):
|
||||
self.emv_qr_invoice_with_non_integer_amount.qr_code_method = 'emv_qr'
|
||||
unstruct_ref = 'INV/TEST/0002'
|
||||
emv_qr_vals = self.emv_qr_invoice_with_non_integer_amount.partner_bank_id._get_qr_vals(
|
||||
qr_method=self.emv_qr_invoice_with_non_integer_amount.qr_code_method,
|
||||
amount=self.emv_qr_invoice_with_non_integer_amount.amount_residual,
|
||||
currency=self.emv_qr_invoice_with_non_integer_amount.currency_id,
|
||||
debtor_partner=self.emv_qr_invoice_with_non_integer_amount.partner_id,
|
||||
free_communication=unstruct_ref,
|
||||
structured_communication=self.emv_qr_invoice_with_non_integer_amount.payment_reference,
|
||||
)
|
||||
|
||||
# Check the whole qr code string
|
||||
self.assertEqual(emv_qr_vals, '00020101021226330012hk.com.hkicl0313+852-678912345204000053033445405100.55802HK5914company_1_data6002HK62170513INV/TEST/000263049E64')
|
||||
|
||||
def test_invoice_default_code(self):
|
||||
""" If no QR method is selected by default, and the country does not match, it should not be selecting the EMV QR method. """
|
||||
self.acc_emv_hk.country_code = 'NZ'
|
||||
|
||||
self.assertIsNone(self.emv_qr_invoice._generate_qr_code())
|
||||
|
||||
def test_invoice_wrong_method(self):
|
||||
""" If an EMV QR is selected on the invoice with a wrong country, it should raise errors messages. """
|
||||
self.acc_emv_hk.country_code = 'NZ'
|
||||
self.emv_qr_invoice.qr_code_method = 'emv_qr'
|
||||
|
||||
error_message = self.acc_emv_hk._get_error_messages_for_qr('emv_qr', self.partner_a, self.env.ref('base.HKD'))
|
||||
self.assertIsNotNone(error_message)
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_partner_bank_form_inherit_account" model="ir.ui.view">
|
||||
<field name="name">res.partner.bank.form.inherit</field>
|
||||
<field name="model">res.partner.bank</field>
|
||||
<field name="inherit_id" ref="base.view_partner_bank_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="include_reference" position="after">
|
||||
<p invisible="country_code != 'HK'">
|
||||
<widget name="documentation_link" path="/applications/finance/fiscal_localizations/hong_kong.html" label="Documentation"/>
|
||||
</p>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
|
|
@ -1,12 +1,15 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-l10n_hk"
|
||||
version = "16.0.0"
|
||||
description = "Hong Kong - Accounting - Odoo addon"
|
||||
description = "Hong Kong - Accounting -
|
||||
Odoo addon
|
||||
"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-account>=16.0.0",
|
||||
"TODO_MAP-account_qr_code_emv>=19.0.0",
|
||||
"odoo-bringout-oca-ocb-account>=19.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
|
|
@ -16,7 +19,7 @@ classifiers = [
|
|||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"Programming Language :: Python :: 3",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.11",
|
||||
"Programming Language :: Python :: 3.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue