IRC logs of #tryton for Monday, 2013-04-29

chat.freenode.net #tryton log beginning Mon Apr 29 00:00:03 CEST 2013
2013-04-29 05:24 <iamnoob> Q: hi i had overided the 'create method' and inserted a code there that 'UPDATES' a column of a record (the column name is 'usedtag'). that record was selected by a Many2One field that has a domain of --> domain=[('usedtag', '=', None)] , now when i try to save the record. it gives me an error of -->> The value of the field "<my many2one field>" on "<some module>" is not valid according to its
2013-04-29 05:24 <iamnoob> domain. when i check the databse manually, i see that the UPDATE query was made, but i cant saved the record ... i just need it to save the record im editing...
2013-04-29 05:30 <iamnoob> here is a pastebin of a [part of my module : -->http://pastebin.com/LZDC4pKZ
2013-04-29 07:24 <udono> iamnoob: hi, what exactly is <my many2one field> in the error message? Is it "pendingupr"?
2013-04-29 07:26 <udono> iamnoob: The field pendingupr will be saved, when the m2o relation field upr.pr.usedtag is None.
2013-04-29 07:30 <iamnoob> udono: on your 1st question, yes its pendingupr
2013-04-29 07:31 <iamnoob> udono: do you mean, it will only see records that have field.upr.pr.usedtag = None, and will on save records where field.upr.pr.usedtag = None?
2013-04-29 07:32 <iamnoob> udono: do you mean, it will only see records that have field.upr.pr.usedtag = None, and will only save records where field.upr.pr.usedtag = None?
2013-04-29 07:33 <iamnoob> udono: is it possible to override that rulling? because i really need to make the update Query on the field i have declared on the domain.. or is there any other way of doing this please?
2013-04-29 07:37 <udono> iamnoob: so simply do not use the domain.
2013-04-29 07:38 <udono> iamnoob: More clear: remove the domain and you will not get domain errors.
2013-04-29 07:39 <iamnoob> udono: umm,ok , well the reason i used domain is because it filters out the records that is shown when i select the records, thats the only reason i used domains.. is there another way to do it ?
2013-04-29 07:41 <iamnoob> udono: this makes my many2on field have the ability not to pick again the same records that has been used by another record.. hope you get what i want to express.. and thankyou for clearing it out to me.. the domain
2013-04-29 07:41 <udono> iamnoob: which version of Tryton you use?
2013-04-29 07:43 <iamnoob> udono: im using 2.6.2 client and server
2013-04-29 07:43 <iamnoob> udono: im using 2.6.2 client and 2.6.4 server to be exact
2013-04-29 07:44 <udono> iamnoob: yes, thanks.
2013-04-29 07:51 <udono> iamnoob: the problem using domains is to understand it is on field level a forced "constraint" and not only a kind of rule searching records. In your case it could be, that your code reads the items correctly (upr.pr.usedtag is None). But it seems on save upr.pr.usedtag is no longer None. So the domain constraint prevents to save the record.
2013-04-29 07:55 <udono> iamnoob: ... but domains are very flexble in Tryton. You can try to implement a domain with a conditional. Like http://hg.tryton.org/2.6/modules/account/file/e57abf64b3a1/tax.py#l561
2013-04-29 07:56 <iamnoob> udono: yes that exactly what happen, its just that i really need to save the record even having a domain,, hoping there another way (like the domain) to work only and searching records, but not restrict me from saving the records
2013-04-29 07:57 <udono> iamnoob: you can use a selection field and just search the items.
2013-04-29 07:58 <iamnoob> udono you mean override the *def search_rec_name(cls, name, clause):* ?
2013-04-29 07:59 <udono> iamnoob: no, just something like http://hg.tryton.org/2.6/modules/account/file/e57abf64b3a1/journal.py#l94
2013-04-29 08:03 <iamnoob> udono: i see, a combobox... then edit the Type.seacrch([]) ? on http://hg.tryton.org/2.6/modules/account/file/e57abf64b3a1/journal.py#l168
2013-04-29 08:07 <udono> iamnoob: yes, maybe it is sufficient for the usability, to just select one out of a selection?
2013-04-29 08:09 <iamnoob> udono: it may do the job, do the problem will be for the end-users, they may have a hardtime finding the record they needed if there's already hundreds of records to select to.. anyway .. thanks udono.. i may not solve my problem but this gives me other stuffs to try out
2013-04-29 08:29 <iamnoob> is there any way i can activate the --> def search_rec_name(cls, name, clause): when i click on the search record? rather than click the search record then input something on the filter box then enter for it to trigger>
2013-04-29 08:34 <iamnoob> Q: in a many2many field is there any way i can activate the --> def search_rec_name(cls, name, clause): when i click on the search record? rather than click the search record then input something on the filter box then enter for it to trigger>
2013-04-29 08:37 <iamnoob> my goal is to filter the records right away , rather than show all the records when you click on the 'select records button' , i cant use domains on this part
2013-04-29 08:47 <cedk> iamnoob: there is a search entry next to the add button of m2m
2013-04-29 08:51 <iamnoob> cedk: anyway i can put a default value on that entry box?
2013-04-29 08:51 <cedk> iamnoob: no
2013-04-29 08:55 <iamnoob> cedk: is it possible to remove the restriction on the domain? i needed the domain to filter out the records, but its restricting me to save, because i Updated the field i used on the domain.. (via overriding the def create)
2013-04-29 08:56 <cedk> iamnoob: no
2013-04-29 08:57 <iamnoob> cedk: ok thanks
2013-04-29 08:57 <cedk> iamnoob: I think you try to do somethin that doesn't fit the Tryton's logic
2013-04-29 08:58 <iamnoob> cedk: yes it seems like that, i just need something to prevent the end users from re-using the same records again and again..
2013-04-29 08:59 <cedk> iamnoob: m2m records are unique
2013-04-29 09:02 <iamnoob> cedk: i see..
2013-04-29 09:58 <cedk> albertca: you push to fast
2013-04-29 10:14 <cedk> bechamel: could you check http://codereview.tryton.org/837003/
2013-04-29 10:15 <bechamel> cedk: yes
2013-04-29 10:17 <cedk> bechamel: and also http://codereview.tryton.org/837002/
2013-04-29 10:17 <cedk> bechamel: I made some comments
2013-04-29 11:07 <coeps> Hi, I have a general design question: when using multiple functionfields that kind of depend on each other i.e. like an amount, a tax-amount and a sum, is it possible (or advisable) to calculate the SUM as amount + taxamount, (both as well function fields)? all 3 funcitonfilels might be changed in the same on_change operation, so I am worried that the result might be inconsistent because of the order of execution. Do I have to worry?
2013-04-29 11:31 <cedk> coeps: there is the special keywords "names" that will run once the method for many fields
2013-04-29 11:58 <coeps> cdek: thank you, can you think of a module where names is used? I would like to see an example of the retrund dict: "containing for each names a dictionary with a value for each instance". Thats not quite clear, is it a dict with "name" [list of values] (one per instance)?
2013-04-29 12:02 <cedk> coeps: Party.get_receivable_payable

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!