[MERGE] delivery: clarified behavior when saving a delivery.carrier. We want to keep the behavior of writing normal_price and free_if_more_than delivery lines. However, we also want to keep user modifications. The module 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.
lp bug: https://launchpad.net/bugs/927415 fixed bzr revid: tde@openerp.com-20120214141618-w5c6ybouaqj87tqx
This commit is contained in:
@@ -98,11 +98,16 @@ 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):
|
||||
|
||||
@@ -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/>
|
||||
|
||||
Reference in New Issue
Block a user