Discussion:
[tryton] main entity and lines
Cato Nano
2018-01-28 17:12:46 UTC
Permalink
Some time ago I asked how to have on my Bolletta lines fields defined on the main entity, the Bolletta

I did this with some date fields and it worked like a charm.

Now I need to read the value of a selection field, defined on Bolletta

In fact, I have to assign the "invisible" state to a field on the base of a selection on a selection field on Bolletta

It doesn' t work

How do I read the content of a selection field from a line ?

Thanks
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/7b9375fc-55d7-44f7-9bd9-27548c7d1a28%40googlegroups.com.
Sergi Almacellas Abellana
2018-01-29 09:05:15 UTC
Permalink
Post by Cato Nano
Some time ago I asked how to have on my Bolletta lines fields defined on the main entity, the Bolletta
I did this with some date fields and it worked like a charm.
Now I need to read the value of a selection field, defined on Bolletta
In fact, I have to assign the "invisible" state to a field on the base of a selection on a selection field on Bolletta
It doesn' t work
What does not work? Could you provide more information please?
Post by Cato Nano
How do I read the content of a selection field from a line ?
If you are going to evaluate it on pyson, you should create a functional
field. Here is an example:

http://hg.tryton.org/modules/account_invoice/file/6c85f394741c/invoice.py#l1455
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/f9fc4472-4c52-296a-aa58-b9902da16661%40koolpi.com.
Cato Nano
2018-01-29 19:28:04 UTC
Permalink
Post by Sergi Almacellas Abellana
Post by Cato Nano
Some time ago I asked how to have on my Bolletta lines fields defined on the main entity, the Bolletta
I did this with some date fields and it worked like a charm.
Now I need to read the value of a selection field, defined on Bolletta
In fact, I have to assign the "invisible" state to a field on the base of a selection on a selection field on Bolletta
It doesn' t work
What does not work? Could you provide more information please?
yes, I can provide mor einformation, sorry
Post by Sergi Almacellas Abellana
Post by Cato Nano
How do I read the content of a selection field from a line ?
If you are going to evaluate it on pyson, you should create a functional
http://hg.tryton.org/modules/account_invoice/file/6c85f394741c/invoice.py#l1455
Thanks

I made this field. the thing runs, but the field doesn't appear
https://gitlab.com/humanitiesNerd/tributi/blob/master/affissione.py#L97

I' d like to be able to debug this not appearance myself

How would you do, if you were in my shoes ?
Would you use Proteus on a SQLite db for debugging this ?
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/192d1f64-65f1-4e20-8584-fb5aab302d9e%40googlegroups.com.
Sergi Almacellas Abellana
2018-01-31 16:33:32 UTC
Permalink
Post by Cato Nano
I made this field. the thing runs, but the field doesn't appear
https://gitlab.com/humanitiesNerd/tributi/blob/master/affissione.py#L97
The problem is that self.bolletta.tipo is not a field of the model. You
can not use the dot notation to navigate on pyson statements, so you
should create a functional field that returns the value of the
referenced field.
--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/855c2b6a-610d-d65c-209b-5df57d2c0181%40koolpi.com.
Cato Nano
2018-02-02 07:10:43 UTC
Permalink
Post by Sergi Almacellas Abellana
Post by Cato Nano
I made this field. the thing runs, but the field doesn't appear
https://gitlab.com/humanitiesNerd/tributi/blob/master/affissione.py#L97
The problem is that self.bolletta.tipo is not a field of the model. You
can not use the dot notation to navigate on pyson statements, so you
should create a functional field that returns the value of the
referenced field.
Ah, I will try this.
Thanks !
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/5bad98ac-63bd-41bb-bb20-4155320ad999%40googlegroups.com.
Cato Nano
2018-02-02 08:17:38 UTC
Permalink
Post by Cato Nano
Post by Sergi Almacellas Abellana
Post by Cato Nano
I made this field. the thing runs, but the field doesn't appear
https://gitlab.com/humanitiesNerd/tributi/blob/master/affissione.py#L97
The problem is that self.bolletta.tipo is not a field of the model. You
can not use the dot notation to navigate on pyson statements, so you
should create a functional field that returns the value of the
referenced field.
Ah, I will try this.
Thanks !
I tried

Not only the field had to belong to the model but also I had to move from this

states={'invisible': Eval('bollettaTipo') != 'commerciale'}

to this

states={'invisible': (Eval('bollettaTipo') != 'commerciale')}

in order for it to work :-)
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/55532698-ef24-4e91-883b-001657c5381c%40googlegroups.com.
Loading...