diff --git a/addons/mrp/report/price.py b/addons/mrp/report/price.py index 5afd6b3ee49..d5a3c32646c 100644 --- a/addons/mrp/report/price.py +++ b/addons/mrp/report/price.py @@ -34,7 +34,6 @@ class report_custom(report_rml): registry = openerp.registry(cr.dbname) product_pool = registry.get('product.product') product_uom_pool = registry.get('product.uom') - supplier_info_pool = registry.get('product.supplierinfo') workcenter_pool = registry.get('mrp.workcenter') user_pool = registry.get('res.users') bom_pool = registry.get('mrp.bom') diff --git a/addons/product/pricelist.py b/addons/product/pricelist.py index 838c3008318..279f921f6c9 100644 --- a/addons/product/pricelist.py +++ b/addons/product/pricelist.py @@ -172,9 +172,7 @@ class product_pricelist(osv.osv): products = map(lambda x: x[0], products_by_qty_by_partner) currency_obj = self.pool.get('res.currency') product_obj = self.pool.get('product.product') - product_category_obj = self.pool.get('product.category') product_uom_obj = self.pool.get('product.uom') - supplierinfo_obj = self.pool.get('product.supplierinfo') price_type_obj = self.pool.get('product.price.type') version = False diff --git a/addons/product/product.py b/addons/product/product.py index 7ca28e2f623..2b1380bd58e 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -410,7 +410,7 @@ class product_template(osv.osv): help='Coefficient to convert default Unit of Measure to Unit of Sale\n' ' uos = uom * coeff'), 'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type'), - 'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Supplier'), + 'seller_ids': fields.one2many('product.supplierinfo', 'product_tmpl_id', 'Supplier'), 'company_id': fields.many2one('res.company', 'Company', select=1), # image: all image fields are base64 encoded and PIL-supported 'image': fields.binary("Image", @@ -928,7 +928,6 @@ class product_supplierinfo(osv.osv): _description = "Information about a product supplier" def _calc_qty(self, cr, uid, ids, fields, arg, context=None): result = {} - product_uom_pool = self.pool.get('product.uom') for supplier_info in self.browse(cr, uid, ids, context=context): for field in fields: result[supplier_info.id] = {field:False} @@ -941,10 +940,10 @@ class product_supplierinfo(osv.osv): '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."), - 'product_uom': fields.related('product_id', 'uom_po_id', type='many2one', relation='product.uom', string="Supplier Unit of Measure", readonly="1", help="This comes from the product form."), + 'product_uom': fields.related('product_tmpl_id', 'uom_po_id', type='many2one', relation='product.uom', string="Supplier Unit of Measure", readonly="1", help="This comes from the product form."), 'min_qty': fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the supplier Product Unit of Measure if not empty, in the default unit of measure of the product otherwise."), 'qty': fields.function(_calc_qty, store=True, type='float', string='Quantity', multi="qty", help="This is a quantity which is converted into Default Unit of Measure."), - 'product_id' : fields.many2one('product.product', 'Product', required=True, ondelete='cascade', select=True), + 'product_tmpl_id' : fields.many2one('product.template', 'Product Template', required=True, ondelete='cascade', select=True), 'delay' : fields.integer('Delivery Lead Time', required=True, help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."), 'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'), 'company_id':fields.many2one('res.company','Company',select=1), @@ -972,6 +971,7 @@ class product_supplierinfo(osv.osv): currency_id = self.pool.get('res.users').browse(cr, uid, uid, context=context).company_id.currency_id.id # Compute price from standard price of product product_price = product_pool.price_get(cr, uid, [product_id], 'standard_price', context=context)[product_id] + product = product_pool.browse(cr, uid, product_id, context=context) for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context): price = product_price # Compute price from Purchase pricelist of supplier @@ -981,7 +981,7 @@ class product_supplierinfo(osv.osv): price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price) # Compute price from supplier pricelist which are in Supplier Information - supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_id','=',product_id)]) + supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_tmpl_id','=',product.product_tmpl_id.id)]) if supplier_info_ids: cr.execute('SELECT * ' \ 'FROM pricelist_partnerinfo ' \ diff --git a/addons/product/product_demo.xml b/addons/product/product_demo.xml index 52cbd6abaf7..a309a1f8b88 100644 --- a/addons/product/product_demo.xml +++ b/addons/product/product_demo.xml @@ -995,322 +995,322 @@ QWERTY keyboard --> - + 3 1 - + 3 1 - + 3 1 - + 3 1 - + 2 5 - + 4 1 - + 2 1 - + 2 1 - + 5 1 - + 5 1 - + 5 1 - + 1 1 - + 1 1 - + 3 1 - + 3 1 - + 4 5 - + 3 1 - + 2 1 - + 3 1 - + 3 1 - + 3 1 - + 8 1 - + 8 1 - + 4 1 - + 5 1 - + 2 12 - + 2 12 - + 2 5 - + 2 12 - + 2 5 - + 2 1 - + 2 1 - + 4 1 - + 4 1 - + 5 1 - + 5 1 - + 7 1 - + 4 1 - + 4 0 - + 5 0 - + 2 0 - + 4 0 - + 10 0 - + 3 0 - + 5 0 diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 75f6856709b..88ac7c635c7 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -958,7 +958,6 @@ class purchase_order_line(osv.osv): product_product = self.pool.get('product.product') product_uom = self.pool.get('product.uom') res_partner = self.pool.get('res.partner') - product_supplierinfo = self.pool.get('product.supplierinfo') product_pricelist = self.pool.get('product.pricelist') account_fiscal_position = self.pool.get('account.fiscal.position') account_tax = self.pool.get('account.tax') diff --git a/addons/purchase_requisition/purchase_requisition.py b/addons/purchase_requisition/purchase_requisition.py index 3f31837e38e..5ce57dab811 100644 --- a/addons/purchase_requisition/purchase_requisition.py +++ b/addons/purchase_requisition/purchase_requisition.py @@ -96,7 +96,6 @@ class purchase_requisition(osv.osv): def _seller_details(self, cr, uid, requisition_line, supplier, context=None): product_uom = self.pool.get('product.uom') pricelist = self.pool.get('product.pricelist') - supplier_info = self.pool.get("product.supplierinfo") product = requisition_line.product_id default_uom_po_id = product.uom_po_id.id qty = product_uom._compute_qty(cr, uid, requisition_line.product_uom_id.id, requisition_line.product_qty, default_uom_po_id) diff --git a/addons/website_sale/models/product.py b/addons/website_sale/models/product.py index f04be77d7a2..7070f923e2b 100644 --- a/addons/website_sale/models/product.py +++ b/addons/website_sale/models/product.py @@ -35,17 +35,10 @@ class product_template(osv.Model): _name = 'product.template' def _website_url(self, cr, uid, ids, field_name, arg, context=None): - """ TDE-NOTE: as someone wrote this method without any clue on about what it - does, fixing bugs about product_variant_ids not existing will be done - based on the weather, the sun and Lilo's feelings about pigs. - - If you see this comment in trunk, this means that the website branch has - been merged without any review, which is quite questionable. """ res = dict.fromkeys(ids, '') base_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url') for product in self.browse(cr, uid, ids, context=context): - if product.product_variant_ids: - res[product.id] = "%s/shop/product/%s/" % (base_url, product.product_variant_ids[0].id) + res[product.id] = "%s/shop/product/%s/" % (base_url, product.id) return res _columns = {