Add party tax identifier on invoice

When setting the number, if no tax identifier is defined, the default one is
filled.

issue6733
review40601002
This commit is contained in:
Cédric Krier
2017-09-26 01:23:42 +02:00
parent 98b528ff42
commit 5513035b91
5 changed files with 27 additions and 12 deletions
+2
View File
@@ -1,3 +1,5 @@
* Add party tax identifier on invoice
Version 4.4.0 - 2017-05-01
* Bug fixes (see mercurial logs for details)
* Use Match pattern for invoice sequences
+1
View File
@@ -18,6 +18,7 @@ There are 4 types of invoice: *Invoice*, *Supplier Invoice*, *Credit Note* and
- Reference: The optional external reference of the invoice.
- Party: The party for which or from which the invoice is issued.
- Invoice Address: The address of the party.
- Party Tax Identifier: The tax identifier of the party.
- Description: An optional description of the invoice.
- Comment: A text fields to add custom comments.
- Invoice Date: The date of the invoice. It is set on posting the invoice if not.
+11 -11
View File
@@ -4,9 +4,9 @@
<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="108" meta:word-count="295" meta:character-count="3445" meta:non-whitespace-character-count="3258"/><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">0</config:config-item>
<config:config-item config:name="ViewAreaTop" config:type="long">1880</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">48623</config:config-item>
<config:config-item config:name="ViewAreaWidth" config:type="long">48622</config:config-item>
<config:config-item config:name="ViewAreaHeight" config:type="long">23834</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>
@@ -14,11 +14,11 @@
<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">26797</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">5313</config:config-item>
<config:config-item config:name="ViewTop" config:type="long">11642</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">0</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">48622</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">23832</config:config-item>
<config:config-item config:name="VisibleTop" config:type="long">1880</config:config-item>
<config:config-item config:name="VisibleRight" config:type="long">48620</config:config-item>
<config:config-item config:name="VisibleBottom" config:type="long">25712</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>
@@ -69,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">2153615</config:config-item>
<config:config-item config:name="Rsid" config:type="int">2254801</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>
@@ -541,7 +541,7 @@
</style:style>
<style:style style:name="P26" style:family="paragraph" style:parent-style-name="Standard">
<style:paragraph-properties fo:margin-left="4.4409in" fo:margin-right="0in" fo:text-indent="0in" style:auto-text-indent="false" fo:break-before="page"/>
<style:text-properties officeooo:paragraph-rsid="0020411c"/>
<style:text-properties style:font-name="Liberation Sans1" officeooo:paragraph-rsid="0020411c"/>
</style:style>
<style:style style:name="T1" style:family="text">
<style:text-properties officeooo:rsid="000dd611"/>
@@ -592,13 +592,13 @@
<text:sequence-decl text:display-outline-level="0" text:name="Text"/>
<text:sequence-decl text:display-outline-level="0" text:name="Drawing"/>
</text:sequence-decls>
<text:p text:style-name="P24"><text:span text:style-name="T3"><text:placeholder text:placeholder-type="text">&lt;replace text:p=&quot;set_lang(invoice.party.lang and invoice.party.lang.code or &apos;en&apos;)&quot;&gt;</text:placeholder></text:span></text:p>
<text:p text:style-name="P26"><text:placeholder text:placeholder-type="text">&lt;replace text:p=&quot;set_lang(invoice.party.lang and invoice.party.lang.code or &apos;en&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;replace text:p=&quot;invoice.set_lang(invoice.party.lang and invoice.party.lang.code or &apos;en&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P20"><text:placeholder text:placeholder-type="text">&lt;for each=&quot;line in invoice.invoice_address.full_address.split(&apos;\n&apos;)&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;line&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;/for&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.party.tax_identifier&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;invoice.party.tax_identifier.type_string&gt;</text:placeholder>: <text:placeholder text:placeholder-type="text">&lt;invoice.party.tax_identifier.code&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.party_tax_identifier&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;invoice.party_tax_identifier.type_string&gt;</text:placeholder>: <text:placeholder text:placeholder-type="text">&lt;invoice.party_tax_identifier.code&gt;</text:placeholder></text:p>
<text:p text:style-name="P19"><text:placeholder text:placeholder-type="text">&lt;/if&gt;</text:placeholder></text:p>
<text:p text:style-name="Standard"><text:placeholder text:placeholder-type="text">&lt;if test=&quot;invoice.type == &apos;in&apos;&quot;&gt;</text:placeholder></text:p>
<text:p text:style-name="P18"><text:span text:style-name="T2">Supplier Invoice N°:</text:span><text:span text:style-name="T2"><text:placeholder text:placeholder-type="text">&lt;invoice.number and &apos; &apos; + invoice.number or &apos;&apos;&gt;</text:placeholder></text:span></text:p>
+11
View File
@@ -111,6 +111,13 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
depends=_DEPENDS)
party = fields.Many2One('party.party', 'Party',
required=True, states=_STATES, depends=_DEPENDS)
party_tax_identifier = fields.Many2One(
'party.identifier', "Party Tax Identifier",
states=_STATES,
domain=[
('party', '=', Eval('party', -1)),
],
depends=_DEPENDS + ['party'])
party_lang = fields.Function(fields.Char('Party Language'),
'on_change_with_party_lang')
invoice_address = fields.Many2One('party.address', 'Invoice Address',
@@ -461,6 +468,7 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
if self.party:
self.invoice_address = self.party.address_get(type='invoice')
self.party_tax_identifier = self.party.tax_identifier
@fields.depends('currency')
def on_change_with_currency_digits(self, name=None):
@@ -996,6 +1004,9 @@ class Invoice(Workflow, ModelSQL, ModelView, TaxableMixin):
continue
if not invoice.tax_identifier:
invoice.tax_identifier = invoice.get_tax_identifier()
# Generated invoice may not fill the party tax identifier
if not invoice.party_tax_identifier:
invoice.party_tax_identifier = invoice.party.tax_identifier
if invoice.number:
continue
+2 -1
View File
@@ -12,7 +12,8 @@ this repository contains the full copyright notices and license terms. -->
<field name="party"/>
<label name="invoice_address"/>
<field name="invoice_address"/>
<newline/>
<label name="party_tax_identifier" string="Tax Identifier"/>
<field name="party_tax_identifier"/>
<label name="description"/>
<field name="description" colspan="3"/>
<label name="reference"/>