mirror of
https://github.com/bringout/oca-ocb-l10n_asia-pacific.git
synced 2026-04-26 10:42:00 +02:00
Initial commit: L10N_Asia Pacific packages
This commit is contained in:
commit
54c86b612c
828 changed files with 58224 additions and 0 deletions
48
odoo-bringout-oca-ocb-l10n_ph/README.md
Normal file
48
odoo-bringout-oca-ocb-l10n_ph/README.md
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
# Philippines - Accounting
|
||||
|
||||
Odoo addon: l10n_ph
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-l10n_ph
|
||||
```
|
||||
|
||||
## Dependencies
|
||||
|
||||
This addon depends on:
|
||||
- account
|
||||
- base_vat
|
||||
- l10n_multilang
|
||||
|
||||
## Manifest Information
|
||||
|
||||
- **Name**: Philippines - 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_ph`.
|
||||
|
||||
## 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
|
||||
- Reports: doc/REPORTS.md
|
||||
- Security: doc/SECURITY.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
|
||||
32
odoo-bringout-oca-ocb-l10n_ph/doc/ARCHITECTURE.md
Normal file
32
odoo-bringout-oca-ocb-l10n_ph/doc/ARCHITECTURE.md
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
# Architecture
|
||||
|
||||
```mermaid
|
||||
flowchart TD
|
||||
U[Users] -->|HTTP| V[Views and QWeb Templates]
|
||||
V --> C[Controllers]
|
||||
V --> W[Wizards – Transient Models]
|
||||
C --> M[Models and ORM]
|
||||
W --> M
|
||||
M --> R[Reports]
|
||||
DX[Data XML] --> M
|
||||
S[Security – ACLs and Groups] -. enforces .-> M
|
||||
|
||||
subgraph L10n_ph Module - l10n_ph
|
||||
direction LR
|
||||
M:::layer
|
||||
W:::layer
|
||||
C:::layer
|
||||
V:::layer
|
||||
R:::layer
|
||||
S:::layer
|
||||
DX:::layer
|
||||
end
|
||||
|
||||
classDef layer fill:#eef8ff,stroke:#6ea8fe,stroke-width:1px
|
||||
```
|
||||
|
||||
Notes
|
||||
- Views include tree/form/kanban templates and report templates.
|
||||
- Controllers provide website/portal routes when present.
|
||||
- Wizards are UI flows implemented with `models.TransientModel`.
|
||||
- Data XML loads data/demo records; Security defines groups and access.
|
||||
3
odoo-bringout-oca-ocb-l10n_ph/doc/CONFIGURATION.md
Normal file
3
odoo-bringout-oca-ocb-l10n_ph/doc/CONFIGURATION.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Configuration
|
||||
|
||||
Refer to Odoo settings for l10n_ph. Configure related models, access rights, and options as needed.
|
||||
3
odoo-bringout-oca-ocb-l10n_ph/doc/CONTROLLERS.md
Normal file
3
odoo-bringout-oca-ocb-l10n_ph/doc/CONTROLLERS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Controllers
|
||||
|
||||
This module does not define custom HTTP controllers.
|
||||
7
odoo-bringout-oca-ocb-l10n_ph/doc/DEPENDENCIES.md
Normal file
7
odoo-bringout-oca-ocb-l10n_ph/doc/DEPENDENCIES.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Dependencies
|
||||
|
||||
This addon depends on:
|
||||
|
||||
- [account](../../odoo-bringout-oca-ocb-account)
|
||||
- [base_vat](../../odoo-bringout-oca-ocb-base_vat)
|
||||
- [l10n_multilang](../../odoo-bringout-oca-ocb-l10n_multilang)
|
||||
4
odoo-bringout-oca-ocb-l10n_ph/doc/FAQ.md
Normal file
4
odoo-bringout-oca-ocb-l10n_ph/doc/FAQ.md
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# FAQ
|
||||
|
||||
- Q: Which Odoo version? A: 16.0 (OCA/OCB packaged).
|
||||
- Q: How to enable? A: Start server with --addon l10n_ph or install in UI.
|
||||
7
odoo-bringout-oca-ocb-l10n_ph/doc/INSTALL.md
Normal file
7
odoo-bringout-oca-ocb-l10n_ph/doc/INSTALL.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Install
|
||||
|
||||
```bash
|
||||
pip install odoo-bringout-oca-ocb-l10n_ph"
|
||||
# or
|
||||
uv pip install odoo-bringout-oca-ocb-l10n_ph"
|
||||
```
|
||||
16
odoo-bringout-oca-ocb-l10n_ph/doc/MODELS.md
Normal file
16
odoo-bringout-oca-ocb-l10n_ph/doc/MODELS.md
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Models
|
||||
|
||||
Detected core models and extensions in l10n_ph.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class account_move
|
||||
class account_payment
|
||||
class account_tax
|
||||
class account_tax_template
|
||||
class res_partner
|
||||
```
|
||||
|
||||
Notes
|
||||
- Classes show model technical names; fields omitted for brevity.
|
||||
- Items listed under _inherit are extensions of existing models.
|
||||
6
odoo-bringout-oca-ocb-l10n_ph/doc/OVERVIEW.md
Normal file
6
odoo-bringout-oca-ocb-l10n_ph/doc/OVERVIEW.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Overview
|
||||
|
||||
Packaged Odoo addon: l10n_ph. Provides features documented in upstream Odoo 16 under this addon.
|
||||
|
||||
- Source: OCA/OCB 16.0, addon l10n_ph
|
||||
- License: LGPL-3
|
||||
3
odoo-bringout-oca-ocb-l10n_ph/doc/REPORTS.md
Normal file
3
odoo-bringout-oca-ocb-l10n_ph/doc/REPORTS.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Reports
|
||||
|
||||
This module does not define custom reports.
|
||||
34
odoo-bringout-oca-ocb-l10n_ph/doc/SECURITY.md
Normal file
34
odoo-bringout-oca-ocb-l10n_ph/doc/SECURITY.md
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
# Security
|
||||
|
||||
Access control and security definitions in l10n_ph.
|
||||
|
||||
## Access Control Lists (ACLs)
|
||||
|
||||
Model access permissions defined in:
|
||||
- **[ir.model.access.csv](../l10n_ph/security/ir.model.access.csv)**
|
||||
- 1 model access rules
|
||||
|
||||
## Record Rules
|
||||
|
||||
Row-level security rules defined in:
|
||||
|
||||
```mermaid
|
||||
graph TB
|
||||
subgraph "Security Layers"
|
||||
A[Users] --> B[Groups]
|
||||
B --> C[Access Control Lists]
|
||||
C --> D[Models]
|
||||
B --> E[Record Rules]
|
||||
E --> F[Individual Records]
|
||||
end
|
||||
```
|
||||
|
||||
Security files overview:
|
||||
- **[ir.model.access.csv](../l10n_ph/security/ir.model.access.csv)**
|
||||
- Model access permissions (CRUD rights)
|
||||
|
||||
Notes
|
||||
- Access Control Lists define which groups can access which models
|
||||
- Record Rules provide row-level security (filter records by user/group)
|
||||
- Security groups organize users and define permission sets
|
||||
- All security is enforced at the ORM level by Odoo
|
||||
5
odoo-bringout-oca-ocb-l10n_ph/doc/TROUBLESHOOTING.md
Normal file
5
odoo-bringout-oca-ocb-l10n_ph/doc/TROUBLESHOOTING.md
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Troubleshooting
|
||||
|
||||
- Ensure Python and Odoo environment matches repo guidance.
|
||||
- Check database connectivity and logs if startup fails.
|
||||
- Validate that dependent addons listed in DEPENDENCIES.md are installed.
|
||||
7
odoo-bringout-oca-ocb-l10n_ph/doc/USAGE.md
Normal file
7
odoo-bringout-oca-ocb-l10n_ph/doc/USAGE.md
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Usage
|
||||
|
||||
Start Odoo including this addon (from repo root):
|
||||
|
||||
```bash
|
||||
python3 scripts/nix_odoo_web_server.py --db-name mydb --addon l10n_ph
|
||||
```
|
||||
8
odoo-bringout-oca-ocb-l10n_ph/doc/WIZARDS.md
Normal file
8
odoo-bringout-oca-ocb-l10n_ph/doc/WIZARDS.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Wizards
|
||||
|
||||
Transient models exposed as UI wizards in l10n_ph.
|
||||
|
||||
```mermaid
|
||||
classDiagram
|
||||
class Generate2307Wizard
|
||||
```
|
||||
4
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/__init__.py
Normal file
4
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/__init__.py
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
from . import wizard
|
||||
35
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/__manifest__.py
Normal file
35
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/__manifest__.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
"name": "Philippines - Accounting",
|
||||
"summary": """
|
||||
This is the module to manage the accounting chart for The Philippines.
|
||||
""",
|
||||
"category": "Accounting/Localizations/Account Charts",
|
||||
"version": "1.0",
|
||||
"author": "Odoo PS",
|
||||
"website": "https://www.odoo.com",
|
||||
"depends": [
|
||||
"account",
|
||||
"base_vat",
|
||||
"l10n_multilang",
|
||||
],
|
||||
"data": [
|
||||
"data/account_chart_template_data.xml",
|
||||
"data/account.account.template.csv",
|
||||
"data/account_chart_template_post_data.xml",
|
||||
"data/account_tax_group.xml",
|
||||
"data/account_tax_template.xml",
|
||||
"data/account_fiscal_position_template.xml",
|
||||
"data/account_fiscal_position_tax_template.xml",
|
||||
"data/account_chart_template_configure_data.xml",
|
||||
"wizard/generate_2307_wizard_views.xml",
|
||||
"views/account_move_views.xml",
|
||||
"views/account_payment_views.xml",
|
||||
"views/account_tax_views.xml",
|
||||
"views/res_partner_views.xml",
|
||||
"security/ir.model.access.csv",
|
||||
],
|
||||
"license": "LGPL-3",
|
||||
"icon": "/base/static/img/country_flags/ph.png",
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
id,name,code,account_type,chart_template_id/id,reconcile
|
||||
l10n_ph_100000,Bank Suspense Account,100000,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110000,Accounts Receivable,110000,asset_receivable,l10n_ph_chart_template,True
|
||||
l10n_ph_110003,Accounts Receivable (POS),110003,asset_receivable,l10n_ph_chart_template,True
|
||||
l10n_ph_110100,Advances to Suppliers,110100,asset_prepayments,l10n_ph_chart_template,False
|
||||
l10n_ph_110101,Deposits,110101,asset_prepayments,l10n_ph_chart_template,False
|
||||
l10n_ph_110102,Employees Receivable-Cash Advance,110102,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110103,Employees Receivable-Loan,110103,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110104,ER - Others,110104,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110105,Prepaid Insurance,110105,asset_prepayments,l10n_ph_chart_template,False
|
||||
l10n_ph_110106,Prepaid Pension - contribution,110106,asset_prepayments,l10n_ph_chart_template,False
|
||||
l10n_ph_110200,Prepaid Tax - Tax Credit Certificate,110200,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110201,Input VAT 12%,110201,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110202,Deferred Input VAT 12%,110202,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110203,Deferred Tax Asset,110203,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110205,Creditable Income Tax,110205,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110206,Tax Withheld by Customer,110206,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110207,Deferred Tax Withheld by Customer,110207,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110300,Inventory,110300,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110301,Purchases,110301,asset_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110302,Stock Interim (Received),110302,asset_current,l10n_ph_chart_template,True
|
||||
l10n_ph_110303,Stock Interim (Delivered),110303,asset_current,l10n_ph_chart_template,True
|
||||
l10n_ph_110304,Stock Interim (Production),110304,asset_current,l10n_ph_chart_template,True
|
||||
l10n_ph_110400,Other Non-current Asset,110400,asset_non_current,l10n_ph_chart_template,False
|
||||
l10n_ph_110500,Building and Leasehold Improvements,110500,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110501,"Furniture, Fixtures and Equipment",110501,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110502,Vehicles,110502,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110503,Computers,110503,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110504,Accum Depreciation-Bldg & Leasehold Imp,110504,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110505,"Accum Depreciation-Furniture, Fixtures and Equipment",110505,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110506,Accum Depreciation-Vehicles,110506,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_110507,Accum Depreciation-Computers,110507,asset_fixed,l10n_ph_chart_template,False
|
||||
l10n_ph_200000,Accounts Payable,200000,liability_payable,l10n_ph_chart_template,True
|
||||
l10n_ph_200200,Dividends Payable - Common Shares,200200,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200201,Unearned Revenue,200201,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200202,Customer Deposits Received,200202,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200300,Output VAT 12% - Actual,200300,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200301,Deferred Output VAT 12% - Actual,200301,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200302,Tax Payable-Withholding Tax Compensation,200302,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200303,Tax Pay-Withholding Tax Source,200303,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200304,Deferred Tax Pay-Withholding Tax Source,200304,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200305,Taxes Payable-Final Withholding Tax,200305,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200306,Tax Payable-Withholding Tax at Source (Accrual),200306,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200307,Income Tax Payable,200307,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200308,Accrued Fringe Benefit Tax,200308,liability_current,l10n_ph_chart_template,False
|
||||
l10n_ph_200400,Other Non-current Liability,200400,liability_non_current,l10n_ph_chart_template,False
|
||||
l10n_ph_300000,Capital Stock,300000,equity,l10n_ph_chart_template,False
|
||||
l10n_ph_300001,Additional Paid in Capital,300001,equity,l10n_ph_chart_template,False
|
||||
l10n_ph_300002,Retained Earnings,300002,equity,l10n_ph_chart_template,False
|
||||
l10n_ph_430400,Sales/Revenues,430400,income,l10n_ph_chart_template,False
|
||||
l10n_ph_510000,Cost of Goods Sold,510000,expense_direct_cost,l10n_ph_chart_template,False
|
||||
l10n_ph_511100,COGS - Purchases,511100,expense_direct_cost,l10n_ph_chart_template,False
|
||||
l10n_ph_511600,COGS - Freight Costs,511600,expense_direct_cost,l10n_ph_chart_template,False
|
||||
l10n_ph_511700,COGS - Direct Labor,511700,expense_direct_cost,l10n_ph_chart_template,False
|
||||
l10n_ph_511800,COGS - Factory/Processing Overhead,511800,expense_direct_cost,l10n_ph_chart_template,False
|
||||
l10n_ph_620000,Admin Expense,620000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_620001,Marketing Expense,620001,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_620100,Lease-Corporate Offices,620100,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_621000,Insurance Expenses,621000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_622000,Repairs & Maintenance,622000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623000,Salaries & Wages,623000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623001,Overtime Pay,623001,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623002,SSS Contribution,623002,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623003,HDMF Contribution,623003,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623004,PHIC Contribution,623004,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623005,Meal Allowance,623005,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623006,Other Allowance,623006,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623007,13th Month Pay,623007,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623008,Retirement Expenses,623008,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623009,Training and Webinar,623009,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623014,Sick Leave Expenses,623014,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_623015,Vacation Leave Expenses,623015,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_624000,Taxes and Licenses,624000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_625000,Utilities Expenses,625000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_626000,Security Services,626000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_626001,Professional Fees,626001,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_627000,Travel and Transportation,627000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_628000,Advertising and Promotion,628000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_629000,Depreciation Expense,629000,expense_depreciation,l10n_ph_chart_template,False
|
||||
l10n_ph_632000,Commission Expense,632000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_633000,Supplies Expenses,633000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_634000,Miscellaneous Expenses,634000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_634001,Bank Fees,634001,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_635000,Prov DA-Billed Accts,635000,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_635001,Prov-Probable Expenses,635001,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_635002,Prov for Inc Tax - Creditable,635002,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_635003,Provision for Tax - Final,635003,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_710100,Forex Gain,710100,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_710101,Forex Loss,710101,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_710102,Cash Difference Gain,710102,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_710103,Cash Difference Loss,710103,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_710200,Gain/Loss- Sale FA,710200,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_710201,Loss on FA Disposal,710201,expense,l10n_ph_chart_template,False
|
||||
l10n_ph_710300,Interest Inc-Savings,710300,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_710301,Interest Income-Savings Local,710301,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_710400,Other Income,710400,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_710500,Interest Expense-Suppliers' Credit Local,710500,income_other,l10n_ph_chart_template,False
|
||||
l10n_ph_999999,Undistributed Profits/Losses,999999,equity_unaffected,l10n_ph_chart_template,False
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo noupdate="1">
|
||||
<function model="account.chart.template" name="try_loading">
|
||||
<value eval="[ref('l10n_ph.l10n_ph_chart_template')]" />
|
||||
</function>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="l10n_ph_chart_template" model="account.chart.template">
|
||||
<field name="name">Philippines Account Template</field>
|
||||
<field name="bank_account_code_prefix">1000</field>
|
||||
<field name="cash_account_code_prefix">1001</field>
|
||||
<field name="transfer_account_code_prefix">1002</field>
|
||||
<field name="code_digits">6</field>
|
||||
<field name="currency_id" ref="base.PHP" />
|
||||
<field name="spoken_languages" eval="'tl_PH'"/>
|
||||
<field name="use_anglo_saxon" eval="True" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="l10n_ph_chart_template" model="account.chart.template">
|
||||
<field name="property_account_receivable_id" ref="l10n_ph_110000" />
|
||||
<field name="property_account_payable_id" ref="l10n_ph_200000" />
|
||||
<field name="property_account_income_categ_id" ref="l10n_ph_430400" />
|
||||
<field name="property_account_expense_categ_id" ref="l10n_ph_620000" />
|
||||
<field name="property_stock_valuation_account_id" ref="l10n_ph_110300" />
|
||||
<field name="property_stock_account_input_categ_id" ref="l10n_ph_110302" />
|
||||
<field name="property_stock_account_output_categ_id" ref="l10n_ph_110303" />
|
||||
<field name="income_currency_exchange_account_id" ref="l10n_ph_710100" />
|
||||
<field name="expense_currency_exchange_account_id" ref="l10n_ph_710101" />
|
||||
<field name="default_pos_receivable_account_id" ref="l10n_ph_110003" />
|
||||
<field name="account_journal_suspense_account_id" ref="l10n_ph_100000" />
|
||||
<field name="default_cash_difference_income_account_id" ref="l10n_ph_710102" />
|
||||
<field name="default_cash_difference_expense_account_id" ref="l10n_ph_710103" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<!-- VAT Registered -->
|
||||
<record id="l10n_ph_fiscal_position_tax_sale_vat_registered_vat_exempt" model="account.fiscal.position.tax.template">
|
||||
<field name="tax_src_id" ref="l10n_ph_tax_sale_vat_exempt" />
|
||||
<field name="tax_dest_id" ref="l10n_ph_tax_sale_vat_12" />
|
||||
<field name="position_id" ref="l10n_ph_fiscal_position_vat_registered" />
|
||||
</record>
|
||||
<record id="l10n_ph_fiscal_position_tax_purchase_vat_registered_vat_exempt" model="account.fiscal.position.tax.template">
|
||||
<field name="tax_src_id" ref="l10n_ph_tax_purchase_vat_exempt" />
|
||||
<field name="tax_dest_id" ref="l10n_ph_tax_purchase_vat_12" />
|
||||
<field name="position_id" ref="l10n_ph_fiscal_position_vat_registered" />
|
||||
</record>
|
||||
<record id="l10n_ph_fiscal_position_tax_sale_vat_exempt_vat_registered" model="account.fiscal.position.tax.template">
|
||||
<field name="tax_src_id" ref="l10n_ph_tax_sale_vat_12" />
|
||||
<field name="tax_dest_id" ref="l10n_ph_tax_sale_vat_exempt" />
|
||||
<field name="position_id" ref="l10n_ph_fiscal_position_vat_exempt" />
|
||||
</record>
|
||||
<record id="l10n_ph_fiscal_position_tax_purchase_vat_exempt_vat_registered" model="account.fiscal.position.tax.template">
|
||||
<field name="tax_src_id" ref="l10n_ph_tax_purchase_vat_12" />
|
||||
<field name="tax_dest_id" ref="l10n_ph_tax_purchase_vat_exempt" />
|
||||
<field name="position_id" ref="l10n_ph_fiscal_position_vat_exempt" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<odoo>
|
||||
<record id="l10n_ph_fiscal_position_vat_registered" model="account.fiscal.position.template">
|
||||
<field name="sequence">1</field>
|
||||
<field name="name">VAT Registered</field>
|
||||
<field name="chart_template_id" ref="l10n_ph_chart_template" />
|
||||
<field name="auto_apply" eval="True" />
|
||||
<field name="vat_required" eval="True" />
|
||||
<field name="country_id" ref="base.ph" />
|
||||
</record>
|
||||
<record id="l10n_ph_fiscal_position_vat_exempt" model="account.fiscal.position.template">
|
||||
<field name="sequence">2</field>
|
||||
<field name="name">VAT Exempt</field>
|
||||
<field name="chart_template_id" ref="l10n_ph_chart_template" />
|
||||
<field name="auto_apply" eval="True" />
|
||||
<field name="country_id" ref="base.ph" />
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version='1.0' encoding='utf-8' ?>
|
||||
<odoo noupdate="1">
|
||||
<record id="l10n_ph_tax_group_vat_12" model="account.tax.group">
|
||||
<field name="name">VAT 12%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_vat_exempt" model="account.tax.group">
|
||||
<field name="name">VAT Exempt</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_p5" model="account.tax.group">
|
||||
<field name="name">WHT 0.5%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_1" model="account.tax.group">
|
||||
<field name="name">WHT 1%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_2" model="account.tax.group">
|
||||
<field name="name">WHT 2%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_5" model="account.tax.group">
|
||||
<field name="name">WHT 5%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_10" model="account.tax.group">
|
||||
<field name="name">WHT 10%</field>
|
||||
</record>
|
||||
<record id="l10n_ph_tax_group_wht_15" model="account.tax.group">
|
||||
<field name="name">WHT 15%</field>
|
||||
</record>
|
||||
</odoo>
|
||||
1049
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/data/account_tax_template.xml
Normal file
1049
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/data/account_tax_template.xml
Normal file
File diff suppressed because it is too large
Load diff
7
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/__init__.py
Normal file
7
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/__init__.py
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import res_partner
|
||||
from . import account_move
|
||||
from . import account_payment
|
||||
from . import account_tax
|
||||
from . import account_tax_template
|
||||
19
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/account_move.py
Normal file
19
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/account_move.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountMove(models.Model):
|
||||
_inherit = "account.move"
|
||||
|
||||
def action_open_l10n_ph_2307_wizard(self):
|
||||
vendor_bills = self.filtered_domain([('move_type', '=', 'in_invoice')])
|
||||
if vendor_bills:
|
||||
wizard_action = self.env["ir.actions.act_window"]._for_xml_id("l10n_ph.view_l10n_ph_2307_wizard_act_window")
|
||||
wizard_action.update({
|
||||
'context': {'default_moves_to_export': vendor_bills.ids}
|
||||
})
|
||||
return wizard_action
|
||||
else:
|
||||
raise UserError(_('Only Vendor Bills are available.'))
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import _, models
|
||||
from odoo.exceptions import UserError
|
||||
|
||||
|
||||
class AccountPayment(models.Model):
|
||||
_inherit = "account.payment"
|
||||
|
||||
def action_open_l10n_ph_2307_wizard(self):
|
||||
self.ensure_one()
|
||||
if self.payment_type == 'outbound':
|
||||
wizard_action = self.env["ir.actions.act_window"]._for_xml_id("l10n_ph.view_l10n_ph_2307_wizard_act_window")
|
||||
wizard_action.update({
|
||||
'context': {'default_moves_to_export': self.reconciled_bill_ids.ids}
|
||||
})
|
||||
return wizard_action
|
||||
else:
|
||||
raise UserError(_('Only Outbound Payment is available.'))
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountTax(models.Model):
|
||||
_inherit = "account.tax"
|
||||
|
||||
l10n_ph_atc = fields.Char("Philippines ATC")
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class AccountTaxTemplate(models.Model):
|
||||
_inherit = "account.tax.template"
|
||||
|
||||
l10n_ph_atc = fields.Char("Philippines ATC")
|
||||
|
||||
def _get_tax_vals(self, company, tax_template_to_tax):
|
||||
val = super()._get_tax_vals(company, tax_template_to_tax)
|
||||
val.update({"l10n_ph_atc": self.l10n_ph_atc})
|
||||
return val
|
||||
25
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/res_partner.py
Normal file
25
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/models/res_partner.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, api, models
|
||||
|
||||
|
||||
class ResPartner(models.Model):
|
||||
_inherit = "res.partner"
|
||||
|
||||
branch_code = fields.Char("Branch Code", default='000', compute='_compute_branch_code', store=True)
|
||||
first_name = fields.Char("First Name")
|
||||
middle_name = fields.Char("Middle Name")
|
||||
last_name = fields.Char("Last Name")
|
||||
|
||||
@api.model
|
||||
def _commercial_fields(self):
|
||||
return super()._commercial_fields() + ['branch_code']
|
||||
|
||||
@api.depends('vat', 'country_id')
|
||||
def _compute_branch_code(self):
|
||||
for partner in self:
|
||||
branch_code = '000'
|
||||
if partner.country_id.code == 'PH' and partner.vat:
|
||||
match = partner.__check_vat_ph_re.match(partner.vat)
|
||||
branch_code = match and match.group(1) and match.group(1)[1:] or branch_code
|
||||
partner.branch_code = branch_code
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
|
||||
generate_2307_wizard,access_generate_2307_wizard,model_l10n_ph_2307_wizard,account.group_account_invoice,1,1,1,1
|
||||
|
3
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/tests/__init__.py
Normal file
3
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/tests/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_bir_2307
|
||||
135
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/tests/test_bir_2307.py
Normal file
135
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/tests/test_bir_2307.py
Normal file
|
|
@ -0,0 +1,135 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||
from odoo.tests import tagged
|
||||
|
||||
import xlrd
|
||||
import io
|
||||
import base64
|
||||
|
||||
|
||||
@tagged("post_install_l10n", "post_install", "-at_install")
|
||||
class TestBir2037(AccountTestInvoicingCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls, chart_template_ref="l10n_ph.l10n_ph_chart_template"):
|
||||
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||
|
||||
cls.partner = cls.env['res.partner'].create({
|
||||
'vat': '123-456-789-001',
|
||||
'branch_code': '001',
|
||||
'name': 'Jose Mangahas Cuyegkeng',
|
||||
'first_name': 'Jose',
|
||||
'middle_name': 'Mangahas',
|
||||
'last_name': 'Cuyegkeng',
|
||||
'street': "250 Amorsolo Street",
|
||||
'city': "Manila",
|
||||
'country_id': cls.env.ref('base.ph').id,
|
||||
'zip': "+900–1-096",
|
||||
})
|
||||
|
||||
cls.partner_a.write({
|
||||
'vat': '123-456-789-001',
|
||||
'branch_code': '001',
|
||||
'name': 'JMC Company',
|
||||
'street': "250 Amorsolo Street",
|
||||
'city': "Manila",
|
||||
'country_id': cls.env.ref('base.ph').id,
|
||||
'zip': "+900–1-096",
|
||||
'is_company': True,
|
||||
})
|
||||
|
||||
def test_01_no_atc(self):
|
||||
""" Ensure that generating the file on a document where no taxes has an ATC set will work, although gives an empty file. """
|
||||
tax = self._create_tax('10% VAT', 10)
|
||||
bill = self._create_invoice(
|
||||
move_type='in_invoice',
|
||||
invoice_amount=100,
|
||||
taxes=tax,
|
||||
)
|
||||
bill.action_post()
|
||||
wizard = self.env['l10n_ph_2307.wizard'].with_context(default_moves_to_export=bill.ids).create({})
|
||||
wizard.action_generate()
|
||||
report_file = io.BytesIO(base64.b64decode(wizard.generate_xls_file))
|
||||
xl = xlrd.open_workbook(file_contents=report_file.read())
|
||||
sheet = xl.sheet_by_index(0)
|
||||
|
||||
result = []
|
||||
for row in range(1, sheet.nrows):
|
||||
result.append(sheet.row_values(row))
|
||||
self.assertEqual(result, [])
|
||||
|
||||
def test_02_simple_atc(self):
|
||||
""" Ensure that generating the file on a document with a single ATC tax and check the results. """
|
||||
tax = self._create_tax('10% ATC', -10, l10n_ph_atc='WI010')
|
||||
bill = self._create_invoice(
|
||||
move_type='in_invoice',
|
||||
invoice_amount=1000,
|
||||
taxes=tax,
|
||||
partner_id=self.partner.id,
|
||||
date_invoice='2025-01-01',
|
||||
)
|
||||
bill.action_post()
|
||||
wizard = self.env['l10n_ph_2307.wizard'].with_context(default_moves_to_export=bill.ids).create({})
|
||||
wizard.action_generate()
|
||||
report_file = io.BytesIO(base64.b64decode(wizard.generate_xls_file))
|
||||
xl = xlrd.open_workbook(file_contents=report_file.read())
|
||||
sheet = xl.sheet_by_index(0)
|
||||
|
||||
result = []
|
||||
for row in range(1, sheet.nrows):
|
||||
result.append(sheet.row_values(row))
|
||||
self.assertEqual(result, [
|
||||
['01/01/2025', '123456789', '001', '', 'Cuyegkeng', 'Jose', 'Mangahas', '250 Amorsolo Street, Manila, Philippines', '+900–1-096', '', 'WI010', 1000.0, -10.0, -100.0]
|
||||
])
|
||||
|
||||
def test_03_atc_affected_by_vat(self):
|
||||
""" Ensure that generating the file on a document where the ATC tax is affected works as expected. """
|
||||
vat = self._create_tax('15% VAT', 15, include_base_amount=True)
|
||||
atc = self._create_tax('10% ATC', -10, l10n_ph_atc='WI010', is_base_affected=True)
|
||||
atc.description = '10% ATC'
|
||||
bill = self._create_invoice(
|
||||
move_type='in_invoice',
|
||||
invoice_amount=1000,
|
||||
taxes=(vat | atc),
|
||||
partner_id=self.partner.id,
|
||||
date_invoice='2025-01-01',
|
||||
)
|
||||
bill.action_post()
|
||||
wizard = self.env['l10n_ph_2307.wizard'].with_context(default_moves_to_export=bill.ids).create({})
|
||||
wizard.action_generate()
|
||||
report_file = io.BytesIO(base64.b64decode(wizard.generate_xls_file))
|
||||
xl = xlrd.open_workbook(file_contents=report_file.read())
|
||||
sheet = xl.sheet_by_index(0)
|
||||
|
||||
result = []
|
||||
for row in range(1, sheet.nrows):
|
||||
result.append(sheet.row_values(row))
|
||||
self.assertEqual(result, [
|
||||
['01/01/2025', '123456789', '001', '', 'Cuyegkeng', 'Jose', 'Mangahas', '250 Amorsolo Street, Manila, Philippines', '+900–1-096', '10% ATC', 'WI010', 1150.0, -10.0, -115.0]
|
||||
])
|
||||
|
||||
def test_04_multi_currency(self):
|
||||
""" Ensure that generating the file on a document of another currency than the company's gives the correct result. """
|
||||
tax = self._create_tax('10% ATC', -10, l10n_ph_atc='WI010')
|
||||
bill = self._create_invoice(
|
||||
move_type='in_invoice',
|
||||
invoice_amount=2000,
|
||||
taxes=tax,
|
||||
partner_id=self.partner_a.id,
|
||||
date_invoice='2025-01-01',
|
||||
currency_id=self.currency_data['currency'].id,
|
||||
)
|
||||
bill.action_post()
|
||||
wizard = self.env['l10n_ph_2307.wizard'].with_context(default_moves_to_export=bill.ids).create({})
|
||||
wizard.action_generate()
|
||||
report_file = io.BytesIO(base64.b64decode(wizard.generate_xls_file))
|
||||
xl = xlrd.open_workbook(file_contents=report_file.read())
|
||||
sheet = xl.sheet_by_index(0)
|
||||
|
||||
result = []
|
||||
for row in range(1, sheet.nrows):
|
||||
result.append(sheet.row_values(row))
|
||||
# We expect the values in company currency in the file.
|
||||
self.assertEqual(result, [
|
||||
['01/01/2025', '123456789', '001', 'JMC Company', '', '', '', '250 Amorsolo Street, Manila, Philippines', '+900–1-096', '', 'WI010', 1000.0, -10.0, -100.0]
|
||||
])
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<odoo>
|
||||
<record id="action_account_move_bir_2307" model="ir.actions.server">
|
||||
<field name="name">Download BIR 2307 XLS</field>
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
|
||||
<field name="model_id" ref="account.model_account_move"/>
|
||||
<field name="binding_model_id" ref="account.model_account_move"/>
|
||||
<field name="binding_view_types">list,form</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = records.action_open_l10n_ph_2307_wizard()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,12 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="action_account_payment_bir_2307" model="ir.actions.server">
|
||||
<field name="name">Download BIR 2307 XLS</field>
|
||||
<field name="groups_id" eval="[(4, ref('account.group_account_invoice'))]"/>
|
||||
<field name="model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_model_id" ref="account.model_account_payment"/>
|
||||
<field name="binding_view_types">form</field>
|
||||
<field name="state">code</field>
|
||||
<field name="code">action = record.action_open_l10n_ph_2307_wizard()</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<odoo>
|
||||
<record id="view_tax_form" model="ir.ui.view">
|
||||
<field name="name">account.tax.view.form.inherit.l10n_ph</field>
|
||||
<field name="model">account.tax</field>
|
||||
<field name="inherit_id" ref="account.view_tax_form" />
|
||||
<field name="arch" type="xml">
|
||||
<notebook position="inside">
|
||||
<page name="l10n_ph" string="Philippines">
|
||||
<group>
|
||||
<group>
|
||||
<field name="l10n_ph_atc" />
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<odoo>
|
||||
<record id="view_partner_form" model="ir.ui.view">
|
||||
<field name="name">res.partner.form.inherit.l10n_ph_bir</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='vat']" position="after">
|
||||
<field name="branch_code"/>
|
||||
<field name="first_name" attrs="{'invisible': [('is_company','=', True)]}"/>
|
||||
<field name="middle_name" attrs="{'invisible': [('is_company','=', True)]}"/>
|
||||
<field name="last_name" attrs="{'invisible': [('is_company','=', True)]}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
3
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/wizard/__init__.py
Normal file
3
odoo-bringout-oca-ocb-l10n_ph/l10n_ph/wizard/__init__.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import generate_2307_wizard
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import base64
|
||||
import io
|
||||
import re
|
||||
import xlwt
|
||||
|
||||
from odoo import fields, models
|
||||
from odoo.tools.misc import format_date
|
||||
|
||||
|
||||
COLUMN_HEADER_MAP = {
|
||||
"Reporting_Month": "invoice_date",
|
||||
"Vendor_TIN": "vat",
|
||||
"branchCode": "branch_code",
|
||||
"companyName": "company_name",
|
||||
"surName": "last_name",
|
||||
"firstName": "first_name",
|
||||
"middleName": "middle_name",
|
||||
"address": "address",
|
||||
"zip_code": "zip",
|
||||
"nature": "tax_description",
|
||||
"ATC": "atc",
|
||||
"income_payment": "price_subtotal",
|
||||
"ewt_rate": "amount",
|
||||
"tax_amount": "tax_amount",
|
||||
}
|
||||
|
||||
class Generate2307Wizard(models.TransientModel):
|
||||
_name = "l10n_ph_2307.wizard"
|
||||
_description = "Exports 2307 data to a XLS file."
|
||||
|
||||
moves_to_export = fields.Many2many("account.move", string="Joural To Include")
|
||||
generate_xls_file = fields.Binary(
|
||||
"Generated file",
|
||||
help="Technical field used to temporarily hold the generated XLS file before its downloaded."
|
||||
)
|
||||
|
||||
def _write_single_row(self, worksheet, worksheet_row, values):
|
||||
for index, field in enumerate(COLUMN_HEADER_MAP.values()):
|
||||
worksheet.write(worksheet_row, index, label=values[field])
|
||||
|
||||
def _write_rows(self, worksheet, moves):
|
||||
worksheet_row = 0
|
||||
for move in moves:
|
||||
worksheet_row += 1
|
||||
partner = move.commercial_partner_id
|
||||
partner_address_info = [partner.street, partner.street2, partner.city, partner.state_id.name, partner.country_id.name]
|
||||
first_name = middle_name = last_name = ''
|
||||
if partner.company_type == 'person':
|
||||
first_name = partner.first_name or ''
|
||||
middle_name = partner.middle_name or ''
|
||||
last_name = partner.last_name or ''
|
||||
values = {
|
||||
'invoice_date': format_date(self.env, move.invoice_date, date_format="MM/dd/yyyy"),
|
||||
'vat': re.sub(r'\-', '', partner.vat)[:9] if partner.vat else '',
|
||||
'branch_code': partner.branch_code or '000',
|
||||
'company_name': partner.name if partner.company_type == 'company' else '',
|
||||
'first_name': first_name,
|
||||
'middle_name': middle_name,
|
||||
'last_name': last_name,
|
||||
'address': ', '.join([val for val in partner_address_info if val]),
|
||||
'zip': partner.zip or '',
|
||||
}
|
||||
aggregated_taxes = move._prepare_invoice_aggregated_taxes()
|
||||
for invoice_line, tax_details_for_line in aggregated_taxes['tax_details_per_record'].items():
|
||||
for tax_detail in tax_details_for_line['tax_details'].values():
|
||||
tax = tax_detail['tax']
|
||||
if not tax.l10n_ph_atc:
|
||||
continue
|
||||
values['tax_description'] = tax.description or ''
|
||||
values['atc'] = tax.l10n_ph_atc
|
||||
values['price_subtotal'] = tax_detail['base_amount']
|
||||
values['amount'] = tax.amount
|
||||
values['tax_amount'] = tax_detail['tax_amount']
|
||||
self._write_single_row(worksheet, worksheet_row, values)
|
||||
worksheet_row += 1
|
||||
|
||||
def action_generate(self):
|
||||
""" Generate a xls format file for importing to
|
||||
https://bir-excel-uploader.com/excel-file-to-bir-dat-format/#bir-form-2307-settings.
|
||||
This website will then generate a BIR 2307 format excel file for uploading to the
|
||||
PH government.
|
||||
"""
|
||||
self.ensure_one()
|
||||
|
||||
file_data = io.BytesIO()
|
||||
workbook = xlwt.Workbook(encoding='utf-8')
|
||||
worksheet = workbook.add_sheet('Form2307')
|
||||
|
||||
for index, col_header in enumerate(COLUMN_HEADER_MAP.keys()):
|
||||
worksheet.write(0, index, label=col_header)
|
||||
|
||||
self._write_rows(worksheet, self.moves_to_export)
|
||||
|
||||
workbook.save(file_data)
|
||||
file_data.seek(0)
|
||||
self.generate_xls_file = base64.b64encode(file_data.read())
|
||||
|
||||
return {
|
||||
"type": "ir.actions.act_url",
|
||||
"target": "self",
|
||||
"url": "/web/content?model=l10n_ph_2307.wizard&download=true&field=generate_xls_file&filename=Form_2307.xls&id={}".format(self.id),
|
||||
}
|
||||
|
|
@ -0,0 +1,36 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<record id="l10n_ph_2307_wizard_view_form" model="ir.ui.view">
|
||||
<field name="name">l10n_ph_2307.wizard.form</field>
|
||||
<field name="model">l10n_ph_2307.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Generate BIR 2307 Report">
|
||||
This will export a XLS file for BIR 2307.
|
||||
<group>
|
||||
<field name="moves_to_export" nolabel="1" readonly="1" colspan="2">
|
||||
<tree>
|
||||
<field name="name" optional="show"/>
|
||||
<field name="invoice_partner_display_name" string="Vendor"/>
|
||||
<field name="invoice_date" string="Bill Date"/>
|
||||
<field name="invoice_date_due"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="amount_tax_signed" string="Tax" sum="Total" optional="hide" modifiers="{'readonly':true}" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="amount_total_signed" string="Total" sum="Total" decoration-bf="1" optional="show" widget="monetary" options="{'currency_field': 'currency_id'}"/>
|
||||
<field name="state" widget="badge" decoration-success="state == 'posted'" decoration-info="state == 'draft'" optional="show" on_change="1" modifiers="{'readonly':true, 'required':true}"/>
|
||||
</tree>
|
||||
</field>
|
||||
</group>
|
||||
<footer>
|
||||
<button string="Generate" type="object" name="action_generate" class="btn btn-primary" data-hotkey="q"/>
|
||||
<button string="Cancel" special="cancel" data-hotkey="z" class="btn btn-secondary"/>
|
||||
</footer>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_l10n_ph_2307_wizard_act_window" model="ir.actions.act_window">
|
||||
<field name="name">BIR 2307 Report</field>
|
||||
<field name="res_model">l10n_ph_2307.wizard</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</odoo>
|
||||
46
odoo-bringout-oca-ocb-l10n_ph/pyproject.toml
Normal file
46
odoo-bringout-oca-ocb-l10n_ph/pyproject.toml
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
[project]
|
||||
name = "odoo-bringout-oca-ocb-l10n_ph"
|
||||
version = "16.0.0"
|
||||
description = "Philippines - Accounting -
|
||||
This is the module to manage the accounting chart for The Philippines.
|
||||
"
|
||||
authors = [
|
||||
{ name = "Ernad Husremovic", email = "hernad@bring.out.ba" }
|
||||
]
|
||||
dependencies = [
|
||||
"odoo-bringout-oca-ocb-account>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-base_vat>=16.0.0",
|
||||
"odoo-bringout-oca-ocb-l10n_multilang>=16.0.0",
|
||||
"requests>=2.25.1"
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">= 3.11"
|
||||
classifiers = [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"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.12",
|
||||
"Topic :: Office/Business",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
homepage = "https://github.com/bringout/0"
|
||||
repository = "https://github.com/bringout/0"
|
||||
|
||||
[build-system]
|
||||
requires = ["hatchling"]
|
||||
build-backend = "hatchling.build"
|
||||
|
||||
[tool.hatch.metadata]
|
||||
allow-direct-references = true
|
||||
|
||||
[tool.hatch.build.targets.wheel]
|
||||
packages = ["l10n_ph"]
|
||||
|
||||
[tool.rye]
|
||||
managed = true
|
||||
dev-dependencies = [
|
||||
"pytest>=8.4.1",
|
||||
]
|
||||
Loading…
Add table
Add a link
Reference in a new issue