Hi all,
I'm working for the first time in Odoo, and I need to add a record from a recordset to an another recordset.
I have a purchase_order with some order_line, and I want to copy all the order_line in the order_line of a sale_order
class sale_order(osv.osv):
_inherit = "sale.order"
_columns = {
'commessa' : fields.char('Commessa', copy=False),
}def fill_order(self, cr, uid, ids, context=None):
this = self.browse(cr, uid, ids, context=context)purchase_obj = self.pool.get('purchase.order')
purchase_ids = purchase_obj.search(cr, uid, [('commessa','=',this._commessa)])for purchase_line in purchase_ids:
purchase = purchase_obj.browse(cr, uid, purchase_line, context=context)for order_line in purchase.order_line:
#now I want to copy all the line from purchase_order to this sale_order
Someon can help me?