Fixed module sale_category. Added module analytic_partner (doesn't work yet).
bzr revid: rde-fcdd99c03b5f7142348f54d70856f3ed49a9aa04
This commit is contained in:
parent
54e23b779b
commit
bf8a569b1b
|
@ -0,0 +1,3 @@
|
||||||
|
import analytic_partners
|
||||||
|
import report
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
{
|
||||||
|
"name" : "Analytic Accounts With Multiple Partners",
|
||||||
|
"author" : "Tiny",
|
||||||
|
"version" : "1.0",
|
||||||
|
"category" : "Generic Modules/Others",
|
||||||
|
"depends" : ["account"],
|
||||||
|
"demo_xml" : [],
|
||||||
|
"update_xml" : ["analytic_partners_view.xml",
|
||||||
|
"analytic_partners_report.xml"],
|
||||||
|
"init_xml" : [],
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
from osv import osv, fields
|
||||||
|
|
||||||
|
class analytic_partners_account_analytic_account(osv.osv) :
|
||||||
|
_name = 'account.analytic.account'
|
||||||
|
_inherit = 'account.analytic.account'
|
||||||
|
_columns = {
|
||||||
|
'address_ids' : fields.many2many('res.partner.address', 'account_partner_rel', 'account_id', 'address_id', 'Partners Contacts'),
|
||||||
|
}
|
||||||
|
|
||||||
|
analytic_partners_account_analytic_account()
|
|
@ -0,0 +1,11 @@
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<report id="analytic_partners_report"
|
||||||
|
string="Analytic Account with Partners"
|
||||||
|
model="account.analytic.account"
|
||||||
|
name="analytic_partners.print"
|
||||||
|
rml="analytic_partners/report/analytic_account_partners.rml"
|
||||||
|
auto="False"
|
||||||
|
/>
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="analytic_partners_analytic_account_form">
|
||||||
|
<field name="name">analytic_partners.analytic.account.form</field>
|
||||||
|
<field name="model">account.analytic.account</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_analytic_account_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<notebook>
|
||||||
|
<page string="Partners">
|
||||||
|
<field colspan="4" name="address_ids"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1 @@
|
||||||
|
import analytic_partners_report
|
|
@ -0,0 +1,136 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="35.0" y1="48.0" width="525" height="746"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#ffffcc" start="0,0" stop="0,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="6.0" leading="8"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<para style="P1">[[repeatIn(objects, 'o')]]</para>
|
||||||
|
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P2">Partner listing</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Printed: [[ time.strftime('%d-%m-%Y') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">[[ company.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">[[ o['name'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P6">[[ _init_dict(o) ]]</para>
|
||||||
|
<section>
|
||||||
|
<para style="P7">[[ repeatIn(partners_by_account.keys(), 'cat') ]]</para>
|
||||||
|
<blockTable colWidths="525.0" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P8">[[ cat ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P6">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P9"><font face="Times-Roman">[[ repeatIn(partners_by_account[cat], 'p') ]] </font>[[ p.name ]] - [[ p.vat ]]</para>
|
||||||
|
<blockTable colWidths="186.0,169.0,169.0" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">Contact</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">Address</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">Inforrmation</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10"><font face="Times-Roman">[[ repeatIn(p.address, 'a') ]] </font>[[ a.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P10">[[ a.street ]] [[ a.street2 ]]</para>
|
||||||
|
<para style="P10">[[ a.zip ]] [[ a.city ]]</para>
|
||||||
|
<para style="P10">[[ a.country_id and a.country_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P10"><font face="Times-Roman">Tel</font> : [[ a.phone ]]</para>
|
||||||
|
<para style="P10"><font face="Times-Roman">Fax</font> : [[ a.fax ]]</para>
|
||||||
|
<para style="P10"><font face="Times-Roman">Mobile</font> : [[ a.mobile ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P6">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</section>
|
||||||
|
</section>
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import pooler
|
||||||
|
import time
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
class analytic_partners_report(report_sxw.rml_parse):
|
||||||
|
# o must be an instance of
|
||||||
|
# analytic_partners_account_analytic_account.
|
||||||
|
def _init_dict(self, o):
|
||||||
|
self.partners_by_account.clear()
|
||||||
|
for a in o.address_ids:
|
||||||
|
p = a.partner_id
|
||||||
|
for c in p.category_id:
|
||||||
|
self.partners_by_account.setdefault(c.name, []).append(p)
|
||||||
|
if not p.category_id:
|
||||||
|
self.partners_by_account.setdefault('Non classifie', []).append(p)
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
# self.partners_by_account is a dictionnary where keys are category
|
||||||
|
# names and values are lists of partner_id.
|
||||||
|
self.partners_by_account={}
|
||||||
|
super(analytic_partners_report, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update( {
|
||||||
|
'time' : time,
|
||||||
|
'_init_dict' : self._init_dict,
|
||||||
|
'partners_by_account' : self.partners_by_account,
|
||||||
|
} )
|
||||||
|
|
||||||
|
report_sxw.report_sxw(
|
||||||
|
'report.analytic_partners.print',
|
||||||
|
'account.analytic.account',
|
||||||
|
'addons/analytic_partners/report/analytic_account_partners.rml',
|
||||||
|
parser=analytic_partners_report)
|
|
@ -57,7 +57,7 @@
|
||||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="8.0" leading="10"/>
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="8.0" leading="10"/>
|
||||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="16.0" leading="20"/>
|
<paraStyle name="P11" fontName="Times-Roman" fontSize="16.0" leading="20"/>
|
||||||
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
<paraStyle name="P13" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
<paraStyle name="P13" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
<paraStyle name="P14" fontName="Times-Bold" fontSize="8.0" leading="10"/>
|
<paraStyle name="P14" fontName="Times-Bold" fontSize="8.0" leading="10"/>
|
||||||
<paraStyle name="P15" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
<paraStyle name="P15" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||||
<paraStyle name="P16" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
|
<paraStyle name="P16" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
<para style="P12">Your order reference : [[ o.client_order_ref or '' ]]</para>
|
<para style="P12">Your order reference : [[ o.client_order_ref or '' ]]</para>
|
||||||
<para style="P12">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
|
<para style="P12">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
|
||||||
<para style="P12">Our salesman : [[ o.user_id.name ]]</para>
|
<para style="P12">Our salesman : [[ o.user_id.name ]]</para>
|
||||||
<para style="P13">[[o.topnote or '']]</para>
|
<para style="P13">[[ o.topnotes or '' ]] </para>
|
||||||
<blockTable colWidths="218.0,66.0,50.0,57.0,28.0,54.0,55.0" repeatRows="1" style="Tableau2">
|
<blockTable colWidths="218.0,66.0,50.0,57.0,28.0,54.0,55.0" repeatRows="1" style="Tableau2">
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
|
|
|
@ -7,11 +7,11 @@
|
||||||
<field name="model">sale.order</field>
|
<field name="model">sale.order</field>
|
||||||
<field name="inherit_id" ref="sale.view_order_form"/>
|
<field name="inherit_id" ref="sale.view_order_form"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field name="notes" position="before">
|
<separator string="Notes" colspan="4" position="replace">
|
||||||
<separator string="Top notes" colspan="4"/>
|
<separator string="Top notes" colspan="4"/>
|
||||||
<field name="topnotes" colspan="4" nolabel="1"/>
|
<field name="topnotes" colspan="4" nolabel="1"/>
|
||||||
<separator string="Bottom notes" colspan="4"/>
|
<separator string="Bottom notes" colspan="4"/>
|
||||||
</field>
|
</separator>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
|
|
Loading…
Reference in New Issue