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

Proposed by Atik Agewan(OpenERP)
Status: Merged
Merged at revision: 14
Proposed branch: lp:~openbig/bigconsulting/stock_shop_availability_wizard
Merge into: lp:bigconsulting
Diff against target: 254 lines (+142/-15)
7 files modified
sales_shop_stock_availability/__init__.py (+3/-2)
sales_shop_stock_availability/__terp__.py (+2/-2)
sales_shop_stock_availability/sales_shop_stock_availability.py (+7/-10)
sales_shop_stock_availability/sales_shop_stock_availability_view.xml (+1/-1)
sales_shop_stock_availability/wizard/__init__.py (+25/-0)
sales_shop_stock_availability/wizard/stock_shop_availability.py (+62/-0)
sales_shop_stock_availability/wizard/stock_shop_availability_view.xml (+42/-0)
To merge this branch: bzr merge lp:~openbig/bigconsulting/stock_shop_availability_wizard
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+27244@code.launchpad.net

Description of the change

add wizard in sales_shop_stock_availability module and show menu in sale menagement menu..

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 'sales_shop_stock_availability/__init__.py'
2--- sales_shop_stock_availability/__init__.py 2010-05-28 07:33:26 +0000
3+++ sales_shop_stock_availability/__init__.py 2010-06-10 10:08:25 +0000
4@@ -1,7 +1,7 @@
5 # -*- encoding: utf-8 -*-
6 ##############################################################################
7 #
8-# OpenERP, Open Source Management Solution
9+# OpenERP, Open Source Management Solution
10 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
11 # $Id$
12 #
13@@ -19,8 +19,9 @@
14 # along with this program. If not, see <http://www.gnu.org/licenses/>.
15 #
16 ##############################################################################
17-
18+import wizard
19 import sales_shop_stock_availability
20
21+
22 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
23
24
25=== modified file 'sales_shop_stock_availability/__terp__.py'
26--- sales_shop_stock_availability/__terp__.py 2010-05-28 11:29:13 +0000
27+++ sales_shop_stock_availability/__terp__.py 2010-06-10 10:08:25 +0000
28@@ -1,7 +1,7 @@
29 # -*- encoding: utf-8 -*-
30 ##############################################################################
31 #
32-# OpenERP, Open Source Management Solution
33+# OpenERP, Open Source Management Solution
34 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
35 # $Id$
36 #
37@@ -32,7 +32,7 @@
38 """,
39 "depends": ['base','sale'],
40 "demo_xml": [],
41- "update_xml": ['sales_shop_stock_availability_view.xml'],
42+ "update_xml": ['sales_shop_stock_availability_view.xml','wizard/stock_shop_availability_view.xml'],
43 "license": "GPL-3",
44 "active": False,
45 "installable": True,
46
47=== modified file 'sales_shop_stock_availability/sales_shop_stock_availability.py'
48--- sales_shop_stock_availability/sales_shop_stock_availability.py 2010-05-28 11:29:13 +0000
49+++ sales_shop_stock_availability/sales_shop_stock_availability.py 2010-06-10 10:08:25 +0000
50@@ -1,7 +1,7 @@
51 # -*- encoding: utf-8 -*-
52 ##############################################################################
53 #
54-# OpenERP, Open Source Management Solution
55+# OpenERP, Open Source Management Solution
56 # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
57 # $Id$
58 #
59@@ -22,30 +22,27 @@
60
61 from osv import fields, osv
62 from tools import config
63-
64+
65 class product_product(osv.osv):
66 _inherit = "product.product"
67-
68+
69 def _product_available_other_shop(self, cr, uid, ids, name, arg, context={}):
70
71- res = {}
72+ res = {}
73 product_obj = self.pool.get('product.product')
74 shop = context.get('shop', False)
75 fields_name = ['qty_available']
76-
77 stock2 = product_obj._product_available(cr, uid, ids ,fields_name,context={})
78-
79 context.update({'shop':shop})
80 stock1 = product_obj._product_available(cr, uid, ids ,fields_name,context=context)
81-
82 for key,value in stock2.items():
83 res[key] = stock2[key]['qty_available'] - stock1[key]['qty_available']
84- return res
85-
86+ return res
87+
88 _columns = {
89 'qty_available_other_shop': fields.function(_product_available_other_shop, method=True, type='float', string='Other Shops', help="Current quantities of products in other stock location except selected shop in sale order."),
90 }
91-
92+
93 product_product()
94
95 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
96
97=== modified file 'sales_shop_stock_availability/sales_shop_stock_availability_view.xml'
98--- sales_shop_stock_availability/sales_shop_stock_availability_view.xml 2010-05-28 07:33:26 +0000
99+++ sales_shop_stock_availability/sales_shop_stock_availability_view.xml 2010-06-10 10:08:25 +0000
100@@ -37,7 +37,7 @@
101 on_change="product_id_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'], True, parent.date_order, product_packaging, parent.fiscal_position)"
102 select="1"/>
103 </xpath>
104- </field>
105+ </field>
106 </record>
107 </data>
108 </openerp>
109
110=== added directory 'sales_shop_stock_availability/wizard'
111=== added file 'sales_shop_stock_availability/wizard/__init__.py'
112--- sales_shop_stock_availability/wizard/__init__.py 1970-01-01 00:00:00 +0000
113+++ sales_shop_stock_availability/wizard/__init__.py 2010-06-10 10:08:25 +0000
114@@ -0,0 +1,25 @@
115+# -*- coding: utf-8 -*-
116+##############################################################################
117+#
118+# OpenERP, Open Source Management Solution
119+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
120+#
121+# This program is free software: you can redistribute it and/or modify
122+# it under the terms of the GNU Affero General Public License as
123+# published by the Free Software Foundation, either version 3 of the
124+# License, or (at your option) any later version.
125+#
126+# This program is distributed in the hope that it will be useful,
127+# but WITHOUT ANY WARRANTY; without even the implied warranty of
128+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
129+# GNU Affero General Public License for more details.
130+#
131+# You should have received a copy of the GNU Affero General Public License
132+# along with this program. If not, see <http://www.gnu.org/licenses/>.
133+#
134+##############################################################################
135+
136+import stock_shop_availability
137+
138+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
139+
140
141=== added file 'sales_shop_stock_availability/wizard/stock_shop_availability.py'
142--- sales_shop_stock_availability/wizard/stock_shop_availability.py 1970-01-01 00:00:00 +0000
143+++ sales_shop_stock_availability/wizard/stock_shop_availability.py 2010-06-10 10:08:25 +0000
144@@ -0,0 +1,62 @@
145+# -*- coding: utf-8 -*-
146+##############################################################################
147+#
148+# OpenERP, Open Source Management Solution
149+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
150+#
151+# This program is free software: you can redistribute it and/or modify
152+# it under the terms of the GNU Affero General Public License as
153+# published by the Free Software Foundation, either version 3 of the
154+# License, or (at your option) any later version.
155+#
156+# This program is distributed in the hope that it will be useful,
157+# but WITHOUT ANY WARRANTY; without even the implied warranty of
158+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
159+# GNU Affero General Public License for more details.
160+#
161+# You should have received a copy of the GNU Affero General Public License
162+# along with this program. If not, see <http://www.gnu.org/licenses/>.
163+#
164+##############################################################################
165+
166+from osv import osv, fields
167+
168+class stock_shop_availability(osv.osv_memory):
169+ _name = 'stock.shop.availability'
170+ _description = 'Stock Shop Availability'
171+ _columns = {
172+ 'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
173+ 'product_id': fields.many2one('product.product', 'Product',required= True),
174+ 'real_stock1': fields.float('Real Stock'),
175+ 'virtual_stock1': fields.float('Virtual Stock'),
176+ 'real_stock2': fields.float('Real Stock'),
177+ 'virtual_stock2': fields.float('Virtual Stock'),
178+
179+ }
180+
181+ def product_available_other_shop(self, cr, uid, ids, product_id, shop_id, context={}):
182+ res = {}
183+ product_obj = self.pool.get('product.product')
184+ fields_name = ['qty_available','virtual_available']
185+ stock2 = product_obj._product_available(cr, uid, [product_id] ,fields_name,context={})
186+ context.update({'shop_id':shop_id,'product_id':product_id})
187+ stock1 = product_obj._product_available(cr, uid, [product_id] ,fields_name,context=context)
188+ for key,value in stock1.items():
189+ real_val1 = value['qty_available']
190+ virt_val1 = value['virtual_available']
191+ for key,value in stock2.items():
192+ real_val2 = value['qty_available']
193+ virt_val2 = value['virtual_available']
194+ other_real_val = real_val2 - real_val1
195+ other_virt_val = virt_val2 - virt_val2
196+ result ={'value': {
197+ 'real_stock1': real_val1,
198+ 'virtual_stock1': virt_val1,
199+ 'real_stock2': other_real_val,
200+ 'virtual_stock2': other_virt_val,
201+ }}
202+ return result
203+
204+stock_shop_availability()
205+
206+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
207
208=== added file 'sales_shop_stock_availability/wizard/stock_shop_availability_view.xml'
209--- sales_shop_stock_availability/wizard/stock_shop_availability_view.xml 1970-01-01 00:00:00 +0000
210+++ sales_shop_stock_availability/wizard/stock_shop_availability_view.xml 2010-06-10 10:08:25 +0000
211@@ -0,0 +1,42 @@
212+<?xml version="1.0" encoding="utf-8"?>
213+<openerp>
214+ <data>
215+
216+ <record id="view_stock_shop_availability" model="ir.ui.view">
217+ <field name="name">Stock Shop Availability</field>
218+ <field name="model">stock.shop.availability</field>
219+ <field name="type">form</field>
220+ <field name="arch" type="xml">
221+ <form string="Stock Shop Availability">
222+ <group col="6" colspan="4">
223+ <group col="2" colspan="3">
224+ <field name="shop_id"/>
225+ <separator string="Availability in Shop"/><newline/>
226+ <field name="real_stock1"/>
227+ <field name="virtual_stock1"/>
228+ </group>
229+ <group col="2" colspan="3">
230+ <field name="product_id" on_change="product_available_other_shop(product_id, shop_id)"/>
231+ <separator string="Availability in Other Shops"/><newline/>
232+ <field name="real_stock2"/>
233+ <field name="virtual_stock2"/>
234+ </group>
235+ </group>
236+ </form>
237+ </field>
238+ </record>
239+
240+ <record id="action_stock_shop_availability" model="ir.actions.act_window">
241+ <field name="name">Stock Shop Availability</field>
242+ <field name="type">ir.actions.act_window</field>
243+ <field name="res_model">stock.shop.availability</field>
244+ <field name="view_type">form</field>
245+ <field name="view_mode">form</field>
246+ <field name="view_id" ref="view_stock_shop_availability"/>
247+ <field name="target">new</field>
248+ </record>
249+ <menuitem action="action_stock_shop_availability"
250+ id="menu_stock_shop_availability"
251+ parent="sale.menu_sale_root"/>
252+ </data>
253+</openerp>
254\ No newline at end of file

Subscribers

People subscribed via source and target branches