Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0007923Openbravo ERP03. Procurement managementpublic2009-03-03 18:102009-03-18 11:03
networkb 
alostale 
immediateminoralways
closedno change required 
5
2.40 
2.40 
Core
No
0007923: Error applaying validation on c_tax_id field from Invoice line tab in Purchase Invoice window
The c_tax_id column in the c_invoiceLine table has a validation from a check box. When the check box is not checked (by default), the tax combo shows the taxes checked in c_tax as ISTAXUNDEDUCTABLE = 'Y' (as it is indicated in the validation). When the check is checked, the tax combo shows the taxes checked in c_tax as ISTAXUNDEDUCTABLE = 'N' (as it is indicated in the validation too). The problem comes when the check box is uncheked again because the tax combo shows not taxes at all.
However when the check box is rechecked the tax combo shows correctly the c_tax marked as ISTAXUNDEDUCTABLE = 'N'.
So, the problem appears when the check box is not checked and it has been checked before
To create a column in c_invoiceline as char (1byte), as not nullable and 'N' as default value.
To define the column and the field in Openbravo.
To insert a validation (or modify the table validation of the table reference) in the c_tax_id field of the c_invoiceline table.
I have tried different equivalent validations but the result is always the same. I write some of the examples:

Ej 1.- c_tax.ISTAXUNDEDUCTABLE <> @cus_isdeductible@

Ej 2.- (c_tax.c_tax_id in (select c_tax_id from c_tax where c_tax.ISTAXUNDEDUCTABLE <> @cus_isdeductible@))

Ej 3.- ((c_tax.ISTAXUNDEDUCTABLE ='N' and @cus_isdeductible@ = 'Y') OR (c_tax.ISTAXUNDEDUCTABLE = 'Y' and @cus_isdeductible@<>'Y'))
No tags attached.
related to feature request 0007964 acknowledged Triage Platform Base Checkboxes do not take "N" value util they are saved 
Issue History
2009-03-03 18:10networkbNew Issue
2009-03-03 18:10networkbAssigned To => rafaroda
2009-03-03 18:10networkbRegression testing => No
2009-03-03 18:19rafarodaPrioritynormal => immediate
2009-03-04 09:26rafarodaTypebackport => defect
2009-03-04 16:43rafarodaAssigned Torafaroda => alostale
2009-03-04 16:43rafarodaStatusnew => acknowledged
2009-03-05 10:42alostaleNote Added: 0014426
2009-03-05 10:43alostaleNote Edited: 0014426
2009-03-05 10:43alostaleRelationship addedrelated to 0007964
2009-03-05 10:44alostaleStatusacknowledged => scheduled
2009-03-05 10:44alostalefix_in_branch => pi
2009-03-05 10:44alostaleStatusscheduled => feedback
2009-03-05 11:09networkbNote Added: 0014429
2009-03-06 16:42alostaleStatusfeedback => closed
2009-03-06 16:42alostaleNote Added: 0014487
2009-03-06 16:42alostaleResolutionopen => no change required
2009-03-18 11:03anonymoussf_bug_id0 => 2691456

Notes
(0014426)
alostale   
2009-03-05 10:42   
(edited on: 2009-03-05 10:43)
Here there's a HTML limitation, let me explain briefly where it is. Checkboxes are defined as HTML <input type="checkbox" value="Y">, this means that when the checkbox is selected the value it takes is "Y" other case blank, the problem is that afaic is not possible to set the non-checked value as "N".

The validation works fine when the check is set as "N" and it is saved, but not when changing its value dynamically because the record is not saved, and the value the backend receives is "Y" in case the check is selected and blank instead of "N" when it is not selected.

The solution for this requires a big refactorization in the checkboxes implementation, anyway I've reported a bug for this: 0007964.

Anyway there's an easy workarrond which is to treat the blank value of the checkbox as "N" when defining the validation, in this case this validation would work fine:

(COALESCE(@cus_isdeductible@,'N')='Y' and c_tax.ISTAXUNDEDUCTABLE ='N') OR (COALESCE(@cus_isdeductible@,'N')='N' AND c_tax.ISTAXUNDEDUCTABLE ='Y')

Is this solution enough for your problem?

(0014429)
networkb   
2009-03-05 11:09   
Thank you, both the sotltion and the explication are perfects
(0014487)
alostale   
2009-03-06 16:42   
As the workarround is enough no additional changes required in this issue.