Author: |
Vauxoo |
License: |
AGPL-3 |
Branch: |
10.0 |
Repository: |
Vauxoo/partner-contact |
Dependencies: |
base,
and
portal |
Languages: |
Python (159, 43.7%),
XML (152, 41.8%),
and
reStructuredText (53, 14.6%) |
Other branches: |
12.0-vx,
8.0,
and
9.0 |
<a name="partner-reusable-address-format"></a>
<h2>Partner Reusable Address Format</h2>
<p><strong>Rationale</strong></p>
<p>We show the address of a partner in several reports (purchase, pickings, sales
online forms, etc.) then with this you will be allowed to set such address in
an standard way using some sort of business logic because it frequently depends
of it for example if you are in the country A and a customer in the country B
your address and yours can be in different format (even using more or less
fields) then using this module you will be able to configure per country such
formats, but if th country do not have such format, then it will look into the
company and you can use a generic way to show the address.</p>
<p>You can include (thanks to the Qweb Engine) all the complex logic it can
require to combine for example contacts with parent companies to generate
proper information to be shown in your reports.</p>
<p>Even if this module has some technical components it can be used with basic
Html-Qweb knowledge and you can manually set the templates into the database
with no problem avoiding expend in reports layers a lot of time debugging a
simple comma or a parenthesis to produce pretty and ordered printed address.</p>
<p>The hole point is that per country generally there is a proper manner of show
the address, then it does not make too much sense create 20 or 30 lines of
code xml per report, we can customize this elements per country and/or company
and use a pretty well know standard then.</p>
<p>An example of a very well explained set of address shown process is here:</p>
<p><a class="reference external" href="https://es.wikipedia.org/wiki/Direcci%C3%B3n_postal">https://es.wikipedia.org/wiki/Direcci%C3%B3n_postal</a></p>
<a name="install"></a>
<h2>Install</h2>
<p>No necessary extra steps to install.</p>
<a name="how-to-use"></a>
<h2>How to use</h2>
<p>Simply replace your address rendering in the report you need escaping the new
method available in the partner model called <cite>get_address_from_template()</cite>.</p>
<p>You can inherit the report and use an xpath or simply create your own report.</p>
<p>In order to format and render properly try to use labels and css elements from
twitter bootstrap or inline styles (if you want to show the field in an email
for example or nicer in a report).</p>
<pre>
<code lang="xml"><div t-raw="partner.get_address_from_template()"/></code>
</pre>
<p>If you want use it into the Purchase report you can add this into your module
(or manually into the view using your administrative privileges) inheriting
properly the report template <cite>purchase.purchase_order</cite>.</p>
<pre>
<code lang="xml"><xpath expr="//div[@class='placeholder']" position="replace">
<div t-raw="partner.get_address_from_template()"/>
</xpath></code>
</pre>
<a name="included-formats"></a>
<h2>Included Formats</h2>
<ol class="arabic simple">
<li>Long en_US Format.</li>
<li>Long es_MX Format.</li>
<li>Short International format (used to show just contact info if company_id is
present).</li>
</ol>
<a name="hacking-and-contributing"></a>
<h2>Hacking and Contributing</h2>
<p>If you need more pre loaded formats it is nice if you add the few views lines
into the file templates.xml and propose a proper PR.</p>
<p>Frequently you need render with special fields on partner, the recommendend way
is to depends of this module into the module which add the fields itself and
either inherit the templates here created and/or generate your own templates
there in order to propose to the end use a new template including your fields.</p>
<p>For support and new features call to Vauxoo or fill a proper issue.</p>