Odoo Help


4 Risposte
Janarthanan India
27/07/16, 07:23
create a field in py file,_secteur_public

ub=fields.Float(string='Unité bénéficiaire',compute='_secteur_public',readonly=True)

def _secteur_public(self):   
     for i in self.env['unite.beneficiaire.config.settings'].search([]):

Prakash India

| 4 3 9
Pune, India

I like to surround myself with brave, creative people.

My motivation for learning different technologies and algos drive me. I love challenges of a steep learning curve which I believe makes me a better learner. I have a strong desire to learn different technologies, which would enable me to become a full stack developer.

Prakash India
09/06/16, 07:55
  1. Not use models.Model of configuration  instead use  models.TransientModel

  2. Define   get_default_fields and set_fields method 

  3. Use ir.values in get_default_fields and set_fields

  4. Now retrieve the data from  self.env['ir.values']

For Using  ir.values you can refer  this  link



def get_default_acquirer(self, fields):

default_acquirer = False

if 'default_acquirer' in fields:

default_acquirer = self.env['ir.values'].get_default('payment.transaction', 'acquirer_id', company_id=self.env.user.company_id.id)

return {

'default_acquirer': default_acquirer



def set_default_acquirer(self):

for wizard in self:

ir_values = self.env['ir.values']

if self.user_has_groups('base.group_configuration'):

ir_values = ir_values.sudo()

ir_values.set_default('payment.transaction', 'acquirer_id', wizard.default_acquirer.id, company_id=self.env.user.company_id.id)

Hope it may help in your case.

Hichem MELIK Francia
09/06/16, 10:31

i don't get the step 3 & 4 did you have an example ?

1 Commento
webkul, Prakash India
10/06/16, 13:39
Fai una domanda
Keep Informed
2 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.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now