Community mailing list archives

community@mail.odoo.com

Re: sequence_type and backward compatibility

by
Antony Lesuisse (al)
- 10/07/2015 06:51:23
If you really want to have the same file for both a #ifdef would work

if openerp.release.version_info[0] >= 9:
	#define your stuff

However i would strongly recommend that you use 2 branches instead.

On 10/07/2015 09:27 AM, Fabien MORIN wrote:
> On Tuesday 06 October 2015 16:17:15 Pedro Manuel Baeza Romero wrote:
>> For any reason or another, you'll end up needing to have 2 versions of the
>> module, one for v8, and another for v9, leading with all of this internal
>> changes. Regards.
>
> If my module is 5000 lines, it is better to duplicate this 5000 lines only to
> remove 4 lines which are not compatible with V9 (ir.sequence_type) than to fix
> the core to keep backward compatibility ?
>
> The core patch to make everything compatible is 4 lines (including 2 comment
> lines) ! :
>
> diff --git a/openerp/addons/base/ir/ir_sequence.py
> b/openerp/addons/base/ir/ir_sequence.py
> index ebd8ab0..3420da7 100644
> --- a/openerp/addons/base/ir/ir_sequence.py
> +++ b/openerp/addons/base/ir/ir_sequence.py
> @@ -10,6 +10,10 @@ from openerp.exceptions import UserError
>
>   _logger = logging.getLogger(__name__)
>
> +# This class is not nedeed anymore since V9. Keep it only for compatibility
> +# reasons
> +class ir_sequence_type(models.Model):
> +    _name = 'ir.sequence.type'
>
>   def _create_sequence(cr, seq_name, number_increment, number_next):
>       """ Create a PostreSQL sequence.
>
>
> this patch would avoid this kind of crash at odoo start :
> ParseError: "ir.sequence.type" while parsing
> /home/odoo/odoo/custom_addons/my_module/my_module_sequence.xml:4, near.....
>
> Or maybe there is no will to keep any compatibly between versions ? Is it the
> case ?
> If this is the case, that means harder maintenance, harder customer migration,
> higher costs, wasting time on useless things than using time to develop cool
> features.
>
> --
> Fabien MORIN
> TeMPO Consulting
> 20, avenue de la Paix
> 67000 Strasbourg
> France
>
> http://www.tempo-consulting.fr
> Tel   : +33 3 88 56 82 17
> Fax   : +33 9 70 63 35 46
>
> _______________________________________________
> Mailing-List: https://www.odoo.com/groups/community-59
> Post to: mailto:community@mail.odoo.com
> Unsubscribe: https://www.odoo.com/groups?unsubscribe
>