Skip to content

Commit 6a5f0ab

Browse files
committed
[IMP] Taxes: changes specific to 18.0
- changes for Python taxes - changes to the `Included in Price` setting X-original-commit: 1de5c80
1 parent 9a2b04b commit 6a5f0ab

File tree

1 file changed

+41
-21
lines changed
  • content/applications/finance/accounting

1 file changed

+41
-21
lines changed

content/applications/finance/accounting/taxes.rst

Lines changed: 41 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ price. The following options are available:
8181
tax-excluded sales price
8282
- :ref:`Percentage of Price Tax Included <taxes/computation/percentage-of-price-tax-included>`: a
8383
percentage of the tax-included total
84-
- :ref:`Python Code <taxes/computation/python-code>`: a custom user-defined formula
84+
- :ref:`Custom Formula <taxes/computation/python-code>`: a custom user-defined formula
8585

8686
.. _taxes/computation/group-of-taxes:
8787

@@ -217,34 +217,45 @@ which determines whether the sales price should be treated as tax-excluded or ta
217217

218218
.. _taxes/computation/python-code:
219219

220-
Python code
221-
***********
220+
Custom formula
221+
**************
222222

223223
.. important::
224224
If a tax can be expressed as a multiple of the quantity of the product to which it applies, it
225225
can be defined as a :ref:`Fixed <taxes/computation/fixed>` tax. Doing so is strongly recommended
226-
over defining a :guilabel:`Python Code` tax.
226+
over defining a :guilabel:`Custom Formula` tax.
227+
228+
.. note::
229+
To use :guilabel:`Custom Formula` taxes, :ref:`install <general/install>` the :guilabel:`Define
230+
Taxes as Python Code` (`account_python_tax`) module.
227231

228-
A tax defined as :guilabel:`Python Code` consists of two snippets of Python code that are executed
229-
in a local environment that can access the unit price, quantity, product, and partner.
230-
:guilabel:`Python Code` defines the amount of the tax, and :guilabel:`Applicable Code` defines
231-
whether the tax is applied. Enter a formula for each field at the bottom of the
232-
:guilabel:`Definition` tab.
232+
For a :guilabel:`Custom Formula` tax, the tax amount is computed according to a Python expression
233+
defined in the :guilabel:`Formula` field. The Python expression may contain the following tokens:
233234

234-
.. example::
235-
A product has a sales price of $1000, and we apply a :guilabel:`Python Code` tax with the
236-
following configuration:
235+
- any of the following variables:
237236

238-
- :guilabel:`Python Code`: `result = price_unit * 0.10` and
239-
- :guilabel:`Applicable Code`: `result = True`.
237+
- `price_unit`: the unit price of the product
238+
- `base`: the taxable basis on which the tax is applied - may differ from the `price_unit` if
239+
other taxes are applied first
240+
- `quantity`: the quantity of the product
241+
- `product`: the product record - product fields can also be accessed
242+
243+
- integers and floating-point numbers
244+
245+
- the following permitted tokens: `(`, `)`, `+`, `-`, `*`, `/`, `,`, `<`, `>`, `<=`, `>=`, `and`,
246+
`or`, `None`, `min`, and `max`
247+
248+
.. example::
249+
A product has a sales price of $1000, and we apply a :guilabel:`Custom Formula` tax with a
250+
:guilabel:`Formula` of `max(base, 500) * 0.10 + min(base - 500, 0) * 0.20`
240251

241252
We then have:
242253

243254
+-------------+-------------+----------+----------+
244255
| Product | Price | Tax | Total |
245256
| sales price | without tax | | |
246257
+=============+=============+==========+==========+
247-
| 1,000 | 1,000 | 100 | 1,100.00 |
258+
| 1,000 | 1,000 | 150 | 1,150.00 |
248259
+-------------+-------------+----------+----------+
249260

250261
.. _taxes/active:
@@ -405,10 +416,21 @@ invoice line.
405416
Included in price
406417
~~~~~~~~~~~~~~~~~
407418

408-
With this option activated, the tax will treat the sales price on which it is applied as a total
409-
including the tax amount. The tax computation will split the sales price into a base amount and a
410-
tax amount. This makes it suitable for B2C sales in most countries where prices are quoted
411-
tax-inclusive.
419+
.. tip::
420+
To set a company-wide default for this setting, go to :menuselection:`Accounting -->
421+
Configuration --> Settings`, find the :guilabel:`Taxes` section, and set the :guilabel:`Prices`
422+
setting to :guilabel:`Tax Excluded` or :guilabel:`Tax Included`. This setting cannot be changed
423+
once invoices have been created.
424+
425+
When set to :guilabel:`Tax Included`, the tax will always treat the sales price on which it is
426+
applied as a total including the tax amount. The tax computation will split the sales price into a
427+
base amount and a tax amount. This makes it suitable for B2C sales in most countries where prices
428+
are quoted tax-inclusive.
429+
430+
When set to :guilabel:`Tax Excluded`, the tax will always treat the sales price on which it is
431+
applied as a price excluding the tax amount.
432+
433+
When set to :guilabel:`Default`, the company-wide default will be used.
412434

413435
`Total = Sales Price = Computed Tax-Excluded price + Tax`
414436

@@ -427,8 +449,6 @@ tax-inclusive.
427449
For a guide on configuring tax-excluded and tax-included prices for B2B and B2C customers,
428450
see :doc:`taxes/B2B_B2C`.
429451

430-
.. image:: taxes/toggle-button.png
431-
432452
.. _taxes/base-subsequent:
433453

434454
Affect base of subsequent taxes

0 commit comments

Comments
 (0)