[GNC-dev] Fetching invoice tax list and general business information in python

Michael or Penny Novack stepbystepfarm at comcast.net
Wed Oct 12 10:29:09 EDT 2022


On 10/12/2022 6:41 AM, Tim van Osch wrote:
> Hey everyone,
>
> I would like to render my invoice using the python bindings but I am having
> two issues.
>
> The main issue I am having is getting the tax values of an invoice per tax
> table. Something like this:
> *VAT 21%      *€152.00
> *VAT 6%        *€23.00
> I found the method: Invoice.GetTotalTaxList() which is expected to return
> an AccountValueList. Unfortunately in the python bindings it returns a list
> of _gnc_monetary, which I think is a wrong/incomplete typing.
> Does anyone know how I can fetch the tax values per table for an invoice in
> Python?

Just a reminder.

Those that want/ask for something like this are almost always in a 
jurisdiction where it is a relatively simple problem. In other words, 
they do not recognize they are a "special case" of a "figure the tax" 
problem where the general case is FAR more complicated, Where it would 
require a "system"/function to compute the applicable sales tax (VAT is 
a form of "sales tax".

In the general case, the "compute the tax" process has to deal with 
multiple tax tables (one for each jurisdiction claiming sales tax) and 
that also needing to take into account what is or is not "taxable" in 
that jurisdiction. Over here we have 50 states plus some local 
jurisdiction also wanting sales tax and which applies is not necessarily 
based on where the business is located. If the sale is remote, that will 
depend on the customer location.

USUALLY these calculations are done by a POS system which feeds the 
accounting package, not as part of the accounting package. Why "point of 
sales" should be obvious when you recognize that sales AT a "brick and 
mortar" store will depend on where (the "point of"). Thus a small 
business with three buildings, one in Greenfield MA, one in Brattleboro 
VT, and one in Keene NH (these would all fit in a 40 mile circle) could 
be the same POS software with the program in one place "follow MA 
rules", one "follow VT rules", one "follow NH rules" << the program is 
told where its "point" is >> but if say one of those stores is also 
handling remote sales that "point" changes with each sale << according 
to where the customer/delivery is >>

NOTE: POS systems usually also feed the inventory system so the sale 
results in reduction of physical inventory

Gnucash is JUST an accounting package, the "general ledger" part of a 
complete business system, which might include POS, inventory, payroll, 
billable hours, etc.

Michael D Novack



More information about the gnucash-devel mailing list