Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8237111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:21:51+00:00 2026-06-07T19:21:51+00:00

I select field in database using sql command partner_obj = self.pool.get(‘res.partner’). browse (cr, uid,

  • 0

I select field in database using sql command

 partner_obj = self.pool.get('res.partner'). browse (cr, uid, ids, *args)
                partner_name = partner_obj.ids
                customer = (partner_name)
                cr.execute("select b.city from res_partner a, res_partner_address b where b.partner_id = a.id AND a.id = %s",(customer))
                ads = cr.fetchone()
                city = ads and ads[0] or None

but, I just know we must convert into string. I already try to make like this (the code above), but still doesn’t work.

I made like this, because you want to know SO is in a message in which the city

may you help me, please

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:21:54+00:00Added an answer on June 7, 2026 at 7:21 pm

    I don’t think you need to run raw SQL, you should be able to use the browse records to get the information you want. I wasn’t sure exactly what you wanted from your question, but I’ll assume that you are passing in a list of partner ids, and you want back a list of all the city names that they have addresses in. I have not tested this code, it’s just a suggestion.

    def find_cities(self, cr, uid, partner_ids, context=None):
        cities = set()
        partner_obj = self.pool.get('res.partner')
        for partner in partner_obj.browse(cr, uid, partner_ids, context):
            for address in partner.address:
                if address.city:
                    cities.add(address.city)
        return list(cities)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a SQL Server database and I'm using ADO.NET ExecuteReader to get a
A database field named income_source is queried using: SELECT * FROM table_name WHERE income_source
I need to get two fields from a database table (retrieved using linq-to-sql), one
I'm using MS SQL Server. When I define the database schema I define a
I am connecting to an SQL database using a PLC, and need to return
I have an UPDATE sql command that modifies a Date/Time field in a particular
Using SQL server 2000 and Access 2003 Access Database Name - History.mdb Access Table
I have the following select field and based on whether the class .show-x-trend or
Here is my desired transaction order: User1 select field, perform operation, update with new
I'm trying put an if statement directly into a select field in rails, with

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.