[IMP] Readded the unlink. Instead of removing unlinking, the method now differentiates if it uses advanced pricing per destination or not. It using it, the user is responsible of the delivery grid and lines. None will be overrided. If not using it, the default behavior is used, unlinking previous lines to set normal_price and free_if_more_than.
bzr revid: tde@openerp.com-20120214140825-7hdggsctk8s3twat
This commit is contained in:
parent
4da82cdfc9
commit
6ec72e3ad4
|
@ -98,13 +98,21 @@ class delivery_carrier(osv.osv):
|
|||
return False
|
||||
|
||||
def create_grid_lines(self, cr, uid, ids, vals, context=None):
|
||||
if context == None:
|
||||
if context is None:
|
||||
context = {}
|
||||
grid_line_pool = self.pool.get('delivery.grid.line')
|
||||
grid_pool = self.pool.get('delivery.grid')
|
||||
for record in self.browse(cr, uid, ids, context=context):
|
||||
# if using advanced pricing per destination: do not change
|
||||
if record.use_detailed_pricelist:
|
||||
continue
|
||||
|
||||
# not using advanced pricing per destination: override grid
|
||||
grid_id = grid_pool.search(cr, uid, [('carrier_id', '=', record.id)], context=context)
|
||||
|
||||
if grid_id and not (record.normal_price or record.free_if_more_than):
|
||||
grid_pool.unlink(cr, uid, grid_id, context=context)
|
||||
|
||||
if not (record.normal_price or record.free_if_more_than):
|
||||
continue
|
||||
|
||||
|
|
|
@ -28,9 +28,9 @@
|
|||
<field name="active" select="1"/>
|
||||
<separator string="Pricing Information" colspan="4"/>
|
||||
<group colspan="4" col="4">
|
||||
<field name="normal_price"/>
|
||||
<field name="normal_price" attrs="{'readonly':[('use_detailed_pricelist', '=', True)]}"/>
|
||||
<newline/>
|
||||
<field name="free_if_more_than"/>
|
||||
<field name="free_if_more_than" attrs="{'readonly':[('use_detailed_pricelist', '=', True)]}"/>
|
||||
<field name="amount" attrs="{'required':[('free_if_more_than','<>',False)], 'invisible':[('free_if_more_than','=',False)]}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue