Make description on invoice line optional

issue6860
review43781002
This commit is contained in:
Cédric Krier committed 2017-12-18 19:02:44 +01:00
1 parent 6d319aeaae
commit 562e68a3a3
6 files changed
+32 -34

No files matched your search

+2
View File
@@ -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
+20 -14
View File
@@ -1,28 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<office:document xmlns:office="urn:oasis:names:tc:opendocument:xmlns:office:1.0" xmlns:style="urn:oasis:names:tc:opendocument:xmlns:style:1.0" xmlns:text="urn:oasis:names:tc:opendocument:xmlns:text:1.0" xmlns:table="urn:oasis:names:tc:opendocument:xmlns:table:1.0" xmlns:draw="urn:oasis:names:tc:opendocument:xmlns:drawing:1.0" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:meta="urn:oasis:names:tc:opendocument:xmlns:meta:1.0" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:svg="urn:oasis:names:tc:opendocument:xmlns:svg-compatible:1.0" xmlns:chart="urn:oasis:names:tc:opendocument:xmlns:chart:1.0" xmlns:dr3d="urn:oasis:names:tc:opendocument:xmlns:dr3d:1.0" xmlns:math="http://www.w3.org/1998/Math/MathML" xmlns:form="urn:oasis:names:tc:opendocument:xmlns:form:1.0" xmlns:script="urn:oasis:names:tc:opendocument:xmlns:script:1.0" xmlns:config="urn:oasis:names:tc:opendocument:xmlns:config:1.0" xmlns:ooo="http://openoffice.org/2004/office" xmlns:ooow="http://openoffice.org/2004/writer" xmlns:oooc="http://openoffice.org/2004/calc" xmlns:dom="http://www.w3.org/2001/xml-events" xmlns:xforms="http://www.w3.org/2002/xforms" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:rpt="http://openoffice.org/2005/report" xmlns:of="urn:oasis:names:tc:opendocument:xmlns:of:1.2" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:grddl="http://www.w3.org/2003/g/data-view#" xmlns:officeooo="http://openoffice.org/2009/office" xmlns:tableooo="http://openoffice.org/2009/table" xmlns:drawooo="http://openoffice.org/2010/draw" xmlns:calcext="urn:org:documentfoundation:names:experimental:calc:xmlns:calcext:1.0" xmlns:loext="urn:org:documentfoundation:names:experimental:office:xmlns:loext:1.0" xmlns:field="urn:openoffice:names:experimental:ooo-ms-interop:xmlns:field:1.0" xmlns:formx="urn:openoffice:names:experimental:ooxml-odf-interop:xmlns:form:1.0" xmlns:css3t="http://www.w3.org/TR/css3-text/" office:version="1.2" office:mimetype="application/vnd.oasis.opendocument.text">
<office:meta><meta:generator>LibreOffice/5.1.6.2$Linux_X86_64 LibreOffice_project/10m0$Build-2</meta:generator><meta:creation-date>2012-11-15T15:00:35</meta:creation-date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>P0D</meta:editing-duration><meta:document-statistic meta:table-count="5" meta:image-count="0" meta:object-count="0" meta:page-count="6" meta:paragraph-count="113" meta:word-count="304" meta:character-count="3539" meta:non-whitespace-character-count="3348"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
<office:meta><meta:generator>LibreOffice/5.2.7.2$Linux_X86_64 LibreOffice_project/20m0$Build-2</meta:generator><meta:creation-date>2012-11-15T15:00:35</meta:creation-date><meta:editing-cycles>1</meta:editing-cycles><meta:editing-duration>P0D</meta:editing-duration><meta:document-statistic meta:table-count="5" meta:image-count="0" meta:object-count="0" meta:page-count="6" meta:paragraph-count="118" meta:word-count="319" meta:character-count="3656" meta:non-whitespace-character-count="3455"/><meta:user-defined meta:name="Info 1"/><meta:user-defined meta:name="Info 2"/><meta:user-defined meta:name="Info 3"/><meta:user-defined meta:name="Info 4"/></office:meta>
<office:settings>
<config:config-item-set config:name="ooo:view-settings">
<config:config-item config:name="ViewAreaTop" config:type="long">89958</config:config-item>
<config:config-item config:name="ViewAreaTop" config:type="long">37028</config:config-item>
<config:config-item config:name="ViewAreaLeft" config:type="long">0</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">28665</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">11755</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">43760</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">20505</config:config-item>
<config:config-item config:name="ShowRedlineChanges" config:type="boolean">true</config:config-item>
<config:config-item config:name="InBrowseMode" config:type="boolean">false</config:config-item>
<config:config-item-map-indexed config:name="Views">
<config:config-item-map-entry>
<config:config-item config:name="ViewId" config:type="string">view2</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">6835</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">97846</config:config-item>
<config:config-item config:name="ViewLeft" config:type="long">14041</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">48664</config:config-item>
<config:config-item config:name="VisibleLeft" config:type="long">0</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">89958</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">28663</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">101711</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">37028</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">43759</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">57531</config:config-item>
<config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
<config:config-item config:name="ViewLayoutColumns" config:type="short">1</config:config-item>
<config:config-item config:name="ViewLayoutBookMode" config:type="boolean">false</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">120</config:config-item>
<config:config-item config:name="ZoomFactor" config:type="short">100</config:config-item>
<config:config-item config:name="IsSelectedFrame" config:type="boolean">false</config:config-item>
</config:config-item-map-entry>
</config:config-item-map-indexed>
@@ -53,6 +53,7 @@
<config:config-item config:name="PrintSingleJobs" config:type="boolean">false</config:config-item>
<config:config-item config:name="SmallCapsPercentage66" config:type="boolean">true</config:config-item>
<config:config-item config:name="CollapseEmptyCellPara" config:type="boolean">true</config:config-item>
<config:config-item config:name="TreatSingleColumnBreakAsPageBreak" config:type="boolean">false</config:config-item>
<config:config-item config:name="MathBaselineAlignment" config:type="boolean">false</config:config-item>
<config:config-item config:name="AddFrameOffsets" config:type="boolean">false</config:config-item>
<config:config-item config:name="IsLabelDocument" config:type="boolean">false</config:config-item>
@@ -68,7 +69,7 @@
<config:config-item config:name="InvertBorderSpacing" config:type="boolean">false</config:config-item>
<config:config-item config:name="SaveGlobalDocumentLinks" config:type="boolean">false</config:config-item>
<config:config-item config:name="TabsRelativeToIndent" config:type="boolean">true</config:config-item>
<config:config-item config:name="Rsid" config:type="int">2522830</config:config-item>
<config:config-item config:name="Rsid" config:type="int">2687017</config:config-item>
<config:config-item config:name="PrintProspectRTL" config:type="boolean">false</config:config-item>
<config:config-item config:name="PrintEmptyPages" config:type="boolean">true</config:config-item>
<config:config-item config:name="ApplyUserData" config:type="boolean">false</config:config-item>
@@ -692,9 +693,14 @@
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.product&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;line.product.rec_name&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;line.description&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in line.description.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
</table:table-cell>
<table:table-cell table:style-name="Table1.D5" office:value-type="string">
<text:p text:style-name="P10"><text:placeholder text:placeholder-type="text">&lt;(format_number(line.quantity, invoice.party.lang, digits=line.unit_digits) + (line.unit and (&apos; &apos; + line.unit.symbol) or &apos;&apos;)) or &apos;&apos;&gt;</text:placeholder></text:p>
@@ -730,7 +736,7 @@
<text:soft-page-break/>
<table:table-row>
<table:table-cell table:style-name="Table1.A8" table:number-columns-spanned="4" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in line.description.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
@@ -761,7 +767,7 @@
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A11" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in line.description.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P9"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
@@ -790,7 +796,7 @@
</table:table-row>
<table:table-row>
<table:table-cell table:style-name="Table1.A17" table:number-columns-spanned="5" office:value-type="string">
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in line.description.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in (line.description or &apos;&apos;).split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="Table_20_Contents"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
</table:table-cell>
+5 -14
View File
@@ -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,
+4 -3
View File
@@ -14,9 +14,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="product"/>
<label name="account"/>
<field name="account"/>
<newline/>
<label name="description"/>
<field name="description" colspan="3" yexpand="0"/>
<label name="quantity"/>
<field name="quantity"/>
<label name="unit"/>
@@ -27,6 +24,10 @@ this repository contains the full copyright notices and license terms. -->
<field name="amount"/>
<field name="taxes" colspan="4"/>
</page>
<page name="description">
<separator name="description" colspan="4"/>
<field name="description"/>
</page>
<page string="Notes" id="notes">
<separator name="note" colspan="4"/>
<field name="note" colspan="4"/>
-1
View File
@@ -6,7 +6,6 @@ this repository contains the full copyright notices and license terms. -->
<field name="type"/>
<field name="product"/>
<field name="account"/>
<field name="description"/>
<field name="quantity"/>
<field name="unit"/>
<field name="unit_price"/>
+1 -2
View File
@@ -5,8 +5,7 @@ this repository contains the full copyright notices and license terms. -->
<field name="invoice"/>
<field name="type"/>
<field name="product"/>
<field name="account" tree_invisible="1"/>
<field name="description"/>
<field name="account"/>
<field name="quantity"/>
<field name="unit"/>
<field name="unit_price"/>