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
=== modified file 'product_price_information/product_price_info.py'
--- product_price_information/product_price_info.py 2010-05-20 14:03:55 +0000
+++ product_price_information/product_price_info.py 2010-05-26 13:35:42 +0000
@@ -1,7 +1,7 @@
1# -*- encoding: utf-8 -*-1# -*- encoding: utf-8 -*-
2##############################################################################2##############################################################################
3#3#
4# OpenERP, Open Source Management Solution 4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$6# $Id$
7#7#
@@ -21,20 +21,20 @@
21##############################################################################21##############################################################################
22from osv import fields, osv22from osv import fields, osv
23from tools import config23from tools import config
24 24
25class sale_order_line(osv.osv):25class sale_order_line(osv.osv):
26 _inherit = "sale.order.line"26 _inherit = "sale.order.line"
2727
28 _columns = {28 _columns = {
29 'sale_price_unit_tax': fields.float('Sale price W/O taxes'),29 'sale_price_unit_tax': fields.float('Sale price W/O taxes'),
30 }30 }
31 31
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,
33 uom=False, qty_uos=0, uos=False, name='', partner_id=False,33 uom=False, qty_uos=0, uos=False, name='', partner_id=False,
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):
35 35
36 tax_obj = self.pool.get('account.tax')36 tax_obj = self.pool.get('account.tax')
37 37
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,
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)
40 if product:40 if product:
@@ -43,19 +43,19 @@
43 result['value']['sale_price_unit_tax'] = product_obj.product_tmpl_id.price_unit_tax43 result['value']['sale_price_unit_tax'] = product_obj.product_tmpl_id.price_unit_tax
4444
45 return result45 return result
46 46
47sale_order_line()47sale_order_line()
4848
49class sale_order(osv.osv):49class sale_order(osv.osv):
50 _name = "sale.order"50 _name = "sale.order"
51 _inherit = "sale.order"51 _inherit = "sale.order"
52 52
53 def onchange_shop_id(self, cr, uid, ids, shop_id):53 def onchange_shop_id(self, cr, uid, ids, shop_id):
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)
55 if 'value' in res and shop_id:55 if 'value' in res and shop_id:
56 res['value']['price_type'] = self.pool.get('sale.shop').browse(cr, uid , shop_id).price_type56 res['value']['price_type'] = self.pool.get('sale.shop').browse(cr, uid , shop_id).price_type
57 return res57 return res
58 58
59sale_order()59sale_order()
6060
6161
@@ -86,7 +86,7 @@
86 _defaults = {86 _defaults = {
87 'price_type': lambda *a: 'tax_included',87 'price_type': lambda *a: 'tax_included',
88 }88 }
89 89
90 def set_default(self, cr, uid, ids, context=None):90 def set_default(self, cr, uid, ids, context=None):
91 for o in self.browse(cr, uid, ids, context=context):91 for o in self.browse(cr, uid, ids, context=context):
92 ir_values_obj = self.pool.get('ir.values')92 ir_values_obj = self.pool.get('ir.values')
@@ -97,8 +97,8 @@
97 'res_model': 'ir.actions.configuration.wizard',97 'res_model': 'ir.actions.configuration.wizard',
98 'type': 'ir.actions.act_window',98 'type': 'ir.actions.act_window',
99 'target': 'new',99 'target': 'new',
100 } 100 }
101 101
102 def action_cancel(self,cr,uid,ids,conect=None):102 def action_cancel(self,cr,uid,ids,conect=None):
103 return {103 return {
104 'view_type': 'form',104 'view_type': 'form',
@@ -107,5 +107,5 @@
107 'type': 'ir.actions.act_window',107 'type': 'ir.actions.act_window',
108 'target':'new',108 'target':'new',
109 }109 }
110 110
111sale_shop_price_method_policy()111sale_shop_price_method_policy()
112\ No newline at end of file112\ No newline at end of file
113113
=== added directory 'stock_minimum_calculator'
=== added file 'stock_minimum_calculator/__init__.py'
--- stock_minimum_calculator/__init__.py 1970-01-01 00:00:00 +0000
+++ stock_minimum_calculator/__init__.py 2010-05-26 13:35:42 +0000
@@ -0,0 +1,24 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22
23import stock_minimum_calculator
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
0\ No newline at end of file25\ No newline at end of file
126
=== added file 'stock_minimum_calculator/__terp__.py'
--- stock_minimum_calculator/__terp__.py 1970-01-01 00:00:00 +0000
+++ stock_minimum_calculator/__terp__.py 2010-05-26 13:35:42 +0000
@@ -0,0 +1,37 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22{
23 "name": "Stock Minimum Calculator",
24 "version": "1.0",
25 "author": "Big Consulting",
26 "website" : "",
27 "category": "",
28 "description": """
29 """,
30 "depends": ['stock','mrp'],
31 "demo_xml": [],
32 "update_xml": ['stock_minimum_calculator_view.xml' ],
33 "license": "GPL-3",
34 "active": False,
35 "installable": True,
36}
37# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
038
=== added file 'stock_minimum_calculator/stock_minimum_calculator.py'
--- stock_minimum_calculator/stock_minimum_calculator.py 1970-01-01 00:00:00 +0000
+++ stock_minimum_calculator/stock_minimum_calculator.py 2010-05-26 13:35:42 +0000
@@ -0,0 +1,46 @@
1# -*- encoding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
6# $Id$
7#
8# This program is free software: you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation, either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#
21##############################################################################
22from osv import fields, osv
23from osv import fields, osv
24from tools.translate import _
25import netsvc
26import pooler
27import time
28import tools
29import wizard
30
31class stock_minimum_calculator(osv.osv_memory):
32 _name = 'stock.minimum.calculator'
33
34 def set_default(self, cr, uid, ids, context=None):
35 product_obj = self.pool.get('product.product')
36 min_rule_obj = self.pool.get('stock.warehouse.orderpoint')
37 product_ids = product_obj.search(cr,uid,[])
38 stock_rule_ids = min_rule_obj.search(cr,uid,[])
39 FIELDS = ['qty_available','virtual_available','incoming_qty','outgoing_qty']
40 for rule_record in min_rule_obj.browse(cr, uid, stock_rule_ids, context=context):
41 context.update({'warehouse':rule_record.warehouse_id.id,'location':rule_record.location_id.id})
42 data = product_obj._product_available(cr,uid,[rule_record.product_id.id],FIELDS,context=context)
43 return {}
44
45stock_minimum_calculator()
46
047
=== added file 'stock_minimum_calculator/stock_minimum_calculator_view.xml'
--- stock_minimum_calculator/stock_minimum_calculator_view.xml 1970-01-01 00:00:00 +0000
+++ stock_minimum_calculator/stock_minimum_calculator_view.xml 2010-05-26 13:35:42 +0000
@@ -0,0 +1,35 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4 <record id="view_stock_minimum_calculator_form" model="ir.ui.view">
5 <field name="name">stock.minimum.calculator.form</field>
6 <field name="model">stock.minimum.calculator</field>
7 <field name="type">form</field>
8 <field name="arch" type="xml">
9 <form string="Stock Order Point">
10 <group colspan="4" >
11 <label align="0.7" colspan="6" string="(Re-calculation Minimum stock Rule)"/>
12 </group>
13 <separator string="" colspan="4" />
14 <group colspan="4" col="6">
15 <label string ="" colspan="2"/>
16 <button icon="gtk-cancel" special="cancel" string="Cancel" />
17 <button icon="gtk-open" string="Ok" name="set_default" type="object" />
18 </group>
19 </form>
20 </field>
21 </record>
22 <record id="action_stock_minimum_calculator" model="ir.actions.act_window">
23 <field name="name">Stock Order Point</field>
24 <field name="type">ir.actions.act_window</field>
25 <field name="res_model">stock.minimum.calculator</field>
26 <field name="view_type">form</field>
27 <field name="view_mode">tree,form</field>
28 <field name="view_id" ref="view_stock_minimum_calculator_form"/>
29 <field name="target">new</field>
30 </record>
31 <menuitem action="action_stock_minimum_calculator"
32 id="menu_action_stock_minimum_calculator"
33 parent="product.menu_config_product" />
34 </data>
35</openerp>
0\ No newline at end of file36\ No newline at end of file

Subscribers

People subscribed via source and target branches