diff --git a/CHANGELOG b/CHANGELOG index 06db1dd961..03993204df 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Make description on invoice line optional + Version 4.6.0 - 2017-10-30 * Bug fixes (see mercurial logs for details) * Use tax sequence as default value for invoice taxes sequence diff --git a/invoice.fodt b/invoice.fodt index 6a498362b3..c61955164a 100644 --- a/invoice.fodt +++ b/invoice.fodt @@ -1,28 +1,28 @@ - LibreOffice/5.1.6.2$Linux_X86_64 LibreOffice_project/10m0$Build-22012-11-15T15:00:351P0D + LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-22012-11-15T15:00:351P0D - 89958 + 37028 0 - 28665 - 11755 + 43760 + 20505 true false view2 - 6835 - 97846 + 14041 + 48664 0 - 89958 - 28663 - 101711 + 37028 + 43759 + 57531 0 1 false - 120 + 100 false @@ -53,6 +53,7 @@ false true true + false false false false @@ -68,7 +69,7 @@ false false true - 2522830 + 2687017 false true false @@ -692,9 +693,14 @@ + <if test="line.product"> + <line.product.rec_name> + </if> + <if test="line.description"> <for each="line in line.description.split('\n')"> <line> </for> + </if> <(format_number(line.quantity, invoice.party.lang, digits=line.unit_digits) + (line.unit and (' ' + line.unit.symbol) or '')) or ''> @@ -730,7 +736,7 @@ - <for each="line in line.description.split('\n')"> + <for each="line in (line.description or '').split('\n')"> <line> </for> @@ -761,7 +767,7 @@ - <for each="line in line.description.split('\n')"> + <for each="line in (line.description or '').split('\n')"> <line> </for> @@ -790,7 +796,7 @@ - <for each="line in line.description.split('\n')"> + <for each="line in (line.description or '').split('\n')"> <line> </for> diff --git a/invoice.py b/invoice.py index b30747ee83..29977129fc 100644 --- a/invoice.py +++ b/invoice.py @@ -1438,7 +1438,6 @@ class InvoicePaymentLine(ModelSQL): class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): 'Invoice Line' __name__ = 'account.invoice.line' - _rec_name = 'description' _states = { 'readonly': Eval('invoice_state') != 'draft', } @@ -1545,7 +1544,7 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): 'invisible': ~Eval('type').in_(['line', 'subtotal']), }, depends=['type', 'currency_digits']), 'get_amount') - description = fields.Text('Description', size=None, required=True, + description = fields.Text('Description', size=None, states=_states, depends=_depends) note = fields.Text('Note') taxes = fields.Many2Many('account.invoice.line-account.tax', @@ -1659,6 +1658,9 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): cursor.execute(*sql_table.update([sql_table.company], [company_id], where=sql_table.id == line_id)) + # Migration from 4.6: drop required on description + table.not_null_action('description', action='remove') + @staticmethod def default_currency(): Company = Pool().get('company.company') @@ -1789,23 +1791,17 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): ''' return {} - @fields.depends('product', 'unit', 'description', '_parent_invoice.type', + @fields.depends('product', 'unit', '_parent_invoice.type', '_parent_invoice.party', 'party', 'invoice', 'invoice_type') def on_change_product(self): - pool = Pool() - Product = pool.get('product.product') - if not self.product: return - context = {} party = None if self.invoice and self.invoice.party: party = self.invoice.party elif self.party: party = self.party - if party and party.lang: - context['language'] = party.lang.code if self.invoice and self.invoice.type: type_ = self.invoice.type @@ -1844,10 +1840,6 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): taxes.extend(tax_ids) self.taxes = taxes - if not self.description: - with Transaction().set_context(**context): - self.description = Product(self.product.id).rec_name - category = self.product.default_uom.category if not self.unit or self.unit.category != category: self.unit = self.product.default_uom.id @@ -2007,7 +1999,6 @@ class InvoiceLine(sequence_ordered(), ModelSQL, ModelView, TaxableMixin): if self.type != 'line': return [] line = MoveLine() - line.description = self.description if self.invoice.currency != self.invoice.company.currency: with Transaction().set_context(date=self.invoice.currency_date): amount = Currency.compute(self.invoice.currency, diff --git a/view/invoice_line_form.xml b/view/invoice_line_form.xml index ee2bb4177e..bbde4aec1b 100644 --- a/view/invoice_line_form.xml +++ b/view/invoice_line_form.xml @@ -14,9 +14,6 @@ this repository contains the full copyright notices and license terms. -->