From 730ff68aabe0bc5e098d7a186e74f208ddea45a7 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 2 Dec 2010 17:21:53 +0530 Subject: [PATCH 01/11] [IMP]: stock: Moved puchase related demo in purchase module bzr revid: rpa@tinyerp.com-20101202115153-pm66bdz3rfxuq595 --- addons/purchase/purchase_demo.xml | 4 ++++ addons/stock/stock_demo.xml | 2 -- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/addons/purchase/purchase_demo.xml b/addons/purchase/purchase_demo.xml index f95009aae9d..053c6f17b14 100644 --- a/addons/purchase/purchase_demo.xml +++ b/addons/purchase/purchase_demo.xml @@ -56,6 +56,10 @@ + + + + diff --git a/addons/stock/stock_demo.xml b/addons/stock/stock_demo.xml index 5de12effd2b..f291199f394 100644 --- a/addons/stock/stock_demo.xml +++ b/addons/stock/stock_demo.xml @@ -212,10 +212,8 @@ - - From 1abc54ac2541ae97a8a7d46c393a80d1197b001d Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 2 Dec 2010 18:03:06 +0530 Subject: [PATCH 02/11] [FIX]: purchase_requisition: Fixed error in create quotation wizard lp bug: https://launchpad.net/bugs/663662 fixed bzr revid: rpa@tinyerp.com-20101202123306-50ngxw62gdvhmq3a --- .../wizard/purchase_requisition_partner.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py index a5a291b545d..f196b1e20a8 100644 --- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py +++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py @@ -88,7 +88,10 @@ class purchase_requisition_partner(osv.osv_memory): newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') newdate = newdate - relativedelta(days=company.po_lead) delay = partner_rec and partner_rec.delay or 0.0 - newdate = newdate -(delay and relativedelta(days=delay) or datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') ) + if delay: + newdate = (newdate - (delay and relativedelta(days=delay))) + else: + newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') partner = partner_rec and partner_rec.name or supplier_data pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id] From 9444db9dc9f32d03e97279c5a6dda137203b6252 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 3 Dec 2010 10:49:08 +0530 Subject: [PATCH 03/11] [IMP]: purchase_requisition: Code Improvement bzr revid: rpa@tinyerp.com-20101203051908-yoe57ajd4zvp3g3t --- .../wizard/purchase_requisition_partner.py | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py index f196b1e20a8..9b94b007361 100644 --- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py +++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py @@ -85,31 +85,31 @@ class purchase_requisition_partner(osv.osv_memory): partner_list = sorted([(partner.sequence, partner) for partner in line.product_id.seller_ids if partner]) partner_rec = partner_list and partner_list[0] and partner_list[0][1] or False uom_id = line.product_id.uom_po_id and line.product_id.uom_po_id.id or False - newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') - newdate = newdate - relativedelta(days=company.po_lead) + + if tender.date_start: + newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') - relativedelta(days=company.po_lead) + else: + newdate = datetime.today() - relativedelta(days=company.po_lead) delay = partner_rec and partner_rec.delay or 0.0 if delay: - newdate = (newdate - (delay and relativedelta(days=delay))) - else: - newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') + newdate -= relativedelta(days=delay) +# TO-CHECK: If not delay take date considering PO lead or tender date +# else: +# newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') + partner = partner_rec and partner_rec.name or supplier_data pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False price = pricelist_obj.price_get(cr, uid, [pricelist_id], line.product_id.id, line.product_qty, False, {'uom': uom_id})[pricelist_id] product = prod_obj.browse(cr, uid, line.product_id.id, context=context) location_id = self.pool.get('stock.warehouse').read(cr, uid, [tender.warehouse_id.id], ['lot_input_id'])[0]['lot_input_id'][0] - if not newdate: - date_planned = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') - else: - date_planned = newdate.strftime('%Y-%m-%d %H:%M:%S') - purchase_order_line= { 'name': product.partner_ref, 'product_qty': line.product_qty, 'product_id': line.product_id.id, 'product_uom': uom_id, 'price_unit': price, - 'date_planned': date_planned, + 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'notes': product.description_purchase, } taxes_ids = line.product_id.product_tmpl_id.supplier_taxes_id From 68880fdc90eb04516c4ee0002730b4b67d8b83a1 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 3 Dec 2010 12:43:40 +0530 Subject: [PATCH 04/11] [REM]: purchase_requisition: Removed unused code bzr revid: rpa@tinyerp.com-20101203071340-8su0mlcbotq4qmtb --- addons/purchase_requisition/purchase_requisition_demo.xml | 1 - .../wizard/purchase_requisition_partner.py | 3 --- 2 files changed, 4 deletions(-) diff --git a/addons/purchase_requisition/purchase_requisition_demo.xml b/addons/purchase_requisition/purchase_requisition_demo.xml index 225137416bf..a0b4d7f217b 100644 --- a/addons/purchase_requisition/purchase_requisition_demo.xml +++ b/addons/purchase_requisition/purchase_requisition_demo.xml @@ -9,7 +9,6 @@ - TE0001 multiple 2010/09/16 15:56:14 diff --git a/addons/purchase_requisition/wizard/purchase_requisition_partner.py b/addons/purchase_requisition/wizard/purchase_requisition_partner.py index 9b94b007361..8db1f97b390 100644 --- a/addons/purchase_requisition/wizard/purchase_requisition_partner.py +++ b/addons/purchase_requisition/wizard/purchase_requisition_partner.py @@ -93,9 +93,6 @@ class purchase_requisition_partner(osv.osv_memory): delay = partner_rec and partner_rec.delay or 0.0 if delay: newdate -= relativedelta(days=delay) -# TO-CHECK: If not delay take date considering PO lead or tender date -# else: -# newdate = datetime.strptime(tender.date_start, '%Y-%m-%d %H:%M:%S') partner = partner_rec and partner_rec.name or supplier_data pricelist_id = partner.property_product_pricelist_purchase and partner.property_product_pricelist_purchase.id or False From c511a13c195c60b68ffbf0fd91c269eec3b028f6 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 3 Dec 2010 14:52:26 +0530 Subject: [PATCH 05/11] [FIX]: mrp: "Consume products" in Production order creates 2 records lp bug: https://launchpad.net/bugs/667327 fixed bzr revid: rpa@tinyerp.com-20101203092226-xe490fnzq027sapt --- addons/mrp/stock.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/addons/mrp/stock.py b/addons/mrp/stock.py index caed38654ac..90b98b093ae 100644 --- a/addons/mrp/stock.py +++ b/addons/mrp/stock.py @@ -113,6 +113,9 @@ class StockMove(osv.osv): production_obj.force_production(cr, uid, [prod.id]) wf_service.trg_validate(uid, 'mrp.production', prod.id, 'button_produce', cr) for new_move in new_moves: + if new_move == move.id: + #This move is already there in move lines of production order + continue production_obj.write(cr, uid, production_ids, {'move_lines': [(4, new_move)]}) res.append(new_move) return res From 62e55828d06f400bac5c81895f2789d137276a59 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Fri, 3 Dec 2010 15:02:47 +0530 Subject: [PATCH 06/11] [IMP]: purchase_requisition: Added missing file name in __openerp__.py bzr revid: rpa@tinyerp.com-20101203093247-ahbm3vd44tlyk507 --- addons/purchase_requisition/__openerp__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/purchase_requisition/__openerp__.py b/addons/purchase_requisition/__openerp__.py index 0cfc48feccd..ff99be06ae3 100644 --- a/addons/purchase_requisition/__openerp__.py +++ b/addons/purchase_requisition/__openerp__.py @@ -31,7 +31,8 @@ "depends" : ["purchase","mrp"], "init_xml" : [], "demo_xml" : ['purchase_requisition_demo.xml'], - "update_xml" : ["wizard/purchase_requisition_partner_view.xml", + "update_xml" : ["security/purchase_tender.xml", + "wizard/purchase_requisition_partner_view.xml", "purchase_requisition_data.xml", "purchase_requisition_view.xml", "purchase_requisition_report.xml", From 5e3054ef8a4f4c060e9d121e65abc1fae835d203 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Tue, 7 Dec 2010 09:55:19 +0530 Subject: [PATCH 07/11] [REVERT]: sale: Reverted wrong commit bzr revid: rpa@tinyerp.com-20101207042519-roytk9yl5cbaubys --- addons/sale/sale_view.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index adafd1938fa..c83f1cd3e45 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -138,7 +138,7 @@ + on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"/> Date: Wed, 8 Dec 2010 15:02:58 +0530 Subject: [PATCH 08/11] [FIX]: stock: Source location and destination location should be considered separately while finding stock.move in order to compute proper value of product when we have only one move lp bug: https://launchpad.net/bugs/683718 fixed bzr revid: rpa@tinyerp.com-20101208093258-qih3i1yj19hi7atv --- addons/stock/stock.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 6723c1b142b..7ae3941c545 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -114,8 +114,11 @@ class stock_location(osv.osv): product_product_obj = self.pool.get('product.product') - cr.execute('select distinct product_id, location_id from stock_move where location_id in %s or location_dest_id in %s', (tuple(ids), tuple(ids))) - res_products_by_location = sorted(cr.dictfetchall(), key=itemgetter('location_id')) + cr.execute('select distinct product_id, location_id from stock_move where location_id in %s', (tuple(ids), )) + dict1 = cr.dictfetchall() + cr.execute('select distinct product_id, location_dest_id as location_id from stock_move where location_dest_id in %s', (tuple(ids), )) + dict2 = cr.dictfetchall() + res_products_by_location = sorted(dict1+dict2, key=itemgetter('location_id')) products_by_location = dict((k, [v['product_id'] for v in itr]) for k, itr in groupby(res_products_by_location, itemgetter('location_id'))) result = dict([(i, {}.fromkeys(field_names, 0.0)) for i in ids]) From 2f32807ce692bb35e6df3fa7b2e5a60daaf2297f Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Wed, 8 Dec 2010 18:03:38 +0530 Subject: [PATCH 09/11] [FIX]: product/purchase: Fixed wrong calculation of product qty and amount in purchas line if supplier UOM is different lp bug: https://launchpad.net/bugs/423124 fixed bzr revid: rpa@tinyerp.com-20101208123338-absetujv1l31ce9k --- addons/product/product.py | 2 +- addons/purchase/purchase.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/addons/product/product.py b/addons/product/product.py index 84b90a53b62..be318db59bc 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -159,7 +159,7 @@ class product_uom(osv.osv): return price amount = price * from_unit.factor if to_uom_id: - amount = amount / to_unit.factor + amount = amount / to_unit.factor_inv return amount def onchange_type(self, cursor, user, ids, value): diff --git a/addons/purchase/purchase.py b/addons/purchase/purchase.py index 927f1cdcba5..1995b5d93f7 100644 --- a/addons/purchase/purchase.py +++ b/addons/purchase/purchase.py @@ -647,7 +647,7 @@ class purchase_order_line(osv.osv): 'notes': notes or'', 'product_uom' : uom or False}, 'domain':{'product_uom':[]}} prod= self.pool.get('product.product').browse(cr, uid, product) - + product_uom_pool = self.pool.get('product.uom') lang=False if partner_id: lang=self.pool.get('res.partner').read(cr, uid, partner_id, ['lang'])['lang'] @@ -668,15 +668,18 @@ class purchase_order_line(osv.osv): for s in prod.seller_ids: if s.name.id == partner_id: seller_delay = s.delay - temp_qty = s.qty # supplier _qty assigned to temp + temp_qty = s.min_qty # supplier _qty assigned to temp + if s.product_uom: + qty = product_uom_pool._compute_qty(cr, uid, s.product_uom.id, s.min_qty, to_uom_id=prod_uom_po) + uom = prod_uom_po if qty < temp_qty: # If the supplier quantity is greater than entered from user, set minimal. qty = temp_qty if price_unit: price = price_unit else: price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], - product, qty or 1.0, partner_id, { - 'uom': uom, + product, 1.0, partner_id, { + 'uom': prod_uom_po, 'date': date_order, })[pricelist] dt = (datetime.now() + relativedelta(days=int(seller_delay) or 0.0)).strftime('%Y-%m-%d %H:%M:%S') From 31506fdf8b5d8acdfbca29d9492982b69238bf99 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 9 Dec 2010 12:05:03 +0530 Subject: [PATCH 10/11] [REVERT]: product: Reverted wrong commit in product bzr revid: rpa@tinyerp.com-20101209063503-g13ct483rhq7ss47 --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index be318db59bc..84b90a53b62 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -159,7 +159,7 @@ class product_uom(osv.osv): return price amount = price * from_unit.factor if to_uom_id: - amount = amount / to_unit.factor_inv + amount = amount / to_unit.factor return amount def onchange_type(self, cursor, user, ids, value): From 1c4445a1af63b76e8279308232a7f3b093fc7872 Mon Sep 17 00:00:00 2001 From: "rpa (Open ERP)" Date: Thu, 9 Dec 2010 12:21:35 +0530 Subject: [PATCH 11/11] [IMP]: product: Added proper tooltip for supplier price information amount bzr revid: rpa@tinyerp.com-20101209065135-au355cwbnncm3a29 --- addons/product/product.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/product/product.py b/addons/product/product.py index 84b90a53b62..b51a0df9c5f 100644 --- a/addons/product/product.py +++ b/addons/product/product.py @@ -760,7 +760,7 @@ class pricelist_partnerinfo(osv.osv): 'name': fields.char('Description', size=64), 'suppinfo_id': fields.many2one('product.supplierinfo', 'Partner Information', required=True, ondelete='cascade'), 'min_quantity': fields.float('Quantity', required=True), - 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price')), + 'price': fields.float('Unit Price', required=True, digits_compute=dp.get_precision('Purchase Price'), help="This price will be considered as a price for default Unit of Measure of the product"), } _order = 'min_quantity asc' pricelist_partnerinfo()