lasarux/ooop — Issue #19: Error on 64 bits with saving default relations
Author: argami
Created: 2012-01-01 18:47:18+00:00
State: open

When we create a new model the Data class assigns a negative id

```python
self._ref = -id(self)
```

On the new method all the M2O, M2M, O2M are assign with a new object of the relation type. If we never save or change the value of the attribute the object keeps the negative id.

```
DEBUG [create]: res.partner {'supplier': True, 'customer': False, 'property_account_position': -4506685520, 'employee': False, 'lang': 'es_ES', 'vat_subjected': False, 'credit': False, 'debit_limit': False, 'address': [(6, 0, [165])], 'company_id': 1, 'property_account_receivable': 483, 'property_account_payable': 471, 'property_stock_customer': 9, 'credit_limit': False, 'debit': False, 'property_stock_supplier': 8, 'property_payment_term': -4506762320, 'property_product_pricelist': 1, 'ref': '2', 'active': True, 'name': 'XXXX'}
```

Try to save that give the error

```
OverflowError: int exceeds XML-RPC limits
```

The problem is that even on 64 bits xmlrpc has a maxsize of the int number

```python
>>> import xmlrpclib
>>> xmlrpclib.MAXINT
2147483647L
```

in 64 python maxint fo python is

```python
Python 2.7.1 (r271:86832, Jun 25 2011, 05:09:01)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxint
9223372036854775807
```

in 32 python maxint is

```python
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.maxint
2147483647
```

Solutions
1- On save() all the M2O, O2M, M2M that has not been initialized should be False (which i think is the best option)
2- Create for id a negative number based on xmlrpc.maxint to not OverFlow the value

Mean time for executing scripts theres a option that forces to use 32 bits interpreter instead of the 64 one

```
export VERSIONER_PYTHON_PREFER_32_BIT=yes
```