Odoo Help

Welcome!

This community 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.

0

How can i copy value from one field to another without any action.

By
Dr Obx
on 8/29/15, 10:25 AM 1,009 views

Urgent, i need copy value from <field name="item_id"/> into another field.

On_change .... don't work :) because it require an action. I would like to copy data whilst record is loaded.


What is the other field you intend to copy data to, and why. Also, I think if you saved the record with a specific value in the target field, why you need to override it again. I think this would be a function field that reads a value from specific other fields and format the result by its own function. Some explanation is needed to be able to give more accurate reply.

Tarek Mohamed Ibrahim
on 8/29/15, 5:31 PM

I suggest using a function field

Tarek Mohamed Ibrahim
on 8/30/15, 11:13 AM

I'm sorry, I converted my answer to a comment to put a new answer, and your comments posted to the last answer has been lost. To summarize your reply, you needed to get the item_id.id in a separate field, and you're going to use this field to add it in a link and when clicking it you'll open a file that has the name : 'the number of the item_id field'

Tarek Mohamed Ibrahim
on 8/30/15, 11:38 AM
1

Tarek Mohamed Ibrahim

--Tarek Mohamed Ibrahim--
896
| 5 3 7
Gîza, Egypt
--Tarek Mohamed Ibrahim--

I am an old VFP developer on ERP

I have moved to 2p since Nov-2014 and started developing with Python on Odoo.

https://www.linkedin.com/profile/public-profile-settings?trk=prof-edit-edit-public_profile

tibrahim@2p.com.sa

Tarek Mohamed Ibrahim
On 8/30/15, 11:23 AM

Here is my solution using a function field:

You have the field item_id, create a new field 'item_id_number' 

def _item_id_no(self, cr, uid, ids, name, args, context=None):
    res = {}
    for line in self.browse(cr, uid, ids, context=context):
        res[line.id]=line.item_id.id
    return res


_columns = {
....
'item_id_number':fields.function(_item_id_no,type='integer',string='Item Id #',),
....
}

Then add the field 'item_id_number' to the view as

    ....        
    <field name="item_id_no"/>
....

That's all. I hope this would be helpful


By any chance ... version working on 8.0 new API ?

Dr Obx
on 9/9/15, 5:06 AM

It should, after the required modification needed by the new API. I'm still using the old coding style under Odoo 8.0, and it works fine

Tarek Mohamed Ibrahim
on 9/9/15, 5:47 AM

Moreover, if you checked all modules that imported from OpenERP 7 to Odoo 8 you'll find that their code is still as it is with no any changes. New APIs are applied to the code written newly for Odoo 8

Tarek Mohamed Ibrahim
on 9/9/15, 5:53 AM

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 8/29/15, 10:25 AM
Seen: 1009 times
Last updated: 12/22/15, 9:11 AM