Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0032100Openbravo ERP03. Procurement managementpublic2016-02-02 17:582016-03-17 10:56
maite 
vmromanos 
urgentmajoralways
closedfixed 
5
 
3.0PR16Q23.0PR16Q2 
aferraz
Core
No
0032100: Error when processing CashVAT invoice that has been previously reactivated
Error when processing CashVAT invoice that has been previously reactivated
0. Install CashVat Management module and apply dataset
1. Register Purchase Order and set it as "CashVAT". Add any line and set CashVat tax. Process Order
2. Register Payment Out related with the order and process
3. Create Purchase Invoice and set it as "CashVAT". Run "Create Lines From" and select previous order. Process Invoice
4. Reactivate Invoice
5. Try to process invoice again and following error is obtained "This record cannot be deleted because it is associated with other existing elements. Please see Linked Items"

Problem could be that information from CashVat tab has not been deleted when reactivating the invoice
No tags attached.
related to defect 0032216 closed vmromanos An error is shown in the Cash VAT tab in the case of decreasing Purchase Invoice Amount created from a prepaid order. 
depends on defect 0032206 closed vmromanos System should avoid to reactivate an invoice linked to a Manual Cash VAT Settlement 
Issue History
2016-02-02 17:58maiteNew Issue
2016-02-02 17:58maiteAssigned To => Triage Finance
2016-02-02 17:58maiteModules => Core
2016-02-02 17:58maiteResolution time => 1456873200
2016-02-02 17:58maiteTriggers an Emergency Pack => No
2016-02-02 17:58maiteIssue Monitored: networkb
2016-02-10 18:37vmromanosStatusnew => scheduled
2016-02-10 18:37vmromanosNote Added: 0084091
2016-02-10 18:37vmromanosAssigned ToTriage Finance => vmromanos
2016-02-11 13:31vmromanosRelationship addeddepends on 0032206
2016-02-11 13:48vmromanosNote Added: 0084104
2016-02-12 09:10psanjuanNote Added: 0084140
2016-02-12 09:11psanjuanNote Edited: 0084140bug_revision_view_page.php?bugnote_id=0084140#r11081
2016-02-12 10:11psanjuanNote Added: 0084145
2016-02-12 10:13psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11088
2016-02-12 10:15psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11089
2016-02-12 10:16psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11090
2016-02-12 10:18psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11091
2016-02-12 10:22psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11092
2016-02-12 10:25psanjuanNote Edited: 0084104bug_revision_view_page.php?bugnote_id=0084104#r11094
2016-02-12 10:30psanjuanNote Edited: 0084104bug_revision_view_page.php?bugnote_id=0084104#r11095
2016-02-12 11:03psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11096
2016-02-12 11:27psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11097
2016-02-12 11:31psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11098
2016-02-12 11:41psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11101
2016-02-12 11:47psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11102
2016-02-12 11:55psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11103
2016-02-12 11:58psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11104
2016-02-12 12:10psanjuanNote Edited: 0084104bug_revision_view_page.php?bugnote_id=0084104#r11105
2016-02-12 13:58psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11121
2016-02-12 14:04psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11122
2016-02-12 14:08psanjuanRelationship addedrelated to 0032216
2016-02-12 14:16psanjuanNote Added: 0084156
2016-02-15 11:14hgbotCheckin
2016-02-15 11:14hgbotNote Added: 0084173
2016-02-15 11:14hgbotStatusscheduled => resolved
2016-02-15 11:14hgbotResolutionopen => fixed
2016-02-15 11:14hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/pi/rev/1124bbf1942dde08141e010e1ab02b70fc9d64f1 [^]
2016-02-15 11:14aferrazReview Assigned To => aferraz
2016-02-15 11:14aferrazNote Added: 0084175
2016-02-15 11:14aferrazStatusresolved => closed
2016-02-15 11:14aferrazFixed in Version => 3.0PR16Q2
2016-02-16 10:31psanjuanNote Edited: 0084145bug_revision_view_page.php?bugnote_id=0084145#r11140
2016-03-17 10:56hudsonbotCheckin
2016-03-17 10:56hudsonbotNote Added: 0085136

Notes
(0084091)
vmromanos   
2016-02-10 18:37   
When an invoice has any associate payment, there is a validation that avoids to reactivate the invoice.
Deleting the Cash VAT info is currently done when reactivating the associated payment (not the invoice), because the cash vat can be settled when the payment has been registered.

However, only in the concrete case of prepayments, we could be interested in deleting the Cash VAT info related to the prepayment when reactivating the invoice. This is a scenario that is not covered right now and it's exactly what the bug is reporting.
(0084104)
vmromanos   
2016-02-11 13:48   
(edited on: 2016-02-12 12:10)
Test plan I . total prepayment - no change in the invoice amount.

0. Install CashVat Management module and apply dataset
1. Register Purchase Order and set it as "CashVAT". Add any line and set CashVat tax. Process Order
2. Register Payment Out related with the order and process
3. Create Purchase Invoice and set it as "CashVAT". Run "Create Lines From" and select previous order. Process Invoice.
Verify a record is shown in Cash VAT tab, showing a 100 percentage.
4. Reactivate Invoice.
Verify the Cash VAT tab is empty
5. Process the invoice again.
Verify a record is shown in Cash VAT tab, showing a 100 percentage.

Test plan II . partial prepayment - no change in the invoice amount.
1. Register Purchase Order and set it as "CashVAT". Add any line and set CashVat tax. Process Order.
2. Register a partial (50%) Payment Out related with the order and process
3. Create Purchase Invoice and set it as "CashVAT". Run "Create Lines From" and select previous order. Process Invoice.
Verify a prepayment amount is shown in there (i.e. 30250)
Verify a record is shown in Cash VAT tab, showing a 50 percentage.
4. Reactivate Invoice.
Verify the Cash VAT tab is empty
5. Process the invoice again.
Verify a record is shown in Cash VAT tab, showing a 50 percentage.
6. Post the order, posting looks like:
50.000 (6000) Compra Mercaderias DEBIT
5.250 (4720T) HP IVA soportado temporal DEBIT
5.250 (47200) HP IVA soportado DEBIT
30.250 (4070) Anticipo Proveedores
30.250 (4000) Proveedores

Repeat same flow for Sales.

(0084140)
psanjuan   
2016-02-12 09:10   
(edited on: 2016-02-12 09:11)
While trying to reproduce this issue, it is clear that Cash VAT information is not removed after reactivating the invoice, moreover it is possible to complete the invoice once again but the very same record is created once more in the Cash VAT tab. At the end, there will be as many records in that tab as times the invoice has been reactivated and complete.

(0084145)
psanjuan   
2016-02-12 10:11   
(edited on: 2016-02-16 10:31)
Test Plan above verified for the case of Total Prepayment, invoice amount does not change.

Test Plan I - total prepayment, invoice amount is increased.

- 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 and Complete it.
- Check that the purchase invoice is being shown as Payment complete = Yes, Prepayment = 60.500
- Check that a record has been created in the Cash VAT tab showing below information:
Percentage = 100
Tax Amount = 10.500
Taxable Amount = 50.000
- Post the invoice, verify that the VAT is posted to a final VAT ledger account (i.e. 472000)
- Unpost the invoice and reactivate it.
- Go to the Cash VAT tab and check that there is no info in there.
- Go to lines tab and change the Invoiced Quantity from 500 to 600 therefore total gross amount changes to 72.600 and total Net amount to 60.000.
- Complete the invoice.
- Check that Payment complete changes to NO
- Check that Prepayment Amount remains as 60.500
- Check that Cash VAT tab does not shows now a 100% but an 83.33% that is
Tax Amount = 10449.58
Taxable Amount = 49.998
- Post the invoice, verify below posting:
60.000 (60000) compra mercaderias DEBIT
10499.58 (47200) HP IVA soportado DEBIT
2100.42 (47200T) HP IVA soportado transitorio DEBIT
60.500 (407000) Anticipo a Proveedores CREDIT
12.100 (4000) Proveedores
- Press Add payment and pay the rest of the invoice, that is 12.100
- Check that now the invoice is shown as Payment Complete = Yes
- Go to Cash VAT tab and check that a new record has been created there with the aim of getting up to a 100% percentage of the temporary VAT settled.
- Unpost the invoice
- Reactivate and Delete the lines of the payment, therefore the purchase invoice can be reactivated once more.
- Reactivate the invoice and check that there are no records in the Cash VAT tab.
- Complete the invoice once more, and check that a new record is shown in the Cash VAT tab, the one related to the prepayment at a 83.33 percentage.

Test Plan II - total prepayment, invoice amount is decreased.
- 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 and Complete it.
- Check that the purchase invoice is being shown as Payment complete = Yes, Prepayment = 60.500
- Check that a record has been created in the Cash VAT tab showing below information:
Percentage = 100
Tax Amount = 10.500
Taxable Amount = 50.000
- Post the invoice, verify that the VAT is posted to a final VAT ledger account (i.e. 472000)
- Unpost the invoice and reactivate it.
- Go to the Cash VAT tab and check that there is no info in there.
- 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 below data is shown:
Percentage = 100
Tax Amount = 8400
Taxable Amount = 40000
- 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


Test Plan III - partial prepayment, invoice amount is increased.

- 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 50% gross amount of the order, that is 30.250
- Create a purchase invoice from the order and Complete it.
- Check that the purchase invoice is being shown as Payment complete = Yes, Prepayment = 30.250
- Check that a record has been created in the Cash VAT tab showing below information:
Percentage = 50
- Post the invoice, verify that the 50% of VAT is posted to a final VAT ledger account (i.e. 472000)
- Unpost the invoice and reactivate it.
- Go to the Cash VAT tab and check that there is no info in there.
- Go to lines tab and change the Invoiced Quantity from 500 to 600 therefore total gross amount changes to 72.600 and total Net amount to 60.000.
- Complete the invoice.
- Check that Payment complete is NO
- Check that Prepayment Amount remains as 30.250
- Check that Cash VAT tab does not shows now a 50% but an 41.67% that is
Tax Amount = 5.250.42
Taxable Amount = 25.002
- Post the invoice, verify below posting:
60.000 (60000) compra mercaderias DEBIT
5.250.42 (47200) HP IVA soportado DEBIT
7.349.58 (47200T) HP IVA soportado transitorio DEBIT
30.250 (407000) Anticipo a Proveedores CREDIT
42.350 (4000) Proveedores
- Press Add payment and pay the rest of the invoice, that is 42.350
- Check that now the invoice is shown as Payment Complete = Yes
- Go to Cash VAT tab and check that two new records have been created there with the aim of getting up to a 100% percentage of the temporary VAT settled.
- Unpost the invoice
- Reactivate and Delete the lines of the payment, therefore the purchase invoice can be reactivated once more.
- Reactivate the invoice and check that there are no records in the Cash VAT tab.
- Complete the invoice once more, and check that a new record is shown in the Cash VAT tab, the one related to the prepayment at a 41.67 percentage.

Test Plan IV - partial prepayment, invoice amount is decreased.
- 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 50% gross amount of the order, that is 30.250
- Create a purchase invoice from the order and Complete it.
- Check that the purchase invoice is being shown as Payment complete = No, Prepayment = 30.250
- Check that a record has been created in the Cash VAT tab showing below information:
Percentage = 50
Tax Amount = 5.250
Taxable Amount = 25.000
- Post the invoice, verify that the 50% of VAT is posted to a final VAT ledger account (i.e. 472000)
- Unpost the invoice and reactivate it.
- Go to the Cash VAT tab and check that there is no info in there.
- 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 is NO
- Check that Prepayment Amount remains as 30.250
- Go to the Cash VAT tab and check that below data is shown:
Percentage = 62.5
Tax Amount = 5.250
Taxable Amount = 25.000

- Post the invoice and verify below posting which is correct:
40.000 (60000) compra mercaderias DEBIT
5.250 (47200) HP IVA soportado DEBIT
3.150 (407000) Anticipo a Proveedores DEBIT
30.250 (407000) Anticipo a Proveedores CREDIT
18.150 (47200T) HP IVA soportado transitorio CREDIT

Repeat Test II and IV above for Sales.

Repeat Test I and III for Sales in the case of allowing "Is Quantity Variable" in the product.

(0084156)
psanjuan   
2016-02-12 14:16   
Test Plan above verified.

Issue can be code reviewed and closed.

Prepaid Cash VAT related invoices can be reactivated, therefore Cash VAT info is removed and later on updated once invoice is completed once again.

This issue is focus on "Reactivate" action, and that is working.

What it is not working 100% ok is the action taken once a Cash VAT invoice is reactivated an after that is changed by decreasing invoice amount. See issue related 32216.
(0084173)
hgbot   
2016-02-15 11:14   
Repository: erp/devel/pi
Changeset: 1124bbf1942dde08141e010e1ab02b70fc9d64f1
Author: Víctor Martínez Romanos <victor.martinez <at> openbravo.com>
Date: Thu Feb 11 13:42:35 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/1124bbf1942dde08141e010e1ab02b70fc9d64f1 [^]

Fixed bug 32100: Reactivation control of a prepaid cash vat invoice

When an invoice is linked to a payment, the system currently avoids to reactivate it. You first need to reactivate the payment, so the cash vat information is deleted, and then you can reactivate the invoice.
However for prepaid invoices, the system does allow to reactivate the invoice, but the cash vat information is wrongly kept.

Now we delete all the cash vat info records linked to a prepayment for this invoice at invoice reactivation time. When the invoice is latter on processed, the cash vat records will be calculated again.

---
M modules/org.openbravo.advpaymentmngt/src-db/database/model/functions/APRM_GEN_PAYMENTSCHEDULE_INV.xml
---
(0084175)
aferraz   
2016-02-15 11:14   
Code review OK
(0085136)
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