~arthru/e-commerce-addons/payment-method-multicompany

« back to all changes in this revision

Viewing changes to connector_ecommerce/sale.py

  • Committer: Arthur Vuillard
  • Date: 2013-06-27 14:17:50 UTC
  • Revision ID: arthur.vuillard@akretion.com-20130627141750-dq9h1dlj2y8dogz3
Fix a bug : remove special fields before database storage (avoid to try to store non existing fields in db)

Show diffs side-by-side

added added

removed removed

Lines of Context:
371
371
        elif vals.get(option['price_unit_tax_excluded']):
372
372
            price_unit = vals.pop(option['price_unit_tax_excluded']) * sign
373
373
        else:
374
 
            for key in ['price_unit_tax_excluded',
375
 
                        'price_unit_tax_included',
376
 
                        'tax_rate_field']:
377
 
                if option.get(key) and option[key] in vals:
378
 
                    del vals[option[key]]
379
 
            return vals  # if there is no price, we have nothing to import
380
 
 
 
374
            return self._clean_special_fields(option, vals)
381
375
        model_data_obj = self.pool.get('ir.model.data')
382
376
        product_obj = self.pool.get('product.product')
383
377
        __, product_id = model_data_obj.get_object_reference(
395
389
            extra_line['name'] = "%s [%s]" % (extra_line['name'],
396
390
                                              vals[ext_code_field])
397
391
        vals['order_line'].append((0, 0, extra_line))
398
 
        return vals
 
392
 
 
393
        return self._clean_special_fields(option, vals)
 
394
 
 
395
    def _clean_special_fields(self, option, vals):
 
396
        for key in ['price_unit_tax_excluded',
 
397
                    'price_unit_tax_included',
 
398
                    'tax_rate_field']:
 
399
            if option.get(key) and option[key] in vals:
 
400
                del vals[option[key]]
 
401
        return vals  # if there is no price, we have nothing to import