66
66
step_ids=pool.get('dm.offer.step').search(cr, uid, [('offer_id','=',offer_id)])
67
67
step_obj=pool.get('dm.offer.step').browse(cr, uid, step_ids)
68
68
pprog_obj=pool.get('dm.campaign.proposition.prices_progression').browse(cr, uid, prices_prog_id)
69
print "Avant : ",pprog_obj.product_ids
70
if prop_obj.product_ids:
71
for p in prop_obj.product_ids:
72
pool.get('dm.product').unlink(cr, uid, p.id)
70
for p in prop_obj.item_ids:
71
pool.get('dm.item').unlink(cr, uid, p.id)
74
print "Apres : ",pprog_obj.product_ids
77
75
# Creates proposition items
78
76
for step in step_obj:
79
product_ids=pool.get('dm.step.product').search(cr, uid, [('offer_step_id','=',step.id)])
80
product_obj=pool.get('dm.step.product').browse(cr, uid, product_ids)
81
for product in product_obj:
77
item_ids=pool.get('dm.offer.step.item').search(cr, uid, [('offer_step_id','=',step.id)])
78
item_obj=pool.get('dm.offer.step.item').browse(cr, uid, item_ids)
83
81
if prop_obj.force_sm_price :
84
82
pu = prop_obj.sm_price
86
84
pu = pool.get('product.pricelist').price_get(cr, uid,
87
[prop_obj.customer_pricelist_id.id], product.product_id.id,1.0,
85
[prop_obj.customer_pricelist_id.id], item.product_id.id,1.0,
88
86
context=context)[prop_obj.customer_pricelist_id.id]
90
88
price = pu * (1 + (stp * pprog_obj.percent_prog)) + (stp * pprog_obj.fixed_prog)
92
vals = {'product_id':product.product_id.id,
90
vals = {'product_id':item.product_id.id,
93
91
'proposition_id':data['ids'][0],
94
'item_type':product.item_type,
92
'item_type':item.item_type,
96
'offer_step_type':product.offer_step_id.type
94
'offer_step_type':item.offer_step_id.type
98
new_id=pool.get('dm.product').create(cr, uid, vals)
96
new_id=pool.get('dm.item').create(cr, uid, vals)
123
121
res.sort(lambda x,y: cmp(x[1],y[1]))
126
def _get_products(self, cr, uid, context):
131
125
def _next(self, cr, uid, data, context):
132
126
if not data['form']['prices_progression']:
164
158
'result': {'type': 'form', 'arch': message, 'fields':{} ,'state': [('end', 'Ok', 'gtk-ok', True)]}
167
wizard_proposition_products("wizard_proposition_products")
161
wizard_proposition_items("wizard_proposition_items")
168
162
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: