Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-19882-ado into
lp:openobject-addons/6.0.
Requested reviews:
nel (nel-tinyerp)
Jean-Christophe VASSORT (OpenERP) (jcv-openerp)
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19882-ado/+merge/93531
Hello,
[FIX]: notes field problem while performing onchange in sale order line"
Steps to Reproduce:
First:
1. Create sale order and add a sale order line and select a product that has a
"Sale description". The "Sale description" is copied in the "Notes" tab.
2. Change the description.
3. Go back to the first tab and change the quantity.
4. If you go again in the "Notes" tab, you will see that your modified
description has been lost !
Second:
Product A has a sale description
Product B doesn't have a sale description
1. Create a sale order line and select product A : the "Sale description" of
product A is copied in the "Notes" field
2. Then, select product B instead of product A : the "Sale description" of
product A stays in the "Notes" field.
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-19882-ado/+merge/93531
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-19882-ado.
=== modified file 'product_visible_discount/product_visible_discount.py'
--- product_visible_discount/product_visible_discount.py 2011-06-01 20:56:21 +0000
+++ product_visible_discount/product_visible_discount.py 2012-02-17 05:24:28 +0000
@@ -41,7 +41,7 @@
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, notes=False):
def get_real_price(res_dict, product_id, qty, uom, pricelist):
item_obj = self.pool.get('product.pricelist.item')
@@ -67,11 +67,13 @@
uom_data = product_uom_obj.browse(cr, uid, product.uom_id.id)
factor = uom_data.factor
return product_read[field_name] * factor
-
-
+ if not product:
+ return {'value': {'th_weight': 0, 'product_packaging': False,
+ 'product_uos_qty': qty, 'notes': '', 'tax_id':[]}, 'domain': {'product_uom': [],
+ 'product_uos': []}}
res=super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
- lang, update_tax,date_order,fiscal_position=fiscal_position,flag=flag)
+ lang, update_tax,date_order,fiscal_position=fiscal_position,flag=flag, notes=notes)
context = {'lang': lang, 'partner_id': partner_id}
result = res['value']
=== modified file 'sale/sale.py'
--- sale/sale.py 2011-09-22 10:28:12 +0000
+++ sale/sale.py 2012-02-17 05:24:28 +0000
@@ -1011,7 +1011,7 @@
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, notes=False):
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 = {}
@@ -1024,7 +1024,7 @@
if not product:
return {'value': {'th_weight': 0, 'product_packaging': False,
- 'product_uos_qty': qty, 'tax_id':[]}, 'domain': {'product_uom': [],
+ 'product_uos_qty': qty, 'notes': '', 'tax_id':[]}, 'domain': {'product_uom': [],
'product_uos': []}}
if not date_order:
date_order = time.strftime('%Y-%m-%d')
@@ -1067,8 +1067,12 @@
uos = False
else:
uos = False
- if product_obj.description_sale:
- result['notes'] = product_obj.description_sale
+
+ if not notes:
+ result['notes'] = product_obj.description_sale
+ else:
+ result['notes'] = 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 2012-02-17 05:24:28 +0000
@@ -126,14 +126,14 @@
<notebook>
<page string="Order Line">
<field colspan="4"
- context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
+ context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom,notes=notes"
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, notes)"
/>
<field
- context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
+ context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom,notes=notes"
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, notes)"
/>
<field groups="product.group_uos" name="product_uos_qty"/>
<field groups="product.group_uos" name="product_uos"/>
@@ -141,8 +141,8 @@
on_change="product_uom_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)"/>
<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)"
+ context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom,notes=notes"
+ 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, notes)"
domain="[('product_id','=',product_id)]"
groups="base.group_extended"/>
=== modified file 'sale_margin/sale_margin.py'
--- sale_margin/sale_margin.py 2011-07-19 07:23:29 +0000
+++ sale_margin/sale_margin.py 2012-02-17 05:24:28 +0000
@@ -25,10 +25,14 @@
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, notes=False):
+ if not product:
+ return {'value': {'th_weight': 0, 'product_packaging': False,
+ 'product_uos_qty': qty, 'notes': '', 'tax_id':[]}, 'domain': {'product_uom': [],
+ 'product_uos': []}}
res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
- lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag)
+ lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, notes=notes)
if product:
price = self.pool.get('product.product').browse(cr, uid, product).standard_price
partner_pricelist = self.pool.get('res.partner').browse(cr, uid, partner_id).property_product_pricelist
=== modified file 'warning/warning.py'
--- warning/warning.py 2011-01-14 00:11:01 +0000
+++ warning/warning.py 2012-02-17 05:24:28 +0000
@@ -197,7 +197,7 @@
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):
+ fiscal_position=False, flag=False, notes=False):
warning = {}
if not product:
return {'value': {'th_weight' : 0, 'product_packaging': False,
@@ -215,10 +215,9 @@
message = product_info.sale_line_warn_msg
warning['title'] = title
warning['message'] = message
-
result = super(sale_order_line, self).product_id_change( cr, uid, ids, pricelist, product, qty,
uom, qty_uos, uos, name, partner_id,
- lang, update_tax, date_order, packaging, fiscal_position, flag)
+ lang, update_tax, date_order, packaging, fiscal_position, flag, notes)
if result.get('warning',False):
warning['title'] = title and title +' & '+result['warning']['title'] or result['warning']['title']
_______________________________________________
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