[FIX]Purchase:PO Line description doesnt take Supplier Product Name or Code in Products Suppliers Tab

lp bug: https://launchpad.net/bugs/671386 fixed

bzr revid: ron@tinyerp.com-20101112130753-shfjl1wzjvlwq2kh
This commit is contained in:
ron@tinyerp.com 2010-11-12 18:37:53 +05:30
parent 23d636e998
commit cfb6b99989
2 changed files with 16 additions and 4 deletions

View File

@ -24,7 +24,7 @@ import decimal_precision as dp
import math
from _common import rounding
import re
import re
from tools.translate import _
def is_pair(x):
@ -649,7 +649,7 @@ class product_supplierinfo(osv.osv):
return res and res[0] or False
_columns = {
'name' : fields.many2one('res.partner', 'Supplier', required=True, ondelete='cascade', help="Supplier of this product"),
'name' : fields.many2one('res.partner', 'Supplier', required=True,domain = [('supplier','=',True)], ondelete='cascade', help="Supplier of this product"),
'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one."),
'product_code': fields.char('Supplier Product Code', size=64, help="This supplier's product code will be used when printing a request for quotation. Keep empty to use the internal one."),
'sequence' : fields.integer('Sequence', help="Assigns the priority to the list of product supplier."),

View File

@ -646,6 +646,11 @@ class purchase_order_line(osv.osv):
return {'value': {'price_unit': price_unit or 0.0, 'name': name or '',
'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}}
prod= self.pool.get('product.product').browse(cr, uid, product)
if prod.product_tmpl_id.seller_ids:
seller_get_id = prod.product_tmpl_id.seller_ids[0].name.id
else:
seller_get_id = False
lang=False
if partner_id:
lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang']
@ -675,8 +680,15 @@ class purchase_order_line(osv.osv):
'date': date_order,
})[pricelist]
dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S')
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
if seller_get_id == partner_id:
prod_suppl_name = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_name
prod_suppl_code = self.pool.get('product.product').browse(cr, uid, prod.id).seller_ids[0].product_code
if prod_suppl_name == False or prod_suppl_code == False:
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
else:
prod_name= '[' + prod_suppl_code + '] '+ prod_suppl_name
else:
prod_name = self.pool.get('product.product').name_get(cr, uid, [prod.id])[0][1]
res = {'value': {'price_unit': price, 'name': name or prod_name,
'taxes_id':map(lambda x: x.id, prod.supplier_taxes_id),