Amit Dodiya (OpenERP) has proposed merging lp:~openerp-dev/openobject-addons/6.0-opw-19882-ado into lp:openobject-addons/6.0.
Requested reviews: Vo Minh Thu (OpenERP) (vmt-openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19882-ado/+merge/81970 Hello, "[FIX] Modified description is change while changing the quantity in Sale Order Line : case(19882)" Thanks, Amit -- https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19882-ado/+merge/81970 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/6.0-opw-19882-ado.
=== modified file 'sale/sale.py' --- sale/sale.py 2011-09-22 10:28:12 +0000 +++ sale/sale.py 2011-11-11 12:14:27 +0000 @@ -1008,6 +1008,33 @@ default = {} default.update({'state': 'draft', 'move_ids': [], 'invoiced': False, 'invoice_lines': []}) return super(sale_order_line, self).copy_data(cr, uid, id, default, context=context) + + def product_qty_change(self, cr, uid, ids, product, qty=0, uom=False, partner_id=False, lang=False): + context = {'lang': lang, 'partner_id': partner_id} + if context == None: + context = {} + uom2 = False + warning = {} + if product: + product_obj = self.pool.get('product.product') + prod_data = product_obj.browse(cr, uid, product, context) + product_uom_obj = self.pool.get('product.uom') + if uom: + uom2 = product_uom_obj.browse(cr, uid, uom) + if prod_data.uom_id.category_id.id != uom2.category_id.id: + uom = False + if not uom2: + uom2 = prod_data.uom_id + if (prod_data.type=='product') and (prod_data.virtual_available * uom2.factor < qty * prod_data.uom_id.factor) \ + and (prod_data.procure_method=='make_to_stock'): + warning = { + 'title': _('Not enough stock !'), + 'message': _('You plan to sell %.2f %s but you only have %.2f %s available !\nThe real stock is %.2f %s. (without reservations)') % + (qty, uom2 and uom2.name or prod_data.uom_id.name, + max(0,prod_data.virtual_available), prod_data.uom_id.name, + max(0,prod_data.qty_available), prod_data.uom_id.name) + } + return {'warning': warning} def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, @@ -1069,6 +1096,8 @@ uos = False if product_obj.description_sale: result['notes'] = product_obj.description_sale + else: + result['notes'] = '' fpos = fiscal_position and self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position) or False if update_tax: #The quantity only have changed result['delay'] = (product_obj.sale_delay or 0.0) === modified file 'sale/sale_view.xml' --- sale/sale_view.xml 2011-07-08 10:51:30 +0000 +++ sale/sale_view.xml 2011-11-11 12:14:27 +0000 @@ -133,7 +133,7 @@ <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_qty_change(product_id,product_uom_qty,product_uom,parent.partner_id, 'lang' in context and context['lang'])" /> <field groups="product.group_uos" name="product_uos_qty"/> <field groups="product.group_uos" name="product_uos"/>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp