diff --git a/CHANGELOG b/CHANGELOG index 97c6c0bbae..6d313f4073 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/invoice.odt b/invoice.odt index 28dd18fc43..e2f392b9d3 100644 Binary files a/invoice.odt and b/invoice.odt differ diff --git a/invoice.py b/invoice.py index 4a8e5fb0df..2888303d58 100644 --- a/invoice.py +++ b/invoice.py @@ -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']: