← Back to team overview

openerp-l10n-pt-pt team mailing list archive

[Merge] lp:~openerp-community/openobject-addons/trunk-addons-community into lp:~openerp-commiter/openobject-addons/trunk-extra-addons

 

Grzegorz Grzelak (Cirrus) has proposed merging lp:~openerp-community/openobject-addons/trunk-addons-community into lp:~openerp-commiter/openobject-addons/trunk-extra-addons.

    Requested reviews:
    OpenERP Quality Team (openerp)
Related bugs:
  #387958 It could be easier to enter French RIB
  https://bugs.launchpad.net/bugs/387958


It is my first proposal. I have reviewed l10n_chart_pl from trunk. 
It contains now correct character coding, correct chart hierarchy, some account modification. There is no functional improvement but it can count on polish users acceptance (current l10n_chart_pl cannot). I placed the module here because am not yet Commiter. Please advice me if I should do something different to have this file in extra-addons.The attached diff has been truncated due to its size.
-- 
https://code.launchpad.net/~openerp-community/openobject-addons/trunk-addons-community/+merge/15162
Your team OpenERP & OpenObject Community is subscribed to branch lp:~openerp-community/openobject-addons/trunk-addons-community.
=== added directory 'account_bankimport'
=== added file 'account_bankimport/__init__.py'
--- account_bankimport/__init__.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,37 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+#
+
+import bankimport
+import wizard
\ No newline at end of file

=== added file 'account_bankimport/__terp__.py'
--- account_bankimport/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,52 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#                    Jan Verlaan <informatie@xxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+# 06-10-2009 jverlaan added MT940 filter for Postbank and ING
+#
+
+{
+	"name":"Account Bankimport",
+	"version":"0.0.2",
+	"author":"Tiny / Eddy Boer",
+	"category":"Account Bankimport",
+	"depends":["base", "account","account_report","base_iban"],
+	"init_xml":[],
+	"update_xml" : [
+		"security/ir.model.access.csv",
+		"bankimport_wizard.xml",
+		"bankimport_view.xml",
+	],
+	"active":False,
+	"installable":True,
+}

=== added file 'account_bankimport/bankimport.py'
--- account_bankimport/bankimport.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/bankimport.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,238 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+#
+
+import time
+from osv import osv,fields
+
+import urllib, urllib2, sgmllib
+from BeautifulSoup import BeautifulSoup, SoupStrainer
+import re, string
+
+def _opschonen(name):
+	p = name.split('>')
+	n = p[2].split('<')
+	return n[0]
+	
+def _get_bank_data(bank_acc):
+
+	p = {}
+	
+	urldata = {'number':bank_acc,'method':'POST'}
+	
+	data = urllib.urlencode(urldata)
+	link = "http://www.ibannl.org/iban_check.php";
+	
+	req = urllib2.Request(link, data)
+	f = urllib2.urlopen(req)
+	s = f.read()
+	
+	soup = BeautifulSoup(''.join(s))
+	test = soup.findAll('td')
+	
+	bank_id = 0
+	
+	if len(test) > 1 :
+		p['iban'] = _opschonen(str(test[1]))
+		p['bic'] = _opschonen(str(test[3]))
+		p['bank_name'] = _opschonen(str(test[5]))
+		
+		
+		return p
+	
+	else:
+		return False
+		
+    
+
+
+
+
+class account_bankimport_filters(osv.osv):
+    _name = "account.bankimport.filters"
+    _description = "Define the filters, which is related to the file"
+    _columns = {
+        'filter' : fields.char('Filtername', size=64, required=True),
+        'name' : fields.char('Filename', size=128, required=True),
+    }
+account_bankimport_filters()
+
+# Save data for each company
+class res_company(osv.osv):
+	_inherit = 'res.company'
+	_columns = {
+		'bank_journalid' :  fields.many2one('account.journal', 'Bank Journal', required=True),
+		'def_payable' :  fields.many2one('account.account', 'Default Payable Account', required=True, domain=[('type','=','payable')]),
+		'def_receivable' :  fields.many2one('account.account', 'Default Receivable Account', required=True, domain=[('type','=','receivable')]),
+		'filters': fields.many2one('account.bankimport.filters', 'Filter', required=True),
+		'bank_file' :  fields.char('File Location', size=128, required=True),
+	}
+res_company()
+
+class account_bankimport(osv.osv):
+    _name = "account.bankimport"
+    _description = "import Bank statements-file for an Account"
+    _columns = {
+        'name': fields.char('Name', size=64),
+        'file': fields.binary('bankimport file', readonly=True),
+        'statement_id': fields.many2one('account.bank.statement','Generated Bank Statement', select=True,readonly=True),
+        'note': fields.text('Import log', readonly=True),
+        'journal_id': fields.many2one('account.journal','Bank Journal', readonly=True,select=True),
+        'date': fields.date('Import Date', readonly=True,select=True),
+        'user_id': fields.many2one('res.users','User', readonly=True, select=True),
+    }
+    _defaults = {
+        'date': lambda *a: time.strftime('%Y-%m-%d'),
+        'user_id': lambda self,cr,uid,context: uid,
+    }
+account_bankimport()
+
+class account_bank_statement(osv.osv):
+    _inherit = "account.bank.statement"
+    _columns = {
+        'bankimport_id':fields.many2one('account.bankimport','bankimport'),
+        'state': fields.selection([('draft', 'Draft'),('draft_import', 'Draft Imported'),('confirm', 'Confirm')],
+            'State', required=True,
+            states={'confirm': [('readonly', True)]}, readonly="1"),
+    }
+    
+    
+account_bank_statement()
+
+class bank_statement_line(osv.osv):
+	_inherit = "account.bank.statement.line"
+	_columns = {
+		'bank_accnumber':fields.char('Bank account importfile', size=64, required=False),	
+		'amount': fields.float('Amount', states={'draft_import': [('readonly', True)]} ),
+		'ref': fields.char('Ref.', size=32, states={'draft_import': [('readonly', True)]} ),
+		'name': fields.char('Name', size=64, required=True, states={'draft_import': [('readonly', True)]} ),
+      'date': fields.date('Date', required=True, states={'draft_import': [('readonly', True)]} ),
+		
+            
+	}
+	
+	def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id,
+		context={}):
+		if not partner_id:
+			return {}
+		res_currency_obj = self.pool.get('res.currency')
+		res_users_obj = self.pool.get('res.users')
+		
+		company_currency_id = res_users_obj.browse(cursor, user, user,
+			context=context).company_id.currency_id.id
+			
+		if not currency_id:
+			currency_id = company_currency_id
+		
+		part = self.pool.get('res.partner').browse(cursor, user, partner_id,
+			context=context)
+		if part.supplier == 1 and part.customer == 0:
+			account_id = part.property_account_payable.id
+			type = 'supplier'
+		elif part.supplier == 0 and part.customer == 1:
+			account_id =  part.property_account_receivable.id
+			type = 'customer'
+		else:
+			account_id = 0
+			type = 'general'
+				
+		return {'value': {'type': type , 'account_id': account_id}}
+
+
+	def write(self, cr, uid, ids, vals, context={}):
+		acc_numbers = []
+		
+		if 'partner_id' in vals:
+			db_data = self.pool.get('res.partner.bank').search(cr,uid, [('partner_id','=', vals['partner_id']) ] )
+			acc_nums = self.pool.get('res.partner.bank').browse(cr,uid, db_data )
+		
+			import_acc = self.pool.get('account.bank.statement.line').browse(cr,uid, ids )
+		
+			for num in acc_nums:
+				if num.acc_number:
+					acc_numbers.append(num.acc_number)
+				else:
+					acc_numbers.append(num.iban)
+		
+			found_acc = False		
+			for x in import_acc:
+				if x.bank_accnumber in acc_numbers:
+					found_acc = True
+				
+			if not found_acc:
+				for x in import_acc:
+					p = _get_bank_data(x.bank_accnumber)
+				
+					if p:
+					# test if the bank exists
+						bank_id = self.pool.get('res.bank').search(cr,uid,[('name','=',p['bank_name'])])
+						if not bank_id:
+							bank_id = pool.get('res.bank').create(cr,uid,{
+									'name' : p['bank_name'],
+									'bic' : p['bic'],
+									'active' : 1,
+								})
+						else:
+							bank_id = bank_id[0]
+						
+	
+						bank_acc = self.pool.get('res.partner.bank').create(cr,uid,{
+										'state' : 'bank',
+										'partner_id': vals['partner_id'],
+										'bank' : bank_id,
+										'acc_number' : x.bank_accnumber,
+								})
+		
+						bank_iban = self.pool.get('res.partner.bank').create(cr,uid,{
+   	      						'state' : 'iban',
+      	   						'partner_id': vals['partner_id'],
+         							'bank' : bank_id,
+         							'iban' : p['iban'],
+         					})
+         		
+         			
+					else:
+						bank_acc = self.pool.get('res.partner.bank').create(cr,uid,{
+       					  			'state' : 'bank',
+         							'partner_id': vals['partner_id'],
+          							'acc_number' : x.bank_accnumber,
+         					})
+
+    
+     					
+		return super(bank_statement_line, self).write(cr, uid, ids, vals, context)
+
+	
+
+bank_statement_line()

=== added file 'account_bankimport/bankimport_data.xml'
--- account_bankimport/bankimport_data.xml	1970-01-01 00:00:00 +0000
+++ account_bankimport/bankimport_data.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+	<record model="res.partner.bank" id="base.res_partner_agrolait">
+		<field name="acc_number">301915554082</field>
+		<field name="partner_id" ref="base.res_partner_agrolait"/>
+	</record>
+
+	<record model="res.partner.bank" id="base.res_partner_10">
+		<field name="acc_number">050000000017</field>
+		<field name="partner_id" ref="base.res_partner_10"/>
+	</record>
+
+</data>
+</openerp>

=== added file 'account_bankimport/bankimport_demo.xml'
--- account_bankimport/bankimport_demo.xml	1970-01-01 00:00:00 +0000
+++ account_bankimport/bankimport_demo.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data noupdate="1">
+	<record model="res.partner" id="partner_demo1">
+		<field name="name">Tiny S.p.r.l</field>
+	</record>
+	<record model="res.partner.bank" id="partner_bank1">
+		<field name="acc_number">301915554082</field>
+		<field name="state">bank</field>
+		<field name="partner_id" ref="partner_demo1"></field>
+	</record>
+
+	<record model="res.partner" id="partner_demo2">
+		<field name="name">The-design Company</field>
+	</record>
+	<record model="res.partner.bank" id="partner_bank2">
+     	<field name="acc_number">050000000017</field>
+		<field name="state">iban</field>
+		<field name="partner_id" ref="partner_demo2"></field>
+	</record>
+
+<!--	<record model="res.partner.bank" id="partner_agrolait">
+		<field name="acc_number">301915554082</field>
+		<field name="partner_id" ref="base.res_partner_agrolait"/>
+	</record>
+
+	<record model="res.partner.bank" id="res_partner_10">
+		<field name="acc_number">050000000017</field>
+		<field name="partner_id" ref="base.res_partner_10"/>
+	</record>-->
+</data>
+</openerp>

=== added file 'account_bankimport/bankimport_view.xml'
--- account_bankimport/bankimport_view.xml	1970-01-01 00:00:00 +0000
+++ account_bankimport/bankimport_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+
+	<record model="ir.ui.view" id="view_company_for_bankimport">
+		<field name="name">res.company.form</field>
+		<field name="model">res.company</field>
+		<field name="inherit_id" ref="base.view_company_form"/>
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field name="currency_id" position="after">
+				<separator string="Import Bank Statements" colspan="4"/>		
+				<field name="bank_journalid" />
+				<field name="def_payable" />
+				<field name="def_receivable" />
+				<field name="filters" />
+				<field name="bank_file" />
+			</field>
+		</field>
+	</record>
+	
+	<record model="ir.ui.view" id="view_account_bankimport_form">
+		<field name="name">account.bankimport.form</field>
+		<field name="model">account.bankimport</field>
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<form string="Import bank statements">
+				<field name="name" />
+				<field name="journal_id" />
+				<field name="date" />
+				<field name="user_id" />
+				<field name="statement_id"/>
+				<field name="file"/>
+				<field name="note" colspan="4"/>
+			</form>
+		</field>
+	</record>
+
+
+	<record model="ir.ui.view" id="view_account_bankimport_tree">
+		<field name="name">account.bankimport.tree</field>
+		<field name="model">account.bankimport</field>
+		<field name="type">tree</field>
+		<field name="arch" type="xml">
+			<tree string="Import bank statements">
+				<field name="journal_id" />
+				<field name="date" />
+				<field name="user_id" />
+			</tree>
+		</field>
+	</record>
+
+	<record model="ir.actions.act_window" id="action_account_bankimport">
+		<field name="name">Import bank statements</field>
+		<field name="type">ir.actions.act_window</field>
+		<field name="res_model">account.bankimport</field>
+		<field name="view_type">form</field>
+		<field name="view_mode">tree,form</field>
+	</record>
+
+	<menuitem name="Financial Management/Reporting/Bankimport Statements" id="menu_action_account_bankimport" action="action_account_bankimport" sequence="12" />
+
+	<menuitem name="Financial Management/Periodical Processing/Import Bank Statements" action="wizard_account_bankimport" type="wizard"  id="menu_account_bankimport_wizard" sequence="15"/>
+
+	<act_window name="Import Bank Statements"
+		domain="[('statement_id', '=', active_id)]"
+		res_model="account.bankimport"
+		src_model="account.bank.statement"
+		view_type="form"
+		view_mode="tree,form"
+ 		id="act_account_payment_account_bank_statement"/>
+
+
+<!-- View for adding / changing filters -->
+
+
+
+	<record model="ir.ui.view" id="view_account_bankimport_filters_form">
+		<field name="name">account.bankimport.filters.form</field>
+		<field name="model">account.bankimport.filters</field>
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<form string="Define import filters">
+				<field name="filter" />
+				<field name="name" />
+			</form>
+		</field>
+	</record>
+
+
+	<record model="ir.ui.view" id="view_account_bankimport_filters_tree">
+		<field name="name">account.bankimport.filters.tree</field>
+		<field name="model">account.bankimport.filters</field>
+		<field name="type">tree</field>
+		<field name="arch" type="xml">
+			<tree string="Import filters">
+				<field name="filter" />
+				<field name="name" />
+			</tree>
+		</field>
+	</record>
+	
+	<record model="ir.actions.act_window" id="action_account_bankimport_filters_tree">
+		<field name="name">Define bankimport filters</field>
+		<field name="res_model">account.bankimport.filters</field>
+		<field name="view_type">form</field>
+		<field name="view_mode">tree,form</field>
+	</record>
+<!--
+	<menuitem name="Financial Management/Reporting/Bankimport Statements" id="menu_account_bankimport" action="action_bank_statement_tree" sequence="12"/>
+-->
+	<menuitem action="action_account_bankimport_filters_tree" id="menu_action_account_bankimport_filters_tree" parent="base.menu_users"/>
+
+
+<!-- **** END ***** --> 
+	
+		
+	</data>
+</openerp>

=== added file 'account_bankimport/bankimport_wizard.xml'
--- account_bankimport/bankimport_wizard.xml	1970-01-01 00:00:00 +0000
+++ account_bankimport/bankimport_wizard.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+
+		<wizard
+		string="Import Bank statements file"
+		model="account.bank.statement"
+		name="account.bank_import"
+		id="wizard_account_bankimport"
+		/>
+		
+	</data>
+</openerp>

=== added directory 'account_bankimport/security'
=== added file 'account_bankimport/security/ir.model.access.csv'
--- account_bankimport/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ account_bankimport/security/ir.model.access.csv	2009-11-23 15:50:45 +0000
@@ -0,0 +1,3 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_account_bankimport","account.bankimport","model_account_bankimport","account.group_account_manager",1,1,1,1
+"access_account_bankimport_filters","account.bankimport.filters","model_account_bankimport_filters","account.group_account_manager",1,1,1,1

=== added file 'account_bankimport/usage_of_account_bankimport.pdf'
Binary files account_bankimport/usage_of_account_bankimport.pdf	1970-01-01 00:00:00 +0000 and account_bankimport/usage_of_account_bankimport.pdf	2009-11-23 15:50:45 +0000 differ
=== added directory 'account_bankimport/wizard'
=== added file 'account_bankimport/wizard/__init__.py'
--- account_bankimport/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,35 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+#
+import bank_import

=== added file 'account_bankimport/wizard/bank_import.py'
--- account_bankimport/wizard/bank_import.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/bank_import.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,333 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+#
+import pooler
+import time
+import datetime
+import wizard
+import netsvc
+import base64
+from osv import fields, osv
+
+result_form = """<?xml version="1.0"?>
+<form string="Import ASC Statement">
+<separator colspan="4" string="Results :" />
+    <field name="note" colspan="4" nolabel="1" width="500"/>
+</form>
+"""
+
+result_fields = {
+
+    'note' : {'string':'Log','type':'text'}
+
+}
+
+def _bank_import(self, cr, uid, data, context):
+    
+    pool = pooler.get_pool(cr.dbname)
+
+    # setting variables 
+    line_name = 0
+    str_log = ""
+    err_log = ""
+    str_log1 = ""
+    st_line_name = line_name
+    
+    bank_statement={}
+    bank_statement_lines={}
+    bank_statements=[]
+
+    ########################	 
+	 # building the header. #
+    ######################## 	 
+    # First we get the company_id from the user.
+    user_data = pool.get('res.users').browse(cr, uid, uid, context)
+    
+	 # No we get the company data (journals and the file to read)
+    company_data = pool.get('res.company').browse(cr, uid, user_data.company_id.id, context)
+
+    # create the base
+    bankfile = company_data.bank_file
+    def_pay_acc = company_data.def_payable.id
+    def_rec_acc = company_data.def_receivable.id
+    
+    # get todays date and get the period. The todays date will also be used for the Date-field  
+    today_date = datetime.date.today()
+    periodDate = today_date.strftime('%Y-%m-%d')
+    period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',periodDate),('date_stop','>=',periodDate)])
+    
+    # getting the start data of the balance. We need this from the database
+    # get the latest bank statement from the database (highest id
+    cr.execute('select max(id) from account_bank_statement',)
+    bal_id = cr.fetchone()[0]
+    bal_prev = pool.get('account.bank.statement').browse(cr,uid,bal_id,context)
+    
+    if not bal_prev:
+       # switch to 0	    
+       bal_start = 0
+    else :
+       # use the balance_end_real as the start_balance for the new statement
+       bal_start = bal_prev.balance_end_real    
+    
+    # fill the bankstatement
+    bank_statement["bank_statement_line"]={}
+    bank_statement['date'] = today_date.strftime('%d/%m/%Y')
+    bank_statement['journal_id']=company_data.bank_journalid.id
+    bank_statement['period_id'] = period_id[0]
+    bank_statement['def_pay_acc'] = def_pay_acc
+    bank_statement['def_rec_acc'] = def_rec_acc
+    bank_statement['state']='draft'
+    bank_statement["balance_start"]= bal_start
+    # Because the company is linked to a Partner, we can get also the
+    # acc_number. We can even use it to verify if the right bankstatements
+    # were be imported (acc_numbers should be equal).
+    acc_number_id = pool.get('res.partner.bank').search(cr, uid, [('partner_id','=',company_data.partner_id.id)])
+    
+    # check if we got a bank / iban number
+    if len(acc_number_id) > 0:
+       bank_statement["acc_number"] = []    
+       # create a list of numbers 
+       for acc in acc_number_id:
+          acc_number = pool.get('res.partner.bank').browse(cr,uid,acc)
+         
+          if acc_number.acc_number :
+          	bank_statement["acc_number"].append(acc_number.acc_number.lower())
+          else :
+          	bank_statement["acc_number"].append(acc_number.iban.lower())
+          
+    else :
+    	raise wizard.except_wizard('ERROR !', 'We got no bank / iban number.')
+    #   str_log1 = "We got no bank / iban number!"
+    #   return {'note':str_log1 ,'journal_id':0 , 'asc':0,'statment_id':0}
+
+    # We use the company name and not the partner name
+    bank_statement["acc_holder"] =  company_data.name  
+
+	 # setting the end value of the balance
+    bal_end = bal_start
+    
+    bank_statement['bal_start'] = bal_start
+    bank_statement['bal_end'] = bal_end
+    
+    # based on the filter we parse the document
+    filterObject = 'account.bankimport.filter.' + str(company_data.filters)
+    
+    bank_data = pooler.get_pool(cr.dbname).get( filterObject )
+    
+    exec "from filters import " + company_data.filters.name + " as parser"
+    #__import__( company_data.filters.name )
+
+
+    # opening the file speficied as bank_file and read the data
+    try:
+      bf = open(bankfile, 'r')
+    	
+      try:
+         mydata = bf.read()
+         recordlist = mydata.split('\n') # bf.readlines()
+         recordlist.pop()
+         data = parser.get_data(self,cr,uid,recordlist,bank_statement) # parse the data through the filter
+      finally:
+         bf.close()
+    except IOError:
+       raise
+          
+
+    bank_statements.append(bank_statement)
+    bkst_list=[]
+    bk_st_id=0
+
+    nb_err=0
+    err_log=''
+    str_log=''
+    std_log=''
+    str_log1 = str_log1 + "  Bank Statements were Imported  :  "
+    str_not=''
+    str_not1=''
+    
+    period = []
+    
+   
+    # check if we have new bank statement lines.
+    if len(data) >= 1:
+    	p_bank_state = []
+    	p_state_line = {}
+    	
+    	# move each line to the right period
+    	for line in data:    		
+    		periodDate = time.strftime('%Y-%m-%d', time.strptime(line['date'], '%d/%m/%y') )
+    			
+    		# get the period
+    		periodD = pool.get('account.period').search(cr,uid,[('date_start','<=',periodDate),('date_stop','>=',periodDate)])[0]
+    		
+    		# check if the period already exists in the dictonairy
+    		if periodD in p_state_line:
+    			w = p_state_line[periodD] # fill the array with existing data
+    		else:
+    			w = []
+    			
+    		w.append(line)
+    		p_state_line[periodD] = w
+    		if periodD not in period:
+    			period.append(periodD)
+
+		# sort the periods
+		period.sort()
+		
+		# set the start balance
+		bal_start = float(bank_statement['balance_start'])
+		
+		# we have now a dictionary of statement lines based on the period, so we can create the bankstatements now    			
+    	for li in period:
+    		lines = p_state_line[li]    		
+    		total = 0.0
+    		
+    		# calculate the ending balance
+    		for lin in lines:
+    			total += float(lin['amount'])
+    		bal_end += total
+    		
+    		try:
+    			bk_st_id = pool.get('account.bank.statement').create(cr,uid,{
+    							'journal_id': bank_statement['journal_id'],
+    							'date':today_date.strftime('%Y-%m-%d'),
+    							'period_id':li,
+    							'balance_start': bal_start,
+    							'balance_end_real': bal_end,
+    							'state':'draft',
+    						})
+    						
+    			for line in lines:
+    				str_not1="Partner name : %s\nPartner Account Number : %s\nCommunication : %s\nValue Date : %s\nEntry Date : %s\n" %(line["contry_name"],line["cntry_number"],line["free_comm"],line["val_date"],line["entry_date"][0])
+    				
+    				id=pool.get('account.bank.statement.line').create(cr,uid,{
+    							'name':line['name'],
+    							'date': time.strftime('%Y-%m-%d', time.strptime(line['date'], '%d/%m/%y') ),
+    							'amount': line['amount'],
+    							'partner_id':line['partner_id'] or 0,
+    							'account_id':line['account_id'],
+    							'statement_id': bk_st_id,
+    							'note':str_not1,
+    							'ref':line['ref'],
+    							'bank_accnumber':line['partner_acc_number'],
+    							'type':line['type'],
+    						})
+    			cr.commit()
+    			
+    			str_not= "\n \n Account Number: %s \n Account Holder Name: %s " %(bank_statement["acc_number"],bank_statement["acc_holder"])
+    			std_log = std_log + "\nDate  : %s, Starting Balance :  %.2f , Ending Balance : %.2f "\
+    					%(bank_statement['date'], bal_start, bal_end)
+    			bkst_list.append(bk_st_id)
+
+    			# move ending balance to the start balance   			
+    			bal_start = bal_end
+	
+    		except osv.except_osv, e:
+    			cr.rollback()
+
+    		except osv.except_osv, e:
+    			cr.rollback()
+    			nb_err+=1
+    			err_log= err_log +'\n Application Error : ' + str(e)
+    			raise # REMOVEME
+    		
+    		except Exception, e:
+    			cr.rollback()
+    			nb_err+=1
+    			err_log= err_log +'\n System Error : '+str(e)
+    			raise # REMOVEME
+    			
+    		except :
+    			cr.rollback()
+    			nb_err+=1
+    			err_log= err_log +'\n Unknown Error'
+    			raise
+    	err_log= err_log + '\n\nNumbers of statements : '+ str(len([bkst_list]))     
+    	err_log= err_log + '\nNumber of error :'+ str(nb_err) +'\n'
+
+    	   	
+    	pool.get('account.bankimport').create(cr, uid,{
+    		'file': base64.encodestring(mydata),
+    		'statement_id':bk_st_id,
+    		'note':str(str_log1) + str(str_not) + str(std_log+err_log),
+    		'journal_id':company_data.bank_journalid.id,
+    		'date':time.strftime("%Y-%m-%d"),
+    		'user_id':uid,
+    	})
+    else:
+       raise wizard.except_wizard('WARNING !', 'No new records found, nothing imported.')
+	 # close the file
+    bf.close()
+#    return {}	 
+     
+    return {'note':str_log1 + std_log + err_log ,'journal_id': company_data.bank_journalid.id, 'asc': company_data.bank_file,'statment_id':bkst_list}
+
+    
+class bank_import(wizard.interface):
+    def _action_open_window(self, cr, uid, data, context):
+        form=data['form']
+        return {
+            'domain':"[('id','in',(%s,))]"%(",".join(map(str,form['statment_id']))),
+            'name': 'Statement',
+            'view_type': 'form',
+            'view_mode': 'form,tree',
+            'res_model': 'account.bank.statement',
+            'view_id': False,
+            'type': 'ir.actions.act_window',
+            'res_id':form['statment_id'],
+        }
+    states = {
+         'init' : {
+            'actions' : [_bank_import],
+            'result' : {'type' : 'form',
+                    'arch' : result_form,
+                    'fields' : result_fields,
+                    'state' : [('end', '_Close', 'gtk-close'),('open', '_Open Statement','gtk-ok')]}
+         },
+         
+         'extraction' : {
+            'actions' : [_bank_import],
+            'result' : {'type' : 'form',
+                    'arch' : result_form,
+                    'fields' : result_fields,
+                    'state' : [('end', '_Close', 'gtk-close'),('open', '_Open Statement','gtk-ok')]}
+        },
+        'open': {
+            'actions': [],
+            'result': {'type': 'action', 'action': _action_open_window, 'state': 'end'}
+
+            },
+
+    }
+bank_import("account.bank_import")

=== added directory 'account_bankimport/wizard/filters'
=== added file 'account_bankimport/wizard/filters/__init__.py'
--- account_bankimport/wizard/filters/__init__.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/filters/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,36 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This module can import .asc-files (BRI-layout).
+#
+
+#import 
\ No newline at end of file

=== added file 'account_bankimport/wizard/filters/asc.py'
--- account_bankimport/wizard/filters/asc.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/filters/asc.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,186 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This filter imports .asc-files (BRI-layout).
+#
+
+from osv import fields, osv
+import time
+import pooler
+import conversion
+import string
+
+def get_data(self, cr, uid, bankData, bank_statement):
+	   
+      pool = pooler.get_pool(cr.dbname)
+      
+      bal_end = bank_statement['bal_end']
+      bank_statement_lines={}
+      bank_statements=[]
+      line_name = 0
+      st_line_name = line_name
+      code4 = 0
+      
+      # parse every line in the file and get the right data
+      for line in bankData:
+         if len(line) <= 23:  # the end of the file has an empty line
+            pass
+         else:
+            # check if bankaccount in the file matches with the bankaccount of the database
+            bankaccount = line[0:10]
+            # Look if we can match our number with a number in the list
+            if bankaccount.lower() in bank_statement["acc_number"]:
+               # look for the recordtype
+               # 2 is the baserecord. We can also have 3 and 4. These are followrecords.
+               if line[23] == '2' and code4 == 0:
+                  st_line_name = line_name
+                  st_line = {}
+                  st_line['statement_id']=0
+                  st_line['name'] = line[48:72]
+                  st_line['date'] = conversion.str2date(line[87:93]) # boekingsdatum
+                  st_line_amt = conversion.list2float(line[73:86])
+                  
+                  if line[86] == "D": 
+                     st_line_amt = - st_line_amt
+                     st_line['account_id'] = bank_statement['def_pay_acc']
+                  else:
+                     st_line['account_id'] = bank_statement['def_rec_acc']
+                    
+                  st_line['entry_date']=time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(line[87:93]),"%d/%m/%y")),
+                  st_line['val_date']=time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(line[93:99]),"%d/%m/%y")),
+                              
+                  st_line['partner_id']=0
+                  st_line['amount'] = st_line_amt
+                  st_line['type'] = 'general'
+                 
+                  st_line_partner_acc = str(line[38:48]).strip()
+                  if st_line_partner_acc[:1] == '0':
+                  	st_line_partner_acc = st_line_partner_acc[1::]
+                  	
+                  st_line['partner_acc_number'] = st_line_partner_acc 
+                  	 	  
+                  cntry_number=st_line_partner_acc
+                  contry_name=line[48:72]
+                  bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line_partner_acc)])
+                  
+                  if bank_ids:
+                     bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context={})
+                     st_line['cntry_number']=cntry_number
+                     st_line['contry_name']=contry_name
+      
+                     if st_line and bank.partner_id:
+                        st_line['partner_id']=bank.partner_id.id
+                        
+                        # Create a check if we don't already imported this statement
+                        # We make an unique check in the database with
+                        # partner, date and amount
+                        check_ids = pool.get('account.bank.statement.line').search(cr,uid,[('amount','=',st_line_amt), ('date','=',st_line['entry_date']),('partner_id','=',bank.partner_id.id)])
+                                         
+                                
+                        # check if the partner is a supplier or customer
+                        # if both, we don't add a account due to credit invoices		
+                        partner = pool.get('res.partner').browse(cr,uid,bank.partner_id,context={})
+                        
+                        st_line['type']='general'
+                        
+                        if bank.partner_id.supplier == True and bank.partner_id.customer == False:
+                        	st_line['account_id']= bank.partner_id.property_account_receivable.id
+                        	st_line['type']='supplier'
+
+                        elif bank.partner_id.customer == True and bank.partner_id.supplier == False :
+                        	st_line['account_id']= bank.partner_id.property_account_payable.id
+                        	st_line['type']='customer'
+
+                        #if st_line['amount'] < 0 :
+                        #   st_line['account_id']= bank.partner_id.property_account_payable.id
+                        #else :
+                        #   st_line['account_id']= bank.partner_id.property_account_receivable.id
+   
+                  else:
+                     st_line['cntry_number']=cntry_number
+                     st_line['contry_name']=contry_name
+                     
+                     # Create a check if we don't already imported this statement
+                     # We make an unique check in the database with
+                     # name, date and amount
+                     check_ids = pool.get('account.bank.statement.line').search(cr,uid,[('amount','=',st_line_amt), ('date','=',st_line['entry_date']), ('name','=',contry_name)])               
+                 
+                  st_line['free_comm']= ''
+                  st_line['ref']=''
+                
+               elif line[23] == '3' and code4 == 0 :      # get some information about the transaction
+                  st_line['free_comm']=line[56:119]
+                  refe = line[56:119].split(' ')
+                  stri = ''
+                  for t in refe:
+                  	if t.strip():
+                        	stri = stri + ' ' + ''.join(t.strip())
+                  
+                  st_line['ref']=stri
+                  code4 = int(line[120])
+                  if not check_ids:
+                     line_name += 1
+                     st_line_name = line_name      
+                     
+               elif line[23] == '4':      # get some more information about the transaction
+                  st_line['free_comm'] = st_line['free_comm'] + "\n" + line[24:119]
+                  code4 = code4 - 1
+               
+               if not check_ids:   
+                 bank_statement_lines[line_name]=st_line
+               #  bank_statements.append(st_line)    
+         
+
+           # end if
+      # end for
+      
+      
+      
+      # delete latest row from the list because its an empty row
+      if len(bank_statement_lines) >= 1:
+         del bank_statement_lines[ line_name ]  # delete latest row from the list
+         for test in bank_statement_lines:
+            bank_statements.append(bank_statement_lines[test])
+         
+      # count the end balance
+#      for value in bank_statement_lines:
+#         line=bank_statement_lines[value]
+#         bal_end += line['amount']
+
+#      bank_statement["balance_end_real"]= bal_end
+#      bank_statement["bank_statement_line"]=bank_statement_lines
+     
+      return bank_statements
+                
+            
+    #end for         
+#select distinct b.partner_id, p.ref from res_partner_bank b, res_partner p where b.bank='51' and b.partner_id = p.id

=== added file 'account_bankimport/wizard/filters/coda.py'
--- account_bankimport/wizard/filters/coda.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/filters/coda.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,150 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Eddy Boer
+#                          All Rights Reserved.
+#                    Fabien Pinckaers <fp@xxxxxxx>
+#                    Eddy Boer <tinyerp@xxxxxxxxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+# I used the code of account_coda as base for this module. The module does
+# exactly the same thing as account_coda. The difference is the file-layout. 
+#
+# This filter imports .coda-files (CODA-layout).
+#
+
+
+from osv import fields, osv
+import time
+import pooler
+import conversion
+
+
+def get_data(self, cr, uid, bankData, bank_statement):
+      pool = pooler.get_pool(cr.dbname)
+   
+      bal_end = bank_statement['bal_end']
+      bank_statement_lines={}
+      bank_statements=[]
+      line_name = 0
+      str_log = ""
+      err_log = ""
+      str_log1 = ""
+      st_line_name = line_name
+    
+      # parse every line in the file and get the right data
+      for line in bankData:
+        if line[0] == '0':
+            # header data
+#            bank_statement={}
+#            bank_statement_lines={}
+            bank_statement["bank_statement_line"]={}
+            #bank_statement['date'] = conversion.str2date(line[5:11])
+            #period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime("%y/%m/%d",time.strptime(bank_statement['date'],"%d/%m/%y"))),('date_stop','>=',time.strftime("%y/%m/%d",time.strptime(bank_statement['date'],"%d/%m/%y")))])
+            #period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d"))),('date_stop','>=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d")))])
+            #bank_statement['period_id'] = period_id[0]
+            #bank_statement['state']='draft'
+        elif line[0] == '1':
+            # old balance data
+            bal_start = conversion.list2float(line[43:58])
+            if line[42] == '1':
+                bal_start = - bal_start
+            bank_statement["balance_start"]= bal_start
+            bank_statement["acc_number"]=line[5:17]
+            bank_statement["acc_holder"]=line[64:90]
+
+        elif line[0]=='2':
+            # movement data record 2
+            if line[1]=='1':
+                # movement data record 2.1
+                st_line = {}
+                st_line['statement_id']=0
+                st_line['name'] = line[2:10]
+                st_line['date'] = conversion.str2date(line[115:121])
+                st_line_amt = conversion.list2float(line[32:47])
+
+                if line[61]=='1':
+                    st_line['ref']=(line[65:77])
+                    st_line['free_comm']=''
+                else:
+                    st_line['free_comm']=line[62:115]
+                    st_line['ref']=''
+
+                st_line['val_date']=time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(line[47:53]),"%y/%m/%d")),
+                st_line['entry_date']=time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(line[115:121]),"%y/%m/%d")),
+                st_line['partner_id']=0
+                if line[31] == '1':
+                    st_line_amt = - st_line_amt
+                    st_line['account_id'] = bank_statement['def_pay_acc']
+                else:
+                    st_line['account_id'] = bank_statement['def_rec_acc']
+                st_line['amount'] = st_line_amt
+                bank_statement_lines[st_line['name']]=st_line
+                bank_statement["bank_statement_line"]=bank_statement_lines
+
+            elif line[1] == '3':
+                # movement data record 3.1
+                st_line_name = line[2:10]
+                st_line_partner_acc = str(line[10:47]).strip()
+                cntry_number=line[10:47]
+                contry_name=line[47:125]
+                #bank_ids = pool.get('res.partner.bank').search(cr,uid,[('number','=',st_line_partner_acc)])
+                bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line_partner_acc)])
+                if bank_ids:
+                    bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context={})
+                    line=bank_statement_lines[st_line_name]
+                    line['cntry_number']=cntry_number
+                    line['contry_name']=contry_name
+
+                    if line and bank.partner_id:
+                        line['partner_id']=bank.partner_id.id
+                        if line['amount'] < 0 :
+                            line['account_id']=bank.partner_id.property_account_payable.id
+                        else :
+                            line['account_id']=bank.partner_id.property_account_receivable.id
+
+                        bank_statement_lines[st_line_name]=line
+                else:
+                    line=bank_statement_lines[st_line_name]
+                    line['cntry_number']=cntry_number
+                    line['contry_name']=contry_name
+                    bank_statement_lines[st_line_name]=line
+
+
+                bank_statement["bank_statement_line"]=bank_statement_lines
+        elif line[0]=='3':
+            pass
+        elif line[0]=='8':
+            # new balance record
+            bal_end = conversion.list2float(line[42:57])
+            if line[41] == '1':
+                bal_end = - bal_end
+            bank_statement["balance_end_real"]= bal_end
+
+        elif line[0]=='9':
+            # footer record
+            pass
+            #bank_statements.append(bank_statement)
+     #end for
+      return bank_statement 
+

=== added file 'account_bankimport/wizard/filters/conversion.py'
--- account_bankimport/wizard/filters/conversion.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/filters/conversion.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,20 @@
+import time
+
+def str2date(date_str):
+      return time.strftime("%y/%m/%d",time.strptime(date_str,"%d%m%y"))
+
+def str2float(str):
+     try:
+        return float(str)
+     except:
+        return 0.0
+
+def list2float(lst):
+     try:
+        return str2float((lambda s : s[:-2] + '.' + s[-2:])(lst))
+     except:
+        return 0.0
+
+def list2str(lst):
+     return str(lst).strip('[]').replace(',','').replace('\'','')
+

=== added file 'account_bankimport/wizard/filters/mt940.py'
--- account_bankimport/wizard/filters/mt940.py	1970-01-01 00:00:00 +0000
+++ account_bankimport/wizard/filters/mt940.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,173 @@
+##############################################################################
+#
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) and Peter Dapper
+#                          All Rights Reserved.
+#                     Peter Dapper <verkoop@xxxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+#
+# This filter imports .mt940-files 
+#
+
+from osv import fields, osv
+import time
+import pooler
+import conversion
+import string
+import copy
+
+def get_acc_number(statement_line):
+	pointer = 0
+	only_acc = ""
+	result=[]
+	# one of my suppliers uses incasso, and does not use white space in .940 file between bank account and name 
+	while statement_line[pointer]!= " " and statement_line[pointer]!= "C" and statement_line[pointer]!= "D" and statement_line[pointer]!= "Q":
+		only_acc = only_acc+statement_line[pointer]
+		pointer += 1
+	return only_acc
+
+
+def get_number(statement_line):
+	pointer = 7
+	only_amount = ""
+	while statement_line[pointer] in ["0","1","2","3","4","5","6","7","8","9",","]:
+		only_amount = only_amount+statement_line[pointer]
+		pointer += 1
+	only_amount = only_amount.replace(",",".")
+	return only_amount
+
+
+
+def parse_sequence(bank_statement,bank, cr, uid,):
+	pool = pooler.get_pool(cr.dbname)
+	st_line = {}
+	bank_statement_output=[]
+	current=0
+	while current < len(bank_statement):
+		#if ':61:' in bank_statement[current]:
+		if bank_statement[current].has_key(':61:'):
+			# Pfff.. a line we can use. Gives us the date, debit/credit, and amount
+			st_line['date']=conversion.str2date(bank_statement[current][':61:'][0:6])
+			entry_date = time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(bank_statement[current][':61:'][0:6]),"%d/%m/%y")),
+			st_line['val_date']   = time.strftime('%Y-%m-%d',time.strptime(conversion.str2date(bank_statement[current][':61:'][0:6]),"%d/%m/%y")),
+			st_line['entry_date']=entry_date
+			# Pfff...get amount
+			amount =round(float(get_number(bank_statement[current][':61:'])),2)
+			st_line['amount']=amount
+			# Getting rich or poor
+			if bank_statement[current][':61:'][6] == "D":
+				st_line['account_id'] = bank['def_pay_acc']
+				st_line['amount'] = - st_line['amount']
+				# chek_ids did not work correctly because the amount could also be negativ
+				amount = - amount
+			else:
+				st_line['account_id'] = bank['def_rec_acc']
+			# Well, that was the transaction, now the details, directly next line..
+			current += 1
+			if bank_statement[current].has_key(':68:'):
+				st_line['free_comm'] = " "
+				st_line['partner_id'] = 0
+				st_line['type'] = 'general'
+				st_line['free_comm'] = " "
+				st_line['partner_acc_number'] = get_acc_number(bank_statement[current][':68:'])
+				st_line['cntry_number'] = get_acc_number(bank_statement[current][':68:'])
+				st_line['contry_name'] =bank_statement[current][':68:'][len(st_line['cntry_number']):]
+				st_line['name'] = bank_statement[current][':68:'][len(st_line['cntry_number']):]
+				st_line['ref'] =" " # Sometimes .. there is no ref. Still, it is being used by other scripts.
+				# Houston, we have a problem.. ING uses nicely a second :86: code, Postbank does not ... (back to the filling of the list,.done)
+				# See if we have a next rule, only description!! 
+				current += 1
+				if bank_statement[current].has_key(':68:'):
+					st_line['ref'] =bank_statement[current][':68:'][0:]
+					# extra comment.. filling the free_comm
+					current += 1
+					if bank_statement[current].has_key(':68:'):
+						st_line['free_comm'] = bank_statement[current][':68:'][0:]
+					else:
+						current -= 1
+			# check if there is already a statement like this...
+			check_ids = pool.get('account.bank.statement.line').search(cr,uid,[('amount','=',amount), ('date','=',entry_date),('name','=',st_line['name'])])
+			# check if there already is a relation ..., and use the ID
+			bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line['partner_acc_number'])])
+			if bank_ids:
+				bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context={})
+				if bank.partner_id:
+					st_line['partner_id'] = bank.partner_id.id
+					partner = pool.get('res.partner').browse(cr,uid,bank.partner_id,context={})
+					if bank.partner_id.supplier == True and bank.partner_id.customer == False:
+						st_line['account_id'] = bank.partner_id.property_account_receivable.id
+						st_line['type'] ='supplier'
+					elif bank.partner_id.customer == True and bank.partner_id.supplier == False :
+						st_line['account_id'] = bank.partner_id.property_account_payable.id
+						st_line['type'] ='customer'
+			# ..Let see if we can make that just one line of imput
+			print st_line
+			if not check_ids:
+				bank_statement_output.append(st_line.copy())
+							
+				
+			
+		current += 1
+	return bank_statement_output
+
+
+def fill_simple_list(bankData):
+	current = 0
+	bank_statement_lines={}
+	bank_statements_list=[]
+	while current < len(bankData):
+		# codes used are 20,25,28,28c,60m,61,86,62,64,65. Only 61 and 68 are intresting (if you want more checks 25 and 60 are intresting)
+		statement_line = string.find(bankData[current], ':61:')
+		statement_description = string.find(bankData[current], ':86:')
+		# these codes we use to determin the possible end of the description
+		closing_balance = string.find(bankData[current], ':62F:')
+		closing_balance_available = string.find(bankData[current], ':64:')
+		if statement_line >= 0:
+			bank_statement_lines[":61:"]=bankData[current][4:]
+		if statement_description >= 0:
+			bank_statement_lines[":68:"]=bankData[current][4:]
+		if closing_balance >= 0:
+			bank_statement_lines[":62F:"]=bankData[current][5:]
+		if closing_balance_available >= 0:
+			bank_statement_lines[":64:"]=bankData[current][4:]
+		if bankData[current][0]!=":" and bankData[current][0]!="-" :
+			# some banks use LF , an not an extra :68:, so mutch for a standerd
+			bank_statement_lines[":68:"]=bankData[current][0:]
+		if  statement_line >= 0 or statement_description >= 0 or statement_description >= 0 or closing_balance_available>= 0:	
+			bank_statements_list.append(bank_statement_lines.copy())
+		bank_statement_lines={}
+		current += 1
+	return bank_statements_list
+
+
+def get_data(self, cr, uid, bankData, bank_statement):
+	#pool = pooler.get_pool(cr.dbname)
+	bank_statement_list=[]
+	bank_statement_output=[]
+	bank_statement_list = fill_simple_list(bankData) #just keeping it simple
+	bank_statement_output=parse_sequence(bank_statement_list,bank_statement,cr, uid,)
+	print bank_statement_output
+	return bank_statement_output
+
+

=== added directory 'account_chart_orthogonal'
=== added file 'account_chart_orthogonal/.project'
--- account_chart_orthogonal/.project	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/.project	2009-11-23 15:50:45 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>account_chart_orthogonal</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.python.pydev.PyDevBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.python.pydev.pythonNature</nature>
+	</natures>
+</projectDescription>

=== added file 'account_chart_orthogonal/.pydevproject'
--- account_chart_orthogonal/.pydevproject	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/.pydevproject	2009-11-23 15:50:45 +0000
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?eclipse-pydev version="1.0"?>
+
+<pydev_project>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.6</pydev_property>
+<pydev_property name="org.python.pydev.PYTHON_PROJECT_INTERPRETER">Default</pydev_property>
+</pydev_project>

=== added directory 'account_chart_orthogonal/.settings'
=== added file 'account_chart_orthogonal/.settings/org.eclipse.core.resources.prefs'
--- account_chart_orthogonal/.settings/org.eclipse.core.resources.prefs	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/.settings/org.eclipse.core.resources.prefs	2009-11-23 15:50:45 +0000
@@ -0,0 +1,5 @@
+#Mon Nov 09 19:37:31 BRST 2009
+eclipse.preferences.version=1
+encoding/__init__.py=utf-8
+encoding/__terp__.py=utf-8
+encoding/account_chart.py=utf-8

=== added file 'account_chart_orthogonal/__init__.py'
--- account_chart_orthogonal/__init__.py	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import account_chart
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'account_chart_orthogonal/__terp__.py'
--- account_chart_orthogonal/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#    Written by: Cloves J. G. de Almeida <cjalmeida@xxxxxxxxx>
+#
+##############################################################################
+
+
+{
+    'name': 'Chart of accounts filtered by an analytical account.',
+    'version': '0.9',
+    'category': 'Generic Modules',
+    'description': """
+Add the option to display the chart of accounts filtered by an analytical account. This orthogonal view could be used as
+very simple way to enable multi-company. 
+
+Originally, this is used by the mbi_pos module to use multiple stores in a single chart of account, instead of creating cash, inventory,
+etc. accounts for every store. 
+    """,
+    'author': 'Ville Douro LTDA',
+    'depends': ['account'],
+    'init_xml': ['account_view.xml'],
+    'update_xml': [],
+    'demo_xml': [],
+    'installable': True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_chart_orthogonal/account_chart.py'
--- account_chart_orthogonal/account_chart.py	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/account_chart.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,78 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+#    Written by: Cloves J. G. de Almeida <cjalmeida@xxxxxxxxx>
+#    Using code written by Tiny Srpl.
+#
+##############################################################################
+
+
+from osv import osv, fields
+import pooler
+
+class account_chart_orthogonal_wizard(osv.osv_memory):
+    
+    _name = 'account.chart.orthogonal.wizard'
+    
+    _columns = {
+        'fiscalyear' : fields.many2one('account.fiscalyear', 'Fiscal Year', required=False),
+        'target_move' : fields.selection([('all','All Entries'),('posted','All Posted Entries')], 'Target Moves', required=True),
+        'analytic_id' : fields.many2one('account.analytic.account', 'Analytic Account', required=False, 
+                                        help='The moves not related to this analytic account will be filtered out.')
+    }
+    
+    _defaults = {
+        'fiscalyear' : lambda self, cr, uid, c : pooler.get_pool(cr.dbname).get('account.fiscalyear').find(cr, uid),
+        'target_move' : lambda *a: 'all'          
+    }
+    
+    def action_open(self, cr, uid, ids, context={}):
+        for _id in ids:
+            data = self.read(cr, uid, [_id])[0]
+            mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
+            act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+
+            result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
+            id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+            result = act_obj.read(cr, uid, [id], context=context)[0]
+            result['context'] = str({'fiscalyear': data['fiscalyear'],'state':data['target_move'], 'analytic_id':data['analytic_id']})
+        if data['fiscalyear']:
+            result['name']+=':'+pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr,uid,[data['fiscalyear']])[0]['code']
+        return result
+    
+    def action_cancel(self, cr, uid, ids, context={}):
+        pass
+
+account_chart_orthogonal_wizard()
+
+    
+class account_move_line(osv.osv):
+    _name="account.move.line"
+    _inherit="account.move.line"
+    _description = "Entry lines"
+
+    def _query_get(self, cr, uid, obj='l', context={}):
+        query = super(account_move_line, self)._query_get(cr, uid, obj, context)
+        if context.get('analytic_id',False):
+            query += ' AND (id in (select move_id from account_analytic_line where account_id = ' + str(context['analytic_id']) + ') or analytic_account_id = ' + str(context['analytic_id']) + ') '  
+        return query
+
+account_move_line()
+

=== added file 'account_chart_orthogonal/account_view.xml'
--- account_chart_orthogonal/account_view.xml	1970-01-01 00:00:00 +0000
+++ account_chart_orthogonal/account_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+	
+		<!-- The form -->
+		<record id="view_wizard_chart_orthogonal" model="ir.ui.view">
+            <field name="name">Orthogonal Chart of Accounts</field>
+            <field name="model">account.chart.orthogonal.wizard</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Chart of Accounts (orthogonal)">
+        			<field name="fiscalyear" colspan="6"/>
+        			<label align="0.7" colspan="6" string="(If you do not select Fiscal year it will take all open fiscal years)"/>
+        			<field name="target_move" colspan="6"/>
+        			<field name="analytic_id" colspan="6"/>
+        			<separator string="" colspan="4"/>
+                    <label string="" colspan="2"/>
+                    <group col="2" colspan="2">
+                        <button icon="gtk-cancel" special="cancel" type="object" name="action_cancel" string="Cancel"/>
+                        <button icon="gtk-ok" name="action_open" string="Open" type="object"/>
+                    </group>
+        			
+    			</form>
+            </field>
+        </record>
+
+		<!-- The menu item -->
+		<record id="action_wizard_chart_orthogonal" model="ir.actions.act_window">
+            <field name="name">Chart of Accounts (filter by analytic account)</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">account.chart.orthogonal.wizard</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+            <field name="target">new</field>
+        </record>
+        <menuitem icon="STOCK_INDENT" parent="account.menu_finance_charts" action="action_wizard_chart_orthogonal" id="menu_wizard_chart_orthogonal"/>
+        
+		
+		
+	</data>
+</openerp>
\ No newline at end of file

=== added directory 'account_customer_ref'
=== added file 'account_customer_ref/__init__.py'
--- account_customer_ref/__init__.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+import report
+import account
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'account_customer_ref/__terp__.py'
--- account_customer_ref/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    "name" : "Account Customer Ref",
+    "version" : "1.0",
+    "depends" : ["account"],
+    "author" : "Alberto Garcia & Tiny",
+    "description": """ Add Sale Customer Ref to Invoice
+    In each invoice line show the customer ref of Sale Order origin  """,
+    'author': 'Alberto Garcia & Tiny',
+    'website': '',
+    'depends': ['account'],
+    'init_xml': [],
+    'update_xml': [
+        'account_report.xml',
+
+    ],
+    'demo_xml': [ ],
+    'installable': True,
+    'active': False,
+    'certificate': '',
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_customer_ref/account.py'
--- account_customer_ref/account.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/account.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,47 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields
+from osv import osv
+
+class account_invoice(osv.osv):
+        _name = "account.invoice"
+        _inherit = "account.invoice"
+        _columns = {
+                'order_ids': fields.many2many('sale.order', 'sale_order_invoice_rel', 'invoice_id', 'order_id', 'Pedidos', readonly=True),
+        }
+
+account_invoice()
+
+class account_invoice_line(osv.osv):
+        _name = "account.invoice.line"
+        _inherit = "account.invoice.line"
+        _columns = {
+		'order_ids':fields.many2many('sale.order.line','sale_order_line_invoice_rel','invoice_id','order_line_id','Pedidos', readonly=True),
+        }
+
+account_invoice_line()
+
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file

=== added file 'account_customer_ref/account_report.xml'
--- account_customer_ref/account_report.xml	1970-01-01 00:00:00 +0000
+++ account_customer_ref/account_report.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <report
+            auto="False"
+            id="account_customer_ref_invoices"
+            model="account.invoice"
+            name="account.customer.ref.invoice"
+            rml="account_customer_ref/report/invoice.rml"
+            string="Invoices"
+            attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/',''))"
+            attachment_use="1"/>
+    </data>
+</openerp>

=== added directory 'account_customer_ref/i18n'
=== added file 'account_customer_ref/i18n/es_ES.po'
--- account_customer_ref/i18n/es_ES.po	1970-01-01 00:00:00 +0000
+++ account_customer_ref/i18n/es_ES.po	2009-11-23 15:50:45 +0000
@@ -0,0 +1,149 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.0\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-02-06 15:14:47+0000\n"
+"PO-Revision-Date: 2009-02-06 15:14:47+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+
+#. module: account_customer_ref
+#: model:ir.actions.report.xml,name:account_customer_ref.account_customer_ref_invoices
+#: model:ir.ui.menu,name:account.menu_finance_invoice
+#: wizard_field:populate_statement_from_inv,go,lines:0
+msgid "Invoices"
+msgstr "Facturas"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Amount"
+msgstr "Importe"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Disc. (%)"
+msgstr "Desc. (%)"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Quantity"
+msgstr "Cantidad"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Net Total:"
+msgstr "Total neto:"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Unit Price"
+msgstr "Precio unidad"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Tel. :"
+msgstr "Tel. :"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Partner Ref."
+msgstr "Ref. empresa"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Tax"
+msgstr "Impuesto"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Draft Invoice"
+msgstr "Facturas Borrador"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "VAT :"
+msgstr "CIF/NIF:"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Price"
+msgstr "Precio"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Document"
+msgstr "Documento"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Base"
+msgstr "Base"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Taxes"
+msgstr "Impuestos"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Fax :"
+msgstr "Fax :"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Invoice Date"
+msgstr "Fecha factura"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Invoice"
+msgstr "Factura"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Taxes:"
+msgstr "Impuestos:"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Canceled Invoice"
+msgstr "Factura cancelada"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Total:"
+msgstr "Total:"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Supplier Invoice"
+msgstr "Factura de proveedor"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "PRO-FORMA"
+msgstr "PRO-FORMA"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Refund"
+msgstr "Factura de abono"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Description"
+msgstr "Descripción"
+
+#. module: account_customer_ref
+#: rml:account.customer.ref.invoice:0
+msgid "Supplier Refund"
+msgstr "Factura de abono de proveedor"
\ No newline at end of file

=== added directory 'account_customer_ref/report'
=== added file 'account_customer_ref/report/__init__.py'
--- account_customer_ref/report/__init__.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/report/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,28 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+import invoice
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'account_customer_ref/report/invoice.py'
--- account_customer_ref/report/invoice.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/report/invoice.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+
+class account_invoice(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_invoice, self).__init__(cr, uid, name, context)
+        self.localcontext.update({
+            'time': time,
+        })
+    
+report_sxw.report_sxw(
+    'report.account.customer.ref.invoice',
+    'account.invoice',
+    'addons/account_customer_ref/report/invoice.rml',
+    parser=account_invoice
+)

=== added file 'account_customer_ref/report/invoice.rml'
--- account_customer_ref/report/invoice.rml	1970-01-01 00:00:00 +0000
+++ account_customer_ref/report/invoice.rml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,561 @@
+<?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="34.0" y1="28.0" width="530" height="786"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Partner_Address">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Invoice_General_Header">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_General_Detail_Content">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="1,0" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#e6e6e6" start="2,0" stop="2,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#e6e6e6" start="2,0" stop="2,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Header_Invoice_Line">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Invoice_Line_Content">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Format_2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="1,0" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="2,0" stop="2,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="2,0" stop="2,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="3,0" stop="3,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="3,0" stop="3,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="3,0" stop="3,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="10,0" stop="10,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="11,0" stop="11,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="12,0" stop="12,0"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,1" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,1" stop="0,1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="1,1" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,1" stop="1,1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,2" stop="0,2"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,4" stop="0,4"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,4" stop="1,4"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,4" stop="2,4"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_format_Table_Line_total">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="1,0" stop="1,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_eclu_Taxes_Total">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Taxes_Total">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Total_Include_Taxes">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Main_Table">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="0,0" stop="0,-1"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBEFORE" colorName="#ffffff" start="0,2" stop="0,-1"/>
+      <lineStyle kind="LINEAFTER" colorName="#ffffff" start="0,2" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="3,-1" stop="3,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Tax_Header">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Tax_Content">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Table_Border_White">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="0,-1" stop="0,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="1,-1" stop="1,-1"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,-1" stop="2,-1"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Final_Border">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="0,0" stop="0,0"/>
+      <lineStyle kind="LINEABOVE" colorName="#ffffff" start="1,0" stop="1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Coment_Payment_Term">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Payment_Terms">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="Standard" fontName="Times-Roman"/>
+    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="Index" fontName="Times-Roman"/>
+    <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="Footer" fontName="Times-Roman"/>
+    <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+    <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_Bold_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_address" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_White_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+  </stylesheet>
+  <images/>
+  <story>
+    <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
+    <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
+    <blockTable colWidths="297.0,233.0" style="Table_Partner_Address">
+      <tr>
+        <td>
+          <para style="terp_default_8">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.street ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.street2 or '' ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
+          <para style="terp_default_8">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
+          <para style="terp_default_8">
+            <font color="white"> </font>
+          </para>
+          <para style="terp_default_8">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
+          <para style="terp_default_8">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
+          <para style="terp_default_8">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="terp_header">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
+    <para style="terp_header">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma2') or removeParentNode('para')) and '' ]]</para>
+    <para style="terp_header">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
+    <para style="terp_header">Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
+    <para style="terp_header">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
+    <para style="terp_header">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
+    <para style="terp_header">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
+    <para style="terp_default_8">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="177.0,177.0,177.0" style="Table_Invoice_General_Header">
+      <tr>
+        <td>
+          <para style="terp_tblheader_General_Centre">Document</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_General_Centre">Invoice Date</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_General_Centre">Partner Ref.</para>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="177.0,177.0,177.0" style="Table_General_Detail_Content">
+      <tr>
+        <td>
+          <para style="terp_default_Centre_9">[[ o.name ]]</para>
+        </td>
+        <td>
+          <para style="terp_default_Centre_9">[[ formatLang(o.date_invoice,date=True) ]]</para>
+        </td>
+        <td>
+          <para style="terp_default_Centre_9">[[ o.address_invoice_id.partner_id.ref or '' ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="terp_default_8">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="211.0,62.0,63.0,63.0,80.0,69.0" style="Table_Header_Invoice_Line">
+      <tr>
+        <td>
+          <para style="terp_tblheader_Details">Description</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details">Taxes</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details">Quantity</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details_Right">Unit Price</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details_Right">Disc. (%)</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details_Centre">Price</para>
+        </td>
+      </tr>
+    </blockTable>
+    <section>
+      <para style="terp_default_8">[[ repeatIn(o.invoice_line,'l') ]]</para>
+      <blockTable colWidths="211.0,62.0,36.0,27.0,63.0,36.0,62.0,26.0" style="Table_Invoice_Line_Content">
+        <tr>
+          <td>
+            <para style="terp_default_9">[[ l.name ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_9">[[ ', '.join([ lt.description or '' for lt in l.invoice_line_tax_id ]) ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.quantity)]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ (l.uos_id and l.uos_id.name) or '' ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.price_unit) ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.discount) ]] </para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.price_subtotal) ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <para style="terp_default_Note">[[ format(l.note or removeParentNode('td')) ]]</para>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+		  <para style="terp_default_Note">REF: [[ ', '.join([(order.order_id and order.order_id.client_order_ref or removeParentNode('tr')) for order in l.order_ids]) ]]  </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+          <td>
+            <para style="terp_default_Note">
+              <font color="white"> </font>
+            </para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <blockTable colWidths="371.0,153.0" style="Table_Format_2">
+      <tr>
+        <td>
+          <blockTable colWidths="176.0,258.0" style="Table_format_Table_Line_total">
+            <tr>
+              <td>
+                <para style="terp_default_2">
+                  <font color="white"> </font>
+                </para>
+              </td>
+              <td>
+                <para style="terp_default_2">
+                  <font color="white"> </font>
+                </para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+        <td>
+          <blockTable colWidths="62.0,59.0,25.0" style="Table_eclu_Taxes_Total">
+            <tr>
+              <td>
+                <para style="terp_default_Bold_9">Net Total:</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ formatLang(o.amount_untaxed) ]]</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+          <blockTable colWidths="63.0,58.0,26.0" style="Table_Taxes_Total">
+            <tr>
+              <td>
+                <para style="terp_default_Bold_9">Taxes:</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ formatLang(o.amount_tax) ]]</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+          <blockTable colWidths="63.0,58.0,26.0" style="Table_Total_Include_Taxes">
+            <tr>
+              <td>
+                <para style="terp_default_Bold_9">Total:</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ formatLang(o.amount_total) ]]</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ o.currency_id.code ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="530.0" style="Table_Main_Table">
+      <tr>
+        <td>
+          <para style="terp_default_8">
+            <font color="white"> </font>
+          </para>
+          <blockTable colWidths="54.0,80.0,67.0" style="Table_Tax_Header">
+            <tr>
+              <td>
+                <para style="terp_tblheader_Details_Centre">Tax</para>
+              </td>
+              <td>
+                <para style="terp_tblheader_Details_Right">Base</para>
+              </td>
+              <td>
+                <para style="terp_tblheader_Details_Right">Amount</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="terp_default_8">[[ repeatIn(o.tax_line,'t') ]]</para>
+          <blockTable colWidths="53.0,80.0,65.0" style="Table_Tax_Content">
+            <tr>
+              <td>
+                <para style="terp_default_Centre_8">[[ t.name ]] </para>
+              </td>
+              <td>
+                <para style="terp_default_Right_8">[[ formatLang(t.base) ]]</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_8">[[  t.tax_code_id.notprintable and removeParentNode('blockTable') or '' ]][[ formatLang(t.amount) ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <blockTable colWidths="53.0,60.0,65.0" style="Table_Table_Border_White">
+            <tr>
+              <td>
+                <para style="terp_default_2">
+                  <font color="white"> </font>
+                </para>
+              </td>
+              <td>
+                <para style="terp_default_2">
+                  <font color="white"> </font>
+                </para>
+              </td>
+              <td>
+                <para style="terp_default_2">
+                  <font color="white"> </font>
+                </para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="180.0,350.0" style="Table_Final_Border">
+      <tr>
+        <td>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+        </td>
+      </tr>
+    </blockTable>
+    <blockTable colWidths="530.0" style="Table_Coment_Payment_Term">
+      <tr>
+        <td>
+          <para style="terp_default_9">[[ format(o.comment or removeParentNode('blockTable')) ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="terp_default_2">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="530.0" style="Table_Payment_Terms">
+      <tr>
+        <td>
+          <para style="terp_default_9">[[ format((o.payment_term and o.payment_term.note) or removeParentNode('blockTable')) ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="terp_default_2">
+      <font color="white"> </font>
+    </para>
+  </story>
+</document>

=== added file 'account_customer_ref/report/rml_parse.py'
--- account_customer_ref/report/rml_parse.py	1970-01-01 00:00:00 +0000
+++ account_customer_ref/report/rml_parse.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,177 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from report import report_sxw
+import xml.dom.minidom
+import os, time
+import osv
+import re
+import tools
+import pooler
+import re
+import sys
+
+
+class rml_parse(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(rml_parse, self).__init__(cr, uid, name, context=None)
+        self.localcontext.update({
+            'comma_me': self.comma_me,
+            'format_date': self._get_and_change_date_format_for_swiss,
+            'strip_name' : self._strip_name,
+            'explode_name' : self._explode_name,
+        })
+
+    def comma_me(self,amount):
+        #print "#" + str(amount) + "#"
+        if not amount:
+            amount = 0.0
+        if  type(amount) is float :
+            amount = str('%.2f'%amount)
+        else :
+            amount = str(amount)
+        if (amount == '0'):
+             return ' '
+        orig = amount
+        new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+        if orig == new:
+            return new
+        else:
+            return self.comma_me(new)
+    def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
+        ellipsis = ellipsis or ''
+        try:
+            return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
+        except Exception, e:
+            return False
+    def _strip_name(self, name, maxlen=50):
+        return self._ellipsis(name, maxlen, '...')
+
+    def _get_and_change_date_format_for_swiss (self,date_to_format):
+        date_formatted=''
+        if date_to_format:
+            date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
+        return date_formatted
+
+    def _explode_name(self,chaine,length):
+        # We will test if the size is less then account
+        full_string = ''
+        if (len(str(chaine)) <= length):
+            return chaine
+        #
+        else:
+            chaine = unicode(chaine,'utf8').encode('iso-8859-1')
+            rup = 0
+            for carac in chaine:
+                rup = rup + 1
+                if rup == length:
+                    full_string = full_string + '\n'
+                    full_string = full_string + carac
+                    rup = 0
+                else:
+                    full_string = full_string + carac
+
+        return full_string
+
+    def makeAscii(self,str):
+        try:
+            Stringer = str.encode("utf-8")
+        except UnicodeDecodeError:
+            try:
+                Stringer = str.encode("utf-16")
+            except UnicodeDecodeError:
+                print "UTF_16 Error"
+                Stringer = str
+            else:
+                return Stringer
+        else:
+            return Stringer
+        return Stringer
+    def explode_this(self,chaine,length):
+        #chaine = self.repair_string(chaine)
+        chaine = rstrip(chaine)
+        ast = list(chaine)
+        i = length
+        while i <= len(ast):
+            ast.insert(i,'\n')
+            i = i + length
+        chaine = str("".join(ast))
+        return chaine
+    def repair_string(self,chaine):
+        ast = list(chaine)
+        UnicodeAst = []
+        _previouslyfound = False
+        i = 0
+        #print str(ast)
+        while i < len(ast):
+            elem = ast[i]
+            try:
+                Stringer = elem.encode("utf-8")
+            except UnicodeDecodeError:
+                to_reencode = elem + ast[i+1]
+                print str(to_reencode)
+                Good_char = to_reencode.decode('utf-8')
+                UnicodeAst.append(Good_char)
+                i += i +2
+            else:
+                UnicodeAst.append(elem)
+                i += i + 1
+
+
+        return "".join(UnicodeAst)
+
+    def ReencodeAscii(self,str):
+        print sys.stdin.encoding
+        try:
+            Stringer = str.decode("ascii")
+        except UnicodeEncodeError:
+            print "REENCODING ERROR"
+            return str.encode("ascii")
+        except UnicodeDecodeError:
+            print "DECODING ERROR"
+            return str.encode("ascii")
+
+        else:
+            print Stringer
+            return Stringer
+
+
+    # def _add_header(self, node):
+    #   rml_head = tools.file_open('specific_param/report/header/corporate_rml_header_ch.rml').read()
+    #   head_dom = xml.dom.minidom.parseString(rml_head)
+    #   #for frame in head_dom.getElementsByTagName('frame'):
+    #   #   frame.parentNode.removeChild(frame)
+    #   node2 = head_dom.documentElement
+    #   for tag in node2.childNodes:
+    #       if tag.nodeType==tag.ELEMENT_NODE:
+    #           found = self._find_node(node, tag.localName)
+    #   #       rml_frames = found.getElementsByTagName('frame')
+    #           if found:
+    #               if tag.hasAttribute('position') and (tag.getAttribute('position')=='inside'):
+    #                   found.appendChild(tag)
+    #               else:
+    #                   found.parentNode.replaceChild(tag, found)
+    #   #       for frame in rml_frames:
+    #   #           tag.appendChild(frame)
+    #   return True
+
+
+

=== added directory 'account_export_ebp'
=== added file 'account_export_ebp/__init__.py'
--- account_export_ebp/__init__.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard
+import res_company
+import account

=== added file 'account_export_ebp/__terp__.py'
--- account_export_ebp/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,50 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    'name' : "Export accounting moves to EBP's accounting software",
+    'version' : '0.5',
+    'author' : u'Numérigraphe SARL',
+    'category': 'Generic Modules/Accounting',
+    'description': '''This module lets you export accounting moves and accounts to flat text files readable by 'EBP Comptabilité', an accounting software package widely spread in France.
+The files are in the text format for EBP's software, version 3 and above.
+
+The export feature is in the form of a wizard related to accounting moves, so that the person exporting the data can select which moves to export.
+
+Three pieces of configuration need to be set:
+- the company for each fiscal year
+- the path to folder for each company in EBP's software
+- the number of each fiscal year in these folders
+If those are properly set, the files should be imported automatically as simulation moves by the EBP software next time the folder is opened.
+
+Please note that the files will be generated in the server's file system hierarchy, which may demand some sort of remote access (CIFS mount points for example) if the machine hosting EBP's software is not the same.  
+''',
+    'depends' : ['base', 'account'],
+    'init_xml' : [
+    ],
+    'update_xml' : [
+        'account_export_ebp_wizard.xml',
+        'res_company_view.xml',
+        'account_view.xml',
+    ],
+    'demo_xml' : [],
+    'active': False,
+    'installable': True
+}

=== added file 'account_export_ebp/account.py'
--- account_export_ebp/account.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/account.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,48 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+class account_fiscalyear(osv.osv):
+    _inherit = "account.fiscalyear"
+    _columns = {
+        # make the company id mandatory
+        'company_id': fields.many2one('res.company', 'Company', required=True,
+            help="The company this fiscal year belongs to."),
+        'ebp_nb': fields.integer('EBP Fiscal Year Number',
+            help="""This value should reflect the number of the fiscal year as used by the EBP accounting software. This should be set to the number of fiscal years recorded in EBP accounting before this one - So for the first year the number is 0, for the second year the number is 1 and so on. This is used for exporting accounting moves to EBP."""),
+    }
+    _defaults = {
+        'ebp_nb': lambda * a: 0
+    }
+account_fiscalyear()
+
+class account_move(osv.osv):
+    _inherit = "account.move"
+    _columns = {
+        'exported_ebp': fields.boolean('Transfered to EBP',
+        readonly=True,
+        select=1,
+        help="""Indicates whether the move has already been exported to EBP or not. It is changed automatically."""),
+    }
+    _defaults = {
+        'exported_ebp': lambda * a:False,
+    }
+account_move()

=== added file 'account_export_ebp/account_export_ebp_wizard.xml'
--- account_export_ebp/account_export_ebp_wizard.xml	1970-01-01 00:00:00 +0000
+++ account_export_ebp/account_export_ebp_wizard.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<wizard
+			id="account_export_ebp"
+			name="account.export.ebp"
+			string="Export to EBP"
+			model="account.move"/>
+	</data>
+</openerp>

=== added file 'account_export_ebp/account_view.xml'
--- account_export_ebp/account_view.xml	1970-01-01 00:00:00 +0000
+++ account_export_ebp/account_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<!-- Add the EBP nb on fiscal years -->
+		<record id="view_account_fiscalyear_form" model="ir.ui.view">
+			<field name="name">account_export_ebp.fiscalyear.form</field>
+			<field name="model">account.fiscalyear</field>
+			<field name="type">form</field>
+			<field name="inherit_id" ref="account.view_account_fiscalyear_form" />
+			<field name="arch" type="xml">
+				<field name="end_journal_period_id" position="after">
+                    <field name="company_id" select="2"/>
+					<field name="ebp_nb" />
+				</field>
+			</field>
+		</record>
+
+		<!-- Add the EBP checkbox on moves -->
+		<record id="view_move_tree" model="ir.ui.view">
+			<field name="name">account_export_ebp.move.tree</field>
+			<field name="model">account.move</field>
+			<field name="type">tree</field>
+			<field name="inherit_id" ref="account.view_move_tree" />
+			<field name="arch" type="xml">
+				<field name="to_check" position="before">
+					<field name="exported_ebp" />
+				</field>
+			</field>
+		</record>
+		<record id="view_move_form" model="ir.ui.view">
+			<field name="name">account_export_ebp.move.form</field>
+			<field name="model">account.move</field>
+			<field name="type">form</field>
+			<field name="inherit_id" ref="account.view_move_form" />
+			<field name="arch" type="xml">
+				<field name="to_check" position="before">
+					<field name="exported_ebp" />
+				</field>
+			</field>
+		</record>
+	</data>
+</openerp>

=== added directory 'account_export_ebp/i18n'
=== added file 'account_export_ebp/i18n/fr_FR.po'
--- account_export_ebp/i18n/fr_FR.po	1970-01-01 00:00:00 +0000
+++ account_export_ebp/i18n/fr_FR.po	2009-11-23 15:50:45 +0000
@@ -0,0 +1,261 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_export_ebp
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-07-30 14:03:38+0000\n"
+"PO-Revision-Date: 2009-07-30 14:03:38+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,end_form,exported_lines:0
+msgid "Number of lines exported"
+msgstr "Nombre de lignes exportées"
+
+#. module: account_export_ebp
+#: field:account.move,exported_ebp:0
+msgid "Transfered to EBP"
+msgstr "Transféré vers EBP"
+
+#. module: account_export_ebp
+#: help:account.move,exported_ebp:0
+msgid "Indicates whether the move has already been exported to EBP or not. It is changed automatically."
+msgstr "Indique si l'écriture a été transférée dans EBP ou pas. Information mise à jour automatiquement."
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "''This wizard should only be used on accounting moves''"
+msgstr "\"Cet assistant ne doit être utilisé que sur les écritures comptables\""
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,end_form,exported_moves:0
+msgid "Number of moves exported"
+msgstr "Nombre d'écritures exportées"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,end_form,ignored_moves:0
+msgid "Number of moves ignored"
+msgstr "Nombre d'écritures ignorées"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Wrong Object"
+msgstr "Objet incorrect"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Move name \"%s\" is too long to be exported to EBP."
+msgstr "Le nom d'écriture \"%s\" est trop long pour être exporté vers EBP."
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Account code \"%s\" is too long to be exported to EBP."
+msgstr "Le code de compte \"%s\" est trop long pour être exporté vers EBP"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Path does not exist"
+msgstr "Le chemin n'existe pas"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,end_form,exported_accounts:0
+msgid "Number of accounts exported"
+msgstr "Nombre de comptes exportés"
+
+#. module: account_export_ebp
+#: model:ir.actions.wizard,name:account_export_ebp.account_export_ebp
+msgid "Export to EBP"
+msgstr "Transférer vers EBP"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,init,ignore_exported:0
+msgid "Ignore moves already exported"
+msgstr "Ignorer les écritures déjà transférées"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "''The path \"%s\" does not exist in the server's file system hierarchy.''"
+msgstr "''Le chemin \"%s\" n'existe pas dans la hiérarchie du système de fichier du serveur.''"
+
+#. module: account_export_ebp
+#: view:res.company:0
+msgid "EBP Accounting Software"
+msgstr "EBP Comptabilité"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Account code too long"
+msgstr "Code de compte trop long"
+
+#. module: account_export_ebp
+#: help:account.fiscalyear,ebp_nb:0
+msgid "This value should reflect the number of the fiscal year as used by the EBP accounting software. This should be set to the number of fiscal years recorded in EBP accounting before this one - So for the first year the number is 0, for the second year the number is 1 and so on. This is used for exporting accounting moves to EBP."
+msgstr "Cette valeur doit refléter le numéro d'exercice utilisé dans EBP Comptabilité. Indiquez le nombre d'exercice enregistrés dans EBP avant celui-ci : ainsi pour le premier exercice indiquez 0 ; pour le second indiquez 1 etc. Cette information est utilisée lors de l'exportation des écritures vers EBP."
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,init,ignore_draft:0
+msgid "Ignore draft moves"
+msgstr "Ignorer les écritures en brouillon"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Journal code too long"
+msgstr "Code de journal trop long"
+
+#. module: account_export_ebp
+#: view:res.company:0
+msgid "Configuration"
+msgstr "Configuration"
+
+#. module: account_export_ebp
+#: help:account.export.ebp,init,fiscalyear_id:0
+msgid "Only the moves in this fiscal will be exported"
+msgstr "Seules les écritures de cet exercice seront exportées"
+
+#. module: account_export_ebp
+#: wizard_view:account.export.ebp,end_form:0
+msgid "export_ebp_end"
+msgstr "export_ebp_end"
+
+#. module: account_export_ebp
+#: help:account.export.ebp,init,ignore_exported:0
+msgid "Check this box unless you want to re-export moves to EBP"
+msgstr "Cochez cette case sauf si vous désirez re-transférer des écritures vers EBP"
+
+#. module: account_export_ebp
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr "XML non valide pour l'architecture de la vue !"
+
+#. module: account_export_ebp
+#: field:account.fiscalyear,ebp_nb:0
+msgid "EBP Fiscal Year Number"
+msgstr "Numéro d'exercice EBP"
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Journal code \"%s\" is too long to be exported to EBP."
+msgstr "Le code du journal \"%s\" est trop long pour être exporté vers EBP."
+
+#. module: account_export_ebp
+#: wizard_view:account.export.ebp,init:0
+msgid "export_ebp"
+msgstr "export_ebp"
+
+#. module: account_export_ebp
+#: help:res.company,ebp_folder:0
+msgid "This is the path to the company's folder in the EBP accounting software, as seen from the server's file system.\n"
+"On a typical setup, the accountant would host EBP's software on his computer and share the EBP folders (usually in C:\Documents and Settings\All Users\Documents\EBP\Partage\Dossiers\<YOUR_COMPANY>).\n"
+"This share would then be mounted (by means of SMB, or NFS for example) into the server's file system hierarchy.\n"
+"This is used for exporting accounting moves to EBP."
+msgstr "Le chemin du dossier de la Société dans EBP Comptabilité, tel qu'il est vu dans le système de fichiers du server.\n"
+"Habituellement le comptable héberge les logiciels EBP sur son ordinateur, et partage les dossiers EBP (généralement C:\Documents and Settings\All Users\Documents\EBP\Partage\Dossiers\<VOTRE_SOCIETE>).\n"
+"Ce partage réseau est alors monté (au moyen de SMB ou NFS par exemple) dans la hierarchie du système de fichiers du serveur.\n"
+"Ce paramètre sert lors de l'exportation des écritures comptables vers EBP."
+
+#. module: account_export_ebp
+#: model:ir.module.module,shortdesc:account_export_ebp.module_meta_information
+msgid "Export accounting moves to EBP's accounting software"
+msgstr "Exporter les écritures comptables vers EBP Comptabilité."
+
+#. module: account_export_ebp
+#: help:account.export.ebp,init,partner_accounts:0
+msgid "When this is checked, the partner's special code will be appended to the receivable and payable accounts' numbers in the exported files on every move line where a partner has been specified. By default it has no effect, but can by customized by OpenERP developers."
+msgstr "Si cette case est cochée, les codes spécifiques des partenaires seront accolés aux numéros des comptes payables et recevables dans les fichiers exportés pour chaque ligne d'écriture où un partenaire est précisé. Par défaut cela n'aura aucun effet, les développeurs OpenERP peuvent le personnaliser."
+
+#. module: account_export_ebp
+#: wizard_view:account.export.ebp,end_form:0
+msgid "Moves exported to EBP"
+msgstr "écritures exportées vers EBP"
+
+#. module: account_export_ebp
+#: wizard_view:account.export.ebp,end_form:0
+msgid "You may need to close and reopen the folder for EBP to detect the new data files."
+msgstr "Il vous faudra peut-être fermer et rouvrir le dossier pour qu'EBP détecte les nouveaux fichiers de données."
+
+#. module: account_export_ebp
+#: wizard_button:account.export.ebp,end_form,end:0
+msgid "OK"
+msgstr "Ok"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,init,partner_accounts:0
+msgid "Append partners' codes to accounts"
+msgstr "Accoler le code des partenaire aux comptes"
+
+#. module: account_export_ebp
+#: wizard_field:account.export.ebp,init,fiscalyear_id:0
+msgid "Fiscal year"
+msgstr "Exercice"
+
+#. module: account_export_ebp
+#: field:res.company,ebp_folder:0
+msgid "EBP folder"
+msgstr "Dossier EBP"
+
+#. module: account_export_ebp
+#: wizard_button:account.export.ebp,init,export:0
+msgid "Export"
+msgstr "Continuer"
+
+#. module: account_export_ebp
+#: wizard_button:account.export.ebp,init,end:0
+msgid "Cancel"
+msgstr "Annuler"
+
+#. module: account_export_ebp
+#: help:account.export.ebp,init,ignore_draft:0
+msgid "Please be aware that draft moves do not not have a move number attached to them. As a consequence, they might not be imported correctly into EBP accounting software"
+msgstr "Veuillez noter que les écritures en brouillon ne sont pas numérotées. Par conséquent elles peuvent ne pas être importées correctement dans EBP Comptabilité."
+
+#. module: account_export_ebp
+#: model:ir.module.module,description:account_export_ebp.module_meta_information
+msgid "This module lets you export accounting moves and accounts to flat text files readable by \"EBP Comptabilité\", an accounting software package widely spread in France.\n"
+"The files are in the text format for EBP's software, version 3 and above.\n"
+"\n"
+"The export feature is in the form of a wizard related to accounting moves, so that the person exporting the data can select which moves to export.\n"
+"\n"
+"Three pieces of configuration need to be set:\n"
+"- the company for each fiscal year\n"
+"- the path to folder for each company in EBP's software\n"
+"- the number of each fiscal year in these folders\n"
+"If those are properly set, the files should be imported automatically as simulation moves by the EBP software next time the folder is opened.\n"
+"\n"
+"Please note that the files will be generated in the server's file system hierarchy, which may demand some sort of remote access (CIFS mount points for example) if the machine hosting EBP's software is not the same.  \n"
+""
+msgstr "Ce module permet d'exporter les écritures comptables vers des fichiers plats lisibles par EBP Comptabilité, un logiciel de Comptabilité très répandu en France.\n"
+"Les fichiers sont au format text pour EBP Comptabilité, version 3 et suivantes.\n"
+"\n"
+"L'exportation se présente sous la forme d'un assistant associé aux écritures comptables, afin que la personne qui exporte les données puisse choisir quelles écritures exporter.\n"
+"\n"
+"Trois paramètres doivent être définis :\n"
+"- la société pour chaque exercice enregistré\n"
+"- le chemin du dossier de chaque Société dans EBP\n"
+"- le numéro d'exercice dans ces dossiers\n"
+"S'ils sont correctement définis, les fichiers devraient être importés automatiquement comme écritures de simulation dans EBP à la prochaine ouverture du dossier.\n"
+"\n"
+"Veuillez noter que les fichiers seront générés dans l'arborescence du système de fichier du serveur, ce qui peut exiger un accès à distance (par exemple un montage CIFS) si ce n'est pas cette machine qui héberge le logiciel EBP."
+
+#. module: account_export_ebp
+#: code:addons/account_export_ebp/wizard/wizard_ebp.py:0
+#, python-format
+msgid "Move name too long"
+msgstr "Nom d'écriture trop long"
+

=== added file 'account_export_ebp/res_company.py'
--- account_export_ebp/res_company.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/res_company.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+class res_company(osv.osv):
+    '''Add parameters to export accounting moves to EBP's software''' 
+    _inherit = "res.company"
+    _columns = {
+        'ebp_folder': fields.char('EBP folder', size = 256,
+            help = """This is the path to the company's folder in the EBP accounting software, as seen from the server's file system.
+On a typical setup, the accountant would host EBP's software on his computer and share the EBP folders (usually in C:\Documents and Settings\All Users\Documents\EBP\Partage\Dossiers\<YOUR_COMPANY>).
+This share would then be mounted (by means of SMB, or NFS for example) into the server's file system hierarchy.  
+This is used for exporting accounting moves to EBP."""),
+    }
+res_company()

=== added file 'account_export_ebp/res_company_view.xml'
--- account_export_ebp/res_company_view.xml	1970-01-01 00:00:00 +0000
+++ account_export_ebp/res_company_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" ?>
+<openerp>
+	<data>
+		<record id="res_company_ebp" model="ir.ui.view">
+			<field name="name">res.company.ebp</field>
+			<field name="model">res.company</field>
+			<field name="type">form</field>
+			<field name="inherit_id" ref="base.view_company_form" />
+			<field name="arch" type="xml">
+				<page string="Configuration" position="inside">
+					<separator string="EBP Accounting Software" colspan="4" />
+					<field name="ebp_folder" />
+					<newline />
+				</page>
+			</field>
+		</record>
+	</data>
+</openerp>

=== added file 'account_export_ebp/res_partner.py'
--- account_export_ebp/res_partner.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/res_partner.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved
+#
+##############################################################################
+import string
+import re
+
+from osv import osv, fields
+
+class partner(osv.osv):
+    _inherit = 'res.partner'
+
+    
+    def _get_ref_nb(self, cr, uid, ids, field_name, arg, context):
+        """ This function just returns an empty string as the EBP account number.
+        It may be overridden in another module to make it more useful.""" 
+        return map (lambda x: (x,''),  ids)
+
+    _columns = {
+        # Account number suffix
+        'ref_nb': fields.function(_get_ref_nb, type="char", string='EBP Account Suffix', method=True, size=64,
+              help="This field makes the second part of the Partner's Account in EBP"),
+    }
+
+partner()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added directory 'account_export_ebp/wizard'
=== added file 'account_export_ebp/wizard/__init__.py'
--- account_export_ebp/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/wizard/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import wizard_ebp

=== added file 'account_export_ebp/wizard/wizard_ebp.py'
--- account_export_ebp/wizard/wizard_ebp.py	1970-01-01 00:00:00 +0000
+++ account_export_ebp/wizard/wizard_ebp.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,322 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import os
+import codecs
+
+import wizard
+import pooler
+import tools
+import netsvc
+
+# XXX We should write to a temporary file instead for security and reliability reasons
+# XXX We should raise a clean exception if something goes wrong
+# TODO Add an option to download the files instead of storing them on the server side
+
+# Form for the 1st step
+export_form = '''
+<form string="export_ebp">
+    <field name="fiscalyear_id" colspan="4" />
+    <group colspan="4">
+        <field name="ignore_draft" colspan="4" />
+        <field name="ignore_exported" colspan="4" />
+        <field name="partner_accounts" colspan="4" />
+    </group>
+</form>
+'''
+# Fields for the 1st step
+export_fields = {
+    'fiscalyear_id': {
+        'string': 'Fiscal year',
+        'help': 'Only the moves in this fiscal will be exported',
+        'type': 'many2one',
+        'relation': 'account.fiscalyear',
+        'required': True,
+    },
+    'partner_accounts': {
+        'string': "Append partners' code to accounts",
+        'help': "When this is checked, the partner's special code will be appended to the receivable and payable accounts' numbers in the exported files on every move line where a partner has been specified. By default it has no effect, but can by customized by OpenERP developers.",
+        'default': lambda * a: True,
+        'type': 'boolean',
+        'required': True,
+    },
+    'ignore_draft': {
+        'string': 'Ignore draft moves',
+        'help': 'Please be aware that draft moves do not not have a move number attached to them. As a consequence, they might not be imported correctly into EBP accounting software',
+        'default': lambda * a: True,
+        'type': 'boolean',
+        'required': True,
+    },
+    'ignore_exported': {
+        'string': 'Ignore moves already exported',
+        'help': 'Check this box unless you want to re-export moves to EBP',
+        'default': lambda * a: True,
+        'type': 'boolean',
+        'required': True,
+    },
+}
+
+# Form for the end step
+result_form = '''
+<form string="export_ebp_end">
+    <separator string="Moves exported to EBP" colspan="4"/>
+    <field name="exported_moves" colspan="4"/>
+    <field name="exported_lines" colspan="4"/>
+    <separator colspan="4"/>
+    <field name="ignored_moves" colspan="4"/>
+    <separator colspan="4"/>
+    <field name="exported_accounts" colspan="4"/>
+    <separator colspan="4"/>
+    <label string="You may need to close and reopen the folder for EBP to detect the new data files." colspan="4"/>
+</form>
+'''
+# Fields for the end step
+result_fields = {
+    'exported_moves': {
+        'string': "Number of moves exported",
+        'type': 'integer',
+        'readonly': True
+    },
+    'ignored_moves': {
+        'string': "Number of moves ignored",
+        'type': 'integer',
+        'readonly': True,
+    },
+    'exported_lines': {
+        'string': "Number of lines exported",
+        'type': 'integer',
+        'readonly': True
+    },
+    'exported_accounts': {
+        'string': "Number of accounts exported",
+        'type': 'integer',
+        'readonly': True
+    },
+}
+
+def _export(self, cr, uid, data, context):
+    """
+    Export accounting moves to flat text files usable by accounting software by EBP version 3 and above.
+    
+    2 files will be produced : 
+      - a file of accounting moves (ECRITURES.TXT)
+      - a file of accounts  (COMPTES.TXT)
+    If stored in the right folder, these files will automatically be imported next time you open the folder in EBP.
+    
+    Lines with an amount of 0 are not ignored even though EBP complains about them. This is to raise the attention
+    of the person importing them into EBP.
+    Also, journals with a code which does not meet EBP's requirements are not ignored.
+    
+    Returns a dictionary containing the number of moves and lines exported and the number of moves ignored
+    """
+
+    logger = netsvc.Logger()
+    pool = pooler.get_pool(cr.dbname)
+    logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Form data: %s" % data['form'])
+
+    # Read the EBP year number name from the selected fiscal year
+    fiscalyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fiscalyear_id'], context)
+
+    # Construct the path where files will be stored 
+    path = os.sep.join([fiscalyear.company_id.ebp_folder or '', 'Compta.%s' % fiscalyear.ebp_nb])
+
+    # Sanity checks
+    if data['model'] != 'account.move':
+        raise wizard.except_wizard(_('Wrong Object'), _('''This wizard should only be used on accounting moves'''))
+    if not os.path.exists(path):
+        raise wizard.except_wizard(_('Path does not exist'), _('''The path "%s" does not exist in the server's file system hierarchy.''') % path)
+
+    accounts_data = {} # dictionary to store accounts while we loop through move lines
+
+    l = 0 # Line counter
+    moves = pool.get('account.move').browse(cr, uid, data['ids'], context)
+    # The move summaries will be written to a CSV file encoded in windows latin-1
+    moves_file = codecs.open(os.sep.join([path, 'ECRITURES.TXT']), 'w', 'cp1252')
+    exported_move_ids = []
+    ignored_move_ids = []
+    for move in moves:
+        # Ignore draft moves unless the user asked for them
+        ignore_draft = (data['form']['ignore_draft'] and move.state == 'draft')
+        # Ignore moves in other fiscal years
+        ignore_year = (move.period_id.fiscalyear_id.id != data['form']['fiscalyear_id'])
+        # Ignore moves already exported
+        ignore_exported = (data['form']['ignore_exported'] and move.exported_ebp)
+        # Skip to next move if this one should be ignored
+        if ignore_draft or ignore_year or ignore_exported:
+            logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Ignoring move %d - draft: %s, wrong year: %s, exported: %s" % (move.id, ignore_draft, ignore_year, ignore_exported))
+            ignored_move_ids.append(move.id)
+            continue
+
+        logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Exporting move %d" % move.id)
+        moves_data = {} # dictionary to summarize the lines of the move by account
+        for line in move.line_id:
+            logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Examining move line %d" % line.id)
+            
+            if line.credit == line.debit:
+                logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Move line %d has a sum equal to zero and will not be exported." % line.id)
+                continue
+            
+            # Make up the account number
+            account_nb = line.account_id.code
+            if data['form']['partner_accounts'] and line.partner_id and line.partner_id.ref_nb and (line.account_id.type in ('payable', 'receivable')):
+                # Partner account
+                account_nb = account_nb + line.partner_id.ref_nb
+
+            # Check the most important fields are not above the maximum length so as not to export wrong data with catastrophic consequence
+            if len(move.journal_id.code) > 4:
+                raise wizard.except_wizard(_('Journal code too long'), _('Journal code "%s" is too long to be exported to EBP.') % move.journal_id.code)
+            if len(account_nb) > 10: # The docs from EBP state that account codes may be up to 15 characters but "EBP Comptabilité" v13 will refuse anything longer than 10 characters
+                raise wizard.except_wizard(_('Account code too long'), _('Account code "%s" is too long to be exported to EBP.') % account_nb)
+            if len(move.name) > 15:
+                raise wizard.except_wizard(_('Move name too long'), _('Move name "%s" is too long to be exported to EBP.') % move.name)
+
+            # Collect data for the file of move lines
+            if account_nb not in moves_data.keys():
+                moves_data[account_nb] = {
+                    'date' : move.date,
+                    'journal' : move.journal_id.code,
+                    'ref' : move.ref or move.name,
+                    'name' : move.name,
+                    'credit' : line.credit - line.debit,
+                    'date_maturity' : line.date_maturity,
+                }
+            else:
+                moves_data[account_nb]['credit'] += line.credit - line.debit;
+                # Keep the earliest maturity date
+                if line.date_maturity < moves_data[account_nb]['date_maturity']:
+                    moves_data[account_nb]['date_maturity'] = line.date_maturity
+
+            # Collect data for the file of accounts
+            # We can't just keep the account_id object because the data we want to export may be partner specific 
+            if account_nb not in accounts_data.keys():
+                if data['form']['partner_accounts'] and line.partner_id and line.partner_id.ref_nb and line.account_id.type in ('payable', 'receivable'):
+                    # Partner account
+                    # Get the default address
+                    address_id = pool.get('res.partner').address_get(cr, uid, [line.partner_id.id])['default']
+                    address = pool.get('res.partner.address').browse(cr, uid, [address_id], context)[0]
+                    accounts_data[account_nb] = {
+                        'name': line.partner_id.name,
+                        'partner_name': line.partner_id.name,
+                        'address': address.street or address.street2,
+                        'zip': address.zip,
+                        'city': address.city,
+                        'country': address.country_id.name,
+                        'contact': address.name,
+                        'phone': address.phone or address.mobile,
+                        'fax': address.fax,
+                    }
+                else:
+                    # Normal account
+                    accounts_data[account_nb] = {
+                        'name': line.account_id.name,
+                        'partner_name': '',
+                        'address': '',
+                        'zip': '',
+                        'city': '',
+                        'country': '',
+                        'contact': '',
+                        'phone': '',
+                        'fax': '',
+                    }
+
+        # Write the move summary to the file
+        logger.notifyChannel("ebp", netsvc.LOG_DEBUG, "Writing the move summary to the file")
+        for account_nb, line in moves_data.iteritems():
+            l += 1
+            moves_file.write(','.join([
+                    '%d' % l, # Line number
+                    '%s%s%s' % (line['date'][8:10], line['date'][5:7], line['date'][2:4]), # Date (ddmmyy)
+                    line['journal'].replace(',', '')[:4], # Journal
+                    account_nb.replace(',', ''), # Account number (possibly with the partner code appended to it)
+                    '', # Automatic title (N/A)
+                    '"%s"' % line['ref'][:40], # Manual title
+                    '"%s"' % line['name'][:15], # Accountable receipt number
+                    '%f' % abs(line['credit']), # Amount
+                    (line['credit'] > 0) and 'C' or 'D', # [C]redit or [D]ebit
+                    line['date_maturity'] and '%s%s%s' % (line['date_maturity'][8:10], line['date_maturity'][5:7], line['date_maturity'][2:4]) or '', # Date of maturity (ddmmyy)
+                    fiscalyear.company_id.currency_id.code.replace(',', ''), # Currency
+            ]))
+            moves_file.write('\r\n')
+        exported_move_ids.append(move.id)
+
+    # Mark the moves as exported to EBP
+    if len(exported_move_ids):
+        pool.get('account.move').write(cr, uid, exported_move_ids, {'exported_ebp': True, })
+
+    # Close the move summaries file
+    moves_file.close()
+    logger.notifyChannel("ebp", netsvc.LOG_INFO, "%d line(s) representing %d move(s) exported to ECRITURES.TXT in %s - %d move(s) ignored" % (l, len(exported_move_ids), path, len(ignored_move_ids)))
+
+    # Write the accounts to a CSV file encoded in windows latin-1
+    accounts_file = codecs.open(os.sep.join([path, 'COMPTES.TXT']), 'w', 'cp1252')
+    for account_nb, account in accounts_data.iteritems():
+        accounts_file.write(','.join([
+            account_nb.replace(',', ''), # Account number
+            (account['name'] or '').replace(',', '')[:60], # Account name
+            (account['partner_name'] or '').replace(',', '')[:30], # Partner name
+            (account['address'] or '').replace(',', '')[:100], # Partner address
+            (account['zip'] or '').replace(',', '')[:5], # Zip code
+            (account['city'] or '').replace(',', '')[:30], # City
+            (account['country'] or '').replace(',', '')[:35], # Country
+            (account['contact'] or '').replace(',', '')[:35], # Contact
+            (account['phone'] or '').replace(',', '')[:20], # Phone
+            (account['fax'] or '').replace(',', '')[:20], # Fax
+        ]))
+        accounts_file.write('\r\n')
+    accounts_file.close()
+    logger.notifyChannel("ebp", netsvc.LOG_INFO, "%d accounts(s) exported to COMPTES.TXT in %s" % (len(accounts_data), path))
+
+    return {
+        'exported_moves': len(exported_move_ids),
+        'ignored_moves': len(ignored_move_ids),
+        'exported_lines': l,
+        'exported_accounts': len(accounts_data),
+    }
+
+class wizard_ebp(wizard.interface):
+    states = {
+        'init': {
+            'actions':[],
+            'result': {
+                'type': 'form',
+                'arch': export_form,
+                'fields': export_fields,
+                'state':[('end', 'Cancel', 'gtk-cancel'), ('export', 'Export', 'gtk-go-forward')]
+            }
+        },
+        'export': {
+            'actions':[_export],
+            'result': {
+                'type': 'state',
+                'state':'end_form',
+            }
+        },
+        'end_form': {
+            'actions':[],
+            'result': {
+                'type': 'form',
+                'arch': result_form,
+                'fields': result_fields,
+                'state': [('end', 'OK')],
+            }
+        },
+    }
+wizard_ebp('account.export.ebp')

=== added directory 'account_receipt'
=== added file 'account_receipt/__init__.py'
--- account_receipt/__init__.py	1970-01-01 00:00:00 +0000
+++ account_receipt/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,29 @@
+##############################################################################
+#
+# Copyright (c) 2008 Paulino All Rights Reserved. <paulino1@xxxxxxx>
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import receipt
+import report
\ No newline at end of file

=== added file 'account_receipt/__terp__.py'
--- account_receipt/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_receipt/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,18 @@
+{
+	"name" : "Receipts Management",
+	"version" : "1.0",
+	"author" : "Paulino",
+    "description": """
+            Manages receipts for customers
+            
+            New receipts are created from a wizard, the views on account.receipt object are readonly
+            There should be a journal of type 'cash' with an invoice sequence set to generate receipts numbers
+            """,
+	"category" : "Generic Modules/Receipts",
+	"depends" : ["account"],
+	"init_xml" : [],
+	"demo_xml" : [],
+	"update_xml" : ['receipt_view.xml',  'receipt_report.xml'],
+	"active": False,
+	"installable": True
+}

=== added file 'account_receipt/invoice.py'
--- account_receipt/invoice.py	1970-01-01 00:00:00 +0000
+++ account_receipt/invoice.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,93 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+import time
+import netsvc
+from osv import fields, osv
+import ir
+import pooler
+import mx.DateTime
+from mx.DateTime import RelativeDateTime
+from tools import config
+from tools.translate import _
+
+
+class account_invoice(osv.osv):
+    """Tentativa de ultrapassar o bug no valor residual das facturas quando sujeitas a reconciliação parcial
+    
+    Reescrever os metodos 
+        _amount_residual
+        _get_lines 
+        _compute_lines - usado para mostras pagamentos no formulario facturas   lin 144
+            move_line_id_payment_get - da os id's das linhas de movimento relativas as contas dos parceiros - lin 397
+        """
+    _inherit = "account.invoice"
+    
+    '''
+    def _amount_residual(self, cr, uid, ids, name, args, context=None):
+        res = {}
+        data_inv = self.browse(cr, uid, ids)
+        for inv in data_inv:
+            paid_amt = 0.0
+            to_pay = inv.amount_total
+            for lines in inv.move_lines:
+                paid_amt = paid_amt - lines.credit + lines.debit
+            res[inv.id] = to_pay - abs(paid_amt)
+        return res  '''
+
+    def _get_lines(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for id in ids:
+            #move_lines = []
+            ml = self.pool.get('account.move.line')
+            for inv in self.read(cr, uid, ids, ['move_id']):
+                if inv['move_id']:
+                    move_lines = ml.search(cr, uid, [('move_id', '=', inv['move_id'][0])])
+            
+            if not move_lines:
+                res[id] = []
+                continue
+            data_lines = self.pool.get('account.move.line').browse(cr,uid,move_lines)
+            for line in data_lines:
+                ids_line = []
+                if line.reconcile_id:
+                    ids_line = line.reconcile_id.line_id
+                elif line.reconcile_partial_id:
+                    ids_line = line.reconcile_partial_id.line_partial_ids
+                l = map(lambda x: x.id, ids_line)
+                res[id]=[x for x in l if x <> line.id]
+        print '+++++++++++ sub classe  +++++++++++++\n'
+        return res
+
+    '''
+    def move_line_id_payment_get(self, cr, uid, ids, *args):
+        ml = self.pool.get('account.move.line')
+        res = []
+        for inv in self.read(cr, uid, ids, ['move_id','account_id']):
+            if inv['move_id']:
+                move_line_ids = ml.search(cr, uid, [('move_id', '=', inv['move_id'][0])])
+                for line in ml.read(cr, uid, move_line_ids, ['account_id']):
+                    if line['account_id']==inv['account_id']:
+                        res.append(line['id'])
+        return res'''
+        
+account_invoice()
\ No newline at end of file

=== added file 'account_receipt/receipt.py'
--- account_receipt/receipt.py	1970-01-01 00:00:00 +0000
+++ account_receipt/receipt.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,233 @@
+#! -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2008 Paulino . <paulino1@xxxxxxx> All Rights Reserved.
+#
+##############################################################################
+
+
+from mx import DateTime
+import time
+from osv import fields,osv
+import pooler, wizard, tools
+import pdb
+
+
+class account_receipt(osv.osv):
+    _name = "account.receipt"
+    _description = "Invoice's receipts (wizard)"
+    _columns = {
+        'name': fields.char('Name', size=15, required=True),
+        'partner_id' : fields.many2one('res.partner', 'Partner', required=True),  # set null ???
+        'address_id': fields.many2one('res.partner.address', 'Address', readonly=True, # required=True, 
+                                states={'draft':[('readonly',False)]}),
+        'date'  : fields.date('Date', required=True),
+        'value' : fields.float('Valor', required=True, digits=(16, 3)),
+        'lines': fields.one2many('account.receipt.line', 'receipt_id', 'Facturas'),
+        'move_id': fields.many2one('account.move', 'Receipt Move', readonly=True), 
+        'notes'  : fields.text('Notes'),
+        'state'   : fields.selection([
+                        ('draft', 'Draft'),
+                        ('cancel','Cancelled'),
+                        ('done','Done')], 'State', select=True)
+    }
+    _defaults = {
+        'date' : lambda *a : DateTime.today().strftime('%Y-%m-%d'),
+        'state': lambda *a : 'draft'
+        }
+    
+account_receipt()
+
+
+class account_receipt_line(osv.osv):
+    _name = "account.receipt.line"
+    _description = "Subscription document fields"
+    _rec_name = 'field'
+    _columns = {
+        'receipt_id': fields.many2one('account.receipt', 'Receipt', required=True),
+        'invoice_id': fields.many2one('account.invoice', 'Invoice', required=True), 
+        'name'      : fields.char('Name', size=15 ),
+        'amount': fields.float('Amount', digits=(16,2)),
+        #'paid_amount': fields.float('Paid Amount', digits=(16,2)),
+    }
+    _defaults = {}
+    
+account_receipt_line()
+
+
+
+class wizard_receipt(osv.osv_memory):
+    _name = "wizard.receipt"
+
+    
+    def _partner(self, cr, uid, context={}):
+        partner_obj=self.pool.get('res.partner')
+        ids=partner_obj.search(cr, uid, [])    # test line
+        partners=partner_obj.browse(cr, uid, ids)
+        return [(partner.id, partner.name) for partner in partners]
+
+
+    def act_cancel(self, cr, uid, ids, context=None):
+        return {'type':'ir.actions.act_window_close' }
+
+    def act_destroy(self, *args):
+        return {'type':'ir.actions.act_window_close' }
+
+    def get_invoices(self, cr, uid, ids, context=None):   #get_invoices
+        """Get the open invoices for actual partner to select wich ones to pay        """
+        rec_id = ids[0]
+        this = self.browse(cr, uid, rec_id)
+        inv_obj = self.pool.get("account.invoice")
+        print this.partner_id.id
+        inv_ids = inv_obj.search(cr, uid, [ ('partner_id', '=', this.partner_id.id), 
+                                        ('type', 'in',["out_invoice","out_refund"]),
+                                        ('state', '=', 'open') ] )
+        wiz_lines = self.pool.get('wizard.receipt.lines')
+        vals = None
+        for invoice in inv_obj.browse(cr, uid, inv_ids) :
+            vals = {  'rec' : rec_id,
+                      'invoice_id': invoice.id,
+                      'inv_move'  : invoice.move_id.id,
+                      'inv_date'  : invoice.date_invoice,
+                      'inv_number': invoice.number,
+                      'due_date'  : invoice.date_due,
+                      'inv_total' : invoice.amount_total,
+                      'inv_residual' : invoice.residual,
+                      'to_pay'    : 0,
+                      'paid_amount' : 0.0,
+                      }
+            wiz_lines.create(cr, uid, vals,  context=context)
+        if vals :
+            return self.write(cr, uid, ids, {'state':'get'}, context=context)
+        raise osv.except_osv(_('Warning'), _('Selected Partner has no open invoices!'))
+        return
+
+
+    def create_receipt(self, cr, uid, ids, context=None):
+        "Create receipt, receipt lines, create account_move and reconcile this move with invoices in receipt lines"
+        this = self.browse(cr, uid, ids[0] )
+
+        rec_lines = []
+        moves2reconcile = []                # ids of invoice's moves ids to reconcile
+        total = 0
+        for line in this.lines :
+            # TODO: add account_move_line.id to receipt_line
+            rec_lines.append((0,0, {'invoice_id' : line.invoice_id, 'amount': line.paid_amount} ))
+            total += line.paid_amount
+            moves2reconcile.append( line.inv_move )             
+
+        #stores move and move_line
+        # TODO : add field to force period
+        #        then if not period_id:  get o period by date
+        #        period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',inv.date_invoice or time.strftime('%Y-%m-%d')),('date_stop','>=',inv.date_invoice or time.strftime('%Y-%m-%d'))])
+
+        partner_account_id = self.pool.get('res.partner').browse(cr, uid, this.partner_id.id).property_account_receivable.id
+        move_lines = [(0,0, {   'date': this.rec_date, 
+                                'name': 'Recibo de %s'%this.partner_id.name,
+                                'partner_id': this.partner_id.id,
+                                'account_id': this.journal.default_debit_account_id.id,
+                                'ref': 'recibo',
+                                'debit': total,  
+                                'credit': 0} ),
+                      (0,0, { 'date': this.rec_date,
+                              'name': 'Recibo de %s'%this.partner_id.name,
+                              'partner_id': this.partner_id.id,
+                              'account_id': partner_account_id,
+                              'ref': 'recibo',  
+                              'credit' : total, 
+                              'debit': 0} ) ]
+        # get sequence number for receipt
+        receipt_num = self.pool.get('ir.sequence').get_id(cr, uid, this.journal.invoice_sequence_id.id, context=context) or '/'
+        
+        move = {'ref': receipt_num, 
+                'line_id': move_lines, 
+                #'period_id' : 5,
+                'journal_id': this.journal.id, 
+                'date': this.rec_date, 
+                'partner_id': this.partner_id.id}
+        #print move
+        move_obj = self.pool.get('account.move')
+        move_id = move_obj.create(cr, uid, move)
+        
+        moves2reconcile.append(int(move_id))
+        move_line_obj = self.pool.get('account.move.line')
+        moveLines2reconcile = move_line_obj.search(cr, uid, [('account_id', '=', partner_account_id),
+                                                             ('move_id', 'in', moves2reconcile ) ] )
+        # TODO: get all related lines previously partial reconcileed
+        # so they all become totally reconciled and invoice state can be set as done
+        try :
+            reconcile_id = move_line_obj.reconcile( cr, uid, moveLines2reconcile, type='receipt', context=context)
+        except :
+            partial_reconcile_id = move_line_obj.reconcile_partial( cr, uid, moveLines2reconcile, type='receipt', context=context)
+        
+        # save receipt
+        receipt = { 'name': receipt_num, 
+                    'partner_id': this.partner_id.id, 
+                    'date': this.rec_date ,
+                    'value':total, 
+                    'lines':rec_lines, 
+                    'move_id': move_id}
+        receipt_id = self.pool.get('account.receipt').create(cr, uid, receipt)
+        # TODO: print receipt automatically
+        return self.write(cr, uid, ids, {'state':'done'}, context=context)
+
+    _columns = {
+        'partner_id': fields.many2one('res.partner', 'Partner', required=True),
+        'note'      : fields.text('Notes'),
+        'rec_date'  : fields.date('Date'),
+        'total'     : fields.integer('Total'),
+        'journal'   : fields.many2one('account.journal', 'Journal'),
+        'lines'     : fields.one2many('wizard.receipt.lines', 'rec', 'Lines'),
+        'state'     : fields.selection( ( ('choose','choose'),   ('get','get'), ('done', 'done')  ) ),
+        }
+
+    def _default_journal(self, cr, uid, ids, context={} ):
+        try : return self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('active', '=', '1')])[0]
+        except : return ''
+        
+    _defaults = {
+        'state' : lambda *a: 'choose',
+        'rec_date' : lambda *a : DateTime.today().strftime('%Y-%m-%d'),
+        'journal' : _default_journal
+        }
+wizard_receipt()
+
+
+
+class wizard_receipt_lines(osv.osv_memory):
+    _name = "wizard.receipt.lines"
+
+    _columns = {
+        'rec'    : fields.many2one('wizard.receipt', 'Receipt'),
+        'invoice_id' : fields.integer('Invoice'),
+        'inv_move' : fields.integer('Move'),                    # move line to reconcile
+        'inv_date' : fields.date('Date'),
+        'due_date' : fields.date('Due date'),
+        'inv_number' : fields.char( 'Number', size=16),
+        'inv_total': fields.float('Invoice amount',  digits=(16, 2)),
+        'inv_residual' : fields.float('Residual amount',  digits=(16, 2)),
+        'to_pay'   : fields.boolean('To Pay?'),
+        'paid_amount' : fields.float('Amount to pay', digits=(16, 2)),
+        }
+    _defaults = { }
+
+    def onchange_topay(self, cr, uid, ids, to_pay, residual):
+        if to_pay :
+            return {'value': {'paid_amount' : residual}  , 
+                    'readonly' : {'paid_amount': "False"} 
+                    }
+        return {'value': {'paid_amount' : 0.0} , 
+                'readonly' : {'paid_amount': "True"} 
+                }
+                
+    def onchange_paid_amount(self, cr, uid, ids, amount, residual):
+        if amount > residual:
+            return {'value': {'paid_amount' : residual,
+                              'to_pay' : True} }
+        if amount <= 0 :
+            return {'value': {'paid_amount' : 0,
+                              'to_pay' : False} }
+        return {'value': {'to_pay' : True} }
+
+
+wizard_receipt_lines()

=== added file 'account_receipt/receipt_report.xml'
--- account_receipt/receipt_report.xml	1970-01-01 00:00:00 +0000
+++ account_receipt/receipt_report.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <report
+            auto="False"
+            id="account_receipts"
+            model="account.receipt"
+            name="account.receipt"
+            rml="account_receipt/report/receipt.rml"
+            string="Receipts"/>
+
+    </data>
+</openerp>

=== added file 'account_receipt/receipt_view.xml'
--- account_receipt/receipt_view.xml	1970-01-01 00:00:00 +0000
+++ account_receipt/receipt_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,109 @@
+<?xml version="1.0"?>
+<openerp>
+  <data>
+    <!-- Receipt View
+	=====================================================================================	-->
+
+        <record model="ir.ui.view"  id="account_receipt_form_view" >
+            <field name="name">account.receipt.form</field>
+            <field name="model">account.receipt</field>
+            <field name="type">form</field>
+            <field name="arch" type="xml">
+                <form string="Recibos">
+                    <field name="partner_id" select="1" readonly="1"/>
+                    <field name="name" select="1" readonly="1"/>
+                    <field name="value" select="2" readonly="1"/>
+                    <field name="date" readonly="1"/>
+                    <field colspan="4" mode="tree" name="lines" readonly="1">
+                        <tree string="Lista de facturas">
+                            <field name="invoice_id" readonly="1"/>
+                            <field name="amount" readonly="1"/>
+                        </tree>
+                        <form>
+                            <field name="invoice_id" readonly="1"/>
+                            <field name="amount" readonly="1"/>
+                        </form>
+                    </field>
+                </form>
+            </field>
+        </record>
+        
+        <record model="ir.ui.view"  id="account_receipt_tree_view" >
+            <field name="name">account.receipt.tree</field>
+            <field name="model">account.receipt</field>
+            <field name="type">tree</field>
+            <field name="arch" type="xml">
+                <tree string="Recibos">
+                    <field name="partner_id" select="1" readonly="1"/>
+                    <field name="name" select="1" readonly="1"/>
+                    <field name="value" readonly="1"/>
+                    <field name="date" readonly="1"/>
+                </tree>
+            </field>
+        </record>
+    
+    <record model="ir.actions.act_window" id="action_receipt_form">
+		<field name="name">Receipt</field>
+        <field name="res_model">account.receipt</field>
+		<field name="view_mode">tree,form</field>
+    </record>
+    <menuitem name="Receipts" sequence="15" id="menu_receipts" parent="account.menu_finance" action="action_receipt_form"/>
+
+
+    <record model="ir.ui.view" id="receipt_wizard_view">
+      <field name="name">receipt.wizard.form</field>
+      <field name="model">wizard.receipt</field>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <form string="Lista de facturas">
+          <field name="partner_id"/>
+          <field name="rec_date" attrs="{'required':[('state','=','get')]}"/>
+          <field name="journal"  attrs="{'required':[('state','=','get')]}"/>
+          <field name="total" />
+          <field name="state" invisible="True"/>
+          <newline/>
+          <group  states="get" colspan="4">
+          <field name="lines" colspan="4">
+            <tree string="Open invoices" editable="bottom">
+              <field name="inv_number" readonly="1"/>
+              <field name="inv_date" readonly="1"/>
+              <field name="due_date" readonly="1"/>
+              <field name="inv_total" readonly="1"/>
+              <field name="inv_residual" readonly="1"/>
+              <!--field name="inv_move" invisible="True"/ -->
+              <field name="to_pay" on_change="onchange_topay(to_pay, inv_residual)"/>
+              <field name="paid_amount" on_change="onchange_paid_amount(paid_amount, inv_residual)" 
+                        attrs="{'readonly':[('to_pay','=',0)]}"/>
+            </tree>
+          </field>
+          </group>
+          <group col="2" colspan="4" fill="1">
+            <button icon="gtk-cancel" name="act_cancel" special="cancel" states="choose" string="Cancel" type="object"/>
+            <button icon="gtk-ok" name="get_invoices" states="choose" string="Get Invoices" type="object"/>
+            <button icon="gtk-close" name="act_destroy" special="cancel" states="get" string="Close" type="object"/>
+            <button icon="gtk-ok" name="create_receipt" states="get" string="Create receipt" type="object"/>
+            <button icon="gtk-close" name="act_destroy" special="cancel" states="done" string="Close" type="object"/>
+          </group>
+        </form>
+      </field>
+    </record>
+    <record model="ir.actions.act_window" id="action_receipt_wizard">
+      <field name="name">New Receipt</field>
+      <field name="type">ir.actions.act_window</field>
+      <field name="res_model">wizard.receipt</field>
+      <field name="view_type">form</field>
+      <field name="view_mode">form</field>
+      <!--field name="target">new</field-->
+    </record>
+    <menuitem name="New Receipt" id="menu_action_receipt_wizard" action="action_receipt_wizard" parent="menu_receipts"/>
+    
+        <record id="account_receipt_new" model="ir.values">
+            <field eval="'client_action_multi'" name="key2"/>
+            <field eval="'account.receipt'" name="model"/>
+            <field name="name">New Receipt</field>
+            <field eval="'ir.actions.act_window,'+str(action_receipt_wizard)" name="value"/>
+            <field eval="True" name="object"/>
+        </record>    
+    
+  </data>
+</openerp>

=== added directory 'account_receipt/report'
=== added file 'account_receipt/report/__init__.py'
--- account_receipt/report/__init__.py	1970-01-01 00:00:00 +0000
+++ account_receipt/report/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,27 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import receipt_rpt
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'account_receipt/report/receipt.rml'
--- account_receipt/report/receipt.rml	1970-01-01 00:00:00 +0000
+++ account_receipt/report/receipt.rml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,180 @@
+<?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="34.0" y1="28.0" width="530" height="786"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Partner_Address">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Header_Invoice_Line">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="GRID" colorName="black"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Invoice_Line_Content">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Table_Format_2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      
+    </blockTableStyle>
+    <blockTableStyle id="Table_Total_Include_Taxes">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="LINEABOVE" colorName="black"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="Standard" fontName="Times-Roman"/>
+    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="Index" fontName="Times-Roman"/>
+    <paraStyle name="Header" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="Footer" fontName="Times-Roman"/>
+    <paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+    <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_Bold_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_Right_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Centre_8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+    <paraStyle name="terp_default_address" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Bold_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Centre_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Bold_Right_9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_White_2" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="terp_default_Note" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+  </stylesheet>
+  <story>
+    <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
+    <para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
+    <blockTable colWidths="297.0,233.0" style="Table_Partner_Address">
+      <tr>
+        <td>
+          <para style="terp_default_8">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="terp_default_8">[[ o.address_id.title or '' ]] [[ o.address_id.name ]]</para>
+          <para style="terp_default_8">[[ o.address_id.street ]]</para>
+          <para style="terp_default_8">[[ o.address_id.street2 or '' ]]</para>
+          <para style="terp_default_8">[[ o.address_id.zip or '' ]] [[ o.address_id.city or '' ]]</para>
+          <para style="terp_default_8">
+            <font color="white"> </font>
+          </para>
+          <para style="terp_default_8">Tel. : [[ o.address_id.phone or removeParentNode('para') ]]</para>
+          <para style="terp_default_8">Fax : [[ o.address_id.fax or removeParentNode('para') ]]</para>
+          <para style="terp_default_8">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P1">
+      <font color="white"> </font>
+    </para>
+    <para style="P1">Receipt [[ o.name ]]</para>
+    <para style="P1">Date [[ formatLang(o.date,date=True) ]]</para>
+    <para style="terp_default_8">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="160.0,113.0,63.0,80.0,108.0" style="Table_Header_Invoice_Line">
+      <tr>
+        <td>
+          <para style="terp_tblheader_Details">Description</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details">Invoices</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details">Date</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details_Right">Inv. amount</para>
+        </td>
+        <td>
+          <para style="terp_tblheader_Details_Centre">Paid amount</para>
+        </td>
+      </tr>
+    </blockTable>
+    <section>
+      <para style="terp_default_8">[[ repeatIn(o.lines,'l') ]]</para>
+      <blockTable colWidths="160.0,112.0,63.0,81.0,105.0" style="Table_Invoice_Line_Content">
+        <tr>
+          <td>
+            <para style="terp_default_9">[[ l.name or '']]</para>
+          </td>
+          <td>
+            <para style="terp_default_9">[[ l.invoice_id.number ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.invoice_id.date_invoice, date=True)]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.invoice_id.amount_total) ]]</para>
+          </td>
+          <td>
+            <para style="terp_default_Right_9">[[ formatLang(l.amount) ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <blockTable colWidths="370.0,153.0" style="Table_Format_2">
+      <tr>
+        <td>
+          <para style="Standard">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+          <para style="terp_default_2">
+            <font color="white"> </font>
+          </para>
+          <blockTable colWidths="63.0,84.0" style="Table_Total_Include_Taxes">
+            <tr>
+              <td>
+                <para style="terp_default_Bold_9">Total:</para>
+              </td>
+              <td>
+                <para style="terp_default_Right_9">[[ formatLang(o.value) ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="terp_default_2">
+      <font color="white"> </font>
+    </para>
+  </story>
+</document>
+

=== added file 'account_receipt/report/receipt.sxw'
Binary files account_receipt/report/receipt.sxw	1970-01-01 00:00:00 +0000 and account_receipt/report/receipt.sxw	2009-11-23 15:50:45 +0000 differ
=== added file 'account_receipt/report/receipt_rpt.py'
--- account_receipt/report/receipt_rpt.py	1970-01-01 00:00:00 +0000
+++ account_receipt/report/receipt_rpt.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,37 @@
+#! -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+
+class account_receipt(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(account_receipt, self).__init__(cr, uid, name, context)
+        self.localcontext.update({
+            'time': time,
+        })
+report_sxw.report_sxw(
+    'report.account.receipt',
+    'account.receipt',
+    'addons/account_receipt/report/receipt.rml',
+    parser=account_receipt, header=False
+    )

=== added directory 'account_related_shop'
=== added file 'account_related_shop/__init__.py'
--- account_related_shop/__init__.py	1970-01-01 00:00:00 +0000
+++ account_related_shop/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,2 @@
+import invoice
+import account_move_line
\ No newline at end of file

=== added file 'account_related_shop/__terp__.py'
--- account_related_shop/__terp__.py	1970-01-01 00:00:00 +0000
+++ account_related_shop/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2009 Smile.fr. All Rights Reserved
+#    authors: Raphaël Valyi
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    "name" : "Account Related Shop",
+    "description":"""
+Simple module to provide the origin sale shop reference on account move lines and invoices.
+Since several orders can be at the origin of the same invoice, only the first sale order (thus shop) is taken into account here.
+""",
+    "version" : "0.1",
+    "author" : "Smile.fr",
+    "category" : "Sale",
+    "depends" : ["sale", "account", "sale_invoices_link"],
+    "init_xml" : [],
+    "demo_xml" : [],
+    "update_xml" : ["account_invoice_view.xml", "account_view.xml"],
+    "active": False,
+    "installable": True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'account_related_shop/account_invoice_view.xml'
--- account_related_shop/account_invoice_view.xml	1970-01-01 00:00:00 +0000
+++ account_related_shop/account_invoice_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<record model="ir.ui.view" id="account_related_shop_form">
+			<field name="name">account_related_shop_form</field>
+			<field name="model">account.invoice</field>
+			<field name="inherit_id" ref="account.invoice_form" />
+			<field name="arch" type="xml">
+				<field name="origin" position="after">
+					<field name="origin_sale_order_id" />
+					<field name="origin_sale_shop_id" />
+				</field>
+			</field>
+		</record>
+		
+		<record model="ir.ui.view" id="account_related_shop_tree">
+			<field name="name">account_related_shop_tree</field>
+			<field name="model">account.invoice</field>
+			<field name="inherit_id" ref="account.invoice_tree" />
+			<field name="arch" type="xml">
+				<field name="origin" position="after">
+					<field name="origin_sale_order_id" select="2"/>
+					<field name="origin_sale_shop_id" select="2"/>
+				</field>
+			</field>
+		</record>
+	</data>
+</openerp>
\ No newline at end of file

=== added file 'account_related_shop/account_move_line.py'
--- account_related_shop/account_move_line.py	1970-01-01 00:00:00 +0000
+++ account_related_shop/account_move_line.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,69 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2009 Smile.fr. All Rights Reserved
+#    authors: Raphaël Valyi
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+
+class account_move_line(osv.osv):
+    _inherit = "account.move.line"
+    
+    def _get_sale_order_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for move_line in self.browse(cr, uid, ids, context):
+            if move_line.invoice and move_line.invoice.origin_sale_order_id:
+                res[move_line.id] = move_line.invoice.origin_sale_order_id.id
+            else:
+                res[move_line.id] = False
+        return res
+    
+    def _get_sale_shop_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for move_line in self.browse(cr, uid, ids, context):
+            if move_line.invoice and move_line.invoice.origin_sale_shop_id:
+                res[move_line.id] = move_line.invoice.origin_sale_shop_id.id
+            else:
+                res[move_line.id] = False
+        return res
+    
+    def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False):
+        result = super(account_move_line, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar)
+        xml = result['arch']
+        xml = xml.replace('</tree>', "<field name=\"origin_sale_order_id\" select='2'/><field name=\"origin_sale_shop_id\" select='2'/></tree>")
+        result['arch'] = xml
+        fields = []
+        result['fields']['origin_sale_order_id'] = {'type': 'many2one', 'domain': [], 'relation': 'sale.order', 'string': u'Origin Sale Order', 'context': ''}
+        result['fields']['origin_sale_shop_id'] = {'type': 'many2one', 'domain': [], 'relation': 'sale.shop', 'string': u'Origin Sale Shop', 'context': ''}
+        print "----------------------------"
+        for i in result:
+            print i
+
+        print "type", result.get('type', False)
+        print "toolbar", result.get('toolbar', False)
+        print "fields", result['fields']
+        return result
+
+    _columns = {
+            'origin_sale_order_id': fields.function(_get_sale_order_id, method=True, store=False, relation="sale.order", string="Origin Sale Order", type="many2one", select='2'),
+            'origin_sale_shop_id': fields.function(_get_sale_shop_id, method=True, store=False, relation="sale.shop", string="Origin Sale Shop", type="many2one", select='2'),                
+    }
+
+account_move_line()
\ No newline at end of file

=== added file 'account_related_shop/account_view.xml'
--- account_related_shop/account_view.xml	1970-01-01 00:00:00 +0000
+++ account_related_shop/account_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+        <record id="related_shop_view_move_line_tree" model="ir.ui.view">
+            <field name="name">related_shop_view_move_line_tree</field>
+            <field name="model">account.move.line</field>
+            <field name="type">tree</field>
+			<field name="inherit_id" ref="account.view_move_line_tax_tree" />
+            <field name="arch" type="xml">
+				<field name="partner_id" position="after">
+					<field name="origin_sale_order_id" />
+					<field name="origin_sale_shop_id" />
+				</field>
+			</field>
+        </record>
+	</data>
+</openerp>
\ No newline at end of file

=== added file 'account_related_shop/invoice.py'
--- account_related_shop/invoice.py	1970-01-01 00:00:00 +0000
+++ account_related_shop/invoice.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,78 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2009 Smile.fr. All Rights Reserved
+#    authors: Raphaël Valyi
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+
+class account_invoice(osv.osv):
+    _inherit = "account.invoice"
+    
+    def _get_sale_order_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for invoice in self.browse(cr, uid, ids, context):
+            if invoice.sale_ids:
+                res[invoice.id] = invoice.sale_ids[0].id
+            else:
+                res[invoice.id] = False
+        return res
+    
+    def _get_sale_shop_id(self, cr, uid, ids, name, arg, context=None):
+        res = {}
+        for invoice in self.browse(cr, uid, ids, context):
+            if invoice.sale_ids:
+                res[invoice.id] = invoice.sale_ids[0].shop_id and invoice.sale_ids[0].shop_id.id or False
+            else:
+                res[invoice.id] = False
+        return res
+
+    #implemented because for strange reasons search on fields.function of type many2one doesn't work natively!
+    def search(self, cr, uid, args, offset=0, limit=None, order=None,
+            context=None, count=False):
+        origin_sale_order_name = False
+        origin_sale_shop_name = False
+        args2 = args[:]
+        for arg in args:
+            if arg[0] == 'origin_sale_order_id':
+                origin_sale_order_name = arg[2]
+                args2.remove(arg)
+            if arg[0] == 'origin_sale_shop_id':
+                origin_sale_shop_name = arg[2]
+                args2.remove(arg)
+        ids = super(account_invoice, self).search(cr, uid, args2, offset, limit, order, context, count)
+        
+        if len(ids) > 1 and origin_sale_order_name:
+            cr.execute(("select account_invoice.id from account_invoice left join sale_order on account_invoice.origin_sale_order_id=sale_order.id where sale_order.name ilike '%s' and account_invoice.id in %s" % ('%' + origin_sale_order_name + '%', ids)).replace('[', '(').replace(']', ')'))
+            results = cr.fetchall()
+            ids = [line[0] for line in results]
+            
+        if len(ids) > 1 and origin_sale_shop_name:
+            cr.execute(("select account_invoice.id from account_invoice left join sale_shop on account_invoice.origin_sale_shop_id=sale_shop.id where sale_shop.name ilike '%s' and account_invoice.id in %s" % ('%' + origin_sale_shop_name + '%', ids)).replace('[', '(').replace(']', ')'))
+            results = cr.fetchall()
+            ids = [line[0] for line in results]
+        return ids
+
+    _columns = {
+            'origin_sale_order_id': fields.function(_get_sale_order_id, method=True, store=True, relation="sale.order", string="Origin Sale Order", type="many2one", select='2'),
+            'origin_sale_shop_id': fields.function(_get_sale_shop_id, method=True, store=True, relation="sale.shop", string="Origin Sale Shop", type="many2one", select='2'),
+    }
+
+account_invoice()
\ No newline at end of file

=== added directory 'alerts'
=== added file 'alerts/COPYRIGHT'
--- alerts/COPYRIGHT	1970-01-01 00:00:00 +0000
+++ alerts/COPYRIGHT	2009-11-23 15:50:45 +0000
@@ -0,0 +1,15 @@
+Copyright (c) 2008 Sednacom.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

=== added file 'alerts/LICENSE'
--- alerts/LICENSE	1970-01-01 00:00:00 +0000
+++ alerts/LICENSE	2009-11-23 15:50:45 +0000
@@ -0,0 +1,340 @@
+		    GNU GENERAL PUBLIC LICENSE
+		       Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+		    GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+			    NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+	    How to Apply These Terms to Your New Programs
+
+  If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+  To do so, attach the following notices to the program.  It is safest
+to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the program's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this
+when it starts in an interactive mode:
+
+    Gnomovision version 69, Copyright (C) year name of author
+    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+    This is free software, and you are welcome to redistribute it
+    under certain conditions; type `show c' for details.
+
+The hypothetical commands `show w' and `show c' should show the appropriate
+parts of the General Public License.  Of course, the commands you use may
+be called something other than `show w' and `show c'; they could even be
+mouse-clicks or menu items--whatever suits your program.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the program, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
+  `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+  <signature of Ty Coon>, 1 April 1989
+  Ty Coon, President of Vice
+
+This General Public License does not permit incorporating your program into
+proprietary programs.  If your program is a subroutine library, you may
+consider it more useful to permit linking proprietary applications with the
+library.  If this is what you want to do, use the GNU Library General
+Public License instead of this License.

=== added file 'alerts/__init__.py'
--- alerts/__init__.py	1970-01-01 00:00:00 +0000
+++ alerts/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,16 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+
+from ir_model import *
+from ir_values import *
+from alerts import *
+
+from wizard import *
+
+

=== added file 'alerts/__terp__.py'
--- alerts/__terp__.py	1970-01-01 00:00:00 +0000
+++ alerts/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,13 @@
+{
+    "name" : "Generic alerts",
+    "version" : "1.0",
+    "author" : "Sednacom",
+    "category" : "Generic Modules/Others",
+    "website": "http://www.sednacom.fr";,
+    "description": "Add an alert generator on every ressources of the system",
+    "depends" : ["base","sednacom_extras"],
+    "init_xml" : [],
+    "update_xml" : ["alerts_view.xml","alerts_wizard.xml" ],
+    "active": False,
+    "installable": True
+}

=== added file 'alerts/alerts.py'
--- alerts/alerts.py	1970-01-01 00:00:00 +0000
+++ alerts/alerts.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,134 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+
+from osv import osv, fields
+import pooler
+import mx.DateTime as mdt
+
+def _models_get(self, cr, uid, context={}):
+    pooloo = pooler.get_pool(cr.dbname)
+    obj = pooloo.get('ir.model')
+    ids = obj.search(cr, uid, [('alert_allowed','=',1),])
+    res = []
+    for o in obj.browse(cr, uid, ids, context=context):
+        res.append( [o.model, o.name] )
+
+    res2 = [ [ el[1], el[0] ] for el in res ]
+    res2.sort()
+    res = [ [ el[1], el[0] ] for el in res2 ]
+
+    return res
+
+def _default_date(*args):
+    res = mdt.today() + mdt.oneDay
+    return res.strftime('%Y-%m-%d 09:00:00')
+
+class sednacom_alert(osv.osv):
+    _name = 'sednacom.alert'
+    _description = 'Alerts'
+    _columns = {
+        'name' : fields.char('Description',required=True,size=64, states={'done' : [('readonly', True),]}) ,
+        'datetime' : fields.datetime('Date/Time', required=True, states={'done' : [('readonly', True),]}) ,
+        'user_to' : fields.many2one('res.users','To' ,  required=True, states={'done' : [('readonly', True),]}) ,
+        'user_from' : fields.many2one('res.users','From', required=True, states={'done' : [('readonly', True),]}) ,
+        'state' : fields.selection ([('pending','Pending'),('done','Done'),],'State', readonly=True) ,
+        'resource' : fields.reference('Resource', selection=_models_get, size=128, states={'done' : [('readonly', True),]}) ,
+        'message' : fields.text('Message', states={'done' : [('readonly', True),]}) ,
+        'by_mail' : fields.boolean('Alert by mail', states={'done' : [('readonly', True),]}) ,
+        'by_request' : fields.boolean('Alert by request', states={'done' : [('readonly', True),]}) ,
+
+    }
+    _order = 'datetime asc'
+    _defaults = {
+        'user_to' : lambda *args : args[2] ,
+        'user_from' : lambda *args : args[2] ,
+        'state' : lambda *args : 'pending' ,
+        'by_mail' : lambda *args : True ,
+        'datetime' : _default_date ,
+    }
+
+    def set_to_done(self, cr, uid, alerts, *args):
+        self.write(cr, uid, alerts, {'state' : 'done'})
+        return True
+
+    def set_to_pending(self, cr, uid, alerts, *args):
+        self.write(cr, uid, alerts, {'state' : 'pending'})
+        return True
+
+    def send_alert(self, cr, uid, alert, *args):
+        alerts = self.browse(cr, uid, alert)
+        for alert in alerts:
+            by_mail = alert.by_mail
+            by_request = alert.by_request
+            cron_obj = self.pool.get('ir.cron')
+            if by_request:
+                data = {
+                        'name' : "Request : "+alert.name,
+                        'user_id' : uid,
+                        'nextcall' : alert.datetime,
+                        'model' : 'sednacom.alert',
+                        'function' : 'send_request',
+                        'args' : str([alert.id]),
+                        }
+                cron_obj.create(cr, uid, data)
+            if by_mail:
+                data = {
+                        'name' : "Email : "+alert.name,
+                        'user_id' : uid,
+                        'nextcall' : alert.datetime,
+                        'model' : 'sednacom.alert',
+                        'function' : 'send_mail',
+                        'args' : str([alert.id]),
+                        }
+                cron_obj.create(cr, uid, data)
+        return True
+
+    def send_request(self, cr, uid, alerts, *args):
+        request_obj = self.pool.get('res.request')
+        alert = self.browse(cr, uid, [alerts])[0]
+        partner = False
+        reference = False
+        if alert.resource:
+            resource = alert.resource.split(',')
+            if 'res.partner' in resource:
+                partner = resource[1]
+            else :
+                reference = alert.resource
+        data = {
+                    'name' : alert.name,
+                    'active' : True,
+                    'priority' : 1,
+                    'act_from' : alert.user_from.id,
+                    'act_to' : alert.user_to.id,
+                    'body' : alert.message,
+                    'state' : 'waiting',
+                    'ref_partner_id' : partner,
+                    'ref_doc1' : reference,
+                    'trigger_date' : alert.datetime
+                    }
+        request_obj.create(cr, uid, data)
+        self.set_to_done(cr, uid, [alert.id])
+        return True
+
+    def send_mail(self, cr, uid, alert, *args):
+        sednaemail_obj = self.pool.get('sednacom.email')
+        alert = self.browse(cr, uid, [alert])[0]
+        data = {
+                'name' : alert.name,
+                'exp' : alert.user_from.address_id.email,
+                'recipients' :  [(6, 0, [alert.user_to.address_id.id])],
+                'body' : alert.message,
+                }
+        mail = sednaemail_obj.create(cr, uid, data)
+        sednaemail_obj.send(cr, uid, [mail])
+        self.set_to_done(cr, uid, [alert.id])
+        return True
+
+sednacom_alert()
+

=== added file 'alerts/alerts_view.xml'
--- alerts/alerts_view.xml	1970-01-01 00:00:00 +0000
+++ alerts/alerts_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,135 @@
+<?xml version="1.0"?>
+<!--
+    $Id$
+-->
+<terp>
+<data >
+
+    <record model="ir.ui.view" id="ir_model_form" >
+        <field name="name">ir.model.form.alert</field>
+        <field name="model">ir.model</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="base.view_model_form"/>
+        <field name="arch" type="xml" >
+            <field name="model" position="after">
+                <group cols="3" colspan="2">
+                    <label string="Set this flag to True to allow users to define alerts on resources of this type."/>
+                    <field name="alert_allowed" select="1"/>
+                </group>
+                <separator string="Alerts" colspan="4"/>
+            </field>
+        </field>
+    </record>
+    <record model="ir.ui.view" id="ir_model_tree" >
+        <field name="name">ir.model.tree.alert</field>
+        <field name="model">ir.model</field>
+        <field name="type">tree</field>
+        <field name="inherit_id" ref="base.view_model_tree" />
+        <field name="arch" type="xml" >
+            <field name="model" position="after" >
+                <field name="alert_allowed" />
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="sednacom_alert_form">
+        <field name="name">sednacom.alert.form</field>
+        <field name="model">sednacom.alert</field>
+        <field name="type">form</field>
+        <field name="arch" type="xml">
+            <form string="Alert">
+                <field name="name" select="1" />
+                <field name="datetime" select="1" />
+                <field name="user_to" select="1" />
+                <field name="user_from" select="1" readonly="1" />
+                <field name="by_mail" />
+                <field name="by_request" />
+                <field name="resource" colspan="4" />
+                <separator string="Message" colspan="4" />
+                <field name="message" colspan="4" nolabel="1" />
+                <field name="state" select="2" />
+                <group colspan="2" cols="1">
+                    <button string="Set to done" name="set_to_done" states="pending" type="object" />
+                    <button string="Set to pending" name="set_to_pending" states="done" type="object" />
+                </group>
+            </form>
+        </field>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_form" >
+        <field name="name">Alert</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">form,tree</field>
+        <field name="view_id" ref="sednacom_alert_form"/>
+    </record>
+
+    <record model="ir.ui.view" id="sednacom_alert_tree">
+        <field name="name">sednacom.alert.tree</field>
+        <field name="model">sednacom.alert</field>
+        <field name="type">tree</field>
+        <field name="arch" type="xml">
+            <tree string="Alerts">
+                <field name="name" />
+                <field name="datetime" />
+                <field name="user_from" />
+                <field name="user_to" />
+                <field name="by_mail" />
+                <field name="by_request" />
+                <field name="state" />
+            </tree>
+        </field>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_tree">
+        <field name="name">Alerts</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="view_id" ref="sednacom_alert_tree"/>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_tree_my">
+        <field name="name">My alerts</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="view_id" ref="sednacom_alert_tree"/>
+        <field name="domain">[('user_to','=',uid),('state','=','pending')]</field>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_tree_my_done">
+        <field name="name">My alerts done</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="view_id" ref="sednacom_alert_tree"/>
+        <field name="domain">[('user_to','=',uid),('state','=','done')]</field>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_tree_sent">
+        <field name="name">Alerts sent</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="view_id" ref="sednacom_alert_tree"/>
+        <field name="domain">[('user_from','=',uid),('state','=','pending')]</field>
+    </record>
+    <record model="ir.actions.act_window" id="action_sednacom_alert_tree_sent_done">
+        <field name="name">Alerts sent and done</field>
+        <field name="type">ir.actions.act_window</field>
+        <field name="res_model">sednacom.alert</field>
+        <field name="view_type">form</field>
+        <field name="view_mode">tree,form</field>
+        <field name="view_id" ref="sednacom_alert_tree"/>
+        <field name="domain">[('user_from','=',uid),('state','=','done')]</field>
+    </record>
+
+    <menuitem name="Administration/Alerts/Alerts" action="action_sednacom_alert_tree"  id="menu_sednacom_alerts" />
+    <menuitem name="Tools/My alerts" action="action_sednacom_alert_tree_my"  id="menu_sednacom_alerts_my" />
+    <menuitem name="Tools/My alerts/Done" action="action_sednacom_alert_tree_my_done"  id="menu_sednacom_alerts_my_done" />
+    <menuitem name="Tools/Alerts sent" action="action_sednacom_alert_tree_sent"  id="menu_sednacom_alerts_sent" />
+    <menuitem name="Tools/Alerts sent/Done" action="action_sednacom_alert_tree_sent_done"  id="menu_sednacom_alerts_sent_done" />
+
+</data>
+</terp>

=== added file 'alerts/alerts_wizard.xml'
--- alerts/alerts_wizard.xml	1970-01-01 00:00:00 +0000
+++ alerts/alerts_wizard.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<!--
+    $Id$
+-->
+<terp>
+<data >
+    
+    <wizard 
+        string="Set alert" 
+        model="sednacom.alert" 
+        name="sednacom.setalert" 
+        id="wizard_sednacom_setalert"
+        multi="False"
+     />
+
+</data>
+</terp>

=== added directory 'alerts/i18n'
=== added file 'alerts/i18n/fr_FR.csv'
--- alerts/i18n/fr_FR.csv	1970-01-01 00:00:00 +0000
+++ alerts/i18n/fr_FR.csv	2009-11-23 15:50:45 +0000
@@ -0,0 +1,47 @@
+field,"sednacom.alert,resource",0,Resource,Ressource
+field,"sednacom.alert,name",0,Description,Description
+field,"sednacom.alert,datetime",0,Date/Time,Date/Heure
+field,"sednacom.alert,by_mail",0,Alert by mail,Alerte par email
+field,"sednacom.alert,state",0,State,Etat
+field,"sednacom.alert,by_request",0,Alert by request,Alerte par requête
+field,"sednacom.alert,user_to",0,To,A
+field,"sednacom.alert,message",0,Message,Message
+field,"sednacom.alert,user_from",0,From,De
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_form,Alert,Alerte
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_tree,Alerts,Alertes
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_tree_my,My alerts,Mes alertes
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_tree_my_done,My done alerts,Mes alertes traitées
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_tree_sent,Alerts sent,Alertes envoyées
+model,"ir.actions.act_window,name",sednacom.action_sednacom_alert_tree_sent_done,Alerts sent and done,Alertes envoyées et traitées
+model,"ir.actions.wizard,name",sednacom.wizard_sednacom_setalert,Set alert,Mettre une alerte
+field,"ir.model,alert_allowed",0,Allow alerts,Autoriser les alertes
+model,"ir.model,name",0,Alerts,Alertes
+model,"ir.ui.menu,name",0,Alerts,Alertes
+model,"ir.ui.menu,name",sednacom.menu_sednacom_alerts,Alerts,Alertes
+model,"ir.ui.menu,name",sednacom.menu_sednacom_alerts_my,My alerts,Mes alertes
+model,"ir.ui.menu,name",sednacom.menu_sednacom_alerts_my_done,Done,Traitées
+model,"ir.ui.menu,name",sednacom.menu_sednacom_alerts_sent,Alerts sent,Alertes envoyées
+model,"ir.ui.menu,name",sednacom.menu_sednacom_alerts_sent_done,Done,Traitées
+field,"maintenance.contract,alert_delay",0,Alert Delay (Days),Délais alerte (jours)
+field,"maintenance.contract,date_alert",0,Alert Date,Date alerte
+selection,"sednacom.alert,state",0,Pending,En cours
+selection,"sednacom.alert,state",0,Done,Traitée
+view,ir.model,0,Set this flag to True to allow users to define alerts on resources of this type.,Cochez cette case pour autoriser les utilisateurs à définir des alertes sur ce type d'objet.
+view,ir.model,0,Alerts,Alertes
+view,sednacom.alert,0,Alerts,Alertes
+view,sednacom.alert,0,Alert,Alerte
+view,sednacom.alert,0,Message,Message
+view,sednacom.alert,0,Set to done,Alerte traitée
+view,sednacom.alert,0,Set to pending,Relancer l'alerte
+wizard_field,"sednacom.setalert,init,resource",0,Resource,Resource
+wizard_field,"sednacom.setalert,init,name",0,Description,Description
+wizard_field,"sednacom.setalert,init,datetime",0,Date/Time,Date/Heure
+wizard_field,"sednacom.setalert,init,by_mail",0,Alert by mail,Alerte par email
+wizard_field,"sednacom.setalert,init,by_request",0,Alert by request,Alerte par requête
+wizard_field,"sednacom.setalert,init,user_to",0,User to,A
+wizard_field,"sednacom.setalert,init,message",0,Message,Message
+wizard_view,"sednacom.setalert,init",0,Alert,Alerte
+wizard_view,"sednacom.setalert,init",0,Message,Message
+wizard_button,"sednacom.setalert,init,end",0,Cancel,Annuler
+wizard_button,"sednacom.setalert,init,add",0,Add alert,Ajouter alerte
+

=== added file 'alerts/ir_model.py'
--- alerts/ir_model.py	1970-01-01 00:00:00 +0000
+++ alerts/ir_model.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+
+from osv import osv, fields
+
+
+class ir_model(osv.osv):
+    _name = "ir.model"
+    _inherit = "ir.model"
+    _columns = {
+        'alert_allowed' : fields.boolean('Allow alerts', required=False) ,
+    }
+    _defaults = {
+        'alert_allowed' : lambda *args : 0 ,
+    }
+ir_model()

=== added file 'alerts/ir_values.py'
--- alerts/ir_values.py	1970-01-01 00:00:00 +0000
+++ alerts/ir_values.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,50 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+
+from osv import osv, fields
+import itertools
+
+class ir_values(osv.osv):
+    _name = 'ir.values'
+    _inherit = 'ir.values'
+    def get(self, cr, uid, key, key2, models, meta=False, context={}, res_id_req=False, without_user=True, key2_req=True):
+        #if key2 == 'client_action_multi':
+        #    print 'ir.value.get',key, key2, models, meta, context, res_id_req, without_user, key2_req
+
+        if len(models) != 1:
+            raise Exception("Length of models is a problem")
+
+        model = models[0][0]
+
+        res = super(ir_values, self).get(cr, uid , key, key2, models, meta, context, res_id_req, without_user, key2_req)
+
+        if model == 'sednacom.alert' and key2 == 'client_action_multi':
+            count = itertools.count()
+            for data in res:
+                cur = count.next()
+                if data[2]['wiz_name'] == 'sednacom.alert':
+                    break
+            res.pop(cur)
+
+        #if key2 == 'client_action_multi':
+        #    print 'res',res
+
+        if key2 == 'client_action_multi':
+            o_mod = self.pool.get('ir.model')
+            mod_ids = o_mod.search(cr, uid, [('model','=',model), ('alert_allowed','=',1),])
+            if mod_ids:
+                o_wiz = self.pool.get('ir.actions.wizard')
+                wiz_ids = o_wiz.search(cr, uid, [('wiz_name','=','sednacom.setalert'),])
+                if wiz_ids:
+                    wiz_ids.sort()
+                    wiz_data = o_wiz.read(cr, uid, wiz_ids[-1],context=context)
+                    res.insert(0, (0, 'No matter', wiz_data))
+        return res
+
+ir_values()

=== added directory 'alerts/wizard'
=== added file 'alerts/wizard/__init__.py'
--- alerts/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ alerts/wizard/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,10 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+
+import wizard_setalert

=== added file 'alerts/wizard/wizard_setalert.py'
--- alerts/wizard/wizard_setalert.py	1970-01-01 00:00:00 +0000
+++ alerts/wizard/wizard_setalert.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,110 @@
+#!/usr/bin/env python
+#coding: utf-8
+#
+# (c) 2007-2008 Sednacom <http://www.sednacom.fr>
+#
+# authors :
+#  - Brice < brice@xxxxxxxxxxx >
+#  - Gael < gael@xxxxxxxxxxx >
+import wizard
+import pooler
+
+from alerts.alerts import _models_get, _default_date
+
+init_form_desc = """<?xml version="1.0"?>
+<form string="Alert">
+    <field name="name" colspan="4" />
+    <separator string="Message" colspan="4" />
+    <field colspan="4" name="message" nolabel="1"/>
+    <field name="datetime" />
+    <field name="user_to" />
+    <field name="by_mail"/>
+    <field name="by_request"/>
+    <field name="resource" colspan="4" />
+</form>
+"""
+
+init_form_fields = {
+    'name' : {
+        'string' : 'Description' ,
+        'type' : 'char' ,
+        'size' : 64 ,
+        'required' : True ,
+    },
+    'datetime' : {
+        'string' : 'Date/Time' ,
+        'type' : 'datetime' ,
+        'required' : True ,
+    },
+    'user_to' : {
+        'string' : 'User to' ,
+        'type' : 'many2one' ,
+        'relation' : 'res.users' ,
+        'required' : True ,
+    },
+    'by_mail' : {
+        'string' : 'Alert by mail' ,
+        'type' : 'boolean'
+    },
+    'by_request' : {
+        'string' : 'Alert by request' ,
+        'type' : 'boolean'
+    },
+    'resource' : {
+        'string' : 'Resource' ,
+        'type' : 'reference' ,
+        'selection' : _models_get ,
+    },
+    'message' : {
+        'string' : 'Message' ,
+        'type' : 'text' ,
+    },
+
+}
+
+def _init_form(obj, cr, uid, data, context={}):
+    #print 'data::_init_form',data
+    res = {
+        'user_to' : uid ,
+        'datetime' : _default_date() ,
+        'by_mail' : True ,
+        'by_request' : False ,
+        'resource' : '%s,%s' % (data['model'],data['id']) ,
+    }
+
+    return res
+
+def _add_alert(obj, cr, uid, data, context={}):
+    #print 'data::_add_alert',data
+    pooloo = pooler.get_pool(cr.dbname)
+    vals = data['form']
+    vals['user_from'] = uid
+    o_alert = pooloo.get('sednacom.alert')
+    alert = o_alert.create(cr, uid, vals)
+    ids = []
+    ids.append(int(alert))
+    o_alert.send_alert(cr, uid, ids)
+    return True
+
+class wizard_set_alert( wizard.interface ):
+    states = {
+        'init' : {
+            'actions' : [ _init_form , ],
+            'result' : {
+                'type' : 'form' ,
+                'arch': init_form_desc ,
+                'fields': init_form_fields ,
+                'state': [( 'end', 'Cancel' ), ( 'add', 'Add alert' ), ],
+                }
+            },
+        'add' : {
+            'actions' : [],
+            'result' : {
+                'type' : 'action' ,
+                'state' : 'end' ,
+                'action' : _add_alert,
+                }
+            },
+    }
+
+wizard_set_alert( 'sednacom.setalert' )

=== added directory 'base_partner_security'
=== added file 'base_partner_security/__init__.py'
--- base_partner_security/__init__.py	1970-01-01 00:00:00 +0000
+++ base_partner_security/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,1 @@
+import partner
\ No newline at end of file

=== added file 'base_partner_security/__terp__.py'
--- base_partner_security/__terp__.py	1970-01-01 00:00:00 +0000
+++ base_partner_security/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,37 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Gábor Dukai
+#    Parts of this module are based on product_listprice_upgrade
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    "name" : "Restrict access to partners by categories",
+    "version" : "0.8",
+    "author":"Gábor Dukai",
+    "website" : "http://exploringopenerp.blogspot.com";,
+    "category" : "Generic Modules/Base",
+    "description": """Adds a restricted field to partner categories. That field value is copied
+    to the partners and partner addresses belonging to those categories. With this, it is easy
+    to restrict access to some partner categories using record rules.
+    Example domain to use with record rules or views: [('restricted','=',False)]""",
+    "depends" : ["base", ],
+    "init_xml" : [],
+    "update_xml" : ["partner_view.xml", ],
+    "license": "GPL-3",
+    "installable" : True,
+    "active" : False,
+}

=== added file 'base_partner_security/partner.py'
--- base_partner_security/partner.py	1970-01-01 00:00:00 +0000
+++ base_partner_security/partner.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,92 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Gábor Dukai
+#    Parts of this module are based on product_listprice_upgrade
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from osv import osv, fields
+
+class res_partner_category(osv.osv):
+    _inherit = 'res.partner.category'
+
+    _columns = {
+        'restricted': fields.boolean('Restricted'),
+    }
+
+    _defaults = {
+        'restricted': lambda *a: False,
+    }
+
+res_partner_category()
+
+class res_partner(osv.osv):
+    _inherit = 'res.partner'
+
+    def _is_restricted(self, cr, uid, ids, name, args, context=None):
+        res = {}
+        for partner in self.browse(cr, uid, ids, context=context):
+            res[partner.id] = False
+            has_restricted = False
+            has_allowed = False
+            for cat in partner.category_id:
+                if cat.restricted:
+                    has_restricted = True
+                else:
+                    has_allowed = True
+            if has_restricted and not has_allowed:
+                res[partner.id] = True
+        return res
+
+    def _get_categories(self, cr, uid, ids, context):
+        return self.pool.get('res.partner').search(cr, uid, [('category_id', 'in', ids)])
+
+    _columns = {
+        'restricted': fields.function(_is_restricted, method=True, type='boolean', string='Restricted', store={
+                'res.partner': (lambda self,cr,uid,ids,c={}: ids, ['category_id'], 10),
+                'res.partner.category': (_get_categories, ['restricted'], 10),
+            }),
+    }
+
+res_partner()
+
+#class res_partner_address(osv.osv):
+#    _inherit = 'res.partner.address'
+#
+#    def _is_restricted(self, cr, uid, ids, name, args, context=None):
+#        res = {}
+#        for addr in self.browse(cr, uid, ids, context=context):
+#            if addr.partner_id.restricted:
+#                res[addr.id] = True
+#            else:
+#                res[addr.id] = False
+#        return res
+#
+#    def _get_partner(self, cr, uid, ids, context):
+#        return self.pool.get('res.partner.address').search(cr, uid, [('partner_id', 'in', ids)])
+#
+#    def _get_categories(self, cr, uid, ids, context):
+#        partner_ids = self.pool.get('res.partner').search(cr, uid, [('category_id', 'in', ids)])
+#        return self.pool.get('res.partner.address').search(cr, uid, [('partner_id', 'in', partner_ids)])
+#
+#    _columns = {
+#        'restricted': fields.function(_is_restricted, method=True, type='boolean', string='Restricted', store={
+#                'res.partner': (_get_partner, ['category_id'], 20),
+#                'res.partner.category': (_get_categories, ['restricted'], 20),
+#            }),
+#    }
+#
+#res_partner_address()
\ No newline at end of file

=== added file 'base_partner_security/partner_view.xml'
--- base_partner_security/partner_view.xml	1970-01-01 00:00:00 +0000
+++ base_partner_security/partner_view.xml	2009-11-23 15:50:45 +0000
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_partner_category_form_inherit" model="ir.ui.view">
+            <field name="name">res.partner.category.form.security.inherit</field>
+            <field name="model">res.partner.category</field>
+            <field name="type">form</field>
+            <field name="inherit_id" ref="base.view_partner_category_form"/>
+            <field name="arch" type="xml">
+                <field name="parent_id" position="after">
+                        <field name="restricted"/>
+                </field>
+            </field>
+        </record>
+
+    </data>
+</openerp>

=== added directory 'base_rib'
=== added file 'base_rib/__init__.py'
--- base_rib/__init__.py	1970-01-01 00:00:00 +0000
+++ base_rib/__init__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,24 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import base_rib
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'base_rib/__terp__.py'
--- base_rib/__terp__.py	1970-01-01 00:00:00 +0000
+++ base_rib/__terp__.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,37 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    'name': 'RIB',
+    'version': '0.1',
+    'category': 'Generic Modules/Base',
+    'description': '''
+This module install the base for RIB bank accounts (French standard for bank accounts). 
+To make it easier to enter RIB data, it will also allow to search for banks by code.
+
+    ''',
+    'author' : u'Numérigraphe SARL',
+    'depends': ['base', 'account'],
+    'init_xml': ['base_rib_data.xml', ],
+    'update_xml': ['base_rib_view.xml', ],
+    'installable': True,
+    'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'base_rib/base_rib.py'
--- base_rib/base_rib.py	1970-01-01 00:00:00 +0000
+++ base_rib/base_rib.py	2009-11-23 15:50:45 +0000
@@ -0,0 +1,110 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import string
+import unicodedata
+
+import netsvc
+from osv import fields, osv
+
+# Add fields and behavior for French RIB
+class res_partner_bank(osv.osv):
+    _inherit = "res.partner.bank"
+
+    def _check_key(self, cr, uid, ids):
+        '''
+        Check the RIB key
+        '''
+        for bank_acc in self.browse(cr, uid, ids):
+            # ignore the accounts of type other than rib
+            if bank_acc.state !='rib':
+                continue
+            
+            # Fail if the needed values are empty of too short 
+            if (not bank_acc.bank or not bank_acc.bank.code or len(bank_acc.bank.code) != 5
+            or not bank_acc.office or len(bank_acc.office) != 5
+            or not bank_acc.acc_number or len(bank_acc.acc_number) != 11
+            or not bank_acc.key or len(bank_acc.key) != 2):
+                return False
+            
+            # get the rib data (without the key)
+            rib = "%s%s%s" % (bank_acc.bank.code, bank_acc.office, bank_acc.acc_number)
+            # translate letters into numbers according to a specific table (notice how s -> 2)
+            # Note: maketrans and translate work best with latin1 - that should not be a problem for RIB data
+            rib = rib.lower().encode('latin-1').translate(string.maketrans(u'abcdefghijklmnopqrstuvwxyz', u'12345678912345678923456789'))
+            
+            # compute the key
+            key = 97 - (100 * int(rib)) % 97
+            
+            if int(bank_acc.key) != key:
+                return False
+        return True
+
+    def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+    #overwrite the search method in order to search not only on bank type == basic account number but also on type == rib
+        res = super(res_partner_bank, self).search(cr, uid, args, offset, limit, order, context=context, count=count)
+        if filter(lambda x:x[0] == 'acc_number' , args):
+            #get the value of the search
+            rib_value = filter(lambda x:x[0] == 'acc_number' , args)[0][2]
+            #get the other arguments of the search
+            args1 = filter(lambda x:x[0] != 'acc_number' , args)
+            #add the new criterion
+            args1 += [('rib', 'ilike', rib_value)]
+            #append the results to the older search
+            res += super(res_partner_bank, self).search(cr, uid, args1, offset, limit,
+                order, context=context, count=count)
+        return res
+
+    _columns = {
+        'office': fields.char('Office Code', size=5, readonly=True, help="Office Code"),
+        'key': fields.char('Key', size=2, readonly=True, help="The key is a number allowing to check the correctness of the other codes."),
+    }
+    
+    _constraints = [(_check_key, "The RIB key does not correspond to the other codes.", ["key"])]
+    
+res_partner_bank()
+
+# overload the name_search method on banks to make it easier to enter RIB data
+class res_bank(osv.osv):
+    _inherit = 'res.bank'
+
+    # allow a search by code
+    def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
+        if not args:
+            args = []
+        if context is None:
+            context = {}
+        ids = []
+        if name:
+            ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit, context=context)
+        if not ids:
+            ids = self.search(cr, user, [('code', operator, name)] + args, limit=limit, context=context)
+        return self.name_get(cr, user, ids, context)
+
+    # show the code before the name
+    def name_get(self, cr, uid, ids, context=None):
+        result = []
+        for bank in self.browse(cr, uid, ids, context):
+            result.append((bank.id, (bank.code and (bank.code + ' - ') or '') + bank.name))
+        return result
+
+res_bank()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'base_rib/base_rib_data.xml'
--- base_rib/base_rib_data.xml	1970-01-01 00:00:00 +0000
+++ base_rib/base_rib_data.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <!--
+		Default bank account description
+		-->
+        <record id="bank_rib" model="res.partner.bank.type">
+            <field name="name">RIB Bank Details</field>
+            <field name="code">rib</field>
+        </record>
+        <record id="rib_bank_field" model="res.partner.bank.type.field">
+            <field name="name">bank</field>
+            <field name="bank_type_id" ref="bank_rib"/>
+            <field eval="True" name="required"/>
+            <field eval="False" name="readonly"/>
+        </record>
+        <record id="rib_office_field" model="res.partner.bank.type.field">
+            <field name="name">office</field>
+            <field name="bank_type_id" ref="bank_rib"/>
+            <field eval="True" name="required"/>
+            <field eval="False" name="readonly"/>
+        </record>
+        <record id="bank_acc_number_field" model="res.partner.bank.type.field">
+            <field name="name">acc_number</field>
+            <field name="bank_type_id" ref="bank_rib"/>
+            <field eval="True" name="required"/>
+            <field eval="False" name="readonly"/>
+            <field name="size">11</field>
+        </record>
+        <record id="rib_key_field" model="res.partner.bank.type.field">
+            <field name="name">key</field>
+            <field name="bank_type_id" ref="bank_rib"/>
+            <field eval="True" name="required"/>
+            <field eval="False" name="readonly"/>
+        </record>
+    </data>
+</openerp>

=== added file 'base_rib/base_rib_view.xml'
--- base_rib/base_rib_view.xml	1970-01-01 00:00:00 +0000
+++ base_rib/base_rib_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,90 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<!-- add the fields for French RIB to the partner form (subform)-->
+		<record id="view_partner_rib0_form" model="ir.ui.view">
+			<field name="name">res.partner.form.rib0.inherit</field>
+			<field name="model">res.partner</field>
+			<field name="inherit_id" ref="base.view_partner_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="bank" position="replace"/>
+			</field>
+		</record>
+		<record id="view_partner_rib1_form" model="ir.ui.view">
+			<field name="name">res.partner.form.rib1.inherit</field>
+			<field name="model">res.partner</field>
+			<field name="inherit_id" ref="base.view_partner_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="before">
+					<newline />
+					<field name="bank" />
+					<field name="office" />
+					<newline />
+				</field>
+			</field>
+		</record>
+		<record id="view_partner_rib2_form" model="ir.ui.view">
+			<field name="name">res.partner.form.rib2.inherit</field>
+			<field name="model">res.partner</field>
+			<field name="inherit_id" ref="base.view_partner_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="after">
+					<field name="key" />
+				</field>
+			</field>
+		</record>
+		<!-- 
+		<record id="view_partner_bank_rib1_form" model="ir.ui.view">
+			<field name="name">res.partner.bank.form.rib1.inherit</field>
+			<field name="model">res.partner.bank</field>
+			<field name="inherit_id" ref="base.view_partner_bank_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="before">
+					<newline />
+					<field name="rib_bank" />
+					<field name="rib_office" />
+					<newline />
+				</field>
+			</field>
+		</record>
+		<record id="view_partner_bank_rib2_form" model="ir.ui.view">
+			<field name="name">res.partner.bank.form.rib2.inherit</field>
+			<field name="model">res.partner.bank</field>
+			<field name="inherit_id" ref="base.view_partner_bank_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="after">
+					<field name="rib_key" />
+				</field>
+			</field>
+		</record>
+
+		<record id="view_partner_bank_rib1_tree" model="ir.ui.view">
+			<field name="name">res.partner.bank.tree.rib1.inherit</field>
+			<field name="model">res.partner.bank</field>
+			<field name="inherit_id" ref="base.view_partner_bank_tree" />
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="before">
+					<field name="rib_bank" />
+					<field name="rib_office" />
+				</field>
+			</field>
+		</record>
+		<record id="view_partner_bank_rib2_tree" model="ir.ui.view">
+			<field name="name">res.partner.bank.tree.rib2.inherit</field>
+			<field name="model">res.partner.bank</field>
+			<field name="inherit_id" ref="base.view_partner_bank_tree" />
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<field name="acc_number" position="after">
+					<field name="rib_key" />
+				</field>
+			</field>
+		</record> -->
+	</data>
+</openerp>

=== added directory 'base_rib/i18n'
=== added file 'base_rib/i18n/base_rib.pot'
--- base_rib/i18n/base_rib.pot	1970-01-01 00:00:00 +0000
+++ base_rib/i18n/base_rib.pot	2009-11-23 15:50:46 +0000
@@ -0,0 +1,77 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* base_rib
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-06-19 11:39:18+0000\n"
+"PO-Revision-Date: 2009-06-19 11:39:18+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_key_field
+msgid "key"
+msgstr ""
+
+#. module: base_rib
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: base_rib
+#: model:ir.module.module,description:base_rib.module_meta_information
+msgid "\n"
+"This module install the base for RIB bank accounts (French standard for bank accounts). \n"
+"To make it easier to enter RIB data, it will also allow to search for banks by code.\n"
+"\n"
+"    "
+msgstr ""
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_office_field
+msgid "office"
+msgstr ""
+
+#. module: base_rib
+#: field:res.partner.bank,office:0
+#: help:res.partner.bank,office:0
+msgid "Office Code"
+msgstr ""
+
+#. module: base_rib
+#: model:res.partner.bank.type,name:base_rib.bank_rib
+msgid "RIB Bank Details"
+msgstr ""
+
+#. module: base_rib
+#: help:res.partner.bank,key:0
+msgid "The key is a number allowing to check the correctness of the other codes."
+msgstr ""
+
+#. module: base_rib
+#: field:res.partner.bank,key:0
+msgid "Key"
+msgstr ""
+
+#. module: base_rib
+#: model:ir.module.module,shortdesc:base_rib.module_meta_information
+msgid "RIB"
+msgstr ""
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field
+msgid "bank"
+msgstr ""
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field
+msgid "acc_number"
+msgstr ""
+

=== added file 'base_rib/i18n/fr_FR.po'
--- base_rib/i18n/fr_FR.po	1970-01-01 00:00:00 +0000
+++ base_rib/i18n/fr_FR.po	2009-11-23 15:50:46 +0000
@@ -0,0 +1,81 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* base_rib
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-06-16 14:15:16+0000\n"
+"PO-Revision-Date: 2009-06-16 14:15:16+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_key_field
+msgid "key"
+msgstr "key"
+
+#. module: base_rib
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr "XML non valide pour l'architecture de la vue"
+
+#. module: base_rib
+#: model:ir.module.module,description:base_rib.module_meta_information
+msgid "\n"
+"This module install the base for RIB bank accounts (French standard for bank accounts). \n"
+"To make it easier to enter RIB data, it will also allow to search for banks by code.\n"
+"\n"
+"    "
+msgstr "\n"
+"Ce module configure la base pour la saisie des RIB (Relevés d'Identité Bancaires) standards français. \n"
+"Pour faciliter la saisie des RIB, il permet également une recherche des banques par code.\n"
+"\n"
+"    "
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_office_field
+msgid "office"
+msgstr "Agence"
+
+#. module: base_rib
+#: field:res.partner.bank,office:0
+#: help:res.partner.bank,office:0
+msgid "Office Code"
+msgstr "Code agence"
+
+#. module: base_rib
+#: model:res.partner.bank.type,name:base_rib.bank_rib
+msgid "RIB Bank Details"
+msgstr "Relevé d'identité bancaire (RIB)"
+
+#. module: base_rib
+#: help:res.partner.bank,key:0
+msgid "The key is a number allowing to check the correctness of the other codes."
+msgstr "La clé est un nombre permettant de vérifier que les autres codes sont corrects."
+
+#. module: base_rib
+#: field:res.partner.bank,key:0
+msgid "Key"
+msgstr "Clé"
+
+#. module: base_rib
+#: model:ir.module.module,shortdesc:base_rib.module_meta_information
+msgid "RIB"
+msgstr "RIB"
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.rib_bank_field
+msgid "bank"
+msgstr "bank"
+
+#. module: base_rib
+#: model:res.partner.bank.type.field,name:base_rib.bank_acc_number_field
+msgid "acc_number"
+msgstr "acc_number"
+

=== added directory 'business'
=== added file 'business/__init__.py'
--- business/__init__.py	1970-01-01 00:00:00 +0000
+++ business/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import business
+

=== added file 'business/__terp__.py'
--- business/__terp__.py	1970-01-01 00:00:00 +0000
+++ business/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# coding : utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+{
+	"name" : "Module business",
+	"version" : "1.0",
+	"author" : "Sednacom",
+	"category" : "Generic Modules/Others",
+	"website": "http://www.sednacom.fr";,
+	"description": "regroup object for a business",
+	"depends" : ["base","product","sale","account","project"],
+	"init_xml" : [],
+	"demo_xml" : [], 
+	"update_xml" : ["business_view.xml"],
+	"active": False,
+	"installable": True
+}

=== added file 'business/business.py'
--- business/business.py	1970-01-01 00:00:00 +0000
+++ business/business.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,234 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import osv, fields
+import tools
+from mx import DateTime
+import netsvc
+
+def _default_purchase_analytic( obj, cr, uid, context):
+    #print '_default_purchase_analytic',context
+    business_id = context.get( 'business_id', False )
+    if business_id:
+        res = obj.pool.get( 'business.business' ).browse( cr, uid, business_id, context ).analytic_account.id
+    else:
+        res = False
+    #purchase_order_obj = obj.pool.get('purchase.order').browse( cr, uid, context )
+    
+    #print purchase_order_obj
+    return res
+
+class business_business(osv.osv):
+  _name = "business.business"
+  _description = "business affair"
+
+  def make_list_partners(self, cr, uid, ids,business, arg, context):	
+	for busi in self.browse(cr, uid, ids):
+		business_id = busi.name
+	res1=[]	
+	if business_id:
+		crit = [('business_id','=',business_id)]		
+		res2 = self.pool.get('sale.order').search(cr, uid, crit)	
+		for sale in self.pool.get('sale.order').browse(cr, uid, res2):
+			res1.append(sale.partner_id.id)		
+		res3 = self.pool.get('purchase.order').search(cr, uid, crit)		
+		for purchase in self.pool.get('purchase.order').browse(cr, uid, res3):
+			res1.append(purchase.partner_id.id)			
+		res = unique(res1)
+		print res		
+	else:
+		return False
+	return res
+
+  _columns = {
+	'name' : fields.char('Business', size=64, required=True),
+	'code' : fields.char('Business Number', size=64, required=True),
+	'date_start': fields.date('Start Date'),
+	'date_end': fields.date('End Date'),
+	'analytic_account' : fields.many2one('account.analytic.account', 'Analytic Account',required=False),
+	#'list_partners' : fields.one2many('partner.from.list', 'business_id', 'Sale', readonly=True),
+	'sales' : fields.one2many('sale.order', 'business_id', 'Sales'),
+	'purchases' : fields.one2many('purchase.order', 'business_id', 'Purchases'),
+	'invoices' :fields.one2many('account.invoice', 'business_id', 'Invoices'),
+	'projects' : fields.one2many('project.project', 'business_id', 'Projects'),
+	}
+
+business_business()
+
+class sale_order(osv.osv):
+  _name = "sale.order"
+  _inherit = "sale.order"
+  _description = "Sale order with business affair"
+
+  _columns = {
+	'business_id' : fields.many2one('business.business','Business', required=False , readonly=True, states={'draft':[('readonly',False)]}),
+	}
+
+  def onchange_business_id(self, cr, uid, ids, business_id):
+	if not business_id:
+		return {}
+	analytic = self.pool.get('business.business').browse(cr, uid, business_id).analytic_account.id	
+	return {'value':{'project_id': analytic}}
+
+  def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
+		res = super(sale_order, self).action_invoice_create(cr, uid, ids, grouped, states)			
+		for o in self.browse(cr, uid, ids):		
+			inv = self.pool.get('account.invoice').write(cr, uid, [res], {'business_id': o.business_id.id})		
+		return res
+sale_order()
+
+class purchase_order(osv.osv):
+  _name = "purchase.order"
+  _inherit = "purchase.order"
+  _description = "Purchase order with business affair"
+
+  _columns = {
+	'business_id' : fields.many2one('business.business','Business', required=False, readonly=True, states={'draft':[('readonly',False)]}),
+	}
+
+
+  def action_invoice_create(self, cr, uid, ids, *args):
+		res = super(purchase_order, self).action_invoice_create(cr, uid, ids, *args)		
+		for o in self.browse(cr, uid, ids):		
+			inv = self.pool.get('account.invoice').write(cr, uid, [res], {'business_id': o.business_id.id})		
+		return res
+purchase_order()
+
+class purchase_order_line(osv.osv):
+  _name = "purchase.order.line"
+  _inherit = "purchase.order.line"
+  _description = "purchase order line with business affair"
+
+  _defaults = {
+	'account_analytic_id' : lambda *args : _default_purchase_analytic( *args ) , 
+       }
+purchase_order_line()
+
+class account_invoice(osv.osv):
+  _name = "account.invoice"
+  _inherit = "account.invoice"
+  _description = "invoice with business affair"
+
+  _columns = {
+	'business_id' : fields.many2one('business.business','Business', required=False, readonly=True, states={'draft':[('readonly',False)]}),
+	}
+
+account_invoice()
+
+
+
+class project(osv.osv):
+  _name = "project.project"
+  _inherit="project.project"
+  _description = "Project with business affair"
+
+  _columns = {
+	'business_id' : fields.many2one('business.business','Business', required=False),
+	'category_id': fields.many2one('account.analytic.account','Analytic Account'),	
+	}
+
+  def onchange_business_id(self, cr, uid, ids, business_id):
+	if not business_id:
+		return {}
+	analytic = self.pool.get('business.business').browse(cr, uid, business_id).analytic_account.id	
+	return {'value':{'category_id': analytic}}
+
+project()
+
+class partner_from_sale(osv.osv):
+	_name = "partner.from.sale"
+	_description = "Partners from business sales"
+	_order='partner_id'
+	_auto = False
+	_columns = {
+		'name': fields.one2many('sale.order', 'business_id', 'Sale Order', readonly=True),
+		'business_id': fields.many2one('business.business','Business'),
+		'partner_id' : fields.many2one('res.partner','Partner'),
+	}
+	def init(self, cr):
+		cr.execute("""
+			create or replace view partner_from_sale as (
+				select
+					id, partner_id,business_id,name 
+						from 
+							sale_order 
+						)""")
+partner_from_sale()
+
+class partner_from_purchase(osv.osv):
+	_name = "partner.from.purchase"
+	_description = "Partners from business purchases"
+	_order='partner_id'
+	_auto = False
+	_columns = {
+		'name': fields.one2many('purchase.order', 'business_id', 'Purchase Order', readonly=True),
+		'business_id': fields.many2one('business.business','Business'),
+		'partner_id' : fields.many2one('res.partner','Partner'),
+	}
+	def init(self, cr):
+		cr.execute("""
+			create or replace view partner_from_purchase as (
+				select
+					id, partner_id,business_id,name 
+						from 
+							purchase_order 
+						)""")
+partner_from_purchase()
+
+class partner_from_invoice(osv.osv):
+	_name = "partner.from.invoice"
+	_description = "Partners from business invoices"
+	_order='partner_id'
+	_auto = False
+	_columns = {
+		'name': fields.one2many('account_invoice', 'business_id', 'Purchase Order', readonly=True),
+		'business_id': fields.many2one('business.business','Business'),
+		'partner_id' : fields.many2one('res.partner','Partner'),
+	}
+	def init(self, cr):
+		cr.execute("""
+			create or replace view partner_from_invoice as (
+				select
+					id, partner_id,business_id,name 
+						from 
+							account_invoice 
+						)""")
+partner_from_invoice()
+
+class partner_from_list(osv.osv):
+	_name = "partner.from.list"
+	_description = "Partners from business"
+	_order='partner_id'
+	_auto = False
+	_columns = {
+		'business_id': fields.many2one('business.business','Business'),		
+		'partner_id' : fields.many2one('res.partner','Partner'),
+	}
+	def init(self, cr):
+		cr.execute("""
+			create or replace view partner_from_list as (
+				SELECT DISTINCT r.id,r.id as partner_id,b.id as business_id
+					FROM res_partner r, business_business b, 
+						partner_from_invoice i, partner_from_sale s,
+						partner_from_purchase p
+					WHERE b.id=p.business_id and b.id=s.business_id and b.id=i.business_id
+						)""")
+partner_from_list()
+

=== added file 'business/business_view.xml'
--- business/business_view.xml	1970-01-01 00:00:00 +0000
+++ business/business_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,245 @@
+<terp>
+  <data>
+<!--        order view	-->
+    <record model="ir.ui.view" id="view_order_tree_business">
+      <field name="name">sale.order.tree</field>
+      <field name="model">sale.order</field>
+      <field name="inherit_id" ref="sale.view_order_tree" />
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+      <field name="partner_id" position="before" >
+	<field name="business_id"/>
+	</field>
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_order_form_business">
+      <field name="name">sale.order.form</field>
+      <field name="model">sale.order</field>
+      <field name="inherit_id" ref="sale.view_order_form" />
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+        <field name="project_id" position="before" >
+	  <field name="business_id" select="1" on_change="onchange_business_id(business_id)"/>
+	</field>  
+      </field>
+    </record>
+
+<!-- 	purchase view -->
+    <record model="ir.ui.view" id="purchase_order_form_business">
+      <field name="name">purchase.order.form</field>
+      <field name="model">purchase.order</field>
+      <field name="inherit_id" ref="purchase.purchase_order_form"/>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+	<field name="partner_ref" position="after" >
+	  <field name="business_id" select="1" />
+	</field>			
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="purchase_order_form_business2">
+      <field name="name">purchase.order.form</field>
+      <field name="model">purchase.order</field>
+      <field name="inherit_id" ref="purchase_order_form_business"/>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+	<field name="order_line" position="replace" >
+	  <field name="order_line" widget="one2many_list" colspan="4" nolabel="1" context="business_id=business_id"/>
+	</field>			
+      </field>
+    </record>
+ 
+    <record model="ir.ui.view" id="purchase_order_tree_business">
+      <field name="name">purchase.order.tree</field>
+      <field name="model">purchase.order</field>
+      <field name="inherit_id" ref="purchase.purchase_order_tree"/>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+	<field name="date_order" position="after" >
+	  <field name="business_id" select="1"/>
+	</field>			
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="purchase_order_line_form">
+        <field name="name">purchase.order.line.form</field>
+        <field name="model">purchase.order.line</field>
+        <field name="type">form</field>
+        <field name="inherit_id" ref="purchase.purchase_order_line_form" />
+        <field name="arch" type="xml">
+            <field name="account_analytic_id" position="replace" >
+                <field 
+                    name="account_analytic_id" colspan="3" 
+                    context="business_id = parent.business_id,"/>
+            </field>         
+        </field>
+    </record>
+   
+<!--	invoice view	-->
+    <record model="ir.ui.view" id="invoice_tree_business">
+      <field name="name">account.invoice.tree</field>
+      <field name="model">account.invoice</field>
+      <field name="inherit_id" ref="account.invoice_tree"/>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">
+	<field name="number" position="after" >
+	  <field name="business_id" select="1"/>
+	</field>
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="invoice_form_business">
+      <field name="name">account.invoice.form</field>
+      <field name="model">account.invoice</field>
+      <field name="inherit_id" ref="account.invoice_form"/>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+	<field name="currency_id" position="after" >
+	  <field name="business_id" select="1"/>
+	</field>
+      </field>
+    </record>
+
+<!--	Project view	-->
+    <record model="ir.ui.view" id="edit_project_business">
+      <field name="name">project.project.form</field>
+      <field name="model">project.project</field>
+      <field name="inherit_id" ref="project.edit_project"/>
+      <field name="type">form</field>
+      <field name="arch" type="xml">
+	<field name="state" position="after" >
+	  <field name="business_id" select="1" on_change="onchange_business_id(business_id)"/>
+	</field>
+      </field>
+    </record>
+
+    <record model="ir.ui.view" id="view_project_business">
+      <field name="name">project.project.tree</field>
+      <field name="model">project.project</field>
+      <field name="inherit_id" ref="project.view_project"/>     
+      <field name="type">tree</field>
+      <field name="field_parent">child_id</field>
+      <field name="arch" type="xml">
+	<field name="manager" position="after" >
+	  <field name="business_id" select="1"/>
+	</field>
+      </field>
+    </record>
+
+<!--	Business affair view	-->
+    <record model="ir.ui.view" id="business_form">
+      <field name="name">business.business.form</field>
+      <field name="model">business.business</field>
+      <field name="type">form</field>
+      <field name="arch" type="xml">      
+	<form string="Business">	
+          <notebook>
+	    <page string="Affair">
+              <field name="name" select="1"/>
+              <field name="code" select="1"/>
+              <field name="date_start" select="1"/>
+              <field name="date_end" select="1"/>
+              <field name="analytic_account" select="2"/>
+	    </page>
+            <page string="Sales">
+              <field name="sales" select="2" nolabel="1"/>
+            </page>
+            <page string="Purchases">
+              <field name="purchases" select="2" nolabel="1"/>
+            </page>
+            <page string="Invoices">
+              <field name="invoices" select="2" nolabel="1"/>
+            </page>
+            <page string="Projects">
+              <field name="projects" select="2" nolabel="1"/>
+	    </page>
+<!--	    <page string="Partners">
+      	      <field name="list_partners" select="2" domain="[('business_id', '=', business_id)]">
+	        <tree string="Partners">
+  		  <field name="partner_id"/>
+                </tree>
+              </field>
+            </page>		-->
+          </notebook>
+	</form>
+      </field>
+    </record> 
+
+    <record model="ir.ui.view" id="business_tree">
+      <field name="name">business.business.tree</field>
+      <field name="model">business.business</field>
+      <field name="type">tree</field>
+      <field name="arch" type="xml">      
+	<tree string="Business">
+              <field name="name" select="1"/>
+              <field name="code" select="1"/>
+              <field name="date_start" select="1"/>
+              <field name="date_end" select="1"/>
+              <field name="analytic_account" select="2"/>            
+<!--	      <field name="list_partners" select="2"/>	-->
+  	      <field name="sales" select="2"/>
+	      <field name="purchases" select="2"/>
+	      <field name="invoices" select="2"/>
+	      <field name="projects" select="2"/>
+	</tree>
+      </field>
+    </record> 
+
+
+    <record model="ir.actions.act_window" id="business_form_action">
+      <field name="type">ir.actions.act_window</field>
+      <field name="res_model">business.business</field>
+      <field name="view_type">form</field>
+      <field name="view_mode">form,tree</field>
+      <field name="view_id" ref="business_form"/>
+    </record>
+
+<!-- menu view -->
+  <menuitem name="Business"  id="menu_business_root" sequence="1"/>
+
+  <menuitem name="Business/Business Affair" id="menu_business_form_action" action="business_form_action"/>
+
+<!-- list of views -->
+  <act_window name="Affair's Orders "
+    domain="[('business_id', '=', active_id)]"
+    res_model="sale.order"
+    src_model="business.business"
+    view_type="form"
+    view_mode="tree,form"
+    id="view_order_tree_business"/>
+
+  <act_window name="Affair's Purchases "
+    domain="[('business_id', '=', active_id)]"
+    res_model="purchase.order"
+    src_model="business.business"
+    view_type="form"
+    view_mode="tree,form"
+    id="purchase_order_tree_business"/>
+
+  <act_window name="Affair's Invoices "
+    domain="[('business_id', '=', active_id)]"
+    res_model="account.invoice"
+    src_model="business.business"
+    view_type="form"
+    view_mode="tree,form"
+    id="invoice_tree"/>
+
+  <act_window name="Affair's Projects "
+    domain="[('business_id', '=', active_id)]"
+    res_model="project.project"
+    src_model="business.business"
+    view_type="form"
+    view_mode="tree,form"
+    id="view_project"/>
+
+  <act_window name="Analytic Account "
+    domain="[('id', '=', analytic_account)]"
+    res_model="account.analytic.account"
+    src_model="business.business"
+    view_type="form"
+    view_mode="tree,form"
+    id="hr_timesheet.account_analytic_account_form_form"/>
+
+ </data>
+</terp> 

=== added directory 'business/i18n'
=== added file 'business/i18n/fr_FR.csv'
--- business/i18n/fr_FR.csv	1970-01-01 00:00:00 +0000
+++ business/i18n/fr_FR.csv	2009-11-23 15:50:46 +0000
@@ -0,0 +1,33 @@
+field,"account.invoice,business_id",0,Business,Affaire
+field,"business.business,purchases",0,Purchases,Achats
+field,"business.business,code",0,Business Number,Numéro Affaire
+field,"business.business,name",0,Business,Affaire
+field,"business.business,invoices",0,Invoices,Factures
+field,"business.business,date_end",0,End Date,Date fin
+field,"business.business,date_start",0,Start Date,Date Début
+field,"business.business,sales",0,Sales,Ventes
+field,"business.business,analytic_account",0,Analytic Account,Compte Analytique
+field,"business.business,projects",0,Projects,Projets
+model,"ir.model,name",191,business affair,Affaire
+model,"ir.model,name",192,business affair,Affaire
+model,"ir.model,name",193,Make a supplier product list,
+model,"ir.model,name",194,Partners from business sales,Partenaires des ventes d'une affaire
+model,"ir.model,name",195,Partners from business sales,Partenaires des ventes d'une affaire
+model,"ir.model,name",196,Partners from business purchases,Partenaire des achats d'une affaire
+model,"ir.model,name",197,Partners from business invoices,Partenaires des factures d'une affaire
+model,"ir.model,name",198,Partners from business,Partenaires d'une affaire
+model,"ir.ui.menu,name",438,Business,Affaire
+model,"ir.ui.menu,name",439,Business Affair,Affaire
+field,"partner.from.invoice,business_id",0,Business,Affaire
+field,"partner.from.list,business_id",0,Business,Affaire
+field,"partner.from.purchase,business_id",0,Business,Affaire
+field,"partner.from.sale,business_id",0,Business,Affaire
+field,"purchase.order,business_id",0,Business,Affaire
+field,"sale.order,business_id",0,Business,Affaire
+view,business.business,0,Business,Affaire
+view,business.business,0,Affair,Affaire
+view,business.business,0,Sales,Ventes
+view,business.business,0,Purchases,Achats
+view,business.business,0,Invoices,Factures
+view,business.business,0,Projects,Projets
+view,business.business,0,Business,Affaire

=== added directory 'catalog'
=== added file 'catalog/__init__.py'
--- catalog/__init__.py	1970-01-01 00:00:00 +0000
+++ catalog/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,23 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import catalog
+import report
+import wizard

=== added file 'catalog/__terp__.py'
--- catalog/__terp__.py	1970-01-01 00:00:00 +0000
+++ catalog/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+# coding : utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+{
+	"name" : "Module Catalogue",
+	"version" : "1.0",
+	"author" : "Sednacom",
+	"category" : "Generic Modules/Others",
+	"website": "http://www.sednacom.fr";,
+	"description": "Report for catalog",
+	"depends" : ["base","product"],
+	"init_xml" : [],
+	"demo_xml" : [], 
+	"update_xml" : ["catalog_view.xml"],
+	"active": False,
+	"installable": True
+}

=== added file 'catalog/catalog.py'
--- catalog/catalog.py	1970-01-01 00:00:00 +0000
+++ catalog/catalog.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time
+from osv import osv,fields
+
+
+class catalog(osv.osv):
+	_name="catalog"
+	_description="Make a supplier product list"
+
+catalog()
+
+

=== added file 'catalog/catalog_view.xml'
--- catalog/catalog_view.xml	1970-01-01 00:00:00 +0000
+++ catalog/catalog_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,19 @@
+<terp>
+	<data>
+
+		<wizard string="Perform Catalog" model="product.category" name="wizard.catalog" id="catalog_catalog" />
+			<menuitem name="Products/Catalog"
+				action="catalog_catalog" type="wizard"
+				id="menu_catalog_catalog_wiz" />
+
+		<report
+		id="catalog"
+		string="catalog"
+		model="catalog"
+		name="catalog"
+		rml="catalog/report/catalog.rml"
+		auto="False"
+                menu="False"/>
+
+	</data>
+</terp>

=== added directory 'catalog/report'
=== added file 'catalog/report/__init__.py'
--- catalog/report/__init__.py	1970-01-01 00:00:00 +0000
+++ catalog/report/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import catalog
+

=== added file 'catalog/report/catalog.py'
--- catalog/report/catalog.py	1970-01-01 00:00:00 +0000
+++ catalog/report/catalog.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,128 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time
+from report import report_sxw
+from osv import osv
+
+class catalog(report_sxw.rml_parse):
+    def __init__(self, cr, uid, name, context):
+        super(catalog, self).__init__(cr, uid, name, context)
+        self.localcontext.update({
+            'time': time,
+            'lines': self.lines,
+        })
+        self._context=context
+
+    def preprocess(self, objects, data, ids):
+        category = data['form']['category_id']
+        crit = [('parent_id','child_of',category),]
+        new_ids = self.pool.get('product.category').search(self.cr, self.uid, crit)
+        prod_ids=[]
+        zero_id=[]
+        for id_cat in new_ids:
+            crit2 = [('categ_id','=',id_cat)]
+            cat_zero = self.pool.get('product.product').search(self.cr, self.uid, crit2)
+            crit_noactif = [('categ_id','=',id_cat),('active','=', 0),]
+            cat_noact = self.pool.get('product.product').search(self.cr, self.uid, crit_noactif)
+            if cat_zero and cat_noact:
+                zero_id.append(id_cat)
+                prod_ids+=cat_zero
+                prod_ids+=cat_noact
+            if cat_noact and not cat_zero:
+                if data['form']['state_product']=="inctive" or data['form']['state_product']=="all":
+                    prod_ids+=cat_noact
+                zero_id.append(id_cat)
+            if not cat_noact and cat_zero:
+                if data['form']['state_product']=="active" or data['form']['state_product']=="all":
+                    zero_id.append(id_cat)
+                prod_ids+=cat_zero
+        self._prod_ids=prod_ids
+        if data['form']['cat_zero']:
+            new_ids=zero_id
+        self._report_product = self.pool.get('product.product').browse(self.cr, self.uid, prod_ids, context=self._context)
+        self._data = data
+        self._report_data = self._build_data ( new_ids )
+        new_objects = self.pool.get('product.category').browse(self.cr, self.uid, new_ids, context=self._context)
+        super(catalog, self).preprocess(new_objects, data, new_ids)
+
+    def _build_data(self, new_ids):
+        ret = {}
+        for categ in new_ids:
+            state = self._data['form']['state_product']
+            o_prd = self.pool.get('product.product')
+            lst = ret.get( categ , list() )
+            if not lst:
+                ret[categ]=lst
+            if state == 'active':
+                crit3 = ('active','=', 1)
+            elif state== 'inactive':
+                crit3 = ('active','=', 0)
+            else :
+                crit3 = ('active','=', 1)
+                crit4= [('categ_id','=',categ),('active','=', 0),]
+                line_ids = o_prd.search(self.cr, self.uid, crit4)
+                for prd in line_ids:
+                    prd_id = self._prod_ids.index(prd)
+                    if not self._report_product[prd_id].qty_available:
+                        self._report_product[prd_id].qty_available = '0.0'
+                    if self._report_product[prd_id].active==1:
+                        self._report_product[prd_id].active="True"
+                    elif self._report_product[prd_id].active==0:
+                        self._report_product[prd_id].active="False"
+
+                    lst.append(
+                        {'code' : self._report_product[prd_id].code,
+                        'name' : self._report_product[prd_id].name,
+                        'price_std' : self._report_product[prd_id].standard_price,
+                        'list_price' : self._report_product[prd_id].list_price,
+                        'catalog' : self._report_product[prd_id].categ_id.name,
+                        'qty_available' : self._report_product[prd_id].qty_available,
+                        'active' : self._report_product[prd_id].active,
+                        })
+            crit2= [('categ_id','=',categ),crit3]
+            line_ids = o_prd.search(self.cr, self.uid, crit2)
+            for prd in line_ids:
+                prd_id = self._prod_ids.index(prd)
+                if not self._report_product[prd_id].qty_available:
+                    self._report_product[prd_id].qty_available = '0.0'
+                if self._report_product[prd_id].active==1:
+                    self._report_product[prd_id].active="True"
+                elif self._report_product[prd_id].active==0:
+                    self._report_product[prd_id].active="False"
+                lst.append(
+                    {'code' : self._report_product[prd_id].code,
+                    'name' : self._report_product[prd_id].name,
+                    'price_std' : self._report_product[prd_id].standard_price,
+                    'list_price' : self._report_product[prd_id].list_price,
+                    'catalog' : self._report_product[prd_id].categ_id.name,
+                    'qty_available' : self._report_product[prd_id].qty_available,
+                    'active' : self._report_product[prd_id].active,
+                    })
+
+        return ret
+
+    def lines(self, categ):
+        ret = self._report_data[categ.id]
+        return ret
+
+
+report_sxw.report_sxw('report.catalog', 'catalog', 'addons/catalog/report/catalog.rml', parser=catalog,header=False)
+

=== added file 'catalog/report/catalog.rml'
--- catalog/report/catalog.rml	1970-01-01 00:00:00 +0000
+++ catalog/report/catalog.rml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,119 @@
+<?xml version="1.0"?>
+<document filename="test.pdf">
+  <template pageSize="(842.0,595.0)" title="Test" author="Martin Simon" allowSplitting="20">
+    <pageTemplate id="first">
+      <frame id="first" x1="34.0" y1="42.0" width="774" height="511"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau1">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="GRID" colorName="black"/>
+      <blockBackground colorName="#9999cc" start="0,0" stop="0,0"/>
+      <blockBackground colorName="#9999cc" start="1,0" stop="1,0"/>
+      <blockBackground colorName="#9999cc" start="2,0" stop="2,0"/>
+      <blockBackground colorName="#9999cc" start="3,0" stop="3,0"/>
+      <blockBackground colorName="#9999cc" start="4,0" stop="4,0"/>
+      <blockBackground colorName="#9999cc" start="5,0" stop="5,0"/>
+      <blockBackground colorName="#9999cc" start="6,0" stop="6,0"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P2" fontName="Times-BoldItalic" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P3" fontName="Times-Italic" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P4" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P5" fontName="Times-BoldItalic" fontSize="10.0" leading="13" alignment="LEFT"/>
+    <paraStyle name="P6" fontName="Times-Italic" fontSize="10.0" leading="13"/>
+    <paraStyle name="P7" fontName="Times-BoldItalic" fontSize="16.0" leading="20" alignment="CENTER"/>
+    <paraStyle name="P8" fontName="Times-Roman" fontSize="8.0" leading="10"/>
+    <paraStyle name="P9" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <paraStyle name="P10" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
+    <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="P7">Product Catalog</para>
+    <section>
+      <para style="P6">[[ repeatIn(objects,'o') ]]</para>
+      <para style="P5">[[ o.complete_name ]]</para>
+      <para style="P8">
+        <font color="white"> </font>
+      </para>
+      <blockTable colWidths="156.0,191.0,74.0,74.0,74.0,74.0,74.0" repeatRows="1" style="Tableau1">
+        <tr>
+          <td>
+            <para style="P2">Code</para>
+          </td>
+          <td>
+            <para style="P4">Product</para>
+          </td>
+          <td>
+            <para style="P4">Listed Price</para>
+          </td>
+          <td>
+            <para style="P4">Price Std</para>
+          </td>
+          <td>
+            <para style="P4">Qty available</para>
+          </td>
+          <td>
+            <para style="P4">Catalog</para>
+          </td>
+          <td>
+            <para style="P4">Active</para>
+          </td>
+        </tr>
+        <tr>
+          <td>
+            <para style="P3">[[repeatIn(lines(o) , 'line')]]</para>
+            <para style="P1">[[ line['code'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['name'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['list_price'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['price_std'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['qty_available'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['catalog'] ]]</para>
+          </td>
+          <td>
+            <para style="P1">[[ line['active'] ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      <para style="Standard">
+        <font color="white"> </font>
+      </para>
+      <para style="Standard">
+        <font color="white"> </font>
+      </para>
+    </section>
+    <para style="Table Contents">
+      <font color="white"> </font>
+    </para>
+    <para style="Table Contents">
+      <font color="white"> </font>
+    </para>
+  </story>
+</document>
+

=== added file 'catalog/report/catalog.sxw'
Binary files catalog/report/catalog.sxw	1970-01-01 00:00:00 +0000 and catalog/report/catalog.sxw	2009-11-23 15:50:46 +0000 differ
=== added directory 'catalog/wizard'
=== added file 'catalog/wizard/__init__.py'
--- catalog/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ catalog/wizard/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import wiz_catalog
+

=== added file 'catalog/wizard/wiz_catalog.py'
--- catalog/wizard/wiz_catalog.py	1970-01-01 00:00:00 +0000
+++ catalog/wizard/wiz_catalog.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,70 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# author : gael@xxxxxxxxxxx
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import fields
+import wizard,netsvc
+import catalog
+import pooler
+import time
+
+_catalog_form='''<?xml version="1.0"?>
+			<form string="Compare purchase price / list price">
+				<label string="Choose your family to perform the catalog" colspan="3" />
+				<field name="category_id" />
+				<field name="state_product"/>
+				<field name="cat_zero"/>
+			</form>'''
+_catalog_fields = {
+	'category_id': {'string':"Category Name", 'type':'many2one', 'relation':'product.category', 'required':False, 'domain':"[]",},
+        'state_product' : {'string' : 'Product selection' ,'type' : 'selection' ,
+        'selection' : [( 'active', 'Actifs' ), ( 'inactive', 'Inactifs' ), ( 'all', 'All products' ), ],'default':'active'},
+	'cat_zero' : {
+        'string' : 'Only category with products' ,
+        'type' : 'boolean' , 'default':'true',
+    },
+	}
+
+def search_purchase(self, cr, uid, data, context):
+	id_category = data['form']['category_id']
+	res={}
+	id_cat=[]
+	if not id_category:
+		cr.execute("SELECT DISTINCT id FROM product_category WHERE parent_id is NULL ORDER BY id ")
+        	res_sql=cr.fetchall()
+		for idcat in res_sql:
+			id_cat.append(idcat[0])
+		res={'category_id':id_cat}
+	else:
+		res={'category_id':[id_category]}
+	return res
+
+class wiz_catalog(wizard.interface):
+	states = {
+		'init': {
+			'actions': [],
+			'result': {'type': 'form', 'arch':_catalog_form, 'fields':_catalog_fields, 'state':[('end','Cancel'),('launch','Launch task') ]}
+		},
+		'launch': {
+			'actions': [search_purchase],
+			'result': {'type':'print', 'report':'catalog', 'state':'end'}
+		},
+		}
+wiz_catalog('catalog')
+

=== added directory 'credit_control'
=== added file 'credit_control/__init__.py'
--- credit_control/__init__.py	1970-01-01 00:00:00 +0000
+++ credit_control/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,1 @@
+import sale_credit_check
\ No newline at end of file

=== added file 'credit_control/__init__.pyc'
Binary files credit_control/__init__.pyc	1970-01-01 00:00:00 +0000 and credit_control/__init__.pyc	2009-11-23 15:50:46 +0000 differ
=== added file 'credit_control/__terp__.py'
--- credit_control/__terp__.py	1970-01-01 00:00:00 +0000
+++ credit_control/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    Sharoon Thomas
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    "name" : "Credit Control",
+    "version" : "0.0.1",
+    "author" : "Sharoon Thomas, TL-Pragmatic",
+    "website" : "http://www.pragtech.co.in";,
+    "category" : "Accounts Addons",
+    "depends" : ['account','sale','stock'],
+    "description": """
+    Allows credit control (Ver 1 is very simple)
+
+    """,
+    "update_xml": [],#"account_wkf_with_credit_control.xml"],
+    "installable": True,
+    "active": False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'credit_control/sale_credit_check.py'
--- credit_control/sale_credit_check.py	1970-01-01 00:00:00 +0000
+++ credit_control/sale_credit_check.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,29 @@
+from osv import osv,fields
+
+class account_invoice(osv.osv):
+    _inherit ="account.invoice"
+    
+    def check_credit_limit(self,cr, uid, ids, *args):
+        invtype =  self.browse(cr,uid,ids)[0]['type']
+        if invtype in ('out_invoice','out_refund'):#Why bother if they are not buying from them
+            credit_limit = self.browse(cr,uid,ids)[0].partner_id.credit_limit
+            credit = self.browse(cr,uid,ids)[0].partner_id.credit
+            debit = self.browse(cr,uid,ids)[0].partner_id.debit
+            invamount = self.browse(cr,uid,ids)[0].amount_total
+            print "Cr Limit",credit_limit
+            print "Cr ",credit
+            print "Dr ",debit
+            print "inv amount:",invamount
+            if invamount>(credit_limit-(credit-debit)):
+            #if credit_limit<(credit-debit):
+                raise osv.except_osv('Credit Risk', 'Transaction denied due to credit risk!')
+                return False
+            return True
+        return True
+    
+    def action_move_create(self, cr, uid, ids, *args):
+        if self.check_credit_limit(cr,uid,ids)==False:
+            return False
+        else:
+            return super(account_invoice, self).action_move_create(cr, uid, ids, args)
+account_invoice()
\ No newline at end of file

=== added file 'credit_control/sale_credit_check.pyc'
Binary files credit_control/sale_credit_check.pyc	1970-01-01 00:00:00 +0000 and credit_control/sale_credit_check.pyc	2009-11-23 15:50:46 +0000 differ
=== added directory 'delivery_weight'
=== added file 'delivery_weight/__init__.py'
--- delivery_weight/__init__.py	1970-01-01 00:00:00 +0000
+++ delivery_weight/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import stock
+import sale

=== added file 'delivery_weight/__terp__.py'
--- delivery_weight/__terp__.py	1970-01-01 00:00:00 +0000
+++ delivery_weight/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,34 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+{
+    'name' : 'Estimate the gross weight of a delivery',
+    'version' : '0.1',
+    'author' : u'Numerigraphe',
+    'category': 'Generic Modules/Sales & Purchases',
+    'depends': ['sale', 'delivery', ],
+    'init_xml': [],
+    'demo_xml': [],
+    'update_xml': ['stock_view.xml'],
+    'description': """Adds a button to the picking form to estimate the total weight of a delivery using the unit gross weights of the products.
+This module automatically makes an estimate when pickings are created from sales orders.""",
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added directory 'delivery_weight/i18n'
=== added file 'delivery_weight/i18n/delivery_weight.pot'
--- delivery_weight/i18n/delivery_weight.pot	1970-01-01 00:00:00 +0000
+++ delivery_weight/i18n/delivery_weight.pot	2009-11-23 15:50:46 +0000
@@ -0,0 +1,38 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* delivery_weight
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-07-15 15:07:18+0000\n"
+"PO-Revision-Date: 2009-07-15 15:07:18+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: delivery_weight
+#: model:ir.module.module,shortdesc:delivery_weight.module_meta_information
+msgid "Estimate the gross weight of a delivery"
+msgstr ""
+
+#. module: delivery_weight
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: delivery_weight
+#: view:stock.picking:0
+msgid "Estimate"
+msgstr ""
+
+#. module: delivery_weight
+#: model:ir.module.module,description:delivery_weight.module_meta_information
+msgid "Adds a button to the picking form to estimate the total weight of a delivery using the unit gross weights of the products.\n"
+"This module automatically makes an estimate when pickings are created from sales orders."
+msgstr ""
+

=== added file 'delivery_weight/i18n/fr_FR.po'
--- delivery_weight/i18n/fr_FR.po	1970-01-01 00:00:00 +0000
+++ delivery_weight/i18n/fr_FR.po	2009-11-23 15:50:46 +0000
@@ -0,0 +1,39 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* delivery_weight
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.1\n"
+"Report-Msgid-Bugs-To: support@xxxxxxxxxxx\n"
+"POT-Creation-Date: 2009-07-15 15:00:52+0000\n"
+"PO-Revision-Date: 2009-07-15 15:00:52+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: delivery_weight
+#: model:ir.module.module,shortdesc:delivery_weight.module_meta_information
+msgid "Estimate the gross weight of a delivery"
+msgstr "Estime le poids brut de la livraison"
+
+#. module: delivery_weight
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr ""
+
+#. module: delivery_weight
+#: view:stock.picking:0
+msgid "Estimate"
+msgstr "Estimer"
+
+#. module: delivery_weight
+#: model:ir.module.module,description:delivery_weight.module_meta_information
+msgid "Adds a button to the picking form to estimate the total weight of a delivery using the unit gross weights of the products.\n"
+"This module automatically makes an estimate when pickings are created from sales orders."
+msgstr "Ajoute un bouton au formulaire de colisage pour estimer le poids total brut d'une livraison en fonction des poids unitaires des produits.\n"
+"Ce module fait automatiquement une estimation lorsque le colisage est crée à partir d'une commande de vente."
+

=== added file 'delivery_weight/sale.py'
--- delivery_weight/sale.py	1970-01-01 00:00:00 +0000
+++ delivery_weight/sale.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL. All Rights Reserved
+#
+##############################################################################
+
+from osv import osv, fields
+
+class sale_order(osv.osv):
+    _inherit = 'sale.order'
+    
+    # estimate the weight of the picking lists created by sale orders
+    def action_ship_create(self, cr, uid, ids, *args):
+        result = super(sale_order, self).action_ship_create(cr, uid, ids, *args)
+        for order in self.browse(cr, uid, ids, context={}):
+            pickings = [ x.id for x in order.picking_ids]
+            self.pool.get('stock.picking').estimate_weight(cr, uid, pickings)
+        return result
+sale_order()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'delivery_weight/stock.py'
--- delivery_weight/stock.py	1970-01-01 00:00:00 +0000
+++ delivery_weight/stock.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,35 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2009 Numérigraphe SARL.
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv
+
+# Add a method to estimate the weight
+class stock_picking(osv.osv):
+    _inherit = 'stock.picking'
+
+    def estimate_weight(self, cr, uid, ids, *args):
+        pickings = self.browse(cr, uid, ids)
+        for picking in pickings:
+            weight = 0.0
+            for move in picking.move_lines:
+                weight += move.product_id.weight * move.product_qty / move.product_uom.factor  
+                self.write(cr, uid, picking.id, {'weight': weight, })
+        return True
+stock_picking()

=== added file 'delivery_weight/stock_view.xml'
--- delivery_weight/stock_view.xml	1970-01-01 00:00:00 +0000
+++ delivery_weight/stock_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<!-- add a button to estimate the weight -->
+		<record id="delivery_weight_picking_out_form" model="ir.ui.view">
+			<field name="name">delivery_weight.picking.out.form.view</field>
+			<field name="type">form</field>
+			<field name="model">stock.picking</field>
+			<field name="inherit_id" ref="delivery.view_picking_withcarrier_out_form" />
+			<field name="arch" type="xml">
+				<field name="weight" position="replace">
+					<group col="4" colspan="2">
+						<field name="weight" />
+						<button name="estimate_weight" string="Estimate" type="object" />
+					</group>
+				</field>
+			</field>
+		</record>
+	</data>
+</openerp>

=== added directory 'document_product'
=== added file 'document_product/__init__.py'
--- document_product/__init__.py	1970-01-01 00:00:00 +0000
+++ document_product/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,26 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import product
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'document_product/__terp__.py'
--- document_product/__terp__.py	1970-01-01 00:00:00 +0000
+++ document_product/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'Product Document Management System',
+    'version': '1.0',
+    'category': 'Generic Modules/Others',
+    'description': """This is a module which extended from document module:
+    * Display product name+varient as a directory name in FTP Client like '[varient] name'
+    
+""",
+    'author': 'Tiny',
+    'website': 'http://www.openerp.com',
+    'depends': ['base', 'document','product'],
+    'init_xml': [],
+    'update_xml': [],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,    
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'document_product/product.py'
--- document_product/product.py	1970-01-01 00:00:00 +0000
+++ document_product/product.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,53 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+class product(osv.osv):
+    _inherit = 'product.product'
+    def dir_name_search(self,cr, uid, obj, name, args):
+        if name=='dirname':
+            where=' where '
+            for arg in args:
+                where+='%s %s %s'%(arg[0],arg[1],arg[2])
+            cr.execute('select id from product_product %s '%where)
+            res = cr.fetchall()
+            return res
+        return None
+    def get_dir_name(self, cr, uid, ids, name, arg, context):
+        value={} 
+        for id in ids:
+            value[id]=''        
+        if name=='dirname':
+            results = self.browse(cr, uid, ids, context=context)        
+            for res in results:
+                dirname = ''   
+                if res.variants:
+                   dirname += '[' + res.variants + '] '
+                if res.name:                   
+                   dirname += res.name 
+                value[res.id] = dirname        
+        return value
+
+    _columns = {
+         'dirname': fields.function(get_dir_name,type="char",size=64,fnct_search=dir_name_search,string='Directory Name',method=True,store=True),
+    }
+product()  

=== added directory 'ecotaxe'
=== added file 'ecotaxe/README'
--- ecotaxe/README	1970-01-01 00:00:00 +0000
+++ ecotaxe/README	2009-11-23 15:50:46 +0000
@@ -0,0 +1,24 @@
+Explication sur l'ecotaxe appelée aussi ecoparticipation:
+---------------------------------------------------------
+
+	L'état français a mis cette taxe en application pour le recyclage de produits nécessitant un coût élevé. Cette taxe est payée au final par le client pour financer le recyclage du produit qu'il achète lorsque celui-ci sera en panne.
+Le fabricant fixe le montant de l'ecotaxe; pour ce faire, il choisit l'organisme de recyclage du produit (DEEE). Le prix de l'ecotaxe pour un même produit peut varier en fonction de l'organisme de recyclage. Chaques acteurs situés entre le fabricant et le client final payent donc l'ecotaxe dans le prix d'achat du produit : le prix HT + le montant de l'ecotaxe auquel s'applique la TVA.
+
+	Dans la chaîne de distribution on distingue 2 acteurs : les fournisseurs et les distributeurs. Le cas des fournisseurs est un peu spécifique. Un fournisseur qui est importateur de produits en France devient alors pour la loi de l'ecotaxe un producteur. Dans ce cas présent, c'est le fournisseur qui choisit l'organisme de collecte et donc le prix de l'ecotaxe.
+	Le distributeur achète son produit chez le fournisseur, il paye son produit et l'ecotaxe de celui-ci. D'un point de vue comptable, l'ecotaxe n'est pas considérée comme une taxe mais une participation pour le recyclage, il n'y a donc pas de compte spécifique pour enregistrer des écritures de l'ecotaxe lors d'une vente. On considère que l'ecotaxe est incluse dans le prix de vente du produit. Un distributeur pour un même produit peut avoir plusieurs fournisseurs, le prix du produit peut donc varier par le prix HT unitaire du produit mais aussi par le montant de l'ecotaxe. 
+
+	Le distributeur vend ensuite le produit au client final. Le client final va payer l'ecotaxe sur le produit comme les autres acteurs de la chaîne de distribution. L'obligation des textes de loi est de faire apparaître sur la facture une ligne indiquant l'ecotaxe. Cette ligne + le montant HT nous donne associé à la TVA le montant TTC.
+
+	Obligation des distributeurs sur la reprise des produits ; lorsqu'une vente est faite, le distributeur est obligé de reprendre un produit équivalent usagé. Le distributeur contactera alors l'organisme chargé de la collecte pour prendre ces produits.
+
+	Donc pour résumer : le fournisseur choisit son organisme, fixe l'ecotaxe et la reverse à l'organisme choisi. Tous les acteurs de la chaîne de distribution payent cette ecotaxe et la répercutent sur la vente de leurs produits. C'est donc le client final qui paye celle-ci. 
+
+
+Installation:
+-------------
+
+	Le module Ecotaxe s'intalle par le menu d'administration des modules. Après installation il faut renseigner dans les fiches produits les listes de prix des fournisseurs. Ces listes de prix contiennent un champs supplémentaire dénommé 'eco participation', c'est le champs qui correspond à l'écotaxe du produit.
+	
+	Lors d'une remise (discount), le montant soumis à la déduction est le prix unitaire x quantité . On ajoute l'eco participation x quantité après la déduction.
+
+	Pour imprimer une commande, un devis, une facture, veuillez utiliser le bouton 'imprimer' ayant ma mention '(ECOT)', il vous permettra d'imprimer vos documents avec les eco participations.

=== added file 'ecotaxe/__init__.py'
--- ecotaxe/__init__.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,22 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import ecotaxe,ecotaxe_order,ecotaxe_invoice,ecotaxe_purchase
+import report

=== added file 'ecotaxe/__terp__.py'
--- ecotaxe/__terp__.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,27 @@
+{
+	"name" : "Module for 'Eco participation'",
+	"version" : "1.0",
+	"author" : "Sednacom",
+	"category" : "Generic Modules/Others",
+	"website": "http://www.sednacom.fr";,
+	"module": "",
+	"description": """'Eco participation' management
+
+This module adds the management of 'Eco participation' in TinyERP.
+
+'Eco participation', mostly known as 'Ecotaxe', is a french specificity; its purpose is to finance recycling of products with a high cost of treatment.
+
+Install this module if you need to manage 'Eco participation' in your business.
+
+Module features:
+ - amount of 'Eco participation' for product by producer
+ - 'Eco participation' management in sale orders, purchases orders and invoices.
+
+	""",
+	"depends" : ["base","product","sale","purchase","l10n_fr"],
+	"init_xml" : [],
+	"update_xml" : ["ecotaxe_view.xml"],
+	"demo_xml" : [], 
+	"active": False,
+	"installable": True
+}

=== added file 'ecotaxe/ecotaxe.py'
--- ecotaxe/ecotaxe.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/ecotaxe.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,61 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import osv, fields
+
+
+class product_product(osv.osv):
+	_name = "product.product"
+	_inherit = "product.product"
+	_description = "eco participation"
+
+	def _calc_seller_ecotaxe(self, cr, uid, ids, name, arg, context={}):
+		result = {}
+		for product in self.browse(cr, uid, ids, context):
+			if product.seller_ids:
+				result[product.id] = product.seller_ids[0].ecotaxe
+			else:
+				result[product.id] = 0.00
+		return result
+
+
+
+
+	_columns = {
+		'ecotaxe' : fields.function(_calc_seller_ecotaxe, method=True, type='float', string='Eco Participation'),
+	}
+	_defaults = {
+		'ecotaxe': lambda *a : 0.00,
+	}
+product_product()
+
+class product_supplierinfo(osv.osv):
+	_name = "product.supplierinfo"
+	_inherit = "product.supplierinfo"
+	_description = "eco participation"
+	_columns = {
+		'ecotaxe' : fields.float('Eco participation'),
+	}
+	_defaults = {
+		'ecotaxe': lambda *a : 0.00,
+	}
+product_supplierinfo()
+
+

=== added file 'ecotaxe/ecotaxe_invoice.py'
--- ecotaxe/ecotaxe_invoice.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/ecotaxe_invoice.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,122 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import osv, fields
+from tools import config
+
+class account_invoice(osv.osv):
+	def _amount_ecotaxe(self, cr, uid, ids, name, args, context={}):
+		id_set=",".join(map(str,ids))
+		cr.execute("SELECT s.id,COALESCE(SUM(l.ecotaxe_invoice*l.quantity))::decimal(16,2) AS amount FROM account_invoice s LEFT OUTER JOIN account_invoice_line l ON (s.id=l.invoice_id) WHERE s.id IN ("+id_set+") GROUP BY s.id ")
+		res=dict(cr.fetchall())
+		return res
+
+	def _amount_untaxed(self, cr, uid, ids, name, args, context={}):
+		res = super(account_invoice, self)._amount_untaxed(cr, uid, ids, name, args, context)
+		res1 =  self._amount_ecotaxe( cr, uid, ids, name, args, context)
+		for id in ids:
+			if res1.get(id,0.0): 
+				res[id] = res[id] + res1.get(id,0.0) 				
+		return res
+
+	
+	_name = "account.invoice"
+	_inherit = "account.invoice"
+	_description = 'eco participation Invoice'
+	_columns = {
+		'amount_ecotaxe': fields.function(_amount_ecotaxe, method=True, digits=(16,2),string='Eco Part.'),
+		'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount (with ecopart.)', store=True),
+	}
+account_invoice()
+
+class account_invoice_line(osv.osv):
+
+	def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict):
+		res = super(account_invoice_line, self)._amount_line(cr, uid, ids, prop, unknow_none,unknow_dict)
+		for line in self.browse(cr, uid, ids):
+			res[line.id] += line.ecotaxe_invoice * line.quantity 
+		return res
+
+	_name = "account.invoice.line"
+	_inherit = "account.invoice.line"
+	_description = "Eco participation"
+
+	_columns = {
+		'ecotaxe_invoice': fields.float('Eco Part'),
+		'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
+		}
+	def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, price_unit=False, address_invoice_id=False, context={}):
+		res = super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qt, name, type, partner_id, price_unit, address_invoice_id, context)
+		res2 = self.pool.get('product.product').browse(cr, uid, product)		
+		res['value']['ecotaxe_invoice']=res2.ecotaxe
+		print res
+		return res
+
+
+account_invoice_line()
+
+
+class account_invoice_tax(osv.osv):
+	_name = "account.invoice.tax"
+	_description = "Invoice Tax"
+	_inherit = "account.invoice.tax"
+
+	def compute(self, cr, uid, invoice_id):	
+		tax_grouped = {}
+		tax_obj = self.pool.get('account.tax')
+		cur_obj = self.pool.get('res.currency')
+		inv = self.pool.get('account.invoice').browse(cr, uid, invoice_id)
+		cur = inv.currency_id
+
+		for line in inv.invoice_line:
+			for tax in tax_obj.compute(cr, uid, line.invoice_line_tax_id, (line.price_unit* (1-(line.discount or 0.0)/100.0)+line.ecotaxe_invoice), line.quantity, inv.address_invoice_id.id, line.product_id, inv.partner_id):
+				val={}
+				val['invoice_id'] = inv.id
+				val['name'] = tax['name']
+				val['amount'] = cur_obj.round(cr, uid, cur, tax['amount'])
+				val['manual'] = False
+				val['sequence'] = tax['sequence']
+				val['base'] = tax['price_unit'] * line['quantity'] * (1-(line.discount or 0.0)/100.0)
+
+				if inv.type in ('out_invoice','in_invoice'):
+					val['base_code_id'] = tax['base_code_id']
+					val['tax_code_id'] = tax['tax_code_id']
+					val['base_amount'] = val['base'] * tax['base_sign']
+					val['tax_amount'] = val['amount'] * tax['tax_sign']
+					val['account_id'] = tax['account_collected_id'] or line.account_id.id
+				else:
+					val['base_code_id'] = tax['ref_base_code_id']
+					val['tax_code_id'] = tax['ref_tax_code_id']
+					val['base_amount'] = val['base'] * tax['ref_base_sign']
+					val['tax_amount'] = val['amount'] * tax['ref_tax_sign']
+					val['account_id'] = tax['account_paid_id'] or line.account_id.id
+
+				key = (val['tax_code_id'], val['base_code_id'], val['account_id'])
+				if not key in tax_grouped:
+					tax_grouped[key] = val
+				else:
+					tax_grouped[key]['amount'] += val['amount']
+					tax_grouped[key]['base'] += val['base']
+					tax_grouped[key]['base_amount'] += val['base_amount']
+					tax_grouped[key]['tax_amount'] += val['tax_amount']
+
+		return tax_grouped
+account_invoice_tax()
+

=== added file 'ecotaxe/ecotaxe_order.py'
--- ecotaxe/ecotaxe_order.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/ecotaxe_order.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import osv, fields
+from tools import config
+
+class sale_order_line(osv.osv):
+
+	def _amount_line_net(self, cr, uid, ids, field_name, arg, context):
+		res = super(sale_order_line, self)._amount_line_net(cr, uid, ids, field_name, arg, context)	
+		for line in self.browse(cr, uid, ids):
+			res[line.id] += line.ecotaxe_order
+		return res
+
+	def _amount_line(self, cr, uid, ids, field_name, arg, context):
+		res = super(sale_order_line, self)._amount_line(cr, uid, ids, field_name, arg, context)
+		for line in self.browse(cr, uid, ids):
+			res[line.id] += line.ecotaxe_order * line.product_uom_qty
+		return res
+
+
+	_name = "sale.order.line"
+	_inherit = "sale.order.line"
+	_description = "eco participation"
+
+	_columns = {
+		'ecotaxe_order' : fields.float('Eco part'),
+		'price_net': fields.function(_amount_line_net, method=True, string='Net Price', digits=(16, int(config['price_accuracy']))),
+		'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),
+		}
+	_defaults = {
+		'ecotaxe_order': lambda *a : 0.00,
+	}
+
+
+	def product_id_change(self, cr, uid, ids, pricelist, product, qty=0, uom=False, qty_uos=0, uos=False, name='', partner_id=False, lang=False, update_tax=True, date_order=False):
+		res = super(sale_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order)
+		if product:
+			res2 = self.pool.get('product.product').browse(cr, uid, product)		
+			res['value']['ecotaxe_order']=res2.ecotaxe
+		else:
+			res['value']['ecotaxe_order']=0.00	
+		return res
+	
+	def invoice_line_create(self, cr, uid, ids, context={}):
+		def _get_line_qty(line):
+			if (line.order_id.invoice_quantity=='order') or not line.procurement_id:
+				return line.product_uos_qty or line.product_uom_qty
+			else:
+				return self.pool.get('mrp.procurement').quantity_get(cr, uid, line.procurement_id.id, context)
+		create_ids = []
+		for line in self.browse(cr, uid, ids, context):
+			if not line.invoiced:
+				if line.product_id:
+					a =  line.product_id.product_tmpl_id.property_account_income.id
+					if not a:
+						a = line.product_id.categ_id.property_account_income_categ.id
+					if not a:
+						raise osv.except_osv('Error !', 'There is no income account defined for this product: "%s" (id:%d)' % (line.product_id.name, line.product_id.id,))
+				else:
+					a = self.pool.get('ir.property').get(cr, uid, 'property_account_income_categ', 'product.category', context=context)
+				uosqty = _get_line_qty(line)
+				uos_id = (line.product_uos and line.product_uos.id) or line.product_uom.id
+				pu = line.price_unit
+				if line.product_uos_qty:
+					pu = round(pu * line.product_uom_qty / line.product_uos_qty, int(config['price_accuracy']))
+				inv_id = self.pool.get('account.invoice.line').create(cr, uid, {
+					'name': line.name,
+					'account_id': a,
+					'price_unit': pu,
+					'quantity': uosqty,
+					'discount': line.discount,
+					'uos_id': uos_id,
+					'product_id': line.product_id.id or False,
+					'invoice_line_tax_id': [(6,0,[x.id for x in line.tax_id])],
+					'note': line.notes,
+					'account_analytic_id': line.order_id.project_id.id,
+					'ecotaxe_invoice':line.ecotaxe_order
+				})
+				cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%d,%d)', (line.id, inv_id))
+				self.write(cr, uid, [line.id], {'invoiced':True})
+				create_ids.append(inv_id)
+		return create_ids				
+
+sale_order_line()
+
+class sale_order(osv.osv):
+	_name = "sale.order"
+	_inherit = "sale.order"
+	_description = "eco participation"
+
+	def _amount_ecotaxe(self, cr, uid, ids, field_name, arg, context):
+		res2 = {}
+		cur_obj=self.pool.get('res.currency')
+		for sale in self.browse(cr, uid, ids):
+			res2[sale.id] = 0.0
+			for line in sale.order_line:				
+				res2[sale.id] += line.ecotaxe_order * line.product_uom_qty
+			cur = sale.pricelist_id.currency_id
+			res2[sale.id] = cur_obj.round(cr, uid, cur, res2[sale.id])
+		return res2
+
+	
+
+	def _amount_tax(self, cr, uid, ids, field_name, arg, context):
+		res=super(sale_order, self)._amount_tax(cr, uid, ids, field_name, arg, context)
+		res2={}
+		cur_obj=self.pool.get('res.currency')
+		for sale in self.browse(cr, uid, ids):
+			val = 0.0
+			cur=sale.pricelist_id.currency_id
+			for line in sale.order_line:
+				for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.ecotaxe_order, line.product_uom_qty, sale.partner_invoice_id.id, line.product_id, sale.partner_id):
+					val+= cur_obj.round(cr, uid, cur, c['amount'])
+			res2[sale.id]=cur_obj.round(cr, uid, cur, val)
+		for id in ids:
+			if res2.get(id,0.0):
+				res[id] = res[id] + res2.get(id,0.0) 
+		return res
+
+	
+
+	
+
+
+
+	_columns = {
+		'amount_ecotaxe': fields.function(_amount_ecotaxe, method=True, string='Ecotaxe'),
+		'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),		
+	}
+sale_order()
+

=== added file 'ecotaxe/ecotaxe_purchase.py'
--- ecotaxe/ecotaxe_purchase.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/ecotaxe_purchase.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,149 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+from osv import osv, fields
+from tools import config
+from mx import DateTime
+
+class purchase_order(osv.osv):
+	def _amount_ecotaxe(self, cr, uid, ids, prop, unknow_none, unknow_dict):
+		res = {}
+		for order in self.browse(cr, uid, ids):
+			res[order.id] = 0
+			for oline in order.order_line:
+				res[order.id] += oline.ecotaxe_purchase * oline.product_qty
+		return res	
+
+	def _calc_amount(self, cr, uid, ids, prop, unknow_none, unknow_dict):
+		res = {}
+		for order in self.browse(cr, uid, ids):
+			res[order.id] = 0
+			for oline in order.order_line:
+				res[order.id] += (oline.price_unit + oline.ecotaxe_purchase) * oline.product_qty
+		return res
+
+	def _amount_tax(self, cr, uid, ids, field_name, arg, context):
+		res = super(purchase_order, self)._amount_tax(cr, uid, ids, field_name, arg, context)		
+		res2 = {}
+		cur_obj=self.pool.get('res.currency')
+		for order in self.browse(cr, uid, ids):
+			val = 0.0
+			cur=order.pricelist_id.currency_id
+			for line in order.order_line:
+				for c in self.pool.get('account.tax').compute(cr, uid, line.taxes_id, line.ecotaxe_purchase, line.product_qty, order.partner_address_id.id, line.product_id, order.partner_id):
+					val+= cur_obj.round(cr, uid, cur, c['amount'])
+			res2[order.id]=cur_obj.round(cr, uid, cur, val)
+		for id in ids:
+			if res2.get(id,0.0):
+				res[id] = res[id] + res2.get(id,0.0) 
+		return res
+
+	def _amount_untaxed(self, cr, uid, ids, field_name, arg, context):
+		res = super(purchase_order, self)._amount_untaxed(cr, uid, ids, field_name, arg, context)
+		return res	
+	_columns = {		
+		'amount_ecotaxe': fields.function(_amount_ecotaxe, method=True, string='Ecotaxe'),
+		'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
+		'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount (with ecopart.)'),	
+	}
+	
+	_name = "purchase.order"
+	_inherit = "purchase.order"
+	_description = "Purchase order with Eco participation"
+	_order = "name desc"
+
+	def action_invoice_create(self, cr, uid, ids, *args):
+		res = False
+		for o in self.browse(cr, uid, ids):
+			il = []
+			for ol in o.order_line:
+
+				if ol.product_id:
+					a = ol.product_id.product_tmpl_id.property_account_expense.id
+					if not a:
+						a = ol.product_id.categ_id.property_account_expense_categ.id
+					if not a:
+						raise osv.except_osv('Error !', 'There is no income account defined for this product: "%s" (id:%d)' % (line.product_id.name, line.product_id.id,))
+				else:
+					a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
+				il.append((0, False, {
+					'name': ol.name,
+					'account_id': a,
+					'price_unit': ol.price_unit or 0.0,
+					'quantity': ol.product_qty,
+					'product_id': ol.product_id.id or False,
+					'uos_id': ol.product_uom.id or False,
+					'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])],
+					'account_analytic_id': ol.account_analytic_id.id,
+					'ecotaxe_invoice' : ol.ecotaxe_purchase,					
+				}))
+
+			a = o.partner_id.property_account_payable.id
+			inv = {
+				'name': o.name,
+				'reference': "P%dPO%d" % (o.partner_id.id, o.id),
+				'account_id': a,
+				'type': 'in_invoice',
+				'partner_id': o.partner_id.id,
+				'currency_id': o.pricelist_id.currency_id.id,
+				'address_invoice_id': o.partner_address_id.id,
+				'address_contact_id': o.partner_address_id.id,
+				'origin': o.name,
+				'invoice_line': il,
+			}
+			inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
+			self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)
+
+			self.write(cr, uid, [o.id], {'invoice_id': inv_id})
+			res = inv_id
+		return res
+
+purchase_order()
+
+class purchase_order_line(osv.osv):
+	def _amount_line(self, cr, uid, ids, prop, unknow_none,unknow_dict):
+		res = super(purchase_order_line, self)._amount_line(cr, uid, ids, prop, unknow_none,unknow_dict)
+		for line in self.browse(cr, uid, ids):
+			res[line.id] += line.ecotaxe_purchase * line.product_qty
+		return res
+	
+	_columns = {
+		'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal'),		
+		'ecotaxe_purchase': fields.float('Ecotaxe', required=True, digits=(16,2)),
+		}
+	_defaults = {
+		'ecotaxe_purchase': lambda *a: 0.00
+	}
+	_table = 'purchase_order_line'
+	_name = 'purchase.order.line'
+	_inherit = 'purchase.order.line'
+	_description = 'Purchase Order line with Eco participation'
+	
+	def product_id_change(self, cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order=False):
+		res = super(purchase_order_line, self).product_id_change(cr, uid, ids, pricelist, product, qty, uom, partner_id, date_order)
+		if product:
+			res2 = self.pool.get('product.product').browse(cr, uid, product)		
+			res['value']['ecotaxe_purchase']=res2.ecotaxe
+		else:
+			res['value']['ecotaxe_purchase']=0.00	
+		return res		
+
+
+purchase_order_line()

=== added file 'ecotaxe/ecotaxe_view.xml'
--- ecotaxe/ecotaxe_view.xml	1970-01-01 00:00:00 +0000
+++ ecotaxe/ecotaxe_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,258 @@
+<terp>
+
+     <data>
+               <!-- ajout champ ecotaxe tree produit -->
+              <record model="ir.ui.view" id="product_product_tree_view">
+			<field name="name">product.product.tree</field>
+			<field name="model">product.product</field>
+			<field name="inherit_id" ref="product.product_product_tree_view" />
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Products" colors="red:virtual_available&lt;0;blue:state in ['draft', 'end', 'obsolete']">
+					<field name="ecotaxe"/>
+				</tree>
+			</field>
+		</record>
+            
+            <!-- ajout champ eco dans le tree product variant -->
+           <record model="ir.ui.view" id="product_variant_tree_view">
+                   <field name="name">product.variant.tree</field>
+                   <field name="model">product.product</field>
+		   <field name="inherit_id" ref="product.product_variant_tree_view" />
+		   <field name="type">tree</field>
+                   <field name="arch" type="xml">
+                   	<tree string="Product Variant">
+                    		<field name="ecotaxe"/>
+			</tree>
+		   </field>
+	   </record>
+
+	   <!-- ajout champ eco dans le form product variant -->
+           <record model="ir.ui.view" id="product_variant_form_view">
+			<field name="name">product.variant.form</field>
+			<field name="model">product.product</field>
+			<field name="inherit_id" ref="product.product_variant_form_view" />
+                        <field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Product Variant">
+					<field name="ecotaxe"/>
+				</form>
+			</field>
+		</record>
+
+           <!-- ajout champ eco detail commande -->
+   	   <record model="ir.ui.view" id="view_order_line_tree">
+		<field name="name">sale.order.line.tree</field>
+		<field name="model">sale.order.line</field>
+		<field name="inherit_id" ref="sale.view_order_line_tree" />
+		<field name="type">tree</field>
+		<field name="arch" type="xml">
+				<field name="price_unit" position="before" >
+					<field name="ecotaxe_order"/>
+				</field>
+		</field>
+	  </record>
+
+	<record model="ir.ui.view" id="product_supplierinfo_form_view">
+		<field name="name">product.supplierinfo.form.view</field>
+		<field name="model">product.supplierinfo</field>
+		<field name="inherit_id" ref="product.product_supplierinfo_form_view" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field name="delay" position="after">
+				<field name="ecotaxe"/>
+			</field>
+		</field>
+	</record>
+		<record model="ir.ui.view" id="product_supplierinfo_tree_view">
+			<field name="name">product.supplierinfo.tree.view</field>
+			<field name="model">product.supplierinfo</field>
+			<field name="inherit_id" ref="product.product_supplierinfo_tree_view" />
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<field name="delay" position="after">
+					<field name="ecotaxe"/>
+				</field>
+			</field>
+		</record>
+
+
+	<record model="ir.ui.view" id="view_order_line_form2">
+		<field name="name">sale.order.line.form2</field>
+		<field name="model">sale.order.line</field>
+		<field name="inherit_id" ref="sale.view_order_line_form2" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+				<field position="before" name="discount">
+					<field name="ecotaxe_order"/>
+				</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="view_order_form">
+		<field name="name">sale.order.form</field>
+		<field name="model">sale.order</field>
+		<field name="inherit_id" ref="sale.view_order_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field position="before" name="discount">
+				<field name="ecotaxe_order" />
+			</field>
+		</field>
+	</record>
+	<record model="ir.ui.view" id="view_order_form2">
+		<field name="name">sale.order.form</field>
+		<field name="model">sale.order</field>
+		<field name="inherit_id" ref="sale.view_order_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field position="before" name="price_net">
+				<field name="ecotaxe_order" />
+			</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="view_order_form3">
+		<field name="name">sale.order.form</field>
+		<field name="model">sale.order</field>
+		<field name="inherit_id" ref="sale.view_order_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field position="after" name="amount_total">
+				<field name="amount_ecotaxe" />
+			</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="view_invoice_line_tree1">
+		<field name="name">account.invoice.line.tree</field>
+		<field name="model">account.invoice.line</field>
+		<field name="inherit_id" ref="account.view_invoice_line_tree" />	
+		<field name="type">tree</field>
+		<field name="arch" type="xml">
+			<field name="price_unit" position="before" >
+				<field name="ecotaxe_invoice"/>
+			</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="view_invoice_line_form1">
+		<field name="name">account.invoice.line.form</field>
+		<field name="model">account.invoice.line</field>
+		<field name="inherit_id" ref="account.view_invoice_line_form" />	
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field name="price_unit" position="before" >
+				<field name="ecotaxe_invoice"/>
+			</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="invoice_supplier_form">
+		<field name="name">account.invoice.supplier.form</field>
+		<field name="model">account.invoice</field>
+		<field name="inherit_id" ref="account.invoice_supplier_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field name="price_unit" position="before" >
+				<field name="ecotaxe_invoice"/>
+			</field>
+
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="invoice_supplier_form2">
+		<field name="name">account.invoice.supplier.form</field>
+		<field name="model">account.invoice</field>
+		<field name="inherit_id" ref="account.invoice_supplier_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+				<button name="invoice_cancel" position="replace" >
+					<field name="amount_ecotaxe"/>
+					<button name="invoice_cancel" states="draft,proforma,sale,open" string="Cancel"/>
+				</button>
+		</field>
+	</record>
+	
+	<record model="ir.ui.view" id="invoice_form2">
+		<field name="name">account.invoice.form</field>
+		<field name="model">account.invoice</field>
+		<field name="inherit_id" ref="account.invoice_form" />
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+				<button name="invoice_cancel" position="replace" >
+					<field name="amount_ecotaxe"/>
+					<button name="invoice_cancel" states="draft,proforma,sale,open" string="Cancel"/>
+				</button>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="purchase_order_line_form2">
+		<field name="name">purchase.order.line.form</field>
+		<field name="model">purchase.order.line</field>
+		<field name="inherit_id" ref="purchase.purchase_order_line_form"/>  
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+			<field name="price_subtotal" position="before">
+				<field name="ecotaxe_purchase"/>
+			</field>
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="purchase_order_line_tree2">
+		<field name="name">purchase.order.line.tree</field>
+		<field name="model">purchase.order.line</field>
+		<field name="inherit_id" ref="purchase.purchase_order_line_tree"/>
+		<field name="type">tree</field>
+		<field name="arch" type="xml">
+			<field name="price_subtotal" position="before">
+				<field name="ecotaxe_purchase"/>
+			</field>	
+		</field>
+	</record>
+
+	<record model="ir.ui.view" id="purchase_order_form2">
+		<field name="name">purchase.order.form</field>
+		<field name="model">purchase.order</field>
+		<field name="inherit_id" ref="purchase.purchase_order_form"/>
+		<field name="type">form</field>
+		<field name="arch" type="xml">
+				<button name="purchase_confirm" position="replace" >
+					<field name="amount_ecotaxe"/>
+					<button name="purchase_confirm" states="draft" string="Confirm Purchase Order"/>
+				</button>
+			
+		</field>
+	</record>
+
+
+	<report id="account_invoices" 
+			string="Invoices (Ecot)" 
+			model="account.invoice" 
+			name="account.invoice.ecotaxe" 
+			rml="ecotaxe/report/invoice.rml"
+			sxw="ecotaxe/report/invoice.sxw"
+			auto="False"/>
+
+     	<report
+		id="report_sale_order"
+		string="Print Order (Ecot)"
+		model="sale.order"
+		name="sale.order.ecotaxe"
+		rml="ecotaxe/report/order.rml"
+		sxw="ecotaxe/report/order.sxw"
+		auto="False"/>
+
+	
+	     	<report
+		id="report_purchase_order"
+		string="Print Order (Ecot)"
+		model="purchase.order"
+		name="purchase.order.ecotaxe"
+		rml="ecotaxe/report/purchase.rml"
+		sxw="ecotaxe/report/purchase.sxw"
+		auto="False"/>
+
+	</data>
+
+</terp> 

=== added directory 'ecotaxe/i18n'
=== added file 'ecotaxe/i18n/fr_FR.csv'
--- ecotaxe/i18n/fr_FR.csv	1970-01-01 00:00:00 +0000
+++ ecotaxe/i18n/fr_FR.csv	2009-11-23 15:50:46 +0000
@@ -0,0 +1,51 @@
+field,"account.invoice,amount_ecotaxe",0,Eco Part.,Eco Part.
+field,"account.invoice.line,ecotaxe_invoice",0,Eco Part,Eco Part.
+field,"product.product,ecotaxe",0,Eco participation,Eco participation
+field,"sale.order,amount_ecotaxe",0,Ecotaxe,Ecotaxe
+field,"sale.order.line,ecotaxe_order",0,Eco part,Eco Part.
+rml,account.invoice.ecotaxe,0,Tel. :,Tel. :
+rml,account.invoice.ecotaxe,0,Fax :,Fax :
+rml,account.invoice.ecotaxe,0,VAT :,TVA :
+rml,account.invoice.ecotaxe,0,Invoice,Facture
+rml,account.invoice.ecotaxe,0,Refund,Remboursement
+rml,account.invoice.ecotaxe,0,Supplier Refund,Remboursement Fournisseur
+rml,account.invoice.ecotaxe,0,Supplier Invoice,Facture Fournisseur
+rml,account.invoice.ecotaxe,0,Document,Document
+rml,account.invoice.ecotaxe,0,:,
+rml,account.invoice.ecotaxe,0,Invoice Date:,Date Facture
+rml,account.invoice.ecotaxe,0,Customer Ref:,Client Ref
+rml,account.invoice.ecotaxe,0,Description,Description
+rml,account.invoice.ecotaxe,0,Taxes,Taxes
+rml,account.invoice.ecotaxe,0,Quantity,Quantités
+rml,account.invoice.ecotaxe,0,Unit Price,Prix Unitaire
+rml,account.invoice.ecotaxe,0,Disc. (%),Esc. (%)
+rml,account.invoice.ecotaxe,0,Price,Prix
+rml,account.invoice.ecotaxe,0,Tax,Taxe
+rml,account.invoice.ecotaxe,0,Base,Base
+rml,account.invoice.ecotaxe,0,Amount,Montant
+rml,account.invoice.ecotaxe,0,Total (excl. taxes):,Total HT:
+rml,account.invoice.ecotaxe,0,Taxes:,Taxes:
+rml,account.invoice.ecotaxe,0,Eco Part.:,Eco Part.:
+rml,account.invoice.ecotaxe,0,Total,Total
+rml,account.invoice.ecotaxe,0,(incl. taxes):,(incl. taxes):
+rml,sale.order.ecotaxe,0,Shipping address :,adresse livraison
+rml,sale.order.ecotaxe,0,Invoice address :,adresse facturation
+rml,sale.order.ecotaxe,0,Tel. :,Tel. :
+rml,sale.order.ecotaxe,0,Fax :,Fax :
+rml,sale.order.ecotaxe,0,VAT :,TVA :
+rml,sale.order.ecotaxe,0,Quotation N° :,Devis N° :
+rml,sale.order.ecotaxe,0,Order N° :,Commande N° :
+rml,sale.order.ecotaxe,0,Your order reference :,Votre référence commande :
+rml,sale.order.ecotaxe,0,Date ordered :, Date commande :
+rml,sale.order.ecotaxe,0,Our salesman :,votre vendeur :
+rml,sale.order.ecotaxe,0,Product Description,Description du produit
+rml,sale.order.ecotaxe,0,Applicable Taxes,Taxes applicables
+rml,sale.order.ecotaxe,0,Qty,Qté
+rml,sale.order.ecotaxe,0,Disc.,Esc.
+rml,sale.order.ecotaxe,0,Unit Price,Prix Unitaire
+rml,sale.order.ecotaxe,0,Net Price,Prix Net
+rml,sale.order.ecotaxe,0,Net Total :,Total Net :
+rml,sale.order.ecotaxe,0,Taxes :,Taxes :
+rml,sale.order.ecotaxe,0,Eco Part. :,Eco Part. :
+rml,sale.order.ecotaxe,0,TOTAL :,TOTAL :
+

=== added directory 'ecotaxe/report'
=== added file 'ecotaxe/report/__init__.py'
--- ecotaxe/report/__init__.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,24 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import order
+import invoice
+import purchase
+

=== added file 'ecotaxe/report/invoice.py'
--- ecotaxe/report/invoice.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/invoice.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time
+from report import report_sxw
+
+class account_invoice(report_sxw.rml_parse):
+	def __init__(self, cr, uid, name, context):
+		super(account_invoice, self).__init__(cr, uid, name, context)
+		self.localcontext.update({
+			'time': time,
+		})
+report_sxw.report_sxw('report.account.invoice.ecotaxe', 'account.invoice', 'addons/ecotaxe/report/invoice.rml', parser=account_invoice)
+

=== added file 'ecotaxe/report/invoice.rml'
--- ecotaxe/report/invoice.rml	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/invoice.rml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,285 @@
+<?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="34.0" y1="28.0" width="527" height="786"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau6">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="GRID" colorName="black"/>
+      <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="3,0" stop="3,0"/>
+      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
+      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
+      <blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau7">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau8">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau3">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <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="Tableau4">
+      <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"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau5">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P2" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P3" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P5" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P9" fontName="Times-Italic" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P10" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P11" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P12" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P13" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P14" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
+    <paraStyle name="P15" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
+    <paraStyle name="P16" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
+    <paraStyle name="P17" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
+    <paraStyle name="P20" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="0.0"/>
+    <paraStyle name="P21" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P22" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P23" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P24" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Standard" fontName="Times-Roman"/>
+    <paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
+    <paraStyle name="Index" fontName="Times-Roman"/>
+  </stylesheet>
+  <story>
+    <para style="P1">[[ repeatIn(objects,'o') ]]</para>
+    <para style="P1">[[ setLang(o.partner_id.lang) ]]</para>
+    <blockTable colWidths="295.0,232.0" style="Tableau2">
+      <tr>
+        <td>
+          <para style="P2">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="Standard">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.street ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.street2 or '' ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
+          <para style="Standard">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
+          <para style="Standard">
+            <font color="white"> </font>
+          </para>
+          <para style="Standard">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
+          <para style="Standard">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
+          <para style="Standard">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P14">
+      <font color="white"> </font>
+    </para>
+    <para style="P16">
+      <font face="Times-Roman">Invoice [[ (o.type=='out_invoice' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman">Refund [[ (o.type=='out_refund' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman">[[ o.number ]]</font>
+    </para>
+    <para style="P15">
+      <font color="white"> </font>
+    </para>
+    <para style="P17">
+      <font face="Times-Roman">Document</font>
+      <font face="Times-Roman">:</font>
+      <font face="Times-Roman">[[o.name]]</font>
+    </para>
+    <para style="P17">
+      <font face="Times-Roman">Invoice Date: </font>
+      <font face="Times-Roman">[[o.date_invoice]]</font>
+    </para>
+    <para style="P18"><font face="Times-Roman">Customer Ref:</font> [[ o.address_invoice_id.partner_id.ref or '/' ]]</para>
+    <para style="Standard">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="196.0,57.0,57.0,57.0,46.0,46.0,67.0" style="Tableau6">
+      <tr>
+        <td>
+          <para style="P3">Description</para>
+        </td>
+        <td>
+          <para style="P4">Taxes</para>
+        </td>
+        <td>
+          <para style="P4">Quantity</para>
+        </td>
+        <td>
+          <para style="P4">Unit Price</para>
+        </td>
+        <td>
+          <para style="P4">Eco Part.</para>
+        </td>
+        <td>
+          <para style="P4">Disc. (%)</para>
+        </td>
+        <td>
+          <para style="P4">Price</para>
+        </td>
+      </tr>
+    </blockTable>
+    <section>
+      <para style="P20">[[repeatIn(o.invoice_line,'l') ]]</para>
+      <blockTable colWidths="197.0,57.0,57.0,57.0,46.0,46.0,67.0" style="Tableau7">
+        <tr>
+          <td>
+            <para style="Table Contents">[[ l.name ]]</para>
+          </td>
+          <td>
+            <para style="P6">[[ ', '.join([lt.name for lt in l.invoice_line_tax_id]) ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ '%.2f' % l.quantity ]] [[l.uos_id and l.uos_id.name or '' ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ '%.2f' % l.price_unit ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ '%.2f'%l.ecotaxe_invoice ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ l.discount and '%.2f' % (l.discount) or '' ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ '%.2f' %l.price_subtotal ]] [[o.currency_id.code ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      <blockTable colWidths="28.0,499.0" style="Tableau8">
+        <tr>
+          <td>
+            <para style="P21">[[ repeatIn((l.note and l.note.splitlines()) or [], 'note') ]]</para>
+          </td>
+          <td>
+            <para style="P9">[[ note or removeParentNode('table') ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <para style="Standard">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="215.0,313.0" style="Tableau3">
+      <tr>
+        <td>
+          <blockTable colWidths="81.0,73.0,60.0" style="Tableau4">
+            <tr>
+              <td>
+                <para style="P10">Tax</para>
+              </td>
+              <td>
+                <para style="P8">Base</para>
+              </td>
+              <td>
+                <para style="P8">Amount</para>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <para style="P5"><font face="Times-Roman">[[ repeatIn(o.tax_line,'t') ]]</font> [[ t.name ]]</para>
+              </td>
+              <td>
+                <para style="P11">[[ '%.2f' % t.base ]]</para>
+              </td>
+              <td>
+                <para style="P11">[[ '%.2f' % t.amount]]</para>
+              </td>
+            </tr>
+          </blockTable>
+        </td>
+        <td>
+          <blockTable colWidths="214.0,95.0" style="Tableau5">
+            <tr>
+              <td>
+                <para style="P7">Total (excl. taxes):</para>
+              </td>
+              <td>
+                <para style="P12">[[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]]</para>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <para style="P7">Taxes:</para>
+              </td>
+              <td>
+                <para style="P12">[[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]]</para>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <para style="P7">Eco Part.:</para>
+              </td>
+              <td>
+                <para style="P12">[[ '%.2f' % o.amount_ecotaxe ]] [[o.currency_id.code ]]</para>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <para style="P13">Total <font face="Times-Roman">(incl. taxes):</font></para>
+              </td>
+              <td>
+                <para style="P22">[[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="Table Contents">
+            <font color="white"> </font>
+          </para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P19">[[ format(o.comment or '') ]]</para>
+    <para style="P19">
+      <font color="white"> </font>
+    </para>
+    <para style="P19">[[ format((o.payment_term and o.payment_term.note) or '') ]]</para>
+  </story>
+</document>
+

=== added file 'ecotaxe/report/invoice.sxw'
Binary files ecotaxe/report/invoice.sxw	1970-01-01 00:00:00 +0000 and ecotaxe/report/invoice.sxw	2009-11-23 15:50:46 +0000 differ
=== added file 'ecotaxe/report/order.py'
--- ecotaxe/report/order.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/order.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time
+from report import report_sxw
+from osv import osv
+
+class order(report_sxw.rml_parse):
+	def __init__(self, cr, uid, name, context):
+		super(order, self).__init__(cr, uid, name, context)
+		self.localcontext.update({
+			'time': time,
+		})
+report_sxw.report_sxw('report.sale.order.ecotaxe','sale.order','addons/ecotaxe/report/order.rml',parser=order)

=== added file 'ecotaxe/report/order.rml'
--- ecotaxe/report/order.rml	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/order.rml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,285 @@
+<?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="34.0" y1="42.0" width="527" height="758"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau1">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="GRID" colorName="black"/>
+      <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="3,0" stop="3,0"/>
+      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
+      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
+      <blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau3">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau5">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau6">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau4">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11"/>
+    <paraStyle name="P2" fontName="Times-Roman"/>
+    <paraStyle name="P3" fontName="Times-Roman" alignment="LEFT"/>
+    <paraStyle name="P4" fontName="Times-Roman" alignment="LEFT"/>
+    <paraStyle name="P5" fontName="Times-Bold" fontSize="9.0" leading="11"/>
+    <paraStyle name="P6" fontName="Times-Bold" fontSize="9.0" leading="11"/>
+    <paraStyle name="P7" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
+    <paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P10" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P11" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P12" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P13" fontName="Times-Bold" fontSize="9.0" leading="11"/>
+    <paraStyle name="P14" fontName="Times-Roman" fontSize="10.0" leading="13"/>
+    <paraStyle name="P15" fontName="Times-Roman" fontSize="10.0" leading="13"/>
+    <paraStyle name="P16" fontName="Times-Roman" fontSize="4.0" leading="5"/>
+    <paraStyle name="P17" fontName="Times-Roman" fontSize="4.0" leading="5"/>
+    <paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P20" fontName="Times-Roman" fontSize="16.0" leading="20"/>
+    <paraStyle name="P21" fontName="Times-Bold" fontSize="8.0" leading="10"/>
+    <paraStyle name="P22" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
+    <paraStyle name="P23" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="RIGHT"/>
+    <paraStyle name="P24" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
+    <paraStyle name="P25" fontName="Times-Roman" fontSize="7.0" leading="9"/>
+    <paraStyle name="P26" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P27" fontName="Times-Roman" fontSize="7.0" leading="9"/>
+    <paraStyle name="P28" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P29" fontName="Times-Bold" fontSize="8.0" leading="10"/>
+    <paraStyle name="P30" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <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') ]] <font face="Times-Roman">[[ setLang(o.partner_id.lang) ]]</font></para>
+    <blockTable colWidths="257.0,50.0,220.0" style="Tableau1">
+      <tr>
+        <td>
+          <para style="P5">Shipping address :</para>
+          <para style="P14">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="P14">[[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]]</para>
+          <para style="P14">[[ o.partner_shipping_id.street ]]</para>
+          <para style="P14">[[ o.partner_shipping_id.street2 or '' ]]</para>
+          <para style="P15"><font face="Times-Roman">[[ o.partner_shipping_id.zip or '' ]]</font> [[ o.partner_shipping_id.city or '' ]]</para>
+          <para style="P15">[[ o.partner_shipping_id.state_id and o.partner_shipping_id.state_id.name or '' ]]</para>
+          <para style="P15">[[ o.partner_shipping_id.country_id and o.partner_shipping_id.country_id.name or '' ]]</para>
+          <para style="P16">
+            <font color="white"> </font>
+          </para>
+          <para style="P6">Invoice address :</para>
+          <para style="P15">[[ o.partner_invoice_id.street ]][[ o.partner_invoice_id.street2 and (', %s' % o.partner_invoice_id.street2 or '') ]]</para>
+          <para style="P15">[[ o.partner_invoice_id.zip or '' ]] [[ o.partner_invoice_id.city or '' ]] [[ o.partner_invoice_id.country_id and (', %s' % (o.partner_invoice_id.country_id and o.partner_invoice_id.country_id.name or '')) ]]</para>
+        </td>
+        <td>
+          <para style="P18">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P19">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="P19">[[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]]</para>
+          <para style="P19">[[ o.partner_order_id.street ]]</para>
+          <para style="P19">[[ o.partner_order_id.street2 or '' ]]</para>
+          <para style="P19">[[ o.partner_order_id.zip or '' ]] [[ o.partner_order_id.city or '' ]]</para>
+          <para style="P19">[[ o.partner_order_id.state_id and o.partner_order_id.state_id.name or '' ]]</para>
+          <para style="P19">[[ o.partner_order_id.country_id and o.partner_order_id.country_id.name or '' ]]</para>
+          <para style="P17">
+            <font color="white"> </font>
+          </para>
+          <para style="P14">Tel. : [[ o.partner_order_id.phone or removeParentNode('para') ]]</para>
+          <para style="P14">Fax : [[ o.partner_order_id.fax or removeParentNode('para') ]]</para>
+          <para style="P14">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P2">
+      <font color="white"> </font>
+    </para>
+    <para style="P20">[[ o.state&lt;&gt;'draft' and removeParentNode('para') ]] Quotation N° : [[ o.name ]]</para>
+    <para style="P20">[[ o.state=='draft' and removeParentNode('para') ]] Order N° : [[ o.name ]]</para>
+    <para style="P20">
+      <font color="white"> </font>
+    </para>
+    <para style="P26">Your order reference : [[ o.client_order_ref or '' ]]</para>
+    <para style="P26">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
+    <para style="P26">Our salesman : [[ o.user_id.name ]]</para>
+    <para style="P2">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="246.0,57.0,51.0,38.0,39.0,47.0,50.0" repeatRows="1" style="Tableau2">
+      <tr>
+        <td>
+          <para style="P21">Product Description</para>
+        </td>
+        <td>
+          <para style="P22">Applicable Taxes</para>
+        </td>
+        <td>
+          <para style="P23">Qty</para>
+        </td>
+        <td>
+          <para style="P21">Disc.</para>
+        </td>
+        <td>
+          <para style="P21">Eco Part.</para>
+        </td>
+        <td>
+          <para style="P21">Unit Price</para>
+        </td>
+        <td>
+          <para style="P21">Net Price</para>
+        </td>
+      </tr>
+    </blockTable>
+    <section>
+      <para style="P24">[[ repeatIn(o.order_line,'line') ]]</para>
+      <blockTable colWidths="255.0,59.0,53.0,30.0,30.0,49.0,51.0" style="Tableau3">
+        <tr>
+          <td>
+            <para style="P7">[[ line.name ]]</para>
+          </td>
+          <td>
+            <para style="P8">[[ ', '.join(map(lambda x: x.name, line.tax_id))]]</para>
+          </td>
+          <td>
+            <para style="P9">[[ '%.2f' % line.product_uos_qty or '%.2f' % line.product_uom_qty ]] [[ line.product_uos and line.product_uos.name or line.product_uom.name ]]</para>
+          </td>
+          <td>
+            <para style="P7">[[ (line.discount and str(line.discount)+'%')or '' ]]</para>
+          </td>
+          <td>
+            <para style="P7">[[ '%.2f' % line.ecotaxe_order ]]</para>
+          </td>
+          <td>
+            <para style="P9">[[ '%.2f' % line.price_unit ]]</para>
+          </td>
+          <td>
+            <para style="P9">[[ '%.2f' % line.price_subtotal ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      <blockTable colWidths="52.0,366.0,110.0" style="Tableau5">
+        <tr>
+          <td>
+            <para style="P10">[[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]]</para>
+          </td>
+          <td>
+            <para style="P11">[[ l or removeParentNode('table') ]]</para>
+          </td>
+          <td>
+            <para style="P10">
+              <font color="white"> </font>
+            </para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <blockTable colWidths="348.0,69.0,110.0" style="Tableau6">
+      <tr>
+        <td>
+          <para style="P27">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P28">Net Total :</para>
+        </td>
+        <td>
+          <para style="P28">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P27">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P28">Taxes :</para>
+        </td>
+        <td>
+          <para style="P28">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P27">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P28">Eco Part. :</para>
+        </td>
+        <td>
+          <para style="P28">[[ '%.2f' % o.amount_ecotaxe ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P25">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P12">TOTAL :</para>
+        </td>
+        <td>
+          <para style="P12">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P13">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="527.0" style="Tableau4">
+      <tr>
+        <td>
+          <para style="P3">[[ format(o.note or '') ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P3">[[ format((o.partner_id.property_payment_term and o.partner_id.property_payment_term[1]) or '') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P4">
+      <font color="white"> </font>
+    </para>
+  </story>
+</document>
+

=== added file 'ecotaxe/report/order.sxw'
Binary files ecotaxe/report/order.sxw	1970-01-01 00:00:00 +0000 and ecotaxe/report/order.sxw	2009-11-23 15:50:46 +0000 differ
=== added file 'ecotaxe/report/purchase.py'
--- ecotaxe/report/purchase.py	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/purchase.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,30 @@
+#!/usr/bin/env python
+#coding: utf-8
+
+# (c) 2007 Sednacom <http://www.sednacom.fr>
+# authors : Gaël <gael@xxxxxxxxxxx>
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import time
+from report import report_sxw
+
+class purchase_order(report_sxw.rml_parse):
+	def __init__(self, cr, uid, name, context):
+		super(purchase_order, self).__init__(cr, uid, name, context)
+		self.localcontext.update({
+			'time': time,
+		})
+report_sxw.report_sxw('report.purchase.order.ecotaxe', 'purchase.order', 'addons/ecotaxe/report/purchase.rml', parser=purchase_order)

=== added file 'ecotaxe/report/purchase.rml'
--- ecotaxe/report/purchase.rml	1970-01-01 00:00:00 +0000
+++ ecotaxe/report/purchase.rml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,303 @@
+<?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="42.0" y1="42.0" width="511" height="758"/>
+    </pageTemplate>
+  </template>
+  <stylesheet>
+    <blockTableStyle id="Standard_Outline">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau6">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau10">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau2">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+      <lineStyle kind="GRID" colorName="black"/>
+      <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="3,0" stop="3,0"/>
+      <blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
+      <blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
+      <blockBackground colorName="#e6e6e6" start="6,0" stop="6,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau3">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau5">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau1">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <blockTableStyle id="Tableau4">
+      <blockAlignment value="LEFT"/>
+      <blockValign value="TOP"/>
+    </blockTableStyle>
+    <initialize>
+      <paraStyle name="all" alignment="justify"/>
+    </initialize>
+    <paraStyle name="P1" fontName="Times-Roman" fontSize="9.0" leading="11"/>
+    <paraStyle name="P2" fontName="Times-Roman"/>
+    <paraStyle name="P3" fontName="Times-Roman" alignment="LEFT"/>
+    <paraStyle name="P4" fontName="Times-Bold" fontSize="10.0" leading="13"/>
+    <paraStyle name="P5" fontName="Times-Roman" fontSize="10.0" leading="13"/>
+    <paraStyle name="P6" fontName="Times-Roman" fontSize="10.0" leading="13"/>
+    <paraStyle name="P7" fontName="Times-Roman" fontSize="10.0" leading="13"/>
+    <paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P9" fontName="Times-Roman" fontSize="4.0" leading="5"/>
+    <paraStyle name="P10" fontName="Times-Roman" fontSize="16.0" leading="20"/>
+    <paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P13" fontName="Times-Bold" fontSize="8.0" leading="10"/>
+    <paraStyle name="P14" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
+    <paraStyle name="P15" fontName="Times-BoldItalic" fontSize="6.0" leading="8" alignment="LEFT"/>
+    <paraStyle name="P16" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P17" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
+    <paraStyle name="P18" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P19" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P20" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
+    <paraStyle name="P21" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P22" fontName="Times-Bold" fontSize="9.0" leading="11"/>
+    <paraStyle name="P23" fontName="Times-Roman" fontSize="7.0" leading="9"/>
+    <paraStyle name="P24" fontName="Times-Roman" fontSize="9.0" leading="11"/>
+    <paraStyle name="P25" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P26" fontName="Times-Roman" fontSize="7.0" leading="9"/>
+    <paraStyle name="P27" fontName="Times-Roman" fontSize="11.0" leading="14"/>
+    <paraStyle name="P28" fontName="Times-Roman" fontSize="7.0" leading="9"/>
+    <paraStyle name="P29" fontName="Times-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <paraStyle name="P30" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
+    <paraStyle name="P31" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
+    <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>
+    <para style="P1">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="241.0,57.0,213.0" style="Tableau6">
+      <tr>
+        <td>
+          <blockTable colWidths="241.0" style="Tableau10">
+            <tr>
+              <td>
+                <para style="P4">
+                  <font color="white"> </font>
+                </para>
+              </td>
+            </tr>
+            <tr>
+              <td>
+                <para style="P5">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
+                <para style="P4">Shipping address :</para>
+                <para style="P6">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+                <para style="P6">[[ addr.title or '' ]] [[ addr.name ]]</para>
+                <para style="P6">[[ addr.street ]]</para>
+                <para style="P6">[[ addr.street2 or '' ]]</para>
+                <para style="P7"><font face="Times-Roman">[[ addr.zip or '' ]]</font> [[ addr.city or '' ]]</para>
+                <para style="P7">[[ addr.state_id and addr.state_id.name or '' ]]</para>
+                <para style="P7">[[ addr.country_id and addr.country_id.name or '' ]]</para>
+              </td>
+            </tr>
+          </blockTable>
+          <para style="P24">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P24">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
+          <para style="P8">[[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]]</para>
+          <para style="P8">[[ o.partner_address_id.street ]]</para>
+          <para style="P8">[[ o.partner_address_id.street2 or '' ]]</para>
+          <para style="P8">[[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]]</para>
+          <para style="P8">[[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]</para>
+          <para style="P8">[[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]]</para>
+          <para style="P9">
+            <font color="white"> </font>
+          </para>
+          <para style="P6">Tél. : [[ o.partner_address_id.phone or '' ]]</para>
+          <para style="P6">Fax : [[ o.partner_address_id.fax or '' ]]</para>
+          <para style="P6">TVA : [[ o.partner_id.vat or '' ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P2">
+      <font color="white"> </font>
+    </para>
+    <para style="P10">
+      <font face="Times-Roman">Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman"/>
+      <font face="Times-Roman">Order [[ (o.state&lt;&gt;'draft' or removeParentNode('font')) and '' ]]</font>
+      <font face="Times-Roman">N° : [[ o.name ]]</font>
+    </para>
+    <para style="P11">
+      <font color="white"> </font>
+    </para>
+    <para style="P12">Our order reference : [[ o.ref or '' ]]</para>
+    <para style="P27">Your order reference : [[ o.partner_ref or '' ]]</para>
+    <para style="P27">Date ordered : [[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]</para>
+    <para style="P27">Validated by : [[ o.validator and o.validator.name or '' ]]</para>
+    <para style="P2">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="173.0,57.0,46.0,57.0,57.0,57.0,61.0" repeatRows="1" style="Tableau2">
+      <tr>
+        <td>
+          <para style="P13">Product Description</para>
+        </td>
+        <td>
+          <para style="P14">Applicable Taxes</para>
+        </td>
+        <td>
+          <para style="P14">Date Requested</para>
+        </td>
+        <td>
+          <para style="P14">Qty</para>
+        </td>
+        <td>
+          <para style="P14">Unit Price</para>
+        </td>
+        <td>
+          <para style="P14">Eco Part.</para>
+        </td>
+        <td>
+          <para style="P14">Net Price</para>
+        </td>
+      </tr>
+    </blockTable>
+    <section>
+      <para style="P15">[[ repeatIn(o.order_line,'line') ]]</para>
+      <blockTable colWidths="172.0,57.0,47.0,58.0,57.0,57.0,62.0" style="Tableau3">
+        <tr>
+          <td>
+            <para style="P16">[[ line.product_id and get_product_code(line.product_id.id, o.partner_id.id) or '' ]]</para>
+            <para style="P16">[[ line.name ]]</para>
+          </td>
+          <td>
+            <para style="P17">[[ ', '.join(map(lambda x: x.name, line.taxes_id))]]</para>
+          </td>
+          <td>
+            <para style="P17">[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]</para>
+          </td>
+          <td>
+            <para style="P18">[[ '%.2f' % line.product_qty ]] [[ line.product_uom.name ]]</para>
+          </td>
+          <td>
+            <para style="P18">[[ '%.2f' % line.price_unit ]]</para>
+          </td>
+          <td>
+            <para style="P18">[[ '%.2f' % line.ecotaxe_purchase ]]</para>
+          </td>
+          <td>
+            <para style="P18">[[ '%.2f' % line.price_subtotal ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+      <blockTable colWidths="43.0,468.0" style="Tableau5">
+        <tr>
+          <td>
+            <para style="P19">[[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]]</para>
+          </td>
+          <td>
+            <para style="P20">[[ l or removeParentNode('table') ]]</para>
+          </td>
+        </tr>
+      </blockTable>
+    </section>
+    <para style="Standard">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="349.0,92.0,70.0" style="Tableau1">
+      <tr>
+        <td>
+          <para style="P26">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P25">Net Total :</para>
+        </td>
+        <td>
+          <para style="P25">[[ '%.2f' % o.amount_untaxed ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P26">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P25">Wich Eco Part.</para>
+        </td>
+        <td>
+          <para style="P25">[[ '%.2f' % o.amount_ecotaxe ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P26">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P25">Taxes :</para>
+        </td>
+        <td>
+          <para style="P25">[[ '%.2f' % o.amount_tax ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+      <tr>
+        <td>
+          <para style="P23">
+            <font color="white"> </font>
+          </para>
+        </td>
+        <td>
+          <para style="P21">TOTAL :</para>
+        </td>
+        <td>
+          <para style="P21">[[ '%.2f' % o.amount_total ]] [[ o.pricelist_id.currency_id.name ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P22">
+      <font color="white"> </font>
+    </para>
+    <blockTable colWidths="510.0" style="Tableau4">
+      <tr>
+        <td>
+          <para style="P3">[[ format(o.notes or '') ]]</para>
+        </td>
+      </tr>
+    </blockTable>
+    <para style="P3">
+      <font color="white"> </font>
+    </para>
+  </story>
+</document>
+

=== added file 'ecotaxe/report/purchase.sxw'
Binary files ecotaxe/report/purchase.sxw	1970-01-01 00:00:00 +0000 and ecotaxe/report/purchase.sxw	2009-11-23 15:50:46 +0000 differ
=== added directory 'fleet_manager'
=== added file 'fleet_manager/__init__.py'
--- fleet_manager/__init__.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import fleet_manager
+import fleet_employee
+import fleet_service
+import fleet_wo
+#next file to import is order
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'fleet_manager/__terp__.py'
--- fleet_manager/__terp__.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,38 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+
+{
+    'name': 'Fleet Management System',
+    'version': '1.0',
+    'category': 'Vertical Modules/Fleet Management',
+    'description': """The module is a vertical for fleet operations management""",
+    'author': 'Sharoon Thomas',
+    'website': 'http://www.openerp.com',
+    'depends': ['base','account','hr','account_voucher','stock_location'],
+    'init_xml': [],
+    'update_xml': ['fleet_view.xml','fleet_menu.xml','fleet_sequence.xml','fleet_workflow.xml'],
+    'demo_xml': [],
+    'installable': True,
+    'active': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'fleet_manager/fleet_employee.py'
--- fleet_manager/fleet_employee.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_employee.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+# Coded by: Sharoon Thomas, Date: 30th Jan 2009
+##############################################################################
+
+from osv import fields, osv
+
+class hr_employee(osv.osv):
+    _inherit = "hr.employee"
+    _columns = {
+#                'type':fields.selection([
+#                                         ('general','General'),
+#                                         ('driver','Driver'),
+#                                         ('mechanic','Mechanic'),
+#                                         ('clerk','Clerk'),
+#                                         ('helper','Helper'),
+#                                         ('manager','Manager')
+#                                         ]),
+                'licenseno':fields.char('License #',size=20),
+                'licexpiry':fields.date('License Expiry on'),
+                'licensetyp':fields.char('License Type',size=25),
+                'photo':fields.binary('Photograph')               
+                }
+hr_employee()
+    
\ No newline at end of file

=== added file 'fleet_manager/fleet_manager.py'
--- fleet_manager/fleet_manager.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_manager.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,346 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+import pooler
+import time
+import datetime
+import fleet_service
+
+class fleet_vehicles(osv.osv):
+    _name = "fleet.vehicles"
+    _description = "Holds records of Vehicles"
+    def copy(self, cr, uid, id, default=None,context={}):
+        if not default:
+            default = {}
+        default.update({
+            'name':'New Vehicle Name',
+            'regnno':'New Registration no',
+        })
+        return super(fleet_vehicles, self).copy(cr, uid, id, default, context)
+    
+    #def _lastodometer(self,cr,uid,ids,context={}):
+   #     return(0.00)
+    #def _lastododate(self,cr,uid,ids,context={}):
+    #    datetime.datetime.now()
+    
+    
+    _columns = {
+                'name':fields.char('Vehicle Name',size=20,required=True),
+                'regnno':fields.char('Vehicle Registration #',size=11,required=True),
+                'company':fields.many2one('res.company','Company',required=True),
+                'assetacc':fields.many2one('account.account',string='Asset Account',domain=[('type','=','vehicle')],required=True),
+                'depracc':fields.many2one('account.account',string='Depreciation Account',required=True),
+                'year':fields.char('Year',size=4),
+                'make':fields.char('Make',size=10),
+                'model':fields.char('Model',size=15),
+                'serial':fields.char('productSerial #',size=50),
+                'type': fields.selection([
+                        ('truck','Truck'),
+                        ('bus','Bus'),
+                        ('car','Car')], 'Class', required=True,),
+                'status': fields.selection([
+                        ('active','Active'),
+                        ('inactive','InActive'),
+                        ('outofservice','Out of Service'),                        
+                        ], 'status', required=True,),
+                'ownership': fields.selection([
+                        ('owned','Owned'),
+                        ('leased','Leased'),
+                        ('rented','Rented'),                       
+                        ], 'Ownership', required=True), 
+                'schedname':fields.many2one('fleet.service.templ','PM Schedule',help="Preventive maintainance schedule for this vehicle",required=True),
+                'cmil':fields.float('Current Mileage',digits = (16,3)),
+                'bmil':fields.float('Base Mileage',digits=(16,3),help="The last recorded mileage"),
+                'bdate':fields.date('Recorded Date',help="Date on which the mileage is recorded"),
+                'pdate':fields.date('Purchase Date',help="Date of Purchase of vehicle"),
+                'pcost':fields.float('Purchase Value',digits=(16,2)),
+                'ppartner':fields.many2one('res.partner','Purchased From'),
+                'pinvoice':fields.char('Purchase Invoice',size=15),
+                'podometer':fields.integer('Odometer at Purchase'),
+                'startodometer':fields.integer('Start Odometer',required=True),
+                #'lastodometer':fields.function(_lastodometer , method=True ,string='Last Odometer',digits=(11,0)),
+                #'lastrecdate':fields.function(_lastododate , method=True , string='on date'),
+                'deprecperc':fields.float('Depreciation in %',digits=(10,2),required=True),
+                'deprecperd':fields.selection([
+                                               ('monthly','Monthly'),
+                                               ('quarterly','Quarterly'),
+                                               ('halfyearly','Half Yearly'),
+                                               ('annual','Yearly')
+                                               ],'Depr. period',required=True),
+                'primarymeter':fields.selection([
+                                                 ('odometer','Odometer'),
+                                                 ('hourmeter','Hour Meter'),
+                                                 ],'Primary Meter',required=True),
+                'fueltype':fields.selection([
+                                             ('petrol','Petrol'),
+                                             ('diesel','Diesel'),
+                                             ('gasoline','Gasoline'),
+                                             ('cng','C.N.G'),
+                                             ('lpg','L.P.G')
+                                             ],'Fuel Used',required=True),
+                #'fuelcardno':fields.one2one('fleet.fuelcards','Fuel Card #'),
+                'fueltankcap':fields.float('Fuel Tank Capacity'),
+                'warrexp':fields.date('Date',help="Expiry date for warranty of product"),
+                'warrexpmil':fields.integer('(or) Mileage',help="Expiry mileage for warranty of product"),
+                'location':fields.many2one('stock.location','Stk Location',help="Select the stock location or create one for each vehicle(recommended) so that the spares, tyres etc are assossiated with the vehicle when issued",required=True),
+                
+                
+                }
+    _defaults={
+               'type':lambda *a:'vehicle',
+               'status':lambda *a:'active',
+               'ownership':lambda *a:'owned',
+               'fueltype':lambda *a:'diesel',
+               'primarymeter':lambda *a:'odometer',
+               'deprecperd':lambda *a:'annual'
+               }
+
+        
+    _sql_constraints = [
+        ('uniq_regn_no', 'unique (regnno)', 'The registration no of the vehicle must be unique !')
+    ]
+    
+fleet_vehicles()
+
+class account_account(osv.osv):
+    #This module will 
+    _inherit = "account.account"
+    _columns = {
+             'type': fields.selection([
+            ('receivable','Receivable'),
+            ('payable','Payable'),
+            ('view','View'),
+            ('consolidation','Consolidation'),
+            ('other','Others'),
+            ('closed','Closed'),
+            ('vehicle','Vehicle'),
+        ], 'Internal Type', required=True,),
+}
+account_account()
+
+class product_product(osv.osv):
+    _name="product.product"
+    _description="product fleet enhancements"
+    _inherit="product.product"
+    _columns={
+              'spare_ok': fields.boolean('Is a vehicle spare', help="Determines if the product is a vehicle spare."),
+              }
+product_product()
+
+class res_partner_address(osv.osv):
+    _description ='Partner Addresses with fleet enhancements'
+    _name = 'res.partner.address'
+    _order = 'id'
+    _inherit='res.partner.address'
+    _columns = {
+                'type': fields.selection( [ ('default','Default'),('invoice','Invoice'), ('delivery','Delivery'), ('contact','Contact'),('origin','Origin'),('destination','Destination'), ('other','Other') ],'Address Type', help="Used to select automatically the right address according to the context in sales and purchases documents."),
+                }
+res_partner_address()
+                
+class fleet_fuellog(osv.osv):
+    _name = "fleet.fuellog"
+    _description = "Records the fuelling entries"
+    _rec_name="vehicle"
+    
+    def _get_period(self, cr, uid, context):
+        periods = self.pool.get('account.period').find(cr, uid)
+        if periods:
+            return periods[0]
+        else:
+            return False
+    
+    def cancel_voucher(self,cr,uid,ids,context={}):
+        self.action_cancel(cr, uid, ids)
+        self.write(cr, uid, ids, {'state':'cancel'})
+        return True
+        
+    def action_cancel_draft(self, cr, uid, ids, *args):
+        self.write(cr, uid, ids, {'state':'draft'})
+        return True
+    def calc_amount(self,cr,uid,ids,totalcost,qty):
+        res={}
+        #print "totalcost>>",totalcost
+        #print "qty>>>",qty
+        if qty:
+            res['costpl'] = totalcost/qty
+        else:
+            res['costpl']=0.0
+        #print "costpl>>>",costpl       
+#        self.write(cr,uid,ids,{'costpl':costpl}) 
+        return {'value':res}
+    def calc_amount2(self,cr,uid,ids,field,unknown,context={}):
+        res={}
+        for obj in self.browse(cr,uid,ids):
+            
+        #print "totalcost>>",totalcost
+        #print "qty>>>",qty
+            if obj.qty:
+                res[obj.id] = obj.totalcost/obj.qty
+            else:
+                res[obj.id]=0.0
+        #print "costpl>>>",costpl       
+#        self.write(cr,uid,ids,{'costpl':costpl}) 
+        return res
+        
+    def _get_journal(self, cr, uid, context):
+        type_inv = context.get('type', 'rec_voucher')
+        journal_obj = self.pool.get('account.journal')
+        res = False
+        res = journal_obj.search(cr, uid, [('type', '=', 'purchase')], limit=1)
+        if res:
+            return res[0]
+        else:
+            return False
+        
+    def _get_currency(self, cr, uid, context):
+        user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, [uid])[0]
+        if user.company_id:
+            return user.company_id.currency_id.id
+        else:
+            return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
+
+    def copy(self, cr, uid, id, default=None,context={}):
+        if not default:
+            default = {}
+        default.update({
+            'state':'draft',
+            'log_no': self.pool.get('ir.sequence').get(cr, uid, 'fleet.fuel'),
+            'move_id':False,
+        })
+        return super(fleet_fuellog, self).copy(cr, uid, id, default, context)
+
+    _columns = {
+                'log_no':fields.char('Log Entry#',size=12),
+                'vehicle':fields.many2one('fleet.vehicles','Vehicle Name',required=True),
+                'vendor':fields.many2one('res.partner','Fuel Station',required=True),
+                'date':fields.date('Date',required=True),
+                'invno':fields.char('Invoice no',size=10,required=True),                
+                'costpl':fields.function(calc_amount2,method=True,string='Cost Per Ltr',digits=(16,2),store=True),
+                'qty':fields.float('Quantity',digits=(16,3),required=True),
+                'totalcost':fields.float('Total Cost',digits=(16,2),required=True),
+                'odometer':fields.integer('Odometer',required=True),
+                'emp_resp':fields.many2one('hr.employee','Employee Responsible',required=True,help="Employee reporting fuelling details"),
+                'driver':fields.many2one('hr.employee','Driver',required=True,help="Driver who has driven the vehice before this fuelling"),
+                'currency_id': fields.many2one('res.currency', 'Currency',),
+                'journal_id':fields.many2one('account.journal', 'Journal', required=True,),
+                'move_id':fields.many2one('account.move', 'Account Entry',readonly=True),
+                'period_id': fields.many2one('account.period', 'Period', required=True,),
+                'state':fields.selection([
+                                          ('draft','Draft'),
+                                          ('cancel','Cancel'),
+                                          ('proforma','Proforma'),
+                                          ('posted','Posted')
+                                          ],readonly=True)
+
+                #'voucher':fields.many2one('account.voucher','Rel Voucher',domain=[('state','=','posted')],help="Select the related accounts voucher"),
+                }
+    _defaults = {
+        'date' : lambda *a: time.strftime('%Y-%m-%d'),
+        'period_id': _get_period,
+        'journal_id':_get_journal,
+        'currency_id': _get_currency,
+        'state': lambda *a:'draft',
+        'log_no': lambda obj,cr,uid,context: obj.pool.get('ir.sequence').get(cr,uid,'fleet.fuel'),
+    }
+    
+    #This function is used for transition from draft to proforma
+    def open_fuellog(self,cr,uid,ids,context=None):
+        return self.write(cr,uid,ids,{'state':'proforma'})
+        
+    def unlink(self, cr, uid, ids):
+        vouchers = self.read(cr, uid, ids, ['state'])
+        unlink_ids = []
+        for t in vouchers:
+            if t['state'] in ('draft', 'cancel'):
+                unlink_ids.append(t['id'])
+            else:
+                raise osv.except_osv('Invalid action !', 'Cannot delete invoice(s) which are already opened or paid !')
+        osv.osv.unlink(self, cr, uid, unlink_ids)
+        return True
+    
+    #This function is used to set the state to cancelled
+    def cancel_voucher(self,cr,uid,ids,context={}):    
+        self.write(cr, uid, ids, {'state':'cancel'})
+        return True
+    def _cancel_moves(self,cr,uid,ids,context={}):
+        for obj in self.browse(cr, uid, ids):
+            self.pool.get('account.move').unlink(cr,uid,[obj.move_id.id])
+        return self.write(cr,uid,ids,{'state':'cancel'})
+    #This function will create a new account move and the corresponding account move lines
+    def _create_moves(self,cr,uid,ids,context={}):
+        for log in self.browse(cr,uid,ids):
+            journal = self.pool.get('account.journal').browse(cr, uid, log.journal_id)
+            name=False
+            if journal.sequence_id:
+                name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
+                move = {'name': name, 'journal_id': log.journal_id.id}
+            else:
+                move = {'name': 'Fuel'+str(log.id), 'journal_id': log.journal_id.id}
+            move['period_id'] = log.period_id.id
+            #print ">>>",move
+            move_id = self.pool.get('account.move').create(cr, uid, move)
+            debit_move_line = {
+                'name': log.vehicle.id,
+                'debit': log.totalcost,
+                'credit':False,
+                'account_id': log.journal_id.default_debit_account_id.id or False,
+                'move_id':move_id ,
+                'journal_id':log.journal_id.id ,
+                'period_id':log.period_id.id,
+                'partner_id': log.vendor.id,
+                'ref': str(log.id)+log.vehicle.name, 
+                'date': log.date
+            }
+            self.pool.get('account.move.line').create(cr,uid,debit_move_line)
+            credit_move_line = {
+                'name': log.vehicle.id,
+                'debit': False,
+                'credit':log.totalcost,
+                'account_id': log.vendor.property_account_payable.id or False,
+                'move_id':move_id ,
+                'journal_id':log.journal_id.id ,
+                'period_id':log.period_id.id,
+                'partner_id': log.vendor.id,
+                'ref': str(log.id)+log.vehicle.name, 
+                'date': log.date
+            }
+            #print "credit_move_line>>>",credit_move_line
+            self.pool.get('account.move.line').create(cr,uid,credit_move_line)
+            self.write(cr,uid,log.id,{'move_id':move_id,'state':'posted'})
+        return True
+
+fleet_fuellog()
+
+class fleet_odometer(osv.osv):
+    _name = "fleet.odometer"
+    _description = "Recording of daily odometer reading"
+    _rec_name = "vehicle"
+    _columns = {
+                'vehicle':fields.many2one('fleet.vehicles','Vehicle Name',required=True),
+                'date':fields.date('Date',required=True),
+                'odometer':fields.integer('Odometer',required=True),
+                'emp_resp':fields.many2one('hr.employee','Employee Responsible',required=True),                
+                }
+fleet_odometer()
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+

=== added file 'fleet_manager/fleet_menu.xml'
--- fleet_manager/fleet_menu.xml	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_menu.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<!-- Parent Menu on Right Panes -->
+		<menuitem id="menu_fleet_manager" name="Fleet Manager" />
+
+		<!-- Master menus (tree parent) -->
+		<menuitem id="menu_fleet_manager_config" name="Configuration"
+			parent="menu_fleet_manager" sequence="1" />
+		<menuitem id="menu_fleet_manager_cmms" name="C.M.M.S"
+			parent="menu_fleet_manager" sequence="2" />
+		<menuitem id="menu_fleet_manager_oms"
+			name="Operations Management" parent="menu_fleet_manager"
+			sequence="3" />
+
+		<!-- Sub menus of Configuration -->
+		<menuitem id="menu_fleet_vehicles" name="Vehicles"
+			parent="menu_fleet_manager_config" action="fleet_vehicles_form_act" />
+
+		<!-- Sub menus of CMMS -->
+		<menuitem id="menu_fleet_manager_config_service"
+			name="Service Configuration" parent="menu_fleet_manager_cmms" sequence="1"/>
+		<menuitem id="menu_fleet_sm" name="Service Management"
+			parent="menu_fleet_manager_cmms" sequence="2" />
+			
+		<!-- Sub menus of Service Configuration -->
+		<menuitem id="menu_fleet_serv_templ" name="Service Templates"
+			parent="menu_fleet_manager_config_service"
+			action="fleet_serv_templ_view" />
+		<menuitem id="menu_fleet_serv_items" name="Service Items"
+			parent="menu_fleet_manager_config_service" action="fleet_serv_items" />
+
+		<!-- Sub menus of Service Management -->
+		<menuitem id="menu_fleet_wo" name="Work Orders"
+			parent="menu_fleet_sm" action="fleet_wo_form_act" />
+			
+		<menuitem id="menu_fleet_fuellog" name="Fuel Log"
+			parent="menu_fleet_manager_oms" sequence="5"
+			action="fleet_fuellog_form_act" />
+		<menuitem id="menu_fleet_odometer" name="Odometer Statements"
+			parent="menu_fleet_manager_oms" sequence="6"
+			action="fleet_odometer_form_act" />
+		<menuitem id="temp_menu_fleet_wo_task" name="Work Order Tasks"
+			parent="menu_fleet_manager_oms" sequence="7" action="fleet_wo_tasks_act" />
+	</data>
+</openerp>
\ No newline at end of file

=== added file 'fleet_manager/fleet_order.py'
--- fleet_manager/fleet_order.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_order.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,91 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution	
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+import pooler
+
+class fleet_order(osv.osv):
+    _name="fleet.order"
+    _description="Fleet Orders"
+    
+    def ord_seq_get(self, cr, uid):
+        pool_seq=self.pool.get('ir.sequence')
+        cr.execute("select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='fleet.order' and active=True")
+        res = cr.dictfetchone()
+        if res:
+            if res['number_next']:
+                return pool_seq._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + pool_seq._process(res['suffix'])
+            else:
+                return pool_seq._process(res['prefix']) + pool_seq._process(res['suffix'])
+        return False
+    
+    def create(self, cr, user, vals, context=None):
+        name=self.pool.get('ir.sequence').get(cr, user, 'fleet.order')
+        return super(fleet_workorder,self).create(cr, user, vals, context)
+    
+    _rec_name="orderno"
+    _columns={
+              'orderno':fields.char('Order No',size=20,required=True),
+              'orddate':fields.date('Order Date',required=True),
+              'reqdate':fields.date('Book Date',required=True),
+              'client_order_ref': fields.char('Customer Order Ref',size=64),
+              'partner_id':fields.many2one('res.partner', 'Customer', readonly=True, states={'draft':[('readonly',False)]}, change_default=True, select=True),
+              'partner_invoice_id':fields.many2one('res.partner.address', 'Invoice Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
+              'partner_order_id':fields.many2one('res.partner.address', 'Ordering Contact', readonly=True, required=True, states={'draft':[('readonly',False)]}, help="The name and address of the contact that requested the order or quotation."),
+              'partner_shipping_origin_id':fields.many2one('res.partner.address', 'Origin Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
+              'partner_shipping_dest_id':fields.many2one('res.partner.address', 'Destination Address', readonly=True, required=True, states={'draft':[('readonly',False)]}),
+              'state': fields.selection([
+                ('draft','Enquired'),
+                ('waiting_allotment','Waiting Allotment'),
+                ('allotted','Vehicle Allotted'),
+                ('progress','In Progress'),
+                ('vehicle_except','Vehicle Exception'),
+                ('invoice_except','Invoice Exception'),
+                ('done','Done'),
+                ('cancel','Cancel'),
+                ('invoiced','Invoiced')
+                ], 'Order State', readonly=True, help="Gives the state of the quotation or sale order. The exception state is automatically set when a cancel operation occurs in the invoice validation (Invoice Exception) or in the packing list process (Shipping Exception). The 'Waiting Schedule' state is set when the invoice is confirmed but waiting for the scheduler to run on the date 'Date Ordered'.", select=True),
+              'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+              'payment_term' : fields.many2one('account.payment.term', 'Payment Term'),
+              'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position'),
+              'vehicle':fields.many2one('fleet.vehicle','Vehicle Allotted',required=True, states={'draft':[('readonly',False)],'waiting_allotment':[('readonly',False)]}),
+              
+              }
+    _defaults={
+            'orderno':lambda obj,cr,uid,context: obj.pool.get('fleet.order').wt_seq_get(cr,uid),
+            'partner_invoice_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['invoice'])['invoice'],
+            'partner_order_id': lambda self, cr, uid, context: context.get('partner_id', False) and  self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['contact'])['contact'],
+            'partner_shipping_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['delivery'])['delivery'],
+            'partner_origin_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['origin'])['origin'],
+            'partner_dest_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').address_get(cr, uid, [context['partner_id']], ['destination'])['destination'],
+            'pricelist_id': lambda self, cr, uid, context: context.get('partner_id', False) and self.pool.get('res.partner').browse(cr, uid, context['partner_id']).property_product_pricelist.id,
+               }
+    def onchange_partner_id(self, cr, uid, ids, part):
+        if not part:
+            return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False, 'fiscal_position': False}}
+        addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact','origin','destination'])
+        part = self.pool.get('res.partner').browse(cr, uid, part)
+        pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
+        payment_term = part.property_payment_term and part.property_payment_term.id or False
+        fiscal_position = part.property_account_position and part.property_account_position.id or False
+        return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'],'partner_shipping_origin_id':addr['origin'],'partner_shipping_dest_id':addr['destination'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term, 'fiscal_position': fiscal_position}}
+

=== added file 'fleet_manager/fleet_sequence.xml'
--- fleet_manager/fleet_sequence.xml	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_sequence.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+	<data>
+		<!-- Fuel Log -->
+		<record model="ir.sequence.type" id="seq_type_fleet_fuel_log">
+			<field name="name">Fuel log entry number</field>
+			<field name="code">fleet.fuel</field>
+
+		</record>
+		<record model="ir.sequence" id="seq_fleet_fuel_log">
+			<field name="name">Fleet Log Voucher</field>
+			<field name="code">fleet.fuel</field>
+			<field name="padding" eval="3" />
+			<field name="prefix">FL/%(year)s/LV</field>
+		</record>
+		<!-- Work Orders -->
+		<record model="ir.sequence.type" id="seq_type_fleet_wo">
+			<field name="name">Work Order No</field>
+			<field name="code">fleet.wo</field>
+
+		</record>
+		<record model="ir.sequence" id="seq_fleet_wo">
+			<field name="name">Fleet Work Order</field>
+			<field name="code">fleet.wo</field>
+			<field name="padding" eval="3" />
+			<field name="prefix">FL/%(year)s/WO</field>
+		</record>
+		<!-- Work Order Tasks -->
+		<record model="ir.sequence.type" id="seq_type_fleet_wo_tasks">
+			<field name="name">Work Order Tasks No</field>
+			<field name="code">fleet.wo.tasks</field>
+
+		</record>
+		<record model="ir.sequence" id="seq_fleet_wo_tasks">
+			<field name="name">Fleet Work Order Tasks</field>
+			<field name="code">fleet.wo.tasks</field>
+			<field name="padding" eval="3" />
+			<field name="prefix">FL/%(year)s/WT</field>
+		</record>
+		<!-- Work Order Tasks Spares Requisition-->
+		<record model="ir.sequence.type" id="seq_type_fleet_wo_tasks_spares">
+			<field name="name">Work Order Tasks Spare Req</field>
+			<field name="code">fleet.wo.tasks.spares</field>
+
+		</record>
+		<record model="ir.sequence" id="seq_fleet_wo_tasks_spares">
+			<field name="name">Fleet Work Order Tasks Spares</field>
+			<field name="code">fleet.wo.tasks.spares</field>
+			<field name="padding" eval="3" />
+			<field name="prefix">FL/%(year)s/WTS</field>
+		</record>
+		<!--Fleet Order-->
+		<record model="ir.sequence.type" id="seq_type_fleet_order">
+			<field name="name">Fleet Order</field>
+			<field name="code">fleet.order</field>
+
+		</record>
+		<record model="ir.sequence" id="seq_fleet_order">
+			<field name="name">Fleet Order</field>
+			<field name="code">fleet.order</field>
+			<field name="padding" eval="3" />
+			<field name="prefix">FL/%(year)s/ORD</field>
+		</record>
+	</data>
+</openerp>
\ No newline at end of file

=== added file 'fleet_manager/fleet_service.py'
--- fleet_manager/fleet_service.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_service.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,97 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+import pooler
+import time
+
+class fleet_service_items(osv.osv):
+    _name = "fleet.service.items"
+    _description="Different types of service tasks"
+    _columns={
+              'name':fields.char('Service Item',size=30,required=True),
+              'itemtype':fields.selection([
+                                         ('normal','Normal'),
+                                         ('fluids','Fluids'),
+                                         ('inspection','Inspection'),
+                                         ('replace','Replace'),
+                                         ('others','Others')],'Type of Service'),
+              'freqn':fields.integer('Frequency'),
+              'freqz':fields.selection([('days','Days'),
+                                        ('weeks','Weeks'),
+                                        ('months','Months'),
+                                        ('years','Years')
+                                        ]),
+              'freqd':fields.float('Mileage', digits=(10,3)),
+              'freqdz':fields.selection([
+                                         ('miles','Miles'),
+                                         ('km','Kilometers'),
+                                         ('hours','Hours')
+                                         ]),
+               'sparesreq':fields.one2many('fleet.service.items.spares','serviceitem','Spares Required')
+               
+}
+    _defaults = {
+                 'freqdz':lambda *a:'km',
+                 'freqz':lambda *a:'days',
+                 'itemtype':lambda *a:'inspection'
+                 }
+fleet_service_items()
+
+class fleet_service_items_spares(osv.osv):
+    _name="fleet.service.items.spares"
+    _description="Service items to spare relation"
+    
+    def fetchunit(self,cr,uid,ids,productid):
+        #print "Control is txed & Product id"
+        #print productid
+        if productid:
+            product_obj = self.pool.get('product.product')
+            product_obj = product_obj.browse(cr, uid, productid,False)
+            #print product_obj
+            default_uom = product_obj.uom_id and product_obj.uom_id.id
+            #print default_uom
+            res={}
+            res['unit']=default_uom
+            #print res
+            return {'value':res}
+        else:
+            return False
+    
+    _columns={
+              'product':fields.many2one('product.product','Spare Part',domain="[('spare_ok','=','True')]",required=True),
+              'qtyreqd':fields.float('Quantity',digits=(10,3),required=True),
+              #'unit':fields.function(defaultuom,method=True,store=True,string="Unit of Use(Default)"),
+              'unit':fields.many2one('product.uom','Unit Of Use'),
+              'serviceitem':fields.many2one('fleet.service.items','Service Item')
+              }
+fleet_service_items_spares()
+
+class fleet_service_templ(osv.osv):
+    _name = 'fleet.service.templ'
+    _description='The Template is a collection of service items.'
+    _columns={
+              'name':fields.char('Template Name',size=50,required=True,select=1,help="Service Templates are a collection of Service Tasks for a specific category of vehicles."),
+              'description':fields.char('Description',size=50,required=True,select=1),
+              'items':fields.many2many('fleet.service.items','fleet_template_tasks_rel','template_id','item_id','Service Items'),
+              }
+fleet_service_templ()
\ No newline at end of file

=== added file 'fleet_manager/fleet_test.xml'
--- fleet_manager/fleet_test.xml	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_test.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<record id="wkf_wo" model="workflow">
+			<field name="name">fleet.wo.tasks.simple</field>
+			<field name="osv">fleet.wo.tasks</field>
+			<field name="on_create">True</field>
+		</record>
+
+		<!-- Activity -->
+		<record id="act_notstarted" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="flow_start">True</field>
+			<field name="name">notstarted</field>
+		</record>
+
+		<record id="act_complete" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">complete</field>
+			<field name="flow_stop">True</field>
+			<field name="kind">function</field>
+			<field name="action">write({'status':'complete'})</field>
+		</record>
+
+		<!-- Transistion -->
+
+		<record id="notstarted_to_complete"
+			model="workflow.transition">
+			<field name="act_from" ref="act_notstarted" />
+			<field name="act_to" ref="act_complete" />
+			<field name="signal">start_work</field>
+		</record>
+	</data>
+</openerp>

=== added file 'fleet_manager/fleet_view.xml'
--- fleet_manager/fleet_view.xml	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,532 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<record id="fleet_vehicle_form" model="ir.ui.view">
+			<field name="name">fleet.vehicle.form</field>
+			<field name="model">fleet.vehicles</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="vehicles">
+					<group colspan="2" col="4">
+						<separator string="Vehicle Details" colspan="4" />
+						<field name="name" select="1" /><!--on_change="_getlastodo(name,regnno)"/-->
+						<field name="regnno" />
+						<field name="company" />
+						<field name="location" />
+					</group>
+					<separator string="Analysis Information"
+						colspan="4" />
+					<notebook>
+						<page string="Additional Details">
+							<separator string="Manufacture Details"
+								colspan="4" />
+							<field name="year" />
+							<field name="make" />
+							<field name="model" />
+							<field name="serial" />
+							<field name="type" />
+							<separator string="Current Details"
+								colspan="4" />
+							<field name="status" />
+							<field name="ownership" />
+						</page>
+						<page string="Purchase Details">
+							<field name="pdate" />
+							<field name="ppartner" />
+							<field name="pinvoice" />
+							<field name="pcost" />
+							<field name="podometer" />
+							<separator string="Warranty Expiry"
+								colspan="4" />
+							<field name="warrexp" />
+							<field name="warrexpmil" />
+							<separator string="Financial Details"
+								colspan="4" />
+							<field name="deprecperc" />
+							<field name="deprecperd" />
+							<field name="assetacc" />
+							<field name="depracc"/>
+						</page>
+						<page string="Fuel and Maintainace">
+							<field name="primarymeter" />
+							<field name="startodometer" />
+							<newline />
+							<!-- field name="lastodometer" /-->
+							<!-- field name="lastrecdate" /-->
+							<separator string="Fuel Details"
+								colspan="4" />
+							<field name="fueltype" />
+							<!--field name="fuelcardno" /-->
+							<field name="fueltankcap" />
+							<separator string="Preventive Maintainance"
+								colspan="4" />
+							<field name="schedname" />
+							<field name="cmil" />
+							<field name="bmil" />
+							<field name="bdate" />
+						</page>
+					</notebook>
+				</form>
+			</field>
+		</record>
+
+		<record id="fleet_vehicle_tree" model="ir.ui.view">
+			<field name="name">fleet.vehicle.tree</field>
+			<field name="model">fleet.vehicles</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="vehicles">
+					<field name="name" select="1" />
+					<field name="regnno" select="1" />
+					<field name="company" select="1" />
+					<field name="year" />
+					<field name="make" />
+					<field name="model" />
+					<field name="serial" />
+					<field name="type" />
+				</tree>
+			</field>
+		</record>
+
+		<record id="fleet_fuellog_form_view" model="ir.ui.view">
+			<field name="name">fleet_fuellog_form</field>
+			<field name="model">fleet.fuellog</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Fuel Logbook">
+					<separator colspan="4" col="2"
+						string="Fuel Station Info." />
+					<field name="log_no" />
+					<field name="vendor" />
+					<field name="date" />
+					<field name="invno" />
+					<separator colspan="4" col="2"
+						string="Vehicle Info." />
+					<field name="vehicle" />
+					<field name="odometer" />
+					<field name="emp_resp" />
+					<field name="driver" />
+					<separator colspan="4" col="2"
+						string="Fuelling Info." />
+					<field name="qty"
+						on_change="calc_amount(totalcost,qty)" />
+					<field name="totalcost"
+						on_change="calc_amount(totalcost,qty)" />
+					<field name="costpl" />
+					<separator colspan="4" col="2"
+						string="Accounting Info." />
+					<field name="journal_id" />
+					<field name="currency_id" />
+					<field name="move_id" />
+					<field name="period_id" />
+					<field name="state" />
+					<group col="4">
+						<button name="proforma" string="Proforma"
+							states="draft" />
+						<!--button name="_create_moves" string="Create Move" states="proforma"/-->
+						<button name="_create_moves" string="Post Txn"
+							states="proforma" />
+						<button name="cancel_voucher" string="Cancel"
+							states="draft,proforma" />
+						<button name="_cancel_moves" string="Cancel"
+							states="posted" />
+					</group>
+				</form>
+			</field>
+		</record>
+
+		<record id="fleet_fuellog_tree_view" model="ir.ui.view">
+			<field name="name">fleet_fuellog_tree</field>
+			<field name="model">fleet.fuellog</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Fuel Log">
+					<field name="vehicle" select="1" />
+					<field name="date" select="1" />
+					<field name="invno" select="1" />
+					<field name="vendor" select="1" />
+					<field name="odometer" />
+					<field name="totalcost" />
+
+				</tree>
+			</field>
+		</record>
+		<!-- Work Order View -->
+		<record id="fleet_wo_form_view" model="ir.ui.view">
+			<field name="name">fleet_wo_form</field>
+			<field name="model">fleet.wo</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Work Orders">
+
+					<separator colspan="4" col="4"
+						string="Work Order Master Info." />
+					<field name="wono" />
+					<field name="description" />
+					<newline />
+					<field name="rdate" />
+					<field name="instr" />
+					<newline />
+					<separator colspan="4" col="4"
+						string="Additional Details" />
+					<notebook colspan="4">
+						<page string="Work Order Tasks">
+							<field name="tasks" nolabel="1" />
+						</page>
+					</notebook>
+				</form>
+			</field>
+		</record>
+		<record id="fleet_wo_tree_view" model="ir.ui.view">
+			<field name="name">fleet_wo_tree</field>
+			<field name="model">fleet.wo</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Work Orders">
+					<field name="wono" select="1" />
+					<field name="description" />
+					<field name="rdate" select="1" />
+					<field name="instr" />
+				</tree>
+			</field>
+		</record>
+		<!-- Work Order Tasks View -->
+		<record id="fleet_wo_tasks_view" model="ir.ui.view">
+			<field name="name">fleet_wo_tasks_form</field>
+			<field name="model">fleet.wo.tasks</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Work Order Tasks">
+					<separator string="Task Details" colspan="4"
+						col="4" />
+					<field name="taskno" />
+					<newline />
+					<field name="servitem"
+						on_change="on_change_servitem(servitem)" />
+					<field name="vehicle" />
+					<newline />
+					<separator string="Task Management" colspan="4"
+						col="4" />
+					<field name="duedate" />
+					<field name="scheddate" />
+					<newline />
+					<field name="assignee" />
+					<field name="supervisor" />
+					<field name="state" />
+					<newline />
+					<separator string="Spares Required" colspan="4"
+						col="4" />
+					<field name="spares" nolabel="1" colspan="4" />
+					<separator string="Workflow Actions" colspan="4" />
+					<group colspan="2">
+						<button name="start_work" string="Start Work"
+							states="notstarted" />
+						<button name="get_approval"
+							string="Seek Approval" states="notstarted" />
+						<button name="replan" string="Re Plan"
+							states="planningneeded" />
+						<button name="issue_spares"
+							string="Issue Spares" states="awaitingparts" />
+						<button name="start_test"
+							string="Testing Started" states="inprogress" />
+						<button name="set_done" string="Task Completed"
+							states="testing,inprogress" />
+						<button name="cancel" string="Cancel Task"
+							states="notstarted,planningneeded,inprogress,awaitingparts" />
+					</group>
+				</form>
+			</field>
+		</record>
+		<record id="fleet_wo_tasks_tree" model="ir.ui.view">
+			<field name="name">fleet_wo_tasks_tree</field>
+			<field name="model">fleet.wo.tasks</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Work Order Tasks">
+					<field name="taskno" select="1" />
+					<field name="vehicle" select="1" />
+					<field name="servitem" />
+					<field name="state" select="1" />
+					<field name="duedate" />
+					<field name="assignee" select="2" />
+					<field name="supervisor" select="2" />
+				</tree>
+			</field>
+		</record>
+		<!-- Fleet wo tasks spares -->
+		<record id="fleet_wo_tasks_spares_view" model="ir.ui.view">
+			<field name="name">fleet_wo_tasks_form</field>
+			<field name="model">fleet.wo.tasks.spares</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Work Order Tasks Spare issue">
+
+					<field name="spare_req_no" />
+					<field name="product"
+						on_change="fetchunit(product)" />
+					<newline />
+					<field name="quantity" />
+					<field name="unit" />
+					<newline />
+					<field name="state" />
+				</form>
+			</field>
+		</record>
+		<record id="fleet_wo_tasks_spares_tree" model="ir.ui.view">
+			<field name="name">fleet_wo_tasks_tree</field>
+			<field name="model">fleet.wo.tasks.spares</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Work Order Tasks Spare issue">
+					<field name="spare_req_no" select="1" />
+					<field name="product" select="1" />
+					<field name="quantity" />
+					<field name="unit" />
+					<field name="state" select="1" />
+				</tree>
+			</field>
+		</record>
+		<!-- Odometer Views -->
+		<record id="fleet_odometer_form_view" model="ir.ui.view">
+			<field name="name">fleet_odometer_form</field>
+			<field name="model">fleet.odometer</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Odometer Logbook">
+					<separator colspan="4" col="4"
+						string="Record Info." />
+					<field name="vehicle" />
+					<field name="date" />
+					<field name="odometer" />
+					<field name="emp_resp" />
+				</form>
+			</field>
+		</record>
+
+		<record id="fleet_odometer_tree_view" model="ir.ui.view">
+			<field name="name">fleet_odometer_tree</field>
+			<field name="model">fleet.odometer</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Fuel Log">
+					<field name="vehicle" select="1" />
+					<field name="date" select="1" />
+					<field name="odometer" />
+				</tree>
+			</field>
+		</record>
+
+		<!-- View for Repair templates -->
+		<record id="fleet_serv_template_view" model="ir.ui.view">
+			<field name="name">fleet_serv_temp_view</field>
+			<field name="model">fleet.service.templ</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Service Templates">
+					<separator colspan="4" col="4"
+						string="Service Template" />
+					<field name="name" select="1" />
+					<field name="description" select="1" />
+					<separator colspan="4" col="4"
+						string="Service Items in template" />
+					<field name="items" nolabel="1" colspan="4"
+						widget="many2many" />
+				</form>
+			</field>
+		</record>
+		<!-- View for repair items -->
+		<record id="fleet_serv_items_view" model="ir.ui.view">
+			<field name="name">fleet_serv_items_view</field>
+			<field name="model">fleet.service.items</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Service Items">
+					<separator colspan="4" col="4"
+						string="Service Item Details" />
+					<newline />
+					<field name="name" select="1" colspan="1" />
+					<newline />
+					<field name="itemtype" select="1" colspan="1" />
+					<newline />
+					<separator colspan="4" col="4"
+						string="Service Item Occurance" />
+					<newline />
+					<field name="freqn" colspan="1" />
+					<field name="freqz" nolabel="1" colspan="1" />
+					<separator colspan="4" col="4" string="OR" />
+					<newline />
+					<field name="freqd" colspan="1" />
+					<field name="freqdz" nolabel="1" colspan="1" />
+					<separator colspan="4" col="4"
+						string="Spares Parts required for service" />
+					<field name="sparesreq" nolabel="1" colspan="4"
+						widget="one2many_list" />
+				</form>
+			</field>
+		</record>
+		<record id="fleet_service_items_tree" model="ir.ui.view">
+			<field name="name">fleet_serv_items_tree</field>
+			<field name="model">fleet.service.items</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Service Items">
+					<field name="name" select="1" />
+					<field name="itemtype" select="1" />
+					<field name="freqn" />
+					<field name="freqz" nolabel="1" string="Period" />
+					<!--label string="OR"/-->
+					<field name="freqd" nolabel="1" string="Mileage" />
+					<field name="freqdz" nolabel="1"
+						string="Distance Unit" />
+				</tree>
+			</field>
+		</record>
+		<record id="fleet_service_spares_tree" model="ir.ui.view">
+			<field name="name">fleet_serv_spare_tree</field>
+			<field name="model">fleet.service.items.spares</field>
+			<field name="type">tree</field>
+			<field name="arch" type="xml">
+				<tree string="Service Item Spares">
+					<field name="product" select="1" />
+					<field name="qtyreqd" select="1" />
+					<field name="unit" />
+				</tree>
+			</field>
+		</record>
+		<record id="fleet_service_spares_form" model="ir.ui.view">
+			<field name="name">fleet_serv_spare_view</field>
+			<field name="model">fleet.service.items.spares</field>
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<form string="Service Item Spare Requirement">
+					<separator colspan="4" col="4"
+						string="Service Spare Details" />
+					<newline />
+					<field name="product" select="1" colspan="1"
+						on_change="fetchunit(product)" />
+					<newline />
+					<field name="qtyreqd" select="1" colspan="1" />
+					<newline />
+					<field name="unit" colspan="1" />
+				</form>
+			</field>
+		</record>
+		<!-- Replace the existing HR form with modifications -->
+		<record id="view_employee_form_fleet" model="ir.ui.view">
+			<field name="name">hr.employee.form.fleet</field>
+			<field name="model">hr.employee</field>
+			<field name="inherit_id" ref="hr.view_employee_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="ssnid" position="replace">
+					<field name="licenseno" select="1" />
+				</field>
+			</field>
+		</record>
+		<record id="view_employee_form_fleet2" model="ir.ui.view">
+			<field name="name">hr.employee.form.fleet2</field>
+			<field name="model">hr.employee</field>
+			<field name="inherit_id" ref="hr.view_employee_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="sinid" position="replace">
+					<field name="licexpiry" />
+				</field>
+			</field>
+		</record>
+		<record id="view_employee_form_fleet3" model="ir.ui.view">
+			<field name="name">hr.employee.form.fleet3</field>
+			<field name="model">hr.employee</field>
+			<field name="inherit_id" ref="hr.view_employee_form" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="otherid" position="replace">
+					<field name="licensetyp" />
+					<field name="photo" widget="image" nolabel="1"
+						colspan="2" />
+				</field>
+			</field>
+		</record>
+
+		<record id="fleet_vehicles_form_act"
+			model="ir.actions.act_window">
+			<field name="name">Vehicles</field>
+			<field name="res_model">fleet.vehicles</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">tree,form</field>
+		</record>
+		<!-- Add the spare_ok field to product_product -->
+		<record id="view_product_form_fleet" model="ir.ui.view">
+			<field name="name">product.product</field>
+			<field name="model">product.product</field>
+			<field name="inherit_id"
+				ref="product.product_normal_form_view" />
+			<field name="type">form</field>
+			<field name="arch" type="xml">
+				<field name="purchase_ok" position="after">
+					<field name="spare_ok" />
+				</field>
+			</field>
+		</record>
+		<record id="fleet_serv_items" model="ir.actions.act_window">
+			<field name="name">Service Items</field>
+			<field name="res_model">fleet.service.items</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">tree,form</field>
+		</record>
+		<record id="fleet_serv_templ_view"
+			model="ir.actions.act_window">
+			<field name="name">Service Templates</field>
+			<field name="res_model">fleet.service.templ</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form,tree</field>
+		</record>
+
+		<record id="fleet_fuellog_form_act"
+			model="ir.actions.act_window">
+			<field name="name">Fuellog</field>
+			<field name="res_model">fleet.fuellog</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">tree,form</field>
+		</record>
+
+		<record id="fleet_odometer_form_act"
+			model="ir.actions.act_window">
+			<field name="name">Odometer</field>
+			<field name="res_model">fleet.odometer</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form,tree</field>
+		</record>
+
+		<record id="fleet_odometer_tree_act"
+			model="ir.actions.act_window">
+			<field name="name">Odometer</field>
+			<field name="res_model">fleet.odometer</field>
+			<field name="view_type">tree</field>
+			<field name="view_mode">tree,form</field>
+		</record>
+
+		<record id="fleet_wo_form_act" model="ir.actions.act_window">
+			<field name="name">Work Orders</field>
+			<field name="res_model">fleet.wo</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form,tree</field>
+		</record>
+
+		<record id="fleet_wo_tasks_act" model="ir.actions.act_window">
+			<field name="name">Work Order Tasks</field>
+			<field name="res_model">fleet.wo.tasks</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form,tree</field>
+		</record>
+
+		<record id="fleet_wo_tasks_spares_act"
+			model="ir.actions.act_window">
+			<field name="name">Work Order Tasks Spares</field>
+			<field name="res_model">fleet.wo.tasks.spares</field>
+			<field name="view_type">form</field>
+			<field name="view_mode">form,tree</field>
+		</record>
+	</data>
+</openerp>
+

=== added file 'fleet_manager/fleet_wo.py'
--- fleet_manager/fleet_wo.py	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_wo.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,208 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import osv, fields
+import pooler
+import time
+
+class fleet_workorder(osv.osv):
+    _name="fleet.wo"
+    _description="Work Orders for Fleet Maintainance"
+    _rec_name="wono"
+    def wo_seq_get(self, cr, uid):
+        pool_seq=self.pool.get('ir.sequence')
+        cr.execute("select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='fleet.wo' and active=True")
+        res = cr.dictfetchone()
+        if res:
+            if res['number_next']:
+                return pool_seq._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + pool_seq._process(res['suffix'])
+            else:
+                return pool_seq._process(res['prefix']) + pool_seq._process(res['suffix'])
+        return False
+    
+    def create(self, cr, user, vals, context=None):
+        name=self.pool.get('ir.sequence').get(cr, user, 'fleet.wo')
+        return super(fleet_workorder,self).create(cr, user, vals, context)
+    
+    _columns={
+              'wono':fields.char('Work Order no',size=20,required=True),
+              'description':fields.char('Order Narration',size=100),
+              #'vehicle':fields.one2many('fleet.vehicles','Vehicle'), Depreciated
+              'tasks':fields.one2many('fleet.wo.tasks','workorder','Tasks in Work Order'),
+              'rdate':fields.date('Order Date',required=True),
+              'instr':fields.char('Instructions',size=64)
+              }
+    _defaults={
+               'wono':lambda obj,cr,uid,context: obj.pool.get('fleet.wo').wo_seq_get(cr,uid)
+               }
+    _sql_constraints = [
+        ('uniq_wo_no', 'unique (wono)', 'The Work order no must be unique !')
+    ]
+fleet_workorder()
+
+class fleet_wo_tasks(osv.osv):
+    _name="fleet.wo.tasks"
+    _description="Work Order Tasks"
+    _rec_name="taskno"
+    
+    def _get_vehicle_wo(self, cr, uid, ids, field_name, arg, context):
+        for i in ids:
+            print "i is >>>" + str(i)
+        return False
+    
+    def wt_seq_get(self, cr, uid):
+        pool_seq=self.pool.get('ir.sequence')
+        cr.execute("select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='fleet.wo.tasks' and active=True")
+        res = cr.dictfetchone()
+        if res:
+            if res['number_next']:
+                return pool_seq._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + pool_seq._process(res['suffix'])
+            else:
+                return pool_seq._process(res['prefix']) + pool_seq._process(res['suffix'])
+        return False    
+    
+    def create(self, cr, user, vals, context=None):
+        name=self.pool.get('ir.sequence').get(cr, user, 'fleet.wo.tasks')
+        return super(fleet_wo_tasks,self).create(cr, user, vals, context)
+    
+    def on_change_servitem(cr, uid, ids, servitem,some):
+        if servitem:
+            print "service item is:" + servitem
+        else:
+            print "Theres no servitem"
+    _columns={
+              'taskno':fields.char('Task No',size=20,required=True),
+              #'vehicle':fields.function(_get_vehicle_wo,method=True,string="Vehicle",store=True,type='many2one', obj="fleet.vehicles"), Depreciated
+              'workorder':fields.many2one('fleet.wo','parent work Order',ondelete='cascade'),
+              'vehicle':fields.many2one('fleet.vehicles','Vehicle',required=True),
+              'servitem':fields.many2one('fleet.service.items','Service Task',required=True),
+              'duedate':fields.date('Due Date'),
+              'scheddate':fields.date('Scheduled Date'),
+              'assignee':fields.many2one('hr.employee','Assigned Employee',required=True),
+              'supervisor':fields.many2one('hr.employee','Supervisor'),
+              'wosysgen':fields.boolean('System Generated'),
+              'spares':fields.one2many('fleet.wo.tasks.spares','wotask','Spares Required'),
+              'state':fields.selection([
+                                         ('notstarted','Not Started'),
+                                         ('inprogress','In Progress'),
+                                         ('planningneeded','Planning Needed'),
+                                         ('awaitingparts','Waiting for Spares'),
+                                         ('testing','Test/Inspection'),
+                                         ('complete','Complete'),
+                                         ('cancel','Cancel')
+                                         ],'Task Status',required=True),
+                                         
+              
+              }
+    _defaults={
+               'taskno':lambda obj,cr,uid,context: obj.pool.get('fleet.wo.tasks').wt_seq_get(cr,uid),
+               'state':lambda *a:'notstarted'
+               }
+    
+    _sql_constraints = [
+        ('uniq_task_no', 'unique (taskno)', 'The task no must be unique !')
+    ]
+    
+    
+fleet_wo_tasks()
+
+class fleet_wo_tasks_spares(osv.osv):
+    _name="fleet.wo.tasks.spares"
+    _description="WO Tasks spares requirement"
+    _rec_name="spare_req_no"
+    
+    def wts_seq_get(self, cr, uid):
+        pool_seq=self.pool.get('ir.sequence')
+        cr.execute("select id,number_next,number_increment,prefix,suffix,padding from ir_sequence where code='fleet.wo.tasks.spares' and active=True")
+        res = cr.dictfetchone()
+        if res:
+            if res['number_next']:
+                return pool_seq._process(res['prefix']) + '%%0%sd' % res['padding'] % res['number_next'] + pool_seq._process(res['suffix'])
+            else:
+                return pool_seq._process(res['prefix']) + pool_seq._process(res['suffix'])
+        return False  
+    
+    def fetchunit(self,cr,uid,ids,productid):
+        #print "Control is txed & Product id"
+        #print productid
+        if productid:
+            product_obj = self.pool.get('product.product')
+            product_obj = product_obj.browse(cr, uid, productid,False)
+            #print product_obj
+            default_uom = product_obj.uom_id and product_obj.uom_id.id
+            #print default_uom
+            res={}
+            res['unit']=default_uom
+            #print res
+            return {'value':res}
+        else:
+            return False
+    
+    def create(self, cr, user, vals, context=None):
+        name=self.pool.get('ir.sequence').get(cr, user, 'fleet.wo.tasks.spares')
+        return super(fleet_wo_tasks_spares,self).create(cr, user, vals, context) 
+        
+    _columns={
+             'spare_req_no':fields.char('Spares Req. No',size=20,required=True),
+             'wotask':fields.many2one('fleet.wo.tasks','Parent WO Task',ondelete="cascade"),
+             'product':fields.many2one('product.product',domain=[('spare_ok','=','True')],string='Spare Part',required=True),
+             'quantity':fields.float('Quantity',required=True),
+             'unit':fields.many2one('product.uom','Unit Of Use',required=True),
+             'state':fields.selection([
+                                       ('draft','Request Draft'),
+                                       ('approved','Pending Move'),
+                                       ('moved','Spare Issued')
+                                       ],'State/Status',required=True)
+             }
+    _defaults={
+              'quantity': lambda *a: 1.00,
+              'state': lambda *a:'draft',
+              'spare_req_no': lambda obj,cr,uid,context: obj.pool.get('fleet.wo.tasks.spares').wts_seq_get(cr,uid),
+              }
+    _sql_constraints = [
+        ('spare_req_no', 'unique (spare_req_no)', 'The spare request no must be unique!')
+    ]
+fleet_wo_tasks_spares()
+
+class fleet_wo_tasks_labour(osv.osv):
+    _name="fleet.wo.tasks.labour"
+    _description="WO labour Tasks"
+    _rec_name="lab_req_no"
+    _columns={
+             'lab_req_no':fields.char('Labour Req No',size=20,required=True),
+             'partner':fields.many2one('res.partner','Workshop/Payee'),
+             'description':fields.char('Description of work',size=64,required=True),
+             'amount':fields.float('Amount',digits=(10,2),required=True),
+             'verified':fields.many2one('hr.employee','Verified By'),
+             'state': fields.selection([
+                                        ('draft','Draft'),
+                                        ('verified','Verified'), 
+                                        ('paid','Paid'),
+                                        ('audited','Audited')
+                                        ], 'Status', readonly=True),
+             }
+    _defaults={
+              'amount': lambda *a: 1.00,
+              'state':lambda *a: 'draft',
+              }
+fleet_wo_tasks_labour()
+    
\ No newline at end of file

=== added file 'fleet_manager/fleet_workflow.xml'
--- fleet_manager/fleet_workflow.xml	1970-01-01 00:00:00 +0000
+++ fleet_manager/fleet_workflow.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+	<data>
+		<record id="wkf_wo" model="workflow">
+			<field name="name">fleet.wo.tasks.simple</field>
+			<field name="osv">fleet.wo.tasks</field>
+			<field name="on_create">True</field>
+		</record>
+
+		<!-- Activity -->
+		<record id="act_notstarted" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="flow_start">True</field>
+			<field name="name">notstarted</field>
+		</record>
+
+		<record id="act_planningneeded" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">planningneeded</field>
+			<field name="kind">function</field>
+			<field name="action">write({'state':'planningneeded'})</field>
+		</record>
+
+		<record id="act_awaitingparts" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">awaitingparts</field>
+			<field name="kind">function</field>
+			<field name="action">write({'state':'awaitingparts'})</field>
+		</record>
+
+		<record id="act_inprogress" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">inprogress</field>
+			<field name="kind">function</field>
+			<field name="action">write({'state':'inprogress'})</field>
+		</record>
+		<record id="act_testing" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">testing</field>
+			<field name="kind">function</field>
+			<field name="action">write({'state':'testing'})</field>
+		</record>
+		<record id="act_complete" model="workflow.activity">
+			<field name="wkf_id" ref="wkf_wo" />
+			<field name="name">complete</field>
+			<field name="flow_stop">True</field>
+			<field name="kind">function</field>
+			<field name="action">write({'state':'complete'})</field>
+			<field name="join_mode">AND</field>
+		</record>
+
+		<!-- Transistion -->
+
+		<!--record id="notstarted_to_inprogress"
+			model="workflow.transition">
+			<field name="act_from" ref="act_notstarted" />
+			<field name="act_to" ref="act_inprogress" />
+			<field name="signal">start_work</field>
+		</record-->
+		<record id="notstarted_to_planningneeded"
+			model="workflow.transition">
+			<field name="act_from" ref="act_notstarted" />
+			<field name="act_to" ref="act_planningneeded" />
+			<field name="signal">get_approval</field>
+		</record>
+		<record id="notstarted_to_awaitingparts"
+			model="workflow.transition">
+			<field name="act_from" ref="act_notstarted" />
+			<field name="act_to" ref="act_awaitingparts" />
+			<field name="signal">start_work</field>
+		</record>
+		<record id="planningneeded_to_notstarted"
+			model="workflow.transition">
+			<field name="act_from" ref="act_planningneeded" />
+			<field name="act_to" ref="act_notstarted" />
+			<field name="signal">replan</field>
+		</record>
+		<record id="planningneeded_to_awaitingparts"
+			model="workflow.transition">
+			<field name="act_from" ref="act_planningneeded" />
+			<field name="act_to" ref="act_awaitingparts" />
+			<field name="signal">start_work</field>
+		</record>
+
+		<record id="awaitingparts_to_inprogress"
+			model="workflow.transition">
+			<field name="act_from" ref="act_awaitingparts" />
+			<field name="act_to" ref="act_inprogress" />
+			<field name="signal">issue_spares</field>
+		</record>
+		<record id="inprogress_to_testing"
+			model="workflow.transition">
+			<field name="act_from" ref="act_inprogress" />
+			<field name="act_to" ref="act_testing" />
+			<field name="signal">start_test</field>
+		</record>
+		<record id="testing_to_complete" model="workflow.transition">
+			<field name="act_from" ref="act_testing" />
+			<field name="act_to" ref="act_complete" />
+			<field name="signal">set_done</field>
+		</record>
+		<record id="inprogress_to_complete"
+			model="workflow.transition">
+			<field name="act_from" ref="act_inprogress" />
+			<field name="act_to" ref="act_complete" />
+			<field name="signal">set_done</field>
+		</record>
+	</data>
+</openerp>

=== added directory 'hasa_account_security'
=== added file 'hasa_account_security/__init__.py'
--- hasa_account_security/__init__.py	1970-01-01 00:00:00 +0000
+++ hasa_account_security/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import hasa_account_security
+import wizard

=== added file 'hasa_account_security/__terp__.py'
--- hasa_account_security/__terp__.py	1970-01-01 00:00:00 +0000
+++ hasa_account_security/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,44 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+{
+    "name" : "Account Security",
+    "version" : "1.0",
+    "depends" : ["account"],
+    "author" : "Hasa Sàrl",
+    "description": """
+Add two wizards to check and display the incorrect account move lines/account move where the date is not included in the period.
+Add two constraints to avoid accounting errors that check in all new account move lines/account moves if the date is included in the period.
+    """,
+    "website" : "http://www.hasa.ch";,
+    "category" : "Generic Modules/Accounting",
+    "init_xml" : [],
+    "demo_xml" : [],
+    "update_xml" : ["hasa_account_security_wizard.xml"],
+    "active": False,
+    "installable": True
+}

=== added file 'hasa_account_security/hasa_account_security.py'
--- hasa_account_security/hasa_account_security.py	1970-01-01 00:00:00 +0000
+++ hasa_account_security/hasa_account_security.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,71 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+from osv import osv
+
+class account_move_line(osv.osv):
+    """Add of a method in account move line"""
+    _name = 'account.move.line'
+    _inherit = 'account.move.line'
+
+    def _check_line_period(self, cr, uid, ids):
+        """check if the move line date is included in the move line period"""
+        lines = self.browse(cr, uid, ids)
+        for l in lines:
+            if l.date < l.period_id.date_start or \
+            l.date > l.period_id.date_stop:
+                return False
+        return True
+
+    _constraints = [
+        (_check_line_period, 'You can not create move line with a date not \
+        included in the move line period.', ['date','period_id']),
+    ]
+    
+account_move_line()
+
+class account_move(osv.osv):
+    """Add of a method in account move"""
+    _name = 'account.move'
+    _inherit = 'account.move'
+
+    def _check_move_period(self, cr, uid, ids):
+        """check if the account move date is included in the move period"""
+        moves = self.browse(cr, uid, ids)
+        for m in moves:
+            if m.date < m.period_id.date_start or \
+            m.date > m.period_id.date_stop:
+                return False
+        return True
+
+    _constraints = [
+        (_check_move_period, 'You can not create move with a date not \
+        included in the move period.', ['date','period_id']),
+    ]
+    
+account_move()

=== added file 'hasa_account_security/hasa_account_security_wizard.xml'
--- hasa_account_security/hasa_account_security_wizard.xml	1970-01-01 00:00:00 +0000
+++ hasa_account_security/hasa_account_security_wizard.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,26 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+    
+        <wizard
+        string="Trouble Entries Lines"
+        model="account.move.line"
+        name="account.trouble_entries_lines"
+        keyword="client_action_multi"
+        id="wizard_trouble_account_move_line"
+        />
+    
+        <menuitem name="Financial Management/Entries Encoding/Trouble Entries Lines" type="wizard" id="trouble_account_move_line_menu" action="wizard_trouble_account_move_line"/>
+
+        <wizard
+        string="Trouble Move Lines"
+        model="account.move"
+        name="account.trouble_moves"
+        keyword="client_action_multi"
+        id="wizard_trouble_account_move"
+        />
+    
+        <menuitem name="Financial Management/Entries Encoding/Trouble Move Lines" type="wizard" id="trouble_account_move_menu" action="wizard_trouble_account_move"/>
+  
+        </data>    
+</openerp>

=== added directory 'hasa_account_security/wizard'
=== added file 'hasa_account_security/wizard/__init__.py'
--- hasa_account_security/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ hasa_account_security/wizard/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import wizard_account_security

=== added file 'hasa_account_security/wizard/wizard_account_security.py'
--- hasa_account_security/wizard/wizard_account_security.py	1970-01-01 00:00:00 +0000
+++ hasa_account_security/wizard/wizard_account_security.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,97 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import wizard
+
+class wizard_account_move_line(wizard.interface):
+    """wizard that display the incorrect account move lines"""
+
+    def _trouble_entries_lines_open_window(self, cr, uid, data, context):
+        """check all the account move line date in period"""
+        cr.execute('select id,name from ir_ui_view where model=%s and \
+        type=%s', ('account.move.line', 'tree'))
+        view_res = cr.fetchone()
+        cr.execute('select id from account_move_line as line where date < \
+        (select date_start from account_period where id = line.period_id) \
+        or date > (select date_stop from account_period \
+        where id = line.period_id)')
+        lines = cr.fetchall()
+        domain = "[('id', 'in', ["+','.join(map(str, lines))+"])]"
+
+        return {
+            'domain': domain,
+            'name': 'Trouble Entries Lines',
+            'view_type': 'form',
+            'view_mode': 'tree,form',
+            'res_model': 'account.move.line',
+            'view_id': view_res,
+            'type': 'ir.actions.act_window'
+        }        
+
+    states = {
+        'init': {
+            'actions': [],
+            'result': {'type': 'action', \
+            'action':_trouble_entries_lines_open_window, 'state':'end'}
+        }
+    }
+wizard_account_move_line('account.trouble_entries_lines')
+
+class wizard_account_move(wizard.interface):
+    """wizard that display the incorrect account moves"""
+
+    def _trouble_moves_open_window(self, cr, uid, data, context):
+        """check all the account move date if in period"""
+        cr.execute('select id,name from ir_ui_view where model=%s and \
+        type=%s', ('account.move', 'tree'))
+        view_res = cr.fetchone()
+        cr.execute('select id from account_move as move where date < \
+        (select date_start from account_period where id = move.period_id) \
+        or date > (select date_stop from account_period \
+        where id = move.period_id)')
+        lines = cr.fetchall()
+        domain = "[('id', 'in', ["+','.join(map(str, lines))+"])]"
+
+        return {
+            'domain': domain,
+            'name': 'Trouble Move Lines',
+            'view_type': 'form',
+            'view_mode': 'tree,form',
+            'res_model': 'account.move',
+            'view_id': view_res,
+            'type': 'ir.actions.act_window'
+        }        
+
+    states = {
+        'init': {
+            'actions': [],
+            'result': {'type': 'action', \
+            'action':_trouble_moves_open_window, 'state':'end'}
+        }
+    }
+wizard_account_move('account.trouble_moves')

=== added directory 'hasa_accounts_charts_advanced'
=== added file 'hasa_accounts_charts_advanced/__init__.py'
--- hasa_accounts_charts_advanced/__init__.py	1970-01-01 00:00:00 +0000
+++ hasa_accounts_charts_advanced/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import account
+import wizard

=== added file 'hasa_accounts_charts_advanced/__terp__.py'
--- hasa_accounts_charts_advanced/__terp__.py	1970-01-01 00:00:00 +0000
+++ hasa_accounts_charts_advanced/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,45 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+{
+    "name" : "Accounts Charts Advanced",
+    "version" : "1.1",
+    "depends" : ["account"],
+    "author" : "Hasa Sàrl",
+    "description": """
+Add the new wizard : Chart of Accounts Advanced.
+
+Possibility of choosing a chart of accounts based on dates, period(s) and fiscalyear.
+    """,
+    "website" : "http://www.hasa.ch";,
+    "category" : "Generic Modules/Accounting",
+    "init_xml" : [],
+    "demo_xml" : [],
+    "update_xml" : ["hasa_accounts_charts_advanced_view.xml"],
+    "active": False,
+    "installable": True
+}

=== added file 'hasa_accounts_charts_advanced/hasa_accounts_charts_advanced_view.xml'
--- hasa_accounts_charts_advanced/hasa_accounts_charts_advanced_view.xml	1970-01-01 00:00:00 +0000
+++ hasa_accounts_charts_advanced/hasa_accounts_charts_advanced_view.xml	2009-11-23 15:50:46 +0000
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+        <wizard id="wizard_account_chart_advanced" menu="False" model="account.account" name="account.chart_advanced" string="Chart of Accounts Advanced"/>
+        <menuitem icon="STOCK_INDENT" action="wizard_account_chart_advanced" id="menu_action_account_tree_chart_advanced" parent="account.menu_finance_charts" type="wizard"/>
+    </data>
+</openerp>

=== added directory 'hasa_accounts_charts_advanced/wizard'
=== added file 'hasa_accounts_charts_advanced/wizard/__init__.py'
--- hasa_accounts_charts_advanced/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ hasa_accounts_charts_advanced/wizard/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import wizard_account_chart

=== added file 'hasa_accounts_charts_advanced/wizard/wizard_account_chart.py'
--- hasa_accounts_charts_advanced/wizard/wizard_account_chart.py	1970-01-01 00:00:00 +0000
+++ hasa_accounts_charts_advanced/wizard/wizard_account_chart.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,98 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import wizard
+import pooler
+
+class wizard_account_chart_advanced(wizard.interface):
+    """wizard that display an advanced accounts chart"""
+    _account_chart_arch = '''<?xml version="1.0"?>
+    <form string="Account charts advanced">
+        <separator string="Fields appear in order of priority" colspan="4"/>
+        <field name="fiscalyear" colspan="4"/>
+        <field name="periods" colspan="4"/>
+        <field name="date_from"/>
+        <field name="date_to"/>
+        <field name="target_move"/>
+    </form>'''
+
+    _account_chart_fields = {
+            'fiscalyear': {'string': 'Fiscal year','type': 'many2one', 'relation': 'account.fiscalyear',},
+            'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period',},
+            'date_from': {'string':"Start date",'type':'date',},
+            'date_to': {'string':"End date",'type':'date',},
+            'target_move': {'string': 'Target Moves','type': 'selection','selection': [('all','All Entries'),('posted_only','All Posted Entries')],'required': True,'default': lambda *a:"all",},
+    }
+
+    def _get_defaults(self, cr, uid, data, context):
+        """get the chosen fiscalyear/periods/dates"""
+        if not(data['form']['fiscalyear'] or data['form']['periods'][0][2] or \
+            (data['form']['date_from'] and data['form']['date_to'])):
+            raise wizard.except_wizard('Warning !', 'You must define a year, periods or dates to continue.')
+        return 'suite'
+
+    def _account_chart_open_window(self, cr, uid, data, context):
+        mod_obj = pooler.get_pool(cr.dbname).get('ir.model.data')
+        act_obj = pooler.get_pool(cr.dbname).get('ir.actions.act_window')
+        result = mod_obj._get_id(cr, uid, 'account', 'action_account_tree')
+        ident = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
+        result = act_obj.read(cr, uid, [ident])[0]
+        if data['form']['fiscalyear']:
+            result['context'] = str({'fiscalyear': data['form']['fiscalyear'], \
+            'target_move':data['form']['target_move']})
+            result['name'] += ':'+str(pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr, uid, [data['form']['fiscalyear']])[0]['code'])
+            return result
+        if data['form']['periods'][0][2]:
+            result['context'] = str({'periods': data['form']['periods'][0][2], \
+            'target_move':data['form']['target_move']})
+            for x in data['form']['periods'][0][2]:
+                result['name'] += ':'+str(pooler.get_pool(cr.dbname).get('account.period').read(cr, uid, [x])[0]['code'])
+            return result
+        if data['form']['date_from'] and data['form']['date_to']:
+            result['context'] = str({'date_from': data['form']['date_from'], \
+            'date_to': data['form']['date_to'], 'target_move': data['form']['target_move']})
+            result['name'] += ':'+str(data['form']['date_from'])+'/'+\
+            str(data['form']['date_to'])
+            return result
+
+    states = {
+        'init': {
+            'actions': [],
+            'result':{'type': 'form', 'arch':_account_chart_arch, \
+            'fields':_account_chart_fields, 'state': [('end', 'Cancel'), ('open', 'Open Charts')]}
+        },
+        'open': {
+            'actions': [],
+            'result': {'type': 'action', 'action':_get_defaults, 'state':'suite'}
+        },
+        'suite': {
+            'actions': [],
+            'result': {'type': 'action', 'action':_account_chart_open_window, 'state':'end'}
+        }
+    }
+wizard_account_chart_advanced('account.chart_advanced')

=== added directory 'hasa_balance'
=== added file 'hasa_balance/__init__.py'
--- hasa_balance/__init__.py	1970-01-01 00:00:00 +0000
+++ hasa_balance/__init__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,29 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+
+import hasa_balance

=== added file 'hasa_balance/__terp__.py'
--- hasa_balance/__terp__.py	1970-01-01 00:00:00 +0000
+++ hasa_balance/__terp__.py	2009-11-23 15:50:46 +0000
@@ -0,0 +1,45 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# Copyright (c) 2009 HASA SARL. (http://www.hasa.ch) All Rights Reserved.
+#
+# WARNING: This program as such is intended to be used by professional
+# programmers who take the whole responsability of assessing all potential
+# consequences resulting from its eventual inadequacies and bugs
+# End users who are looking for a ready-to-use solution with commercial
+# garantees and support are strongly adviced to contract a Free Software
+# Service Company
+#
+# This program is Free Software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+#
+##############################################################################
+{
+    "name":"Hasa balance",
+    "version":"0.1",
+    "author":"Hasa Sàrl",
+    "category":"Custom",
+    "website": "http://www.hasa.ch";,
+    "description": """
+This module add the accounting balance at the bottom of the account entries view. The difference between all the debit and credit account move lines is automatically calculated depending th

Follow ups