~sebastien.beau/+junk/project-feature

« back to all changes in this revision

Viewing changes to sale_project_feature/sale.py

  • Committer: Sebastien Beau
  • Date: 2014-03-20 00:18:16 UTC
  • Revision ID: sebastien.beau@akretion.com-20140320001816-mc4axa2xlb1ql73w
[REF] start to refactor the way to create the feature from the sale order

Show diffs side-by-side

added added

removed removed

Lines of Context:
269
269
        return super(sale_order_line, self).\
270
270
            create(cr, uid, vals, context=context)
271
271
 
 
272
    def onchange_feature_id(self, cr, uid, ids, tmpl_id, context=None):
 
273
        res = self.pool['feature.feature'].onchange_feature_id(
 
274
            cr, uid, ids, tmpl_id, context=context)
 
275
        if res.get('value'):
 
276
            rename_key = [
 
277
                ('name', 'feature_name'),
 
278
                ('description', 'name'),
 
279
                ('qty', 'product_uom_qty'),
 
280
                ]
 
281
            for old_key, new_key in rename_key:
 
282
                res['value'][new_key] = res['value'][old_key]
 
283
                del res['value'][old_key]
 
284
        return res
 
285
 
272
286
    _columns = {
 
287
        'is_feature': fields.boolean('Is feature'),
 
288
        'feature_name': fields.char('Feature Name'),
 
289
        'typology_id': fields.many2one('project.typology', 'Typology'),
273
290
        'feature_id': fields.many2one(
274
291
            'feature.feature',
275
292
            'Feature',
276
 
            help="Feature defined in the lead and used in the sale order"),
 
293
            help="Feature linked to the sale order line"),
 
294
        'feature_template_id': fields.many2one(
 
295
            'feature.template',
 
296
            'Feature Template',
 
297
            help="Feature Template used as model"),
277
298
        'functional_block_id': fields.many2one(
278
299
            'project.functional_block',
279
300
            string='Functional Block',