Rifakat (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-51083-rha into 
lp:openobject-addons/6.0.

Requested reviews:
  Priyesh (OpenERP) (pso-openerp)
Related bugs:
  Bug #881199 in OpenERP Addons: "SO not checking stock available from 
warehouse SO is being dispatched from"
  https://bugs.launchpad.net/openobject-addons/+bug/881199

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-51083-rha/+merge/85130

Hello,

We sale products from particular Shop defined on any sales order.
But SO not checking stock available from warehouse of shop which is being 
dispatched from.

This fixes the problem.
Kindly check it and share your view on this.

Regards,
Rifakat
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-51083-rha/+merge/85130
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-51083-rha.
=== modified file 'sale/sale.py'
--- sale/sale.py	2011-09-22 10:28:12 +0000
+++ sale/sale.py	2011-12-09 13:53:25 +0000
@@ -1011,16 +1011,18 @@
 
     def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
             uom=False, qty_uos=0, uos=False, name='', partner_id=False,
-            lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False):
+            lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
         if not  partner_id:
             raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sales form !\nPlease set one customer before choosing a product.'))
         warning = {}
+        if not context:
+            context = {}
         product_uom_obj = self.pool.get('product.uom')
         partner_obj = self.pool.get('res.partner')
         product_obj = self.pool.get('product.product')
         if partner_id:
             lang = partner_obj.browse(cr, uid, partner_id).lang
-        context = {'lang': lang, 'partner_id': partner_id}
+        context.update({'lang': lang, 'partner_id': partner_id})
 
         if not product:
             return {'value': {'th_weight': 0, 'product_packaging': False,

=== modified file 'sale/sale_view.xml'
--- sale/sale_view.xml	2011-07-08 10:51:30 +0000
+++ sale/sale_view.xml	2011-12-09 13:53:25 +0000
@@ -128,12 +128,12 @@
                                             <field colspan="4"
                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
                                                 name="product_id"
-                                                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, False)"
+                                                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, False, {'shop':parent.shop_id})"
                                                 />
                                             <field
                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
                                                 name="product_uom_qty"
-                                                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'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
+                                                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'], False, parent.date_order, product_packaging, parent.fiscal_position, True, {'shop':parent.shop_id})"
                                                 />
                                                 <field groups="product.group_uos" name="product_uos_qty"/>
                                                 <field groups="product.group_uos" name="product_uos"/>
@@ -142,7 +142,7 @@
                                             <field
                                                 name="product_packaging"
                                                 context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
-                                                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'], False, parent.date_order, product_packaging, parent.fiscal_position, False)"
+                                                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'], False, parent.date_order, product_packaging, parent.fiscal_position, False, {'shop':parent.shop_id})"
                                                 domain="[('product_id','=',product_id)]"
                                                 groups="base.group_extended"/>
 

=== modified file 'sale_layout/sale_layout_view.xml'
--- sale_layout/sale_layout_view.xml	2011-01-14 00:11:01 +0000
+++ sale_layout/sale_layout_view.xml	2011-12-09 13:53:25 +0000
@@ -22,13 +22,13 @@
 					                        context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
 					                        name="product_id"
 					                        attrs="{'readonly':[('layout_type','!=','article')]}"
-					                        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)"
+					                        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, False, {'shop':parent.shop_id})"
 					                        select="1"/>
 					                    <field
 					                        context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
 					                        name="product_uom_qty"
 					                        attrs="{'readonly':[('layout_type','!=','article')]}"
-					                        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'], False, parent.date_order, product_packaging, parent.fiscal_position)"
+					                        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'], False, parent.date_order, product_packaging, parent.fiscal_position, True, {'shop':parent.shop_id})"
 					                        select="1"/>
 					                    <field name="product_uom"
 					                  		 required="0"
@@ -38,7 +38,7 @@
 					                        name="product_packaging"
 					                        attrs="{'readonly':[('layout_type','!=','article')]}"
 					                        context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
-					                        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'], False, parent.date_order, product_packaging, parent.fiscal_position)"
+					                        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'], False, parent.date_order, product_packaging, parent.fiscal_position, False, {'shop':parent.shop_id})"
 					                        domain="[('product_id','=',product_id)]"
 					                        groups="base.group_extended"/>
 					                    <separator colspan="4" string="Manual Description" />

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to