I have the following relationships between two objects:
class nsalesorder(osv.osv):
_description = 'Sales Order'
_name = 'nsales.order'_columns = {
#other attributes
'report_id': fields.many2many('nsales.report' , 'Report ID')
class nreport(osv.osv):
_description = 'Report'
_name = 'nsales.report'_columns = {
order_id': fields.many2many('nsales.order', 'order_report')
So, report and order has a many2many relation. But when I try to create a report object with the following code:
def create(self, cr, uid, vals, context=None):
sales_order_object = self.pool.get('nsales.order')
ids = sales_order_object.search(cr, uid, [ ['order_date','>=', vals['start_date'] ], ['order_date','<=',vals['end_date'] ] ], offset=0, order=None, context=None)vals['order_id'] = (0, 0, ids )
ret = super(nreport, self).create(cr, uid, vals, context=context )
The relation order_report remains empty. But the code does not give any error and a new entry is created in the nsalse_report table.
How can I change the code so that the relationship between these two objects is created? I am stuck with this problem for a while. Some help will be highly appreciated.
Regards
Tarif