← Back to team overview

openerp-community-reviewer team mailing list archive

Re: lp:~akretion-team/account-financial-tools/70-always-check-date into lp:account-financial-tools

 

On Tue, Nov 26, 2013 at 10:39 AM, Alexis de Lattre <alexis@xxxxxxxxxx>wrote:

> @Guewen:
>
> The __init__ is designed to set allow_date=True on all the journals that
> existed BEFORE the installation of the module. The small drawback is that,
> with the current code, it is re-executed when you restart the OpenERP
> server ; it you have an idea to fix this, please tell me.
>

You can use the "def init(self, cr)" method, which is executed on each
installation and update of the module (but not on the loading of a
registry). On a side note, __init__ is not called only on the start of the
server, but each time a registry is initialized, it can happen for instance
when you have several processes and one of them invalidates the registry
cache (after creation of a ir.model.fields for instance).

Also, you can  add a WHERE clause, thus no write will be done if not
necessary.
UPDATE account_journal SET allow_date = true WHERE allow_date <> true;


> You say : "It doesn't guarantee that an account journal have this field to
> True. If a new journal is created, it could be False until a new registry
> is built."
>
> My answer : it is not the __init__ that guarantee that an account journal
> have the field set to True. It is the "_constraints" that handle this task.
>

Yes, of course. I was focused on the  __init__ ;o)

 --
>
> https://code.launchpad.net/~akretion-team/account-financial-tools/70-always-check-date/+merge/196398
> You are reviewing the proposed merge of
> lp:~akretion-team/account-financial-tools/70-always-check-date into
> lp:account-financial-tools.
>

-- 
https://code.launchpad.net/~akretion-team/account-financial-tools/70-always-check-date/+merge/196398
Your team OpenERP Community Reviewer/Maintainer is subscribed to branch lp:account-financial-tools.


References