Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
I want get value in Default invoicing(default_invoicing_policy) in sales settings(sale.config.settings).
I tried get_default but its returning a none value
My code :
_inherit = 'sale.order'
res = super(MyTestClass, self).my_method()
ir_values = self.env['ir.values']
def_inv = ir_values.get_default('sale.config.settings', 'default_invoice_policy')
here it is printing none.
You can check default_invoice_policy field definition,
default_invoice_policy = fields.Selection([
('order', 'Invoice ordered quantities'),
('delivery', 'Invoice delivered quantities')
], 'Default Invoicing',
In this field definition, default_model is set as product.template, so this value is not set under model 'sale.config.settings', but it is set under model 'product.template' with name invoice_policy,
So, you have to retrieve value using,
def_inv = ir_values.get_default('product.template', 'invoice_policy')
same applies for picking policy too, picking policy value is set under sale.order model.
In ir.values you can observed that no value is set with name which starts with default_ , there is always substitute field added in another model, to set that value.
A propos de cette communauté
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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
Outils de question
|Posée: 24/04/2017 23:46|
|Vu: 875 temps|
|Dernière mise à jour: 29/04/2017 22:14|