← Back to team overview

openerp-community team mailing list archive

Re: Re-Compute storable function field

 

you should define your function field with a store as a dict with lines for
the model changes and fields that you want to observe to triggers the
recompute of your field function, in your case it's the store structure
that you want to reset, if and only if this store structure that you
mention is an OpenERP model and the reset-change occurs via OpenERP. Take
as example the field reconcile in the model account.invoice in the module
account of OpenERP addons

'reconciled': fields.function(_reconciled, string='Paid/Reconciled',
type='boolean',
            store={
                'account.invoice': (lambda self, cr, uid, ids, c={}: ids,
None, 50), # Check if we can remove ?
                'account.move.line': (_get_invoice_from_line, None, 50),
                'account.move.reconcile': (_get_invoice_from_reconcile,
None, 50),
            }, help="It indicates that the invoice has been paid and the
journal entry of the invoice has been reconciled with one or several
journal entries of payment."),

Hope this help


On Thu, Feb 6, 2014 at 12:36 PM, Ferdinand Gassauer <office@xxxxxxxxxx>wrote:

>  On 2014-02-06 18:57, Lionel Sausin wrote:
>
> Hi,
> If it's for a developper, just drop the column in postgres, restart the
> server and update the module.
>
> but sometimes a little comfort for developers would be appreciated too ;-)
> a flag in the server --recompute_function_fields - which drops the columns
> (of only a specific table?)  prior to update would do the trick.
> Ferdinand
>
>  Lionel.
>
> Le 06/02/2014 15:54, Francesco Apruzzese a écrit :
>
>
> Too much work for a stupid problem. I think all our solutions arre valid
> but every solution require too time for this type of problem. I think a
> solution can be to add the possibility to pass a parameter to terminal when
> you lanch openerp that indcate to re-calculate the function. So a developer
> can test his code in a simplest way.
>
>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>
>
> --
> Ferdinand
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~openerp-community
> Post to     : openerp-community@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~openerp-community
> More help   : https://help.launchpad.net/ListHelp
>
>

References