accountmodif

bzr revid: fp@tinyerp.com-20081007054416-b15z6y42idg26nv2
This commit is contained in:
Fabien Pinckaers 2008-10-07 07:44:16 +02:00
parent 268657552d
commit 938d985c66
3 changed files with 10 additions and 10 deletions

View File

@ -67,8 +67,8 @@ class account_payment_term(osv.osv):
amt = round(amount, 2)
if amt:
next_date = mx.DateTime.strptime(date_ref, '%Y-%m-%d') + RelativeDateTime(days=line.days)
if line.condition == 'end of month':
next_date += RelativeDateTime(day=-1)
if line.days2:
next_date += RelativeDateTime(day=line.days2)
result.append( (next_date.strftime('%Y-%m-%d'), amt) )
amount -= amt
return result
@ -83,14 +83,14 @@ class account_payment_term_line(osv.osv):
'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')], 'Value',required=True),
'value_amount': fields.float('Value Amount'),
'days': fields.integer('Number of Days',required=True),
'condition': fields.selection([('net days','Net Days'),('end of month','End of Month')], 'Condition', required=True, help="The payment delay condition id a number of days expressed in 2 ways: net days or end of the month. The 'net days' condition implies that the paiment arrive after 'Number of Days' calendar days. The 'end of the month' condition requires that the paiement arrives before the end of the month that is that is after 'Number of Days' calendar days."),
'days': fields.integer('Number of Days',required=True, help="Number of days to add before computation of the day of month."),
'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the month."),
'payment_id': fields.many2one('account.payment.term','Payment Term', required=True, select=True),
}
_defaults = {
'value': lambda *a: 'balance',
'sequence': lambda *a: 5,
'condition': lambda *a: 'net days',
'days2': lambda *a: 0,
}
_order = "sequence"
account_payment_term_line()

View File

@ -1094,7 +1094,7 @@
<field name="name"/>
<field name="value"/>
<field name="days"/>
<field name="condition"/>
<field name="days2"/>
</tree>
</field>
</record>
@ -1112,7 +1112,7 @@
<field name="value_amount"/>
<newline/>
<field name="days"/>
<field name="condition"/>
<field name="days2"/>
</form>
</field>
</record>

View File

@ -6,13 +6,13 @@
Payment term
-->
<record id="account_payment_term" model="account.payment.term">
<field name="name">30 Days Net</field>
<field name="name">30 Days End of Month</field>
</record>
<record id="account_payment_term_line" model="account.payment.term.line">
<field name="name">30 days</field>
<field name="name">30 Days End of Month</field>
<field name="value">balance</field>
<field eval="30" name="days"/>
<field name="condition">net days</field>
<field eval="-1" name="days2"/>
<field eval="account_payment_term" name="payment_id"/>
</record>