if line.value == 'fixed':
amt = round(line.value_amount, prec)
elif line.value == 'procent':
- amt = round(value * line.value_amount, prec)
+ amt = round(value * (line.value_amount/100.0), prec)
elif line.value == 'balance':
amt = round(amount, prec)
if amt:
('fixed', 'Fixed Amount')], 'Computation',
required=True, help="""Select here the kind of valuation related to this payment term line. Note that you should have your last line with the type 'Balance' to ensure that the whole amount will be treated."""),
- 'value_amount': fields.float('Amount To Pay', digits_compute=dp.get_precision('Payment Term'), help="For percent enter a ratio between 0-1."),
+ 'value_amount': fields.float('Amount To Pay', digits_compute=dp.get_precision('Payment Term'), help="For percent enter a ratio between 0-100%."),
'days': fields.integer('Number of Days', required=True, help="Number of days to add before computation of the day of month." \
"If Date=15/01, Number of Days=22, Day of Month=-1, then the due date is 28/02."),
'days2': fields.integer('Day of the Month', required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
def _check_percent(self, cr, uid, ids, context=None):
obj = self.browse(cr, uid, ids[0], context=context)
- if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 1.0):
+ if obj.value == 'procent' and ( obj.value_amount < 0.0 or obj.value_amount > 100.0):
return False
return True
_constraints = [
- (_check_percent, 'Percentages for Payment Term Line must be between 0 and 1, Example: 0.02 for 2%.', ['value_amount']),
+ (_check_percent, 'Percentages for Payment Term Line must be between 0 and 100.', ['value_amount']),
]
if line.value == 'fixed':
total_fixed += line.value_amount
if line.value == 'procent':
- total_percent += line.value_amount
+ total_percent += (line.value_amount/100.0)
total_fixed = (total_fixed * 100) / (inv.amount_total or 1.0)
if (total_fixed + total_percent) > 100:
raise except_orm(_('Error!'), _("Cannot create the invoice.\nThe related payment term is probably misconfigured as it gives a computed amount greater than the total invoiced amount. In order to avoid rounding issues, the latest line of your payment term must be of type 'balance'."))