list_price of product template returns None after migrating to 4.4

64 views
Skip to first unread message

Mark Shane Hayden

unread,
Jun 14, 2017, 4:13:43 PM6/14/17
to tryton
I have upgraded the development environment for a flask web app from 4.2 to 4.4  After completing the upgrade the list prices of products are all returning None in the web application.  However the Tryton GTK client shows all the correct prices.

I know that list_price was migrated over to a MultiValue field type and things on the server side seem to be OK.  Are there changes on the flask end of things that would have to be changes as well?  What would cause these fields to always return None awhen the old property fields worked fine?


Cédric Krier

unread,
Jun 14, 2017, 4:45:07 PM6/14/17
to tryton
Probably the context is not correct.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Mark Shane Hayden

unread,
Jun 14, 2017, 5:24:08 PM6/14/17
to try...@googlegroups.com
On Jun 14, 2017 14:45, "Cédric Krier" <cedric...@b2ck.com> wrote:
On 2017-06-14 13:13, Mark Shane Hayden wrote:
> I have upgraded the development environment for a flask web app from 4.2 to
> 4.4  After completing the upgrade the list prices of products are all
> returning None in the web application.  However the Tryton GTK client shows
> all the correct prices.
>
> I know that list_price was migrated over to a MultiValue field type and
> things on the server side seem to be OK.  Are there changes on the flask
> end of things that would have to be changes as well?  What would cause
> these fields to always return None awhen the old property fields worked
> fine?

Probably the context is not correct.

Is there something specific that is not correct? I believe we do set the company, and the old property field seemed to work with the same context. Can't think of what would be different...


--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

--
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/20170614204259.GN3591%40kei.

Sergi Almacellas Abellana

unread,
Jun 15, 2017, 3:03:31 AM6/15/17
to try...@googlegroups.com
El 14/06/17 a les 23:24, Mark Shane Hayden ha escrit:
>
>
> On Jun 14, 2017 14:45, "Cédric Krier" <cedric...@b2ck.com
> <mailto:cedric...@b2ck.com>> wrote:
>
> On 2017-06-14 13:13, Mark Shane Hayden wrote:
> > I have upgraded the development environment for a flask web app
> from 4.2 to
> > 4.4 After completing the upgrade the list prices of products are all
> > returning None in the web application. However the Tryton GTK
> client shows
> > all the correct prices.
> >
> > I know that list_price was migrated over to a MultiValue field
> type and
> > things on the server side seem to be OK. Are there changes on
> the flask
> > end of things that would have to be changes as well? What would
> cause
> > these fields to always return None awhen the old property fields
> worked
> > fine?
>
> Probably the context is not correct.
>
> Is there something specific that is not correct? I believe we do set
> the company, and the old property field seemed to work with the same
> context. Can't think of what would be different...
Which company do you have in the context?

--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Mark Shane Hayden

unread,
Jun 25, 2017, 3:11:28 AM6/25/17
to tryton
In the flask application I have the following:

@tryton.default_context
def default_context():
    context = {}
    context['company'] = app.config.get('TRYTON_COMPANY')
    return context

And in the config file TRYTON_COMPANY = 1

It is the only company defined in this system, and the multivalues all reference company ID of 1.

It doesn't seem that the company value is being set in the context as expected otherwise product.list_price would not return None?

Cédric Krier

unread,
Jun 25, 2017, 4:10:07 AM6/25/17
to tryton
On 2017-06-25 00:11, Mark Shane Hayden wrote:
> It doesn't seem that the company value is being set in the context as
> expected otherwise product.list_price would not return None?

Please check it.

Mark Shane Hayden

unread,
Jul 8, 2017, 4:19:30 AM7/8/17
to tryton
On Sunday, 25 June 2017 02:10:07 UTC-6, Cédric Krier wrote:
On 2017-06-25 00:11, Mark Shane Hayden wrote:
> It doesn't seem that the company value is being set in the context as
> expected otherwise product.list_price would not return None?

Please check it.

There is no company set in the context within my flask tryton app.  It isn't an issue with 4.2 but in the dev version on 4.4 with multivalues it seems critically important.  however I do not know how to set the company in my flask tryton app.  What is the proper way to do that?

Sergi Almacellas Abellana

unread,
Jul 10, 2017, 3:28:42 AM7/10/17
to try...@googlegroups.com
El 08/07/17 a les 10:19, Mark Shane Hayden ha escrit:
> On Sunday, 25 June 2017 02:10:07 UTC-6, Cédric Krier wrote:
>
> On 2017-06-25 00:11, Mark Shane Hayden wrote:
> > It doesn't seem that the company value is being set in the
> context as
> > expected otherwise product.list_price would not return None?
>
> Please check it.
>
>
> There is no company set in the context within my flask tryton app. It
> isn't an issue with 4.2 but in the dev version on 4.4 with multivalues
> it seems critically important. however I do not know how to set the
> company in my flask tryton app. What is the proper way to do that?
You can use the default_context[1] decorator to set the context of all
the transactions, or pass a different context (or callable) to each
transaction [2] using the context parameter.

Hope it helps.


[1] http://hg.b2ck.com/flask-tryton/file/7ea1706ad421/README#l19
[2] http://hg.b2ck.com/flask-tryton/file/7ea1706ad421/flask_tryton.py#l69
Reply all
Reply to author
Forward
0 new messages