0

I am trying to access the field manufacturer_pref from the product.product table from the purchase order report.

This is the module that created the field :

class product_product(osv.osv):
_inherit = 'product.product'
_columns = {
    'manufacturer' : fields.many2one('res.partner', 'Manufacturer'),
    'manufacturer_pname' : fields.char('Manufacturer Product Name', size=64),
    'manufacturer_pref' : fields.char('Manufacturer Product Code', size=64),
    'attribute_ids': fields.one2many('product.manufacturer.attribute', 'product_id', 'Attributes'),
}

I went in the purchase module, edited purchase.py and added this under _columns = {

'manufacturer_pref': fields.related('order_line','manufacturer_pref', type='char', relation='product.product', string='Manufacturer'),

saved, did a

./openerp-server -db My_DB -u=all

and when I get back in pgAdminIII, when I look in purchase_order_line table, the column is not showing up.

Where I am wrong ?

Mobidoy
  • 353
  • 1
  • 3
  • 11
  • 1
    Maybe a missing commit when the columns are added? –  Apr 16 '14 at 17:35
  • Could you explain your comment, I am not getting it. – Mobidoy Apr 16 '14 at 17:55
  • Lets see it that way. In my table purchase order line, I would like to add a column for both, the manufacturer name (manufacturer_pname) and manufacturer code(manufacturer_pref). those 2 are fields of product wich are located in product.product table. in the table purchase.order.line, I have the field product_id which is related to my product id in product.product table 'product_id': fields.many2one('product.product', 'Product', domain=[('purchase_ok','=',True)], change_default=True), so, I would I get those 2 fields from that product.product table into purchase.order.line table ? – Mobidoy Apr 17 '14 at 15:40
  • 1
    I have change the line to: 'manufacturer_pref': fields.many2one('product.product','manufacturer_pref'), The column was created but, it still does not get the value from the product.product table field manufacturer_pref – Mobidoy Apr 17 '14 at 15:44

0 Answers0