Actually i don't know how to create a field in odoo so anyone please solve this problem.
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Comptabilité
- Inventaire
- PoS
- Project
- MRP
Cette question a été signalée
(For version 8 and above)
For create method you need values i.e. the values with which you want to create a record.
@api.model is used for create method
suppose we have an object called students and fields like name and standard and we want to create a record with values like name='ABC' standrd='10'
then our method will be
@api.model
def create(self,vals):
vals = {'name': 'ABC', 'standard':10}
res = super(students, self).create(vals)
return res
here res will hold the browse record of created record.
You can create record using create method.
@api.model print values |
What version are you using?
I'm using odoo8
Could you be a bit more specific about what you need?
Hi,
You can Use create method to create a record: This is the syntax of create method:
self.pool.get['object.name'].create( cr, uid, vals, context )
vals contains dictionaries of field and its value: eg.
vals = {'name': 'Chandni', 'city': 'xyz'}
This is how you can use in PY file.
Which version you are using and where u want to use create method !
Hope this will help you.
Thanks,
Chandni.
Hi...
to create field you can use http://odoo-new-api-guide-line.readthedocs.io/en/latest/fields.html as recommendation
for example if you want to create Boolean object in odoo 10 , build a folder to contain python file, and xml
in python (file.py):
from odoo import api, fields, models, _
class YourClassName(models.Model):
_inherit= 'res.partner' #or any of your model that you want to add
iam_your_rival_field = fields.Boolean(string='Is Your Rival Company')
#below here is the example function
@api.onchange('suplier','customer')
@api.multi
def are_this_rival(self):
if not self.suplier and not self.customer:
self.iam_your_rival_field= True
Then put your field in python field into XML, plus don't foreget to put __init__.py and __manifest__.py more detail you browse on you example base module on add on...
hope this will help...
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !
Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !
S'inscrire