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

Proposed by Husen Daudi
Status: Merged
Merged at revision: 6
Proposed branch: lp:~openbig/bigconsulting/Wizard_minimum_stock_rules
Merge into: lp:bigconsulting
Diff against target: 253 lines (+154/-12)
5 files modified
product_price_information/product_price_info.py (+12/-12)
stock_minimum_calculator/__init__.py (+24/-0)
stock_minimum_calculator/__terp__.py (+37/-0)
stock_minimum_calculator/stock_minimum_calculator.py (+46/-0)
stock_minimum_calculator/stock_minimum_calculator_view.xml (+35/-0)
To merge this branch: bzr merge lp:~openbig/bigconsulting/Wizard_minimum_stock_rules
Reviewer Review Type Date Requested Status
openbig Pending
Review via email: mp+26047@code.launchpad.net

Description of the change

Wizard added of minimum stock rules. The function must have a menu under products/configuration.

To post a comment you must log in.
Revision history for this message
Husen Daudi (husendaudi) wrote :

I reviewed your code and need some improvement in code.
Please follow this point in future development.

In __terp__.py file
"author": "Big Consulting",
"website" : "",
"category": "",
"description": """
""",

website should be there for big consulting, proper module category should be there,
 There must be detailed description required for each module.

In python file

from osv import fields, osv
from osv import fields, osv
from tools.translate import _
import netsvc
import pooler
import time
import tools
import wizard

duplication of import statement
from osv import fields, osv

remove useless imports
mport netsvc
import pooler
import time
import tools
import wizard

In each python file we must have
first line:
# -*- encoding: utf-8 -*-

in bottom last line:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'product_price_information/product_price_info.py'
2--- product_price_information/product_price_info.py 2010-05-20 14:03:55 +0000
3+++ product_price_information/product_price_info.py 2010-05-26 13:35:42 +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@@ -21,20 +21,20 @@
14 ##############################################################################
15 from osv import fields, osv
16 from tools import config
17-
18+
19 class sale_order_line(osv.osv):
20 _inherit = "sale.order.line"
21
22 _columns = {
23 'sale_price_unit_tax': fields.float('Sale price W/O taxes'),
24 }
25-
26+
27 def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
28 uom=False, qty_uos=0, uos=False, name='', partner_id=False,
29 lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
30-
31+
32 tax_obj = self.pool.get('account.tax')
33-
34+
35 result = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
36 uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order, packaging, fiscal_position, flag)
37 if product:
38@@ -43,19 +43,19 @@
39 result['value']['sale_price_unit_tax'] = product_obj.product_tmpl_id.price_unit_tax
40
41 return result
42-
43+
44 sale_order_line()
45
46 class sale_order(osv.osv):
47 _name = "sale.order"
48 _inherit = "sale.order"
49-
50+
51 def onchange_shop_id(self, cr, uid, ids, shop_id):
52 res = super(sale_order, self).onchange_shop_id(cr, uid, id, shop_id)
53 if 'value' in res and shop_id:
54 res['value']['price_type'] = self.pool.get('sale.shop').browse(cr, uid , shop_id).price_type
55 return res
56-
57+
58 sale_order()
59
60
61@@ -86,7 +86,7 @@
62 _defaults = {
63 'price_type': lambda *a: 'tax_included',
64 }
65-
66+
67 def set_default(self, cr, uid, ids, context=None):
68 for o in self.browse(cr, uid, ids, context=context):
69 ir_values_obj = self.pool.get('ir.values')
70@@ -97,8 +97,8 @@
71 'res_model': 'ir.actions.configuration.wizard',
72 'type': 'ir.actions.act_window',
73 'target': 'new',
74- }
75-
76+ }
77+
78 def action_cancel(self,cr,uid,ids,conect=None):
79 return {
80 'view_type': 'form',
81@@ -107,5 +107,5 @@
82 'type': 'ir.actions.act_window',
83 'target':'new',
84 }
85-
86+
87 sale_shop_price_method_policy()
88\ No newline at end of file
89
90=== added directory 'stock_minimum_calculator'
91=== added file 'stock_minimum_calculator/__init__.py'
92--- stock_minimum_calculator/__init__.py 1970-01-01 00:00:00 +0000
93+++ stock_minimum_calculator/__init__.py 2010-05-26 13:35:42 +0000
94@@ -0,0 +1,24 @@
95+# -*- encoding: utf-8 -*-
96+##############################################################################
97+#
98+# OpenERP, Open Source Management Solution
99+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
100+# $Id$
101+#
102+# This program is free software: you can redistribute it and/or modify
103+# it under the terms of the GNU General Public License as published by
104+# the Free Software Foundation, either version 3 of the License, or
105+# (at your option) any later version.
106+#
107+# This program is distributed in the hope that it will be useful,
108+# but WITHOUT ANY WARRANTY; without even the implied warranty of
109+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
110+# GNU General Public License for more details.
111+#
112+# You should have received a copy of the GNU General Public License
113+# along with this program. If not, see <http://www.gnu.org/licenses/>.
114+#
115+##############################################################################
116+
117+import stock_minimum_calculator
118+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
119\ No newline at end of file
120
121=== added file 'stock_minimum_calculator/__terp__.py'
122--- stock_minimum_calculator/__terp__.py 1970-01-01 00:00:00 +0000
123+++ stock_minimum_calculator/__terp__.py 2010-05-26 13:35:42 +0000
124@@ -0,0 +1,37 @@
125+# -*- encoding: utf-8 -*-
126+##############################################################################
127+#
128+# OpenERP, Open Source Management Solution
129+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
130+# $Id$
131+#
132+# This program is free software: you can redistribute it and/or modify
133+# it under the terms of the GNU General Public License as published by
134+# the Free Software Foundation, either version 3 of the License, or
135+# (at your option) any later version.
136+#
137+# This program is distributed in the hope that it will be useful,
138+# but WITHOUT ANY WARRANTY; without even the implied warranty of
139+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
140+# GNU General Public License for more details.
141+#
142+# You should have received a copy of the GNU General Public License
143+# along with this program. If not, see <http://www.gnu.org/licenses/>.
144+#
145+##############################################################################
146+{
147+ "name": "Stock Minimum Calculator",
148+ "version": "1.0",
149+ "author": "Big Consulting",
150+ "website" : "",
151+ "category": "",
152+ "description": """
153+ """,
154+ "depends": ['stock','mrp'],
155+ "demo_xml": [],
156+ "update_xml": ['stock_minimum_calculator_view.xml' ],
157+ "license": "GPL-3",
158+ "active": False,
159+ "installable": True,
160+}
161+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
162
163=== added file 'stock_minimum_calculator/stock_minimum_calculator.py'
164--- stock_minimum_calculator/stock_minimum_calculator.py 1970-01-01 00:00:00 +0000
165+++ stock_minimum_calculator/stock_minimum_calculator.py 2010-05-26 13:35:42 +0000
166@@ -0,0 +1,46 @@
167+# -*- encoding: utf-8 -*-
168+##############################################################################
169+#
170+# OpenERP, Open Source Management Solution
171+# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
172+# $Id$
173+#
174+# This program is free software: you can redistribute it and/or modify
175+# it under the terms of the GNU General Public License as published by
176+# the Free Software Foundation, either version 3 of the License, or
177+# (at your option) any later version.
178+#
179+# This program is distributed in the hope that it will be useful,
180+# but WITHOUT ANY WARRANTY; without even the implied warranty of
181+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
182+# GNU General Public License for more details.
183+#
184+# You should have received a copy of the GNU General Public License
185+# along with this program. If not, see <http://www.gnu.org/licenses/>.
186+#
187+##############################################################################
188+from osv import fields, osv
189+from osv import fields, osv
190+from tools.translate import _
191+import netsvc
192+import pooler
193+import time
194+import tools
195+import wizard
196+
197+class stock_minimum_calculator(osv.osv_memory):
198+ _name = 'stock.minimum.calculator'
199+
200+ def set_default(self, cr, uid, ids, context=None):
201+ product_obj = self.pool.get('product.product')
202+ min_rule_obj = self.pool.get('stock.warehouse.orderpoint')
203+ product_ids = product_obj.search(cr,uid,[])
204+ stock_rule_ids = min_rule_obj.search(cr,uid,[])
205+ FIELDS = ['qty_available','virtual_available','incoming_qty','outgoing_qty']
206+ for rule_record in min_rule_obj.browse(cr, uid, stock_rule_ids, context=context):
207+ context.update({'warehouse':rule_record.warehouse_id.id,'location':rule_record.location_id.id})
208+ data = product_obj._product_available(cr,uid,[rule_record.product_id.id],FIELDS,context=context)
209+ return {}
210+
211+stock_minimum_calculator()
212+
213
214=== added file 'stock_minimum_calculator/stock_minimum_calculator_view.xml'
215--- stock_minimum_calculator/stock_minimum_calculator_view.xml 1970-01-01 00:00:00 +0000
216+++ stock_minimum_calculator/stock_minimum_calculator_view.xml 2010-05-26 13:35:42 +0000
217@@ -0,0 +1,35 @@
218+<?xml version="1.0" encoding="utf-8"?>
219+<openerp>
220+ <data>
221+ <record id="view_stock_minimum_calculator_form" model="ir.ui.view">
222+ <field name="name">stock.minimum.calculator.form</field>
223+ <field name="model">stock.minimum.calculator</field>
224+ <field name="type">form</field>
225+ <field name="arch" type="xml">
226+ <form string="Stock Order Point">
227+ <group colspan="4" >
228+ <label align="0.7" colspan="6" string="(Re-calculation Minimum stock Rule)"/>
229+ </group>
230+ <separator string="" colspan="4" />
231+ <group colspan="4" col="6">
232+ <label string ="" colspan="2"/>
233+ <button icon="gtk-cancel" special="cancel" string="Cancel" />
234+ <button icon="gtk-open" string="Ok" name="set_default" type="object" />
235+ </group>
236+ </form>
237+ </field>
238+ </record>
239+ <record id="action_stock_minimum_calculator" model="ir.actions.act_window">
240+ <field name="name">Stock Order Point</field>
241+ <field name="type">ir.actions.act_window</field>
242+ <field name="res_model">stock.minimum.calculator</field>
243+ <field name="view_type">form</field>
244+ <field name="view_mode">tree,form</field>
245+ <field name="view_id" ref="view_stock_minimum_calculator_form"/>
246+ <field name="target">new</field>
247+ </record>
248+ <menuitem action="action_stock_minimum_calculator"
249+ id="menu_action_stock_minimum_calculator"
250+ parent="product.menu_config_product" />
251+ </data>
252+</openerp>
253\ No newline at end of file

Subscribers

People subscribed via source and target branches