Odoo Help

2

0
2 Answers
1
Susi Indonesia
12/25/14, 1:40 AM

i have use this code

@api.multi
    def onchange_city(self, city_id):
        if city_id :
            city= self.env['res.country.state'].browse(city_id)
            return {'value': {'provinsi_id': city.name.id}}
        return {}

with .xml

<field name="city_id" onchange="onchange_city(city)"/>

but it doesnt work

3 Comments
Emipro Technologies Pvt. Ltd. India
12/25/14, 1:44 AM

@susi you don't need to declare any thing in the xml file. In odoo-v8 we don't need that.

Emipro Technologies Pvt. Ltd. India
12/25/14, 1:45 AM

@susi please tell me, which version of openerp you are using

Emipro Technologies Pvt. Ltd. India
12/25/14, 1:46 AM

@susi @api.multi will not work, you should do as I mentioned in my ans. Use @api.onchange

0
Avatar

Emipro Technologies Pvt. Ltd. India

--Emipro Technologies Pvt. Ltd.--
7863
| 7 8 10
Rajkot, India
--Emipro Technologies Pvt. Ltd.--

Emipro has been providing a wide range of business solutions in the domain of ERP & eCommerce. We take pride in serving 1000s of contented customers across the globe with strong roots in the US, Europe & India. Being a Certified Odoo Gold Partner in India as well as the United States, we bring our rich professional experience and unrivaled technical competence to help our customers obtain efficient and cost-effective business solutions in Odoo. With our team of 50+ Odoo Experts and highly experienced business analysts, we serve our customers which are companies of all sizes, ranging from start-ups to large enterprises. 

Our ERP Services:

  • Business Need Analysis & GAP Analysis

  • ERP Migration

  • Odoo Consultancy

  • Odoo Implementation & Customization

  • Odoo Training & Support

  • Odoo Website & eCommerce Development

  • Odoo Integration (Marketplaces, eCommerce platforms, Shipping Carriers, Payment Gateways etc.)

Our Achievements:


Reach Us:

Website: www.emiprotechnologies.com

Email: info@emiprotechnologies.com

Skype: emiprotech

Emipro Technologies Pvt. Ltd. India
12/24/14, 11:59 PM

@Susi

You can define the onchange method in following way

@api.onchange('city')

def onchange_city(self):

    <<fetch the value based on 'self.city'>>

    self.province=<<fetched value>>

 

hope this helps !!

2 Comments
Susi Indonesia
12/25/14, 12:10 AM

sorry i dont understand with method @api.onchange

Emipro Technologies Pvt. Ltd. India
12/25/14, 12:16 AM

@susi this is the way you define the onchange method in the odoo-v8 @api.onchange is the decorator to identify the onchange method in the import section do the following 'from openerp import models,fields,api' for more details.. refer to following line - http://odoo-new-api-guide-line.readthedocs.org/en/latest/decorator.html

Ask a Question
Writer
145
Susi
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