diff --git a/addons/account/views/account_move_views.xml b/addons/account/views/account_move_views.xml index 77a48763001..3e704a282cb 100644 --- a/addons/account/views/account_move_views.xml +++ b/addons/account/views/account_move_views.xml @@ -821,6 +821,8 @@ attrs="{'invisible': [('type', 'not in', ('out_invoice', 'out_refund'))]}"> + 0.0 and balance or 0.0, 'credit': balance < 0.0 and -balance or 0.0, }) else: - amount_currency = -invoice_line_vals['price_subtotal'] + amount_currency = -(operation.product_uom_qty * operation.price_unit) balance = currency._convert(amount_currency, self.company_id.currency_id, self.company_id, fields.Date.today()) invoice_line_vals.update({ 'amount_currency': amount_currency, @@ -381,7 +379,6 @@ class Repair(models.Model): raise UserError(_('No account defined for product "%s".') % fee.product_id.name) invoice_line_vals = { - 'type': 'out_invoice', 'name': name, 'account_id': account.id, 'quantity': fee.product_uom_qty, @@ -390,17 +387,16 @@ class Repair(models.Model): 'price_unit': fee.price_unit, 'product_id': fee.product_id.id, 'repair_fee_ids': [(4, fee.id)], - 'invoice_line_ids': [], } if currency == company.currency_id: - balance = -invoice_line_vals['price_subtotal'] + balance = -(fee.product_uom_qty * fee.price_unit) invoice_line_vals.update({ 'debit': balance > 0.0 and balance or 0.0, 'credit': balance < 0.0 and -balance or 0.0, }) else: - amount_currency = -invoice_line_vals['price_subtotal'] + amount_currency = -(fee.product_uom_qty * fee.price_unit) balance = currency._convert(amount_currency, self.company_id.currency_id, self.company_id, fields.Date.today()) invoice_line_vals.update({