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
=== modified file 'sales_shop_stock_availability/__init__.py'
--- sales_shop_stock_availability/__init__.py 2010-05-28 07:33:26 +0000
+++ sales_shop_stock_availability/__init__.py 2010-06-10 10:08:25 +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#
@@ -19,8 +19,9 @@
19# along with this program. If not, see <http://www.gnu.org/licenses/>.19# along with this program. If not, see <http://www.gnu.org/licenses/>.
20#20#
21##############################################################################21##############################################################################
2222import wizard
23import sales_shop_stock_availability23import sales_shop_stock_availability
2424
25
25# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:26# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
2627
2728
=== modified file 'sales_shop_stock_availability/__terp__.py'
--- sales_shop_stock_availability/__terp__.py 2010-05-28 11:29:13 +0000
+++ sales_shop_stock_availability/__terp__.py 2010-06-10 10:08:25 +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#
@@ -32,7 +32,7 @@
32 """,32 """,
33 "depends": ['base','sale'],33 "depends": ['base','sale'],
34 "demo_xml": [],34 "demo_xml": [],
35 "update_xml": ['sales_shop_stock_availability_view.xml'],35 "update_xml": ['sales_shop_stock_availability_view.xml','wizard/stock_shop_availability_view.xml'],
36 "license": "GPL-3",36 "license": "GPL-3",
37 "active": False,37 "active": False,
38 "installable": True,38 "installable": True,
3939
=== modified file 'sales_shop_stock_availability/sales_shop_stock_availability.py'
--- sales_shop_stock_availability/sales_shop_stock_availability.py 2010-05-28 11:29:13 +0000
+++ sales_shop_stock_availability/sales_shop_stock_availability.py 2010-06-10 10:08:25 +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#
@@ -22,30 +22,27 @@
2222
23from osv import fields, osv23from osv import fields, osv
24from tools import config24from tools import config
25 25
26class product_product(osv.osv):26class product_product(osv.osv):
27 _inherit = "product.product"27 _inherit = "product.product"
28 28
29 def _product_available_other_shop(self, cr, uid, ids, name, arg, context={}):29 def _product_available_other_shop(self, cr, uid, ids, name, arg, context={}):
3030
31 res = {} 31 res = {}
32 product_obj = self.pool.get('product.product')32 product_obj = self.pool.get('product.product')
33 shop = context.get('shop', False)33 shop = context.get('shop', False)
34 fields_name = ['qty_available']34 fields_name = ['qty_available']
35
36 stock2 = product_obj._product_available(cr, uid, ids ,fields_name,context={})35 stock2 = product_obj._product_available(cr, uid, ids ,fields_name,context={})
37
38 context.update({'shop':shop})36 context.update({'shop':shop})
39 stock1 = product_obj._product_available(cr, uid, ids ,fields_name,context=context)37 stock1 = product_obj._product_available(cr, uid, ids ,fields_name,context=context)
40
41 for key,value in stock2.items():38 for key,value in stock2.items():
42 res[key] = stock2[key]['qty_available'] - stock1[key]['qty_available']39 res[key] = stock2[key]['qty_available'] - stock1[key]['qty_available']
43 return res 40 return res
44 41
45 _columns = {42 _columns = {
46 '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."),43 '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."),
47 }44 }
48 45
49product_product()46product_product()
5047
51# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:48# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
5249
=== modified file 'sales_shop_stock_availability/sales_shop_stock_availability_view.xml'
--- sales_shop_stock_availability/sales_shop_stock_availability_view.xml 2010-05-28 07:33:26 +0000
+++ sales_shop_stock_availability/sales_shop_stock_availability_view.xml 2010-06-10 10:08:25 +0000
@@ -37,7 +37,7 @@
37 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)"37 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)"
38 select="1"/>38 select="1"/>
39 </xpath>39 </xpath>
40 </field> 40 </field>
41 </record>41 </record>
42 </data>42 </data>
43</openerp>43</openerp>
4444
=== added directory 'sales_shop_stock_availability/wizard'
=== added file 'sales_shop_stock_availability/wizard/__init__.py'
--- sales_shop_stock_availability/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ sales_shop_stock_availability/wizard/__init__.py 2010-06-10 10:08:25 +0000
@@ -0,0 +1,25 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22import stock_shop_availability
23
24# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
25
026
=== added file 'sales_shop_stock_availability/wizard/stock_shop_availability.py'
--- sales_shop_stock_availability/wizard/stock_shop_availability.py 1970-01-01 00:00:00 +0000
+++ sales_shop_stock_availability/wizard/stock_shop_availability.py 2010-06-10 10:08:25 +0000
@@ -0,0 +1,62 @@
1# -*- coding: utf-8 -*-
2##############################################################################
3#
4# OpenERP, Open Source Management Solution
5# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
6#
7# This program is free software: you can redistribute it and/or modify
8# it under the terms of the GNU Affero General Public License as
9# published by the Free Software Foundation, either version 3 of the
10# License, or (at your option) any later version.
11#
12# This program is distributed in the hope that it will be useful,
13# but WITHOUT ANY WARRANTY; without even the implied warranty of
14# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15# GNU Affero General Public License for more details.
16#
17# You should have received a copy of the GNU Affero General Public License
18# along with this program. If not, see <http://www.gnu.org/licenses/>.
19#
20##############################################################################
21
22from osv import osv, fields
23
24class stock_shop_availability(osv.osv_memory):
25 _name = 'stock.shop.availability'
26 _description = 'Stock Shop Availability'
27 _columns = {
28 'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
29 'product_id': fields.many2one('product.product', 'Product',required= True),
30 'real_stock1': fields.float('Real Stock'),
31 'virtual_stock1': fields.float('Virtual Stock'),
32 'real_stock2': fields.float('Real Stock'),
33 'virtual_stock2': fields.float('Virtual Stock'),
34
35 }
36
37 def product_available_other_shop(self, cr, uid, ids, product_id, shop_id, context={}):
38 res = {}
39 product_obj = self.pool.get('product.product')
40 fields_name = ['qty_available','virtual_available']
41 stock2 = product_obj._product_available(cr, uid, [product_id] ,fields_name,context={})
42 context.update({'shop_id':shop_id,'product_id':product_id})
43 stock1 = product_obj._product_available(cr, uid, [product_id] ,fields_name,context=context)
44 for key,value in stock1.items():
45 real_val1 = value['qty_available']
46 virt_val1 = value['virtual_available']
47 for key,value in stock2.items():
48 real_val2 = value['qty_available']
49 virt_val2 = value['virtual_available']
50 other_real_val = real_val2 - real_val1
51 other_virt_val = virt_val2 - virt_val2
52 result ={'value': {
53 'real_stock1': real_val1,
54 'virtual_stock1': virt_val1,
55 'real_stock2': other_real_val,
56 'virtual_stock2': other_virt_val,
57 }}
58 return result
59
60stock_shop_availability()
61
62# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
063
=== added file 'sales_shop_stock_availability/wizard/stock_shop_availability_view.xml'
--- sales_shop_stock_availability/wizard/stock_shop_availability_view.xml 1970-01-01 00:00:00 +0000
+++ sales_shop_stock_availability/wizard/stock_shop_availability_view.xml 2010-06-10 10:08:25 +0000
@@ -0,0 +1,42 @@
1<?xml version="1.0" encoding="utf-8"?>
2<openerp>
3 <data>
4
5 <record id="view_stock_shop_availability" model="ir.ui.view">
6 <field name="name">Stock Shop Availability</field>
7 <field name="model">stock.shop.availability</field>
8 <field name="type">form</field>
9 <field name="arch" type="xml">
10 <form string="Stock Shop Availability">
11 <group col="6" colspan="4">
12 <group col="2" colspan="3">
13 <field name="shop_id"/>
14 <separator string="Availability in Shop"/><newline/>
15 <field name="real_stock1"/>
16 <field name="virtual_stock1"/>
17 </group>
18 <group col="2" colspan="3">
19 <field name="product_id" on_change="product_available_other_shop(product_id, shop_id)"/>
20 <separator string="Availability in Other Shops"/><newline/>
21 <field name="real_stock2"/>
22 <field name="virtual_stock2"/>
23 </group>
24 </group>
25 </form>
26 </field>
27 </record>
28
29 <record id="action_stock_shop_availability" model="ir.actions.act_window">
30 <field name="name">Stock Shop Availability</field>
31 <field name="type">ir.actions.act_window</field>
32 <field name="res_model">stock.shop.availability</field>
33 <field name="view_type">form</field>
34 <field name="view_mode">form</field>
35 <field name="view_id" ref="view_stock_shop_availability"/>
36 <field name="target">new</field>
37 </record>
38 <menuitem action="action_stock_shop_availability"
39 id="menu_stock_shop_availability"
40 parent="sale.menu_sale_root"/>
41 </data>
42</openerp>
0\ No newline at end of file43\ No newline at end of file

Subscribers

People subscribed via source and target branches