[ADD]: Added Upstream Patch for account_voucher.
This commit is contained in:
parent
086d6fd53f
commit
cc9a88e2d2
@ -154,11 +154,6 @@ class AccountVoucher(models.Model):
|
||||
voucher.amount = total + voucher.tax_correction
|
||||
voucher.tax_amount = tax_amount
|
||||
|
||||
@api.one
|
||||
@api.depends('account_pay_now_id', 'account_pay_later_id', 'pay_now')
|
||||
def _get_account(self):
|
||||
self.account_id = self.account_pay_now_id if self.pay_now == 'pay_now' else self.account_pay_later_id
|
||||
|
||||
@api.onchange('date')
|
||||
def onchange_date(self):
|
||||
self.account_date = self.date
|
||||
@ -315,6 +310,9 @@ class AccountVoucher(models.Model):
|
||||
#create one move line per voucher line where amount is not 0.0
|
||||
if not line.price_subtotal:
|
||||
continue
|
||||
line_subtotal = line.price_subtotal
|
||||
if self.voucher_type == 'sale':
|
||||
line_subtotal = -1 * line.price_subtotal
|
||||
# convert the amount set on the voucher line into the currency of the voucher's company
|
||||
# this calls res_curreny.compute() with the right context,
|
||||
# so that it will take either the rate on the voucher if it is relevant or will use the default behaviour
|
||||
@ -331,7 +329,7 @@ class AccountVoucher(models.Model):
|
||||
'debit': abs(amount) if self.voucher_type == 'purchase' else 0.0,
|
||||
'date': self.account_date,
|
||||
'tax_ids': [(4,t.id) for t in line.tax_ids],
|
||||
'amount_currency': line.price_subtotal if current_currency != company_currency else 0.0,
|
||||
'amount_currency': line_subtotal if current_currency != company_currency else 0.0,
|
||||
'currency_id': company_currency != current_currency and current_currency or False,
|
||||
'payment_id': self._context.get('payment_id'),
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user