We separated the product name and it's description on devices so it looks like this:
Product Name | Product Description | ... | Price |
Some Product | Some Product Some Product Description | ... |
As you can see the product's name "Some Product" is duplicated in the name-column.
I copied the function's head from account/account_invoice.py
I'm trying with a custom module, which looks like this:
# -*- coding: utf-8 -*-
from openerp import models
class account_invoice_line(models.Model):
_inherit='account.invoice.line'
@api.multi
def product_id_change(self, product, uom_id, qty=0, name='', type='out_invoice',
partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
company_id=None):
res = super(account_invoice_line, self).product_id_change(
product, uom_id, qty=qty, name=name, type=type, partner_id=partner_id,
fposition_id=fposition_id, price_unit=price_unit,
currency_id=currency_id, context=context, company_id=company_id)
if product_id:
product_obj = self.pool.get('product.product')
product = product_obj.browse(cr, uid, product_id, context=context)
if product.description_sale:
res['value']['name'] = product.description_sale
elif product.description_purchase:
res['value']['name'] = product.description_purchase
return res
After installing and trying to create an invoice position, I get this error, which I am not able to fix:
TypeError: product_id_change() got multiple values for keyword argument 'qty'