diff --git a/addons/account_voucher/models/account_voucher.py b/addons/account_voucher/models/account_voucher.py
index d677a6490e5..ae3fb6eaf07 100644
--- a/addons/account_voucher/models/account_voucher.py
+++ b/addons/account_voucher/models/account_voucher.py
@@ -345,6 +345,20 @@ class AccountVoucherLine(models.Model):
taxes = self.tax_ids.compute_all(self.price_unit, self.voucher_id.currency_id, self.quantity, product=self.product_id, partner=self.voucher_id.partner_id)
self.price_subtotal = taxes['total_excluded']
+ @api.onchange('product_id', 'voucher_id', 'price_unit', 'company_id')
+ def _onchange_line_details(self):
+ if not self.voucher_id or not self.product_id or not self.voucher_id.partner_id:
+ return
+ onchange_res = self.product_id_change(
+ self.product_id.id,
+ self.voucher_id.partner_id.id,
+ self.price_unit,
+ self.company_id.id,
+ self.voucher_id.currency_id.id,
+ self.voucher_id.voucher_type)
+ for fname, fvalue in onchange_res['values'].iteritems():
+ setattr(self, fname, fvalue)
+
def _get_account(self, product, fpos, type):
accounts = product.product_tmpl_id.get_product_accounts(fpos)
if type == 'sale':
@@ -353,6 +367,7 @@ class AccountVoucherLine(models.Model):
@api.multi
def product_id_change(self, product_id, partner_id=False, price_unit=False, company_id=None, currency_id=None, type=None):
+ # TDE note: mix of old and new onchange badly written in 9, multi but does not use record set
context = self._context
company_id = company_id if company_id is not None else context.get('company_id', False)
company = self.env['res.company'].browse(company_id)
diff --git a/addons/account_voucher/views/account_voucher_views.xml b/addons/account_voucher/views/account_voucher_views.xml
index 2bdf99ec1e9..15c2d0a1749 100644
--- a/addons/account_voucher/views/account_voucher_views.xml
+++ b/addons/account_voucher/views/account_voucher_views.xml
@@ -100,8 +100,7 @@
account.voucher.line
-
+
@@ -248,8 +247,7 @@
-
+
@@ -365,8 +363,7 @@
-
+