[MERGE] forward port branch 10.0 up to efd300156b
This commit is contained in:
@@ -1077,6 +1077,7 @@ class AccountInvoice(models.Model):
|
||||
values['state'] = 'draft'
|
||||
values['number'] = False
|
||||
values['origin'] = invoice.number
|
||||
values['payment_term_id'] = False
|
||||
values['refund_invoice_id'] = invoice.id
|
||||
|
||||
if date:
|
||||
@@ -1465,6 +1466,7 @@ class AccountPaymentTerm(models.Model):
|
||||
def compute(self, value, date_ref=False):
|
||||
date_ref = date_ref or fields.Date.today()
|
||||
amount = value
|
||||
sign = value < 0 and -1 or 1
|
||||
result = []
|
||||
if self.env.context.get('currency_id'):
|
||||
currency = self.env['res.currency'].browse(self.env.context['currency_id'])
|
||||
@@ -1473,7 +1475,7 @@ class AccountPaymentTerm(models.Model):
|
||||
prec = currency.decimal_places
|
||||
for line in self.line_ids:
|
||||
if line.value == 'fixed':
|
||||
amt = round(line.value_amount, prec)
|
||||
amt = sign * round(line.value_amount, prec)
|
||||
elif line.value == 'percent':
|
||||
amt = round(value * (line.value_amount / 100.0), prec)
|
||||
elif line.value == 'balance':
|
||||
|
||||
@@ -822,7 +822,7 @@ class AccountMoveLine(models.Model):
|
||||
elif self._context.get('skip_full_reconcile_check') == 'amount_currency_only':
|
||||
field = 'amount_residual_currency'
|
||||
#target the pair of move in self that are the oldest
|
||||
sorted_moves = sorted(self, key=lambda a: a.date)
|
||||
sorted_moves = sorted(self, key=lambda a: a.date_maturity or a.date)
|
||||
debit = credit = False
|
||||
for aml in sorted_moves:
|
||||
if credit and debit:
|
||||
|
||||
@@ -207,11 +207,12 @@ class BlogPost(models.Model):
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
self.ensure_one()
|
||||
if 'website_published' in vals and 'published_date' not in vals:
|
||||
if self.published_date <= fields.Datetime.now():
|
||||
vals['published_date'] = vals['website_published'] and fields.Datetime.now()
|
||||
result = super(BlogPost, self).write(vals)
|
||||
result = True
|
||||
for post in self:
|
||||
copy_vals = vals
|
||||
if 'website_published' in vals and 'published_date' not in vals and post.published_date <= fields.Datetime.now():
|
||||
copy_vals['published_date'] = vals['website_published'] and fields.Datetime.now() or False
|
||||
result &= super(BlogPost, self).write(copy_vals)
|
||||
self._check_for_publication(vals)
|
||||
return result
|
||||
|
||||
|
||||
@@ -21,7 +21,10 @@ $(document).ready(function () {
|
||||
setTimeout(function () { payment_transaction_poll_status(); }, Math.ceil(_poll_nbr / 3) * 1000);
|
||||
}
|
||||
else {
|
||||
result.message = "<i class='fa fa-warning' />";
|
||||
var $message = $(result.message);
|
||||
$message.find('span:first').prepend($(
|
||||
"<i title='We are waiting the confirmation of the bank or payment provider' class='fa fa-warning' style='margin-right:10px;'>"));
|
||||
result.message = $message.html();
|
||||
}
|
||||
}
|
||||
$('div.oe_website_sale_tx_status').html(result.message);
|
||||
|
||||
Reference in New Issue
Block a user