diff --git a/ext/custom-addons/cam_custom/cam_custom.py b/ext/custom-addons/cam_custom/cam_custom.py index e652c7c3..871897db 100644 --- a/ext/custom-addons/cam_custom/cam_custom.py +++ b/ext/custom-addons/cam_custom/cam_custom.py @@ -127,3 +127,14 @@ class mail_notification(osv.Model): # c.update({'display_default_code': False}) # return super(product_product, self).name_get(cr, user, ids, context=c) +class sale_order_line(models.Model): + _inherit = 'sale.order.line' + + @api.onchange('name') + def onchange_name(self): + if self.name != False and self.product_id.id == False: + ir_values = self.pool.get('ir.values') + company = self.env['res.company'].search([], limit=1) + taxes_id = ir_values.get_default(self._cr, self._uid, 'product.template', 'taxes_id', company_id=company.id) + at = self.env['account.tax'].search([('id','=',isinstance(taxes_id, list) and taxes_id[0] or taxes_id)]) + self.tax_id = at