Wednesday, September 11, 2019

I fixed #3192.

I first subtle problem was how to report a configuration error. What to do when there is no database object defined for a given common account? Lino said “Exception: Not an account: None” when you tried to register an invoice and the account for returnable VAT was not configured. Now it says “Exception: Not an account: No account pointing to VAT returnable”. The lino_xl.lib.ledger.CommonAccounts.get_object() method now returns a MissingAccount object when there is no ledger account for this common account. TODO: write a test case to reproduce the situation.

Another problem was that Lino added returnable VAT in the total fields of the invoice. (The generated movements were already correct before.)

I changed the label of lino_xl.lib.vat.VatTotal.total_incl from “Total incl. VAT” to “Total to pay”. Because when returnable VAT is being applied, “incl VAT” would be disturbing because there actually is VAT, but that VAT is not to be paid.

En passant I fixed another bug in the VAT setup (both in lino_xl.lib.bevat and lino_xl.lib.eevat): returnable VAT was also configured for sales, but that was wrong : in a sales invoice to an intracom partner you don’t specify any VAT at all. In a sales invoice to an intracom partner, there is simply no VAT to be generated. IOW even for services and good for which national customers must pay VAT (because their VAT class is normal or reduced but not exempt), the VAT rule specifies a rate of 0.

I also fixed #2847 : added the your_ref field to the description of a ledger movement. TODO: this virtual description field of a ledger movement is not yet perfect. For example in MovementsByPartner it should not show the partner.