Community mailing list archives
Re: time.strftime error on tasksby
Thanks Martin for your fast response, Appreciated ;) .
On 07/23/2015 04:49 PM, Martin Trigaux wrote:<blockquote cite="mid:55B0EFDA.firstname.lastname@example.org" type="cite">
On 22/07/15 21:18, Mohamed M. Hagag wrote: > is it possible to do imports in a domain filter ?! No (and it's a good thing for security) > I have automated action for started tasks that's using time.strftime , > the filter is working fine on the interface but it generates error > below in automated action: > > ValueError: "name 'time' is not defined" while evaluating Indeed, you don't have access to time (or any python library) by default in evaluated context. When you need to work with temporal constraint, you may (and you should) be able to work with a run trigger "Based on Timed Condition". This is a good way to manage your automated actions as they will still match even in corner cases like server down during one day, etc. When creating automated actions, don't forget that, most of the time, you will want to match the domain *only once*! Using filter conditions like "date_start > today" will match each time you check the filter (e.g. run "on update" will be rexecuted when you correct a typo somewhere). So be sure that the automated action you are executing modifies the record so that your domain is not evaluated several times. However, there is also no reason to prevent using time in your domain if you have good reason to do so. I have made a patch (revision ab54722e) to change that and allow you to use 'time' and 'user' in domain (same as for the ir.rule). Martin -- Martin Trigaux Odoo (Formerly OpenERP) https://odoo.com https://github.com/mart-e