[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['state'] = 'draft'
|
||||||
values['number'] = False
|
values['number'] = False
|
||||||
values['origin'] = invoice.number
|
values['origin'] = invoice.number
|
||||||
|
values['payment_term_id'] = False
|
||||||
values['refund_invoice_id'] = invoice.id
|
values['refund_invoice_id'] = invoice.id
|
||||||
|
|
||||||
if date:
|
if date:
|
||||||
@@ -1465,6 +1466,7 @@ class AccountPaymentTerm(models.Model):
|
|||||||
def compute(self, value, date_ref=False):
|
def compute(self, value, date_ref=False):
|
||||||
date_ref = date_ref or fields.Date.today()
|
date_ref = date_ref or fields.Date.today()
|
||||||
amount = value
|
amount = value
|
||||||
|
sign = value < 0 and -1 or 1
|
||||||
result = []
|
result = []
|
||||||
if self.env.context.get('currency_id'):
|
if self.env.context.get('currency_id'):
|
||||||
currency = self.env['res.currency'].browse(self.env.context['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
|
prec = currency.decimal_places
|
||||||
for line in self.line_ids:
|
for line in self.line_ids:
|
||||||
if line.value == 'fixed':
|
if line.value == 'fixed':
|
||||||
amt = round(line.value_amount, prec)
|
amt = sign * round(line.value_amount, prec)
|
||||||
elif line.value == 'percent':
|
elif line.value == 'percent':
|
||||||
amt = round(value * (line.value_amount / 100.0), prec)
|
amt = round(value * (line.value_amount / 100.0), prec)
|
||||||
elif line.value == 'balance':
|
elif line.value == 'balance':
|
||||||
|
|||||||
@@ -822,7 +822,7 @@ class AccountMoveLine(models.Model):
|
|||||||
elif self._context.get('skip_full_reconcile_check') == 'amount_currency_only':
|
elif self._context.get('skip_full_reconcile_check') == 'amount_currency_only':
|
||||||
field = 'amount_residual_currency'
|
field = 'amount_residual_currency'
|
||||||
#target the pair of move in self that are the oldest
|
#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
|
debit = credit = False
|
||||||
for aml in sorted_moves:
|
for aml in sorted_moves:
|
||||||
if credit and debit:
|
if credit and debit:
|
||||||
|
|||||||
@@ -207,11 +207,12 @@ class BlogPost(models.Model):
|
|||||||
|
|
||||||
@api.multi
|
@api.multi
|
||||||
def write(self, vals):
|
def write(self, vals):
|
||||||
self.ensure_one()
|
result = True
|
||||||
if 'website_published' in vals and 'published_date' not in vals:
|
for post in self:
|
||||||
if self.published_date <= fields.Datetime.now():
|
copy_vals = vals
|
||||||
vals['published_date'] = vals['website_published'] and fields.Datetime.now()
|
if 'website_published' in vals and 'published_date' not in vals and post.published_date <= fields.Datetime.now():
|
||||||
result = super(BlogPost, self).write(vals)
|
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)
|
self._check_for_publication(vals)
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,10 @@ $(document).ready(function () {
|
|||||||
setTimeout(function () { payment_transaction_poll_status(); }, Math.ceil(_poll_nbr / 3) * 1000);
|
setTimeout(function () { payment_transaction_poll_status(); }, Math.ceil(_poll_nbr / 3) * 1000);
|
||||||
}
|
}
|
||||||
else {
|
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);
|
$('div.oe_website_sale_tx_status').html(result.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user