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