Odoo Help

1

0
4 Semua Jawaban
2
Avatar

Pawan Kumar Sharma India

--Pawan Kumar Sharma--
SunArc Technologies
8827
| 6 3 7
Gangashahar(Bikaner), India
--Pawan Kumar Sharma--


Pawan Kumar Sharma India
26/07/19 08.00

Hi,

Review below links. they will helpful for you.

https://doc.odoo.com/6.0/developer/2_5_Objects_Fields_Methods/field_type/

https://odoo-development.readthedocs.io/en/latest/dev/py/fields.html#many2one


1 Komentar
vx2008 China
27/07/19 01.34

thanks for your reply

1
Avatar

Thayif kabir India

--Thayif kabir--

9225
| 6 3 9
Calicut, India
--Thayif kabir--


Thayif kabir India
26/07/19 07.32

Hi,

Many2one relation returns records of related model. Many2one field store record id of that related model. For reference check this link​   

You can use default method to load default value in many2one field 

field = fields.Many2one('related_model', string="", default=_default_value, required=True)
@api.model
def _default_value(self):
    return self.env['related_model'].search([], limit=1)
1 Komentar
vx2008 China
27/07/19 01.33

thank you

1
Avatar

Hemant Bhoi India

--Hemant Bhoi--

5673
| 1 1 3
Nadiad, India
--Hemant Bhoi--
Hemant Bhoi India
26/07/19 07.03

The value in "x" is the record that you have selected.
It stores the 'id' of that referencing record. So directly you cannot store the "value" to that, but by setting the id of the record will set the value. It will Integer value that you can set in "x".

1 Komentar
vx2008 China
27/07/19 01.34

thanks

Mengajukan pertanyaan
Writer
Tanda
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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now