diff --git a/addons/account/account.py b/addons/account/account.py index 98e51d0cf4f..9ae6edcba38 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -75,8 +75,8 @@ class account_payment_term(osv.osv): amount = value result = [] obj_precision = self.pool.get('decimal.precision') + prec = obj_precision.precision_get(cr, uid, 'Account') for line in pt.line_ids: - prec = obj_precision.precision_get(cr, uid, 'Account') if line.value == 'fixed': amt = round(line.value_amount, prec) elif line.value == 'procent': @@ -92,19 +92,20 @@ class account_payment_term(osv.osv): next_date += relativedelta(day=line.days2, months=1) result.append( (next_date.strftime('%Y-%m-%d'), amt) ) amount -= amt - return result -account_payment_term() + amount = reduce(lambda x,y: x+y[1], result, 0.0) + dist = round(value-amount, prec) + if dist: + result.append( (time.strftime('%Y-%m-%d'), dist) ) + return result class account_payment_term_line(osv.osv): _name = "account.payment.term.line" _description = "Payment Term Line" _columns = { - 'name': fields.char('Line Name', size=32, required=True), - 'sequence': fields.integer('Sequence', required=True, help="The sequence field is used to order the payment term lines from the lowest sequences to the higher ones"), 'value': fields.selection([('procent', 'Percent'), ('balance', 'Balance'), - ('fixed', 'Fixed Amount')], 'Valuation', + ('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."), @@ -115,10 +116,10 @@ class account_payment_term_line(osv.osv): } _defaults = { 'value': 'balance', - 'sequence': 5, + 'days': 30, 'days2': 0, } - _order = "sequence" + _order = "value desc,days" def _check_percent(self, cr, uid, ids, context=None): obj = self.browse(cr, uid, ids[0], context=context) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 6d3519cc461..401f569c74e 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1549,10 +1549,8 @@ account.payment.term.line - - - + @@ -1563,37 +1561,20 @@ account.payment.term.line
- - - - - - + + - - -
@@ -1616,7 +1597,7 @@ - + diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 97bea14c1f2..f8a0fcdfcaa 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -10,17 +10,33 @@ - - 30 Days End of Month - 30 Days End of Month + + Immediate Payment + Immediate Payment - - 30 Days End of Month + + + Immediate Payment balance - - - + + + + + + + 15 Days + 15 Days + + + + 15 Days + balance + + + + + Payment Term 6 @@ -30,6 +46,7 @@ 30 Net Days 30 Net Days + 30 Net Days balance @@ -37,28 +54,7 @@ - - - 30% Advance End 30 Days - 30% Advance End 30 Days - - - 30% Advance - procent - - - - - - - - Remaining Balance - balance - - - - - + diff --git a/addons/account/demo/account_demo.xml b/addons/account/demo/account_demo.xml index 8b0f026c9f0..6918ad44702 100644 --- a/addons/account/demo/account_demo.xml +++ b/addons/account/demo/account_demo.xml @@ -127,6 +127,41 @@ + + + + + 30 Days End of Month + 30 Days End of Month + + + 30 Days End of Month + balance + + + + + + + 30% Advance End 30 Days + 30% Advance End 30 Days + + + 30% Advance + procent + + + + + + + + Remaining Balance + balance + + + +