When I installed my module it loads but whenever I select a product that has a label type specified for, I get this error and I don't have a clue. I need your help please. Thank you in advance
class label_maker(osv.osv):
_name = 'label.maker'
_columns = {
'name': fields.char('Label Name',size=200,required=True, help='This is the name of the label'),
'label_owner': fields.char('Company Name',size=200,select=True, help='selects the product on the order line'),
}
label_maker()
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
_columns = {
'order_line_label': fields.many2one('label.maker','Label',select=True, help='label name'),
}
product_product()
class sale_order_line(osv.osv):
_name = 'sale.order.line'
_inherit = 'sale.order.line'
_columns = {
'order_line_label': fields.many2one('label.maker','Label',select=True, help='select the right label for the product and partner'),
}
def product_id_change2(self, cr, uid, ids, pricelist, product, qty=0,
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, order_line_label=False, context=None):
context = context or {}
res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
product_obj = self.pool.get('product.product').browse(cr, uid, product, context=context)
# product_obj = product_obj
res['value'].update({'order_line_label': product_obj.order_line_label or False})
return res
sale_order_line()
xml am using is
<record model="ir.ui.view" id="view_order_line_tree">
<field name="name">order.line.tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<xpath expr="//page[@string='Sales Order']/field[@name='order_line']/tree[@string='Sales Order Lines']/field[@name='product_uom_qty']" position="before">
<field name="order_line_label"/>
</xpath>
<xpath expr="//field[@name='order_line']/form/notebook/page[@string='Order Line']//field[@name='product_uom_qty' ]" position="before">
<field name="order_line_label" />
</xpath>
</field>
</record>