Hi everybody,
I would like to add a new field in the sale.py : Table sale_order. This field will link to an purchase _order. It is why I add this in the python code
class sale_order(osv.osv):
_name = "sale.order"
_inherit = ['mail.thread', 'ir.needaction_mixin']
_description = "Sales Order"
_track = {
'state': {
'sale.mt_order_confirmed': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['manual', 'progress'],
'sale.mt_order_sent': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['sent'],
'sale.mt_order_bat': lambda self, cr, uid, obj, ctx=None: obj['state'] in ['bat']
},
}
.
.
.
_columns = {
'name': fields.char('Order Reference', size=64, required=True,
readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True),
'shop_id': fields.many2one('sale.shop', 'Shop', required=True, readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}),
.
.
.
'link_Purchase': fields.many2one('purchase.order', 'Link Purchase'),
}
But it don't work. I have this error:
'NoneType' object has no attribute '_table'
Someone knows why please?
Thank you a lot
Please link the whole file you have created. (I assume you have created a new module, and not injected directly your python code into the sale.py file...)
Hi Yann. Thank you for your help. I injected my code directly on sale.py. I will try to create my own file but for the beginning I prefered use the sale.py. I edited my text to be more clear.
I don't know, perhaps you have something in your log file that can help us to solve this ?