Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032216Openbravo ERP09. Financial managementpublic2016-02-12 11:312016-03-17 10:56
psanjuan 
vmromanos 
urgentminoralways
closedfixed 
20Professional Appliance
 
3.0PR16Q2 
aferraz
Core
No
0032216: An error is shown in the Cash VAT tab in the case of decreasing Purchase Invoice Amount created from a prepaid order.
An error is shown in the Cash VAT tab in the case of decreasing Purchase Invoice Amount created from a prepaid order.

Same applies to sales.
- Register purchase order set is as Cash VAT. Add a line:
* Ordered quantity = 500
* Net unit price = 100.00
* Tax Rate = "Adquisiciones IVA 21% IVA de Caja".
- Book the order.
- Register payment out for the total gross amount of the order, that is Total Gross Amount = 60.500
- Create a purchase invoice from the order
- Go to lines tab and change the Invoiced Quantity from 500 to 400, Complete the invoice.
- Total Gross Amount is now 48.400, Total Net Amount = 40.000
- Check that Payment complete remains as YES
- Check that Prepayment Amount remains as 60.500
- Go to the Cash VAT tab and check that an error is show:
Error
More than one row with the given identifier was found: C345048D563045C0B6A6421D5CA11DA2, for class: InvoiceTaxCashVAT_V_ComputedColumns


No error should be shown.

Cash VAT tab should show the corresponding percentage.
No tags attached.
related to defect 00321003.0PR16Q2 closed vmromanos Error when processing CashVAT invoice that has been previously reactivated 
causes defect 0033620 closed dmiguelez Performance problems in Postgresql 9.3 when invoking view from query 
Issue History
2016-02-12 11:31psanjuanNew Issue
2016-02-12 11:31psanjuanAssigned To => Triage Finance
2016-02-12 11:31psanjuanModules => Core
2016-02-12 11:31psanjuanTriggers an Emergency Pack => No
2016-02-12 11:31psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11100#r11100
2016-02-12 12:14psanjuanDescription Updatedbug_revision_view_page.php?rev_id=11107#r11107
2016-02-12 13:37psanjuanNote Added: 0084155
2016-02-12 13:43psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11115
2016-02-12 13:43psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11116
2016-02-12 13:49psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11117
2016-02-12 13:51psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11118
2016-02-12 13:51psanjuanSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=11119#r11119
2016-02-12 13:51psanjuanProposed Solution updated
2016-02-12 13:52psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11120
2016-02-12 14:08psanjuanRelationship addedrelated to 0032100
2016-02-15 12:28vmromanosStatusnew => scheduled
2016-02-15 12:28vmromanosAssigned ToTriage Finance => vmromanos
2016-02-16 10:15psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11138
2016-02-16 10:26psanjuanNote Edited: 0084155bug_revision_view_page.php?bugnote_id=0084155#r11139
2016-02-16 10:27psanjuanNote Added: 0084231
2016-02-16 13:09hgbotCheckin
2016-02-16 13:09hgbotNote Added: 0084245
2016-02-16 13:09hgbotStatusscheduled => resolved
2016-02-16 13:09hgbotResolutionopen => fixed
2016-02-16 13:09hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/5435ecfe6c1f4f7100784a9f3bc74c23062584fd [^]
2016-02-16 13:10aferrazReview Assigned To => aferraz
2016-02-16 13:10aferrazNote Added: 0084247
2016-02-16 13:10aferrazStatusresolved => closed
2016-02-16 13:10aferrazFixed in Version => 3.0PR16Q2
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085143
2016-08-08 14:34aferrazRelationship addedcauses 0033620

Notes
(0084155)
psanjuan   
2016-02-12 13:37   
(edited on: 2016-02-16 10:26)
Test Plan I
- Register purchase order set is as Cash VAT. Add a line:
* Ordered quantity = 500
* Net unit price = 100.00
* Tax Rate = "Adquisiciones IVA 21% IVA de Caja".
- Book the order.
- Register payment out for the total gross amount of the order, that is Total Gross Amount = 60.500
- Create a purchase invoice from the order
- Go to lines tab and change the Invoiced Quantity from 500 to 400, Complete the invoice.
- Total Gross Amount is now 48.400, Total Net Amount = 40.000
- Check that Payment complete remains as YES
- Check that Prepayment Amount remains as 60.500
- Go to the Cash VAT tab and check below data:
Percentage = 100
Tax Amount = 8.400
Taxable Amount = 40.000

- Post the invoice, verify below posting:
40.000 (60000) compra mercaderias DEBIT
8.400 (47200) HP IVA soportado DEBIT
48.400 (407000) Anticipo a Proveedores CREDIT


Repeat same scenario for Sales.

Test Plan II
- Go to purchase invoice window and create a new one. By using the option "Create Lines From" select the order created in test plan I above. Check that there are 100 units remaining to be invoice.
- Select 100 units and complete the invoice.
- Check that Prepayment Amount remains as 60.500
- Go to the Cash VAT tab and check below data:
Percentage = 100
Tax Amount = 2.100
Taxable Amount = 12.100

- Post the invoice, verify below posting:
10.000 (60000) compra mercaderias DEBIT
2.100 (47200) HP IVA soportado DEBIT
12.100(407000) Anticipo a Proveedores CREDIT


Repeat same scenario as above, but in the second invoice change the "Invoiced Quantity" from 100 units to 50 units and complete the invoice. Check Cash VAT tab and make sure that Cash VAT info is properly shown in there.


Repeat same scenario for Sales.

(0084231)
psanjuan   
2016-02-16 10:27   
Test plan above verified and working.

Issue can be code reviewed and closed.
(0084245)
hgbot   
2016-02-16 13:09   
Repository: erp/devel/pi
Changeset: 5435ecfe6c1f4f7100784a9f3bc74c23062584fd
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Fri Feb 12 15:13:04 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/5435ecfe6c1f4f7100784a9f3bc74c23062584fd [^]

Fixed bug 32216: Cash VAT tab with prepaid invoice

The C_INVOICETAX_CASHVAT_V view, which populates the Sales/Purchase Invoice | Cash VAT tab, has been rewritten to properly manage the scenarios of prepaid invoices where the invoice amount is lower than the original order, either because of a partial invoice or because of a cheaper invoice.

The view has been split in 2 queries merged with an union all to improve the performance:
1. The first one searches the Cash VAT records linked to a payment. In this part we only filter by the records linked to the invoice's FPS, which fixes the scenarios raised by the issue.
2. The second one searches the Cash VAT records linked to a manual cash vat settlement. In this part there is no need to join with the payment tables, so the global performance is better.

---
M src-db/database/model/views/C_INVOICETAX_CASHVAT_V.xml
---
(0084247)
aferraz   
2016-02-16 13:10   
Code review OK
(0085143)
hudsonbot   
2016-03-17 10:56   
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/b22fb0500156 [^]
Maturity status: Test