Dear Navnath Desale,
Thank you for your answer.
I have three importantes questions:
First one:
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"
.
.
.
_columns = {
'name': fields.char('Order Reference', size=64, required=True,
readonly=True, states={'draft': [('readonly', False)], 'sent': [('readonly', False)]}, select=True),
.
.
.
'link_Purchase': fields.many2one('purchase.order', 'Link Purchase'),
}
But it don't work. I have this error:
'NoneType' object has no attribute '_table'
You know why please?
Second one :
Is it possible to print the result of an SQL queries?
For exemple my SQL queries will send me the name of 10 products. I would like to have a tree with a line for each result.
Is it possible? If yes how? With a field type function? How can I put in my field the names of the 10 products? How can I print it?
For the moment I succeed in storing the result of my SQL queries in a field type text.
cr.execute('SELECT name from product_bat where name is not null')
res = cr.fetchall()
result['product_BAT'] = res
'product_BAT': fields.text('product.bat'),
<field name="product_BAT"/>
The problem is that I have the list of my result in one line, seperate by some coma.
name1,name2,name3
Third one:
I would like to know how is possible to get (or to link together) two fields in two differents tables?
To be more clear:
My first field (field1) is a one2many field. Table product.template. My second field (field2) is on the table sale.order.line.
The goal of this manipulation is to have the field1 (the one2many) for each product of the sale.order.line.
Need I to declare my field2 as a one2many too? or can in make the link to say: My field 2 is my field 1?
You think you can help me? How many times you need?
Thank you a lot.
Selverine