Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0021894Openbravo ERP07. Sales managementpublic2012-10-10 11:152012-10-30 18:11
maite 
jonalegriaesarte 
urgentmajoralways
closedfixed 
5
 
 
Core
No
0021894: Wrong Invoice posting when using "Tax Not deductible" and adding correction tax line
Wrong Invoice posting when using "Tax Not deductible" and adding correction tax line
1. Edit any tax rate to define it as "Tax not deductible"
2. Create Purchase Invoice for any BP, any product and using that tax rate
3. Go to "Tax" tab and add manually new record for same tax rate and tax amount=-0.01
4. Process Invoice and Post
5. Accounting entry is wrong as it should only use 2 accounts, as it is documented in http://wiki.openbravo.com/wiki/Tax_Rate#Tax [^]
Problem is in DocInvoice_data.xsql file, "select" should group by tax_id. Query should be left as follows:

"SELECT t.IsTaxUndeductable as rateTaxUndeductable,
        (select IsTaxUndeductable from ad_orginfo o where o.ad_org_id=it.ad_org_id) as orgTaxUndeductable,
        it.C_Tax_ID, t.Name, t.Rate, t.IsTaxDeductable, SUM(it.TaxBaseAmt) AS TaxBaseAmt, SUM(it.TaxAmt) AS TaxAmt,
        '' AS C_INVOICE_ID, '' AS AD_CLIENT_ID, '' AS AD_ORG_ID,
        '' AS ISACTIVE, '' AS CREATED, '' AS CREATEDBY, '' AS UPDATED, '' AS UPDATEDBY, '' AS ISSOTRX, '' AS DOCUMENTNO,
        '' AS DOCSTATUS, '' AS DOCACTION, '' AS PROCESSING, '' AS PROCESSED, '' AS POSTED, '' AS C_DOCTYPE_ID, '' AS C_DOCTYPETARGET_ID,
        '' AS C_ORDER_ID, '' AS DESCRIPTION, '' AS ISTRANSFERRED, '' AS ISPRINTED, '' AS SALESREP_ID, '' AS DATEINVOICED,
        '' AS DATEPRINTED, '' AS DATEACCT, '' AS C_BPARTNER_ID, '' AS C_BPARTNER_LOCATION_ID, '' AS POREFERENCE, '' AS ISDISCOUNTPRINTED,
        '' AS DATEORDERED, '' AS C_CURRENCY_ID, '' AS PAYMENTRULE, '' AS C_PAYMENTTERM_ID, '' AS C_CHARGE_ID, '' AS CHARGEAMT, '' AS TOTALLINES,
        '' AS GRANDTOTAL, '' AS M_PRICELIST_ID, '' AS ISTAXINCLUDED, '' AS C_CAMPAIGN_ID, '' AS C_PROJECT_ID, '' AS C_ACTIVITY_ID,
        '' AS ISPAID, '' AS CREATEFROM, '' AS GENERATETO, '' AS SENDEMAIL, '' AS AD_USER_ID, '' AS COPYFROM, '' AS ISSELFSERVICE,
        '' AS AD_ORGTRX_ID, '' AS USER1_ID, '' AS USER2_ID, '' as AMOUNT, '' AS STATUS, '' AS ISRECEIPT, '' AS ISMANUAL, '' AS WRITEOFFAMT,
        '' AS C_DEBT_PAYMENT_ID, '' AS P_REVENUE_ACCT, '' AS P_EXPENSE_ACCT, '' as FIN_PAYMENT_SCHEDULE_ID, '' as FIN_PAYMENTMETHOD_ID, '' AS PREPAIDAMT,
        '' AS FININVCOUNT, '' AS FINACCTCOUNT, '' AS FIN_PAYMENT_ID
        FROM C_Tax t, C_InvoiceTax it
        WHERE t.C_Tax_ID=it.C_Tax_ID AND it.C_Invoice_ID=?
        GROUP BY t.IsTaxUndeductable, it.C_Tax_ID, t.Name, t.Rate, t.IsTaxDeductable, it.ad_org_id"
No tags attached.
Issue History
2012-10-10 11:15maiteNew Issue
2012-10-10 11:15maiteAssigned To => dmiguelez
2012-10-10 11:15maiteModules => Core
2012-10-10 11:17maiteIssue Monitored: networkb
2012-10-10 11:18jonalegriaesarteAssigned Todmiguelez => jonalegriaesarte
2012-10-10 11:59hgbotCheckin
2012-10-10 11:59hgbotNote Added: 0053199
2012-10-10 11:59hgbotStatusnew => resolved
2012-10-10 11:59hgbotResolutionopen => fixed
2012-10-10 11:59hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/86ff038e5ebdd84a0d04254a18aabea36bc625f5 [^]
2012-10-11 07:51hudsonbotCheckin
2012-10-11 07:51hudsonbotNote Added: 0053293
2012-10-30 18:11maiteNote Added: 0053856
2012-10-30 18:11maiteStatusresolved => closed

Notes
(0053199)
hgbot   
2012-10-10 11:59   
Repository: erp/devel/pi
Changeset: 86ff038e5ebdd84a0d04254a18aabea36bc625f5
Author: Jon Alegría <jon.alegria <at> openbravo.com>
Date: Wed Oct 10 11:57:22 2012 +0200
URL: http://code.openbravo.com/erp/devel/pi/rev/86ff038e5ebdd84a0d04254a18aabea36bc625f5 [^]

Fixes issue 0021894: Wrong Invoice posting when using "Tax Not deductible" and
adding correction tax line
Added group by to work as documented
http://wiki.openbravo.com/wiki/Tax_Rate#Tax [^]

---
M src/org/openbravo/erpCommon/ad_forms/DocInvoice_data.xsql
---
(0053293)
hudsonbot   
2012-10-11 07:51   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/63dfc135f2a1 [^]

Maturity status: Test
(0053856)
maite   
2012-10-30 18:11   
verified