Skip to main content

CVGo VAT-Inclusive Tax

Panville is on Philippine VAT (l10n_ph) — 12% VAT on most sales. CVGo prices are already VAT-inclusive, so shell18 uses a special tax that extracts VAT from the inclusive price rather than adding it on top.

The tax

Each branch has its own copy of:

FieldValue
Name12% CVGo (Incl.)
Amount12.0
Amount Typepercent
Type Tax Usesale
Price Include Overridetax_included
Tax GroupVAT 12% (each branch's own copy)

How the per-branch tax is created

The post-install hook in shell18/__init__.py runs at -i shell18:

  1. Loads the l10n_ph chart on Panville. Odoo 18 cascades the chart to all child branches automatically (account.chart.template._load walks child_ids)
  2. After cascade, each branch has its own VAT 12% tax group
  3. The hook iterates panville.child_ids and creates the 12% CVGo (Incl.) tax on each, referencing that branch's group

This ensures _check_company consistency: a SO created on a branch references a tax owned by the same branch.

How posting picks the right tax

In cvgo_pos_data_posting.py, the tax search is scoped by the data's branch:

taxes_obj = self.env['account.tax'].search([
('type_tax_use', '=', 'sale'),
('company_id', '=', self.company_id.id),
])

Then _find_tax(taxes_obj, tax_code, tax_rate) matches by:

  1. Amount (12.0 or 0.0 from CVGo tax_rate)
  2. Prefer price_include_override == 'tax_included' — this picks the CVGo tax over any plain "12% VAT" the chart might add
  3. Fallback to any matching tax if no inclusive variant exists

Reading totals

Because the tax is inclusive:

  • CVGo sale_total = pump price the customer paid (VAT-inclusive)
  • Odoo amount_total = same number
  • Odoo amount_untaxed = sale_total / 1.12
  • Odoo amount_tax = sale_total - amount_untaxed

The reconciliation tab compares these directly — see Reconciliation.

Verifying

-- Confirm each branch has the CVGo tax
SELECT t.name, t.amount, t.price_include_override, c.name AS branch
FROM account_tax t
JOIN res_company c ON t.company_id = c.id
WHERE t.name = '12% CVGo (Incl.)'
ORDER BY c.name;

Expect exactly six rows (one per branch). Panville (parent) may or may not have one depending on whether you transact on the parent — shell18 only creates the tax on branches.

What if the hook didn't run?

The post-install hook only runs on -i shell18. If you upgraded with -u and the tax is missing:

  1. Confirm l10n_ph chart is loaded on Panville (Settings > Accounting > Configuration > Chart Template)
  2. Re-run install on a fresh DB, or create the missing taxes manually per branch via Settings > Accounting > Taxes