Make payment term not required

issue4286
review23031002
This commit is contained in:
Sergi Almacellas Abellana committed 2016-05-17 09:49:24 +02:00
1 parent 0ceb0c084e
commit bb0c990355
3 files changed
+10 -5

No files matched your search

+2
View File
@@ -1,3 +1,5 @@
* Make payment term not required
Version 4.0.0 - 2016-05-02
* Bug fixes (see mercurial logs for details)
* Merge invoice and credit note
BIN
View File
Binary file not shown.
+8 -5
View File
@@ -129,7 +129,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
('kind', '=', 'payable')),
])
payment_term = fields.Many2One('account.invoice.payment_term',
'Payment Term', required=True, states=_STATES, depends=_DEPENDS)
'Payment Term', states=_STATES, depends=_DEPENDS)
lines = fields.One2Many('account.invoice.line', 'invoice', 'Lines',
domain=[
('company', '=', Eval('company', -1)),
@@ -359,6 +359,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
# Add index on create_date
table.index_action('create_date', action='add')
# Migration from 4.0: Drop not null on payment_term
table.not_null_action('payment_term', 'remove')
@staticmethod
def default_type():
return Transaction().context.get('type', 'out')
@@ -937,11 +940,11 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
if line['amount_second_currency']:
total_currency += line['amount_second_currency']
term_lines = self.payment_term.compute(total, self.company.currency,
self.invoice_date)
term_lines = [(Date.today(), total)]
if self.payment_term:
term_lines = self.payment_term.compute(
total, self.company.currency, self.invoice_date)
remainder_total_currency = total_currency
if not term_lines:
term_lines = [(Date.today(), total)]
for date, amount in term_lines:
val = self._get_move_line(date, amount)
if val['amount_second_currency']: