Merge lp:~openbig/bigconsulting/modify_sale_prize_information2 into lp:bigconsulting

Proposed by Atik Agewan(OpenERP)
Status: Merged
Merged at revision: 18
Proposed branch: lp:~openbig/bigconsulting/modify_sale_prize_information2
Merge into: lp:bigconsulting
Diff against target: 54 lines (+26/-3)
1 file modified
product_price_information/wizard/sale_prize_information.py (+26/-3)
To merge this branch: bzr merge lp:~openbig/bigconsulting/modify_sale_prize_information2
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+27679@code.launchpad.net

Description of the change

modify the product price information wizard

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product_price_information/wizard/sale_prize_information.py'
2--- product_price_information/wizard/sale_prize_information.py 2010-06-09 10:37:58 +0000
3+++ product_price_information/wizard/sale_prize_information.py 2010-06-16 07:35:45 +0000
4@@ -49,6 +49,7 @@
5 def set_default(self, cr, uid, ids, context=None):
6 obj = self.pool.get('product.pricelist')
7 obj2 = self.pool.get('product.pricelist.item')
8+ obj3 = self.pool.get('sale.order.line')
9 form = self.read(cr, uid, ids, [])[0]
10 partner = form['partner_id']
11 pricelist = form['pricelist_id']
12@@ -66,11 +67,33 @@
13 for line in obj2.browse(cr, uid,item_line, context=context):
14 if product == line.product_id.id:
15 list.append(line.min_quantity)
16- m_qty = max(list)
17+ if list == []:
18+ m_qty = 1.0
19+ else:
20+ m_qty = max(list)
21 val3 = obj.price_get(cr, uid, ids, product, m_qty, partner)
22 for key,values in val3.items():
23 c_price3 = values
24- self.write(cr , uid, ids,{'customer_prices1':c_price1,'customer_prices2':c_price2,'next_better_price_qty':m_qty,'best_price_on_qty':c_price3},context=context)
25+ list_price = self.pool.get("product.product").browse(cr, uid, product).standard_price
26+ list_price1 = list_price * qty1
27+ list_price2 = list_price * qty2
28+ read_id = obj3.search(cr,uid,[('product_id','=',product)])
29+ if read_id == []:
30+ last_price = 0.0
31+ qty_last = 0.0
32+ last_list_price = 0.0
33+ else:
34+ last_id = max(read_id)
35+ last_brw = obj3.browse(cr,uid,[last_id],context=context)
36+ for rec in last_brw:
37+ product2 = rec.product_id.id
38+ if product == product2:
39+ last_price = rec.price_unit
40+ qty_last = rec.product_uom_qty
41+ val_last = obj.price_get(cr, uid,ids, product2, qty_last)
42+ for key,values in val_last.items():
43+ last_list_price = values
44+ self.write(cr , uid, ids,{'customer_prices1':c_price1,'customer_prices2':c_price2,'list_prices1':list_price1,'list_prices2':list_price2,'next_better_price_qty':m_qty,'best_price_on_qty':c_price3,'last_customer_prices':last_price,'qty_buyed':qty_last,'last_list_prices':last_list_price},context=context)
45 value = {
46
47 'name': 'Sale Prize Information',
48@@ -82,4 +105,4 @@
49
50 sale_prize_information()
51
52-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
53+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
54\ No newline at end of file

Subscribers

People subscribed via source and target branches