Skip to content

Commit 5c37b24

Browse files
committed
Apply workaround for all Odoo versions after 7
1 parent cabbbcb commit 5c37b24

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/main/java/com/debortoliwines/odoo/api/ObjectAdapter.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -586,10 +586,9 @@ private static String getFieldNameForImport(Field field) {
586586
* @throws OdooApiException
587587
*/
588588
public boolean importData(RowCollection rows) throws OdooApiException, XmlRpcException {
589-
//TODO : Check the way importdata are handled in v8/v9/
590-
// Workaround. Odoo7 bug where old and new rows can't be sent
589+
// Workaround: old and new rows can't be sent together
591590
// together using the import_data or load function
592-
if (this.serverVersion.getMajor() >= 7 && this.serverVersion.getMinor() == 0) {
591+
if (this.serverVersion.getMajor() >= 7) {
593592
RowCollection newRows = new RowCollection();
594593
RowCollection oldRows = new RowCollection();
595594

@@ -647,8 +646,8 @@ private void importDataV7(RowCollection rows, Object[][] importRows) throws XmlR
647646

648647
String[] targetFieldList = getFieldListForImport(rows.get(0).getFields());
649648

650-
// Workaround Odoo V7 bug. Remove the .id field for new rows.
651-
if (this.serverVersion.getMinor() == 0 && !rows.isEmpty() && rows.get(0).getID() == 0) {
649+
// Remove the .id field for new rows.
650+
if (this.serverVersion.getMajor() >= 7 && !rows.isEmpty() && rows.get(0).getID() == 0) {
652651
String[] newTargetFieldList = new String[targetFieldList.length - 1];
653652
for (int i = 1; i < targetFieldList.length; i++) {
654653
newTargetFieldList[i - 1] = targetFieldList[i];

0 commit comments

Comments
 (0)