Getting list_price from flask_tryton

Dear Tryton team,
I’m working on a light portal to see, create only products and invoices information from Tryton.
The problem:
I’m using product.template.list_price but is always None, on trytond 5.0.15
I’m not sure what’s happening I mean fields like name, account_category are there also on tryton client list_price has values for sure.

If someone can give me a hand, It will be appreciated.
Thanks

Hello, I’m not sure if it’s the best solution but I was able to get it by:

p.template.list_prices[0].list_price
Thank you

This does not sound as a resonable solution.

As product list price is multlivalue (can be diferent for each company) maybe the problem is that you do not have the proper company set on the context so it returns an empty value.

Thank you for your response, has many sense what you say, I’m facing issues inserting the company on account_invoice for domain: “Company value is not correct according to domain”.

I thought these lines sets the context: Am I wrong? or how could I check ?

@tryton.default_context
def default_context():
return User.get_preferences(context_only=True)

Thanks as always for your kind help

Yes this sets the default context for flask but the company will be only set if the user running the flask aplication has the main company set. Otherwise it will be empty

1 Like

You were so right, that context also solves the issue that I had with invoice.

What I did:
app.config[‘TRYTON_USER’] = 1

so now the context has the company and list_price works,
Thank you @pokoli , stay safe there in Spain!.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.