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

  • SEARCH
  • Home
  • 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 7955875
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:49:14+00:00 2026-06-04T03:49:14+00:00

I have two functional fields in OpenERP that are not stored in the db.

  • 0

I have two functional fields in OpenERP that are not stored in the db. In fact, they don’t have columns in the db. They are calculate on the fly from other tables. I want to be able to calculate their sum or difference. I saw something here (calculate sum of fields) that does that but I think it goes to the db to fetch the data. Please how can I achieve this. Is the best option to store the data in the db and pull it from there?

  • 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-04T03:49:15+00:00Added an answer on June 4, 2026 at 3:49 am

    Their can be alternate solution like, define third calculation field and use the “multi=”” and also calculate the difference and either you can save that third field in db or you can keep it dynamic if you need for later external usage.

    Advantage over here will be after calculation your 2 field store diff for the third field.

    Example Code Snippet is as Follow :

    class code_play(osv.osv):
    _name = 'code.play'
    
    def _calc_function(self, cr, uid, ids, fields_list, args, context=None):
        vals = {}
        for id in ids:
            fields = {}
            for field in fields_list:
                fields[field] = 10
            fields["calc3"] = fields['calc1'] + fields['calc2']
            vals[id] = fields
        return vals       
    
    _columns = {
        'name': fields.char('Name', required=True, size=50),
        'calc1': fields.function(_calc_function, type='integer', store=False, multi="compute_person_data"),
        'calc2': fields.function(_calc_function, type='integer', store=False, multi="compute_person_data"),
        'calc3': fields.function(_calc_function, type='integer', store=False, multi="compute_person_data"),
    }
    

    As i explained up again field with multi will be calculated but same function so return type will be

        # when called with ``ids=[1,2,3]``, ``compute_person_data`` could return:
        {
            1: {'calc1': 10, 'calc2': 10, 'calc3': 20},
            2: {'calc1': 10, 'calc2': 10, 'calc3': 20},
            3: {'calc1': 10, 'calc2': 10, 'calc3': 20}
        }
    

    Regards

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Datetime fields that I wish to add together. They are in
I have two fields that I'd like to match. (already done the validation functions
basically I have two input fields, name and username. The idea is that the
I have two CKeditor fields that are a part of the form. I have
Suppose that I have two data types Foo and Bar. Foo has fields x
In my controller I have two functions that pull all records from the db
I have two questions about Javascript: How can I prevent my fields from being
I have two fields that a user will fill in, one is a begin
I have two two date fields - from date and to date, and i
I have two password fields and am trying to confirm they are the same

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.