Odoo Help

3

0
1 Answer
1
Avatar

Yenthe Van Ginneken

--Yenthe Van Ginneken--
22650
| 9 9 12
Turnhout, Belgium
--Yenthe Van Ginneken--

My Odoo training platform: https://www.oocademy.com
My Odoo blog: http://www.odoo.yenthevg.com/
My Twitter: https://twitter.com/Yenthe666

Yenthe Van Ginneken
11/11/17 14:37

Alright so to answer my own question: You've need to call the execute() function in order to trigger the save and to apply everything to the settings. The code:

# We only need the last configuration record so let us set a limit and order it desc
config_id = client.model('res.config.settings').search([], limit=1, order='id desc')
if config_id:
    # This means there is already a configuration - let us write on it.
    config_rec = client.model('res.config.settings').browse(config_id[0])
    # 'group_discount_per_so_line' is the field name (in the settings) that I want to use
    config_rec.write({'group_discount_per_so_line': True,
        'group_uom': True,
        'multi_sales_price': True'})
    # Execute the record in order to trigger the save and to apply everything
    config_rec.execute()
else:
# This means there is no configuration yet - let us make one! config_params = client.model('res.config.settings').create({}) config_params.write({'group_discount_per_so_line': True, 'group_uom': True, 'multi_sales_price': True}) # Execute the record in order to trigger the save and to apply everything config_params.execute()


Dave Lasley gave me a good pointer at https://twitter.com/dlasley88/status/929371108448464896 and Jérémy (JKE-be from Odoo) gave another tip, so a big thank you to these guys. They deserve the credit.

Regards,
Yenthe

Ask a Question
Keep Informed
1 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now