Atik Agewan(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-803375-aag into
lp:openobject-addons.
Requested reviews:
Rucha (Open ERP) (rpa-openerp)
Related bugs:
Bug #803375 in OpenERP Addons: "delivery pricelist don't work"
https://bugs.launchpad.net/openobject-addons/+bug/803375
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-803375-aag/+merge/69262
Hello
Delivery:delivery pricelist is now working .
Thanks
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-803375-aag/+merge/69262
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-803375-aag.
=== modified file 'delivery/delivery.py'
--- delivery/delivery.py 2011-07-06 14:56:44 +0000
+++ delivery/delivery.py 2011-07-26 11:56:02 +0000
@@ -186,24 +186,34 @@
weight += (line.product_id.weight or 0.0) * line.product_uom_qty
volume += (line.product_id.volume or 0.0) * line.product_uom_qty
-
+ context['order'] = order
return self.get_price_from_picking(cr, uid, id, total,weight, volume, context=context)
def get_price_from_picking(self, cr, uid, id, total, weight, volume, context=None):
- grid = self.browse(cr, uid, id, context=context)
+ order = context['order']
+ cr_id = order.carrier_id.id
+ line_grid = []
+ if cr_id:
+ cr.execute('select dg.id from delivery_grid as dg , delivery_grid_line as dgl where carrier_id=%s and dg.id = dgl.grid_id', (cr_id,))
+ line_grid = [id for (id,) in cr.fetchall()]
+ gr_id = []
+ for i in line_grid:
+ if i not in gr_id:
+ gr_id.append(i)
price = 0.0
ok = False
-
- for line in grid.line_ids:
- price_dict = {'price': total, 'volume':volume, 'weight': weight, 'wv':volume*weight}
- test = eval(line.type+line.operator+str(line.max_value), price_dict)
- if test:
- if line.price_type=='variable':
- price = line.list_price * price_dict[line.variable_factor]
- else:
- price = line.list_price
- ok = True
- break
+ for grd_id in gr_id:
+ grid = self.browse(cr, uid, grd_id, context=context)
+ for line in grid.line_ids:
+ price_dict = {'price': total, 'volume':volume, 'weight': weight, 'wv':volume*weight}
+ test = eval(line.type+line.operator+str(line.max_value), price_dict)
+ if test:
+ if line.price_type=='variable':
+ price = line.list_price * price_dict[line.variable_factor]
+ else:
+ price = line.list_price
+ ok = True
+ break
if not ok:
raise osv.except_osv(_('No price available !'), _('No line matched this order in the choosed delivery grids !'))
_______________________________________________
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