Intermediate method needed if we create another object

Registered by Nilesh

The Problem : If we create one module 'xyz' which will add one new field 'abc' in account.invoice. I also add another field 'def' in account.move which is same as invoice's 'abc' field. Now when i create Invoice i gave some value to 'abc'. When i press 'Create Invoice' it create account.move from Invoice and put that move reference in Invoice. If i want to set same value for 'def' as i have for 'abc' in invoice then what i have to do is, I have to override the 'action_move_create' method in my module 'xyz'. But the problem is this function return only True not a move_id created from that function if it returns move_id then i can update that move id to set def value. As per OpenERP standard its ok that function return True when it call from workflow. I just want to add same value as 'abc' has in Invoice to 'def' in Move.

The Solution : If we create any object from any other object then add one intermidiate method which return dict which dict we can use to update the dict of new object which is goint to create. This thing is done in Sales Order. I am including that method.

For example :
We are creating Invoice from Sales Order with '_make_invoice' method so there is another method '_inv_get' which return dict and that dict is update in created invoice dict
                    inv.update(self._inv_get(cr, uid, order))
so if we want to add any value of fields from Sale Order to Invoice then we have to override only this '_inv_get' method and just return dict with this value like if we want to set 'abc' fields value of Sales Order to 'def' then we have to return dict as
                    {'def' : order.abc}
This will set 'def' value as same as 'abc' in Sales Order

Blueprint information

Status:
Not started
Approver:
None
Priority:
Undefined
Drafter:
Husen Daudi
Direction:
Needs approval
Assignee:
Jay Vora (Serpent Consulting Services)
Definition:
New
Series goal:
None
Implementation:
Unknown
Milestone target:
None

Related branches

Sprints

Whiteboard

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.

Subscribers

No subscribers.