Hi,
I inherit "purchase.order.line" by adding my new field like this:
Code:
class purchase_order_line(osv.osv):
_inherit = "purchase.order.line"
_columns = {
'myfield_id': fields.many2one('my_class','Field', required=True),
.......
Everything works fine, I've got a new field, I have to fill it before saving records (I added field in inherit xml view ).
Next I fill my purchase orders with two different products producing by the same supplier. So I've got two different purchase orders , each with one purchase order line.
Next I make merge orders action via "Action" --> "Merge Orders" , I've got one line in "Purchase Orders" and inside this purchase order two purchase order lines.
The problem is that after marge action I don't have my new field added in inheritance, field is empty (but is required).
Before :
Purchase Order (Supplier A)
|
|____> Purchase Order Line (with my new field)
Purchase Order (Supplier A)
|
|____> Purchase Order Line (with my new field)
After merge :
Purchase Order (Supplier A)
|
|____> Purchase Order Line (without my new field, field is empty)
|
|____> Purchase Order Line (without my new field, field is empty)
It looks like merge action gets objects not from my class but from parent class. Any ideas how to fix it ?
Trying to fix this problem I Also extended purchase.order class and overwrote it putting
print "My statement" inside _get_order function like this:
Code:
class purchase_order(osv.osv):
_inherit = "purchase.order"
def _get_order(self, cr, uid, ids, context={}):
print "My statement"
result = {}
for line in self.pool.get('purchase.order.line').browse(cr, uid, ids, context=context):
result[line.order_id.id] = True
return result.keys()
But there is no print during merge action , parent class function is invoked. Any ideas ?
Thanks in advance .