details: https://code.openbravo.com/erp/devel/pi/rev/76d2f588a1c7 changeset: 33943:76d2f588a1c7 user: Javier Armendáriz <javier.armendariz <at> openbravo.com> date: Thu May 10 16:03:18 2018 +0200 summary: Fixed issue 38517: Test fails sometimes when translation pack is installed.
Requesting the first language retrieved by OBDal with no criteria or order may return a language that is already installed. This leads to an exception as the FormTrl object was already created when saving Form and there cannot be 2 form translations with the same associated Form ID and language. diffstat: src-test/src/org/openbravo/test/dal/IssuesTest.java | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diffs (24 lines): diff -r 4ddf86704248 -r 76d2f588a1c7 src-test/src/org/openbravo/test/dal/IssuesTest.java --- a/src-test/src/org/openbravo/test/dal/IssuesTest.java Wed May 09 17:18:45 2018 +0000 +++ b/src-test/src/org/openbravo/test/dal/IssuesTest.java Thu May 10 16:03:18 2018 +0200 @@ -379,7 +379,7 @@ formTrl.setDescription("description"); formTrl.setName("name"); formTrl.setSpecialForm(form); - formTrl.setLanguage(OBDal.getInstance().createCriteria(Language.class).list().get(0)); + formTrl.setLanguage(getNonInstalledLanguage()); form.getADFormTrlList().add(formTrl); OBDal.getInstance().save(form); @@ -391,6 +391,11 @@ OBDal.getInstance().rollbackAndClose(); } + private Language getNonInstalledLanguage() { + return (Language) OBDal.getInstance().createCriteria(Language.class) + .add(Restrictions.eq(Language.PROPERTY_SYSTEMLANGUAGE, false)).list().get(0); + } + /** * Tests issue: https://issues.openbravo.com/view.php?id=11681 */ ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits