openerp-community team mailing list archive
-
openerp-community team
-
Mailing list archive
-
Message #02869
lp:~savoirfairelinux-openerp/openerp-accountedge/6.1-initial-version into lp:openerp-accountedge
Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/openerp-accountedge/6.1-initial-version into lp:openerp-accountedge.
Requested reviews:
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903)
OpenERP - AccountEdge (openerp-accountedge)
For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-accountedge/6.1-initial-version/+merge/175949
[ADD] Allow OpenERP expense import into AccountEdge
--
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-accountedge/6.1-initial-version/+merge/175949
Your team OpenERP Community is subscribed to branch lp:~savoirfairelinux-openerp/openerp-accountedge/6.1-initial-version.
=== added directory 'account_account_halftax'
=== added file 'account_account_halftax/__init__.py'
--- account_account_halftax/__init__.py 1970-01-01 00:00:00 +0000
+++ account_account_halftax/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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_account_halftax
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'account_account_halftax/__openerp__.py'
--- account_account_halftax/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_account_halftax/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,42 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 tax halftax",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds a boolean to account.account called 'tax_halftax'.
+ If this boolean is set to true, then the amount of the tax has to be
+ divided by 2.
+ """,
+ "depends" : ['account'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'account_account_halftax.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'account_account_halftax/account_account_halftax.py'
--- account_account_halftax/account_account_halftax.py 1970-01-01 00:00:00 +0000
+++ account_account_halftax/account_account_halftax.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,30 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 account_account(osv.osv):
+ _inherit = 'account.account'
+ _columns = {
+ 'tax_halftax': fields.boolean('Divide tax by 2'),
+ }
+
+account_account()
=== added file 'account_account_halftax/account_account_halftax.xml'
--- account_account_halftax/account_account_halftax.xml 1970-01-01 00:00:00 +0000
+++ account_account_halftax/account_account_halftax.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_account_form" model="ir.ui.view">
+ <field name="name">account.account.form</field>
+ <field name="model">account.account</field>
+ <field name="inherit_id" ref="account.view_account_form"/>
+ <field name="arch" type="xml">
+ <field name="code" position="after">
+ <field name="tax_halftax"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
+
=== added directory 'account_account_halftax/i18n'
=== added file 'account_account_halftax/i18n/account_account_halftax.pot'
--- account_account_halftax/i18n/account_account_halftax.pot 1970-01-01 00:00:00 +0000
+++ account_account_halftax/i18n/account_account_halftax.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,49 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_account_halftax
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:35+0000\n"
+"PO-Revision-Date: 2013-07-19 19:35+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_account_halftax
+#: model:ir.model,name:account_account_halftax.model_account_account
+msgid "Account"
+msgstr ""
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Error ! You can not create recursive accounts."
+msgstr ""
+
+#. module: account_account_halftax
+#: field:account.account,tax_halftax:0
+msgid "Divide tax by 2"
+msgstr ""
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not select an account type with a deferral method different of \"Unreconciled\" for accounts with internal type \"Payable/Receivable\"! "
+msgstr ""
+
+#. module: account_account_halftax
+#: sql_constraint:account.account:0
+msgid "The code of the account must be unique per company !"
+msgstr ""
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not define children to an account with internal type different of \"View\"! "
+msgstr ""
+
=== added file 'account_account_halftax/i18n/fr.po'
--- account_account_halftax/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ account_account_halftax/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,50 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_account_halftax
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:35+0000\n"
+"PO-Revision-Date: 2013-07-19 19:35+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_account_halftax
+#: model:ir.model,name:account_account_halftax.model_account_account
+msgid "Account"
+msgstr "Compte"
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Error ! You can not create recursive accounts."
+msgstr "Erreur! Vous ne pouvez pas créer de comptes récursifs."
+
+#. module: account_account_halftax
+#: field:account.account,tax_halftax:0
+msgid "Divide tax by 2"
+msgstr "Diviser la taxe par 2"
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not select an account type with a deferral method different of \"Unreconciled\" for accounts with internal type \"Payable/Receivable\"! "
+msgstr ""
+
+#. module: account_account_halftax
+#: sql_constraint:account.account:0
+msgid "The code of the account must be unique per company !"
+msgstr "Le code du compte doit être unique par société!"
+
+#. module: account_account_halftax
+#: constraint:account.account:0
+msgid "Configuration Error! \n"
+"You can not define children to an account with internal type different of \"View\"! "
+msgstr "Erreur de configuration! \n"
+"Vous ne pouvez pas définir de compte enfant à un compte avec un type différent de \"Vue\"! "
+
=== added directory 'account_tax_accountedge'
=== added file 'account_tax_accountedge/__init__.py'
--- account_tax_accountedge/__init__.py 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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_tax_accountedge
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'account_tax_accountedge/__openerp__.py'
--- account_tax_accountedge/__openerp__.py 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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" : "AccountEdge tax code",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds the AccountEdge tax code field to account.tax
+ """,
+ "depends" : ['account', 'account_accountant'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'account_tax_accountedge.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'account_tax_accountedge/account_tax_accountedge.py'
--- account_tax_accountedge/account_tax_accountedge.py 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/account_tax_accountedge.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,31 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 account_tax(osv.osv):
+ _inherit = 'account.tax'
+ _columns = {
+ 'tax_code_accountedge': fields.char('Tax code in AccountEdge', size=16, required=False),
+ }
+
+account_tax()
+
=== added file 'account_tax_accountedge/account_tax_accountedge.xml'
--- account_tax_accountedge/account_tax_accountedge.xml 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/account_tax_accountedge.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_tax_tree" model="ir.ui.view">
+ <field name="name">account.tax.tree</field>
+ <field name="model">account.tax</field>
+ <field name="inherit_id" ref="account.view_tax_tree"/>
+ <field name="arch" type="xml">
+ <field name="description" position="after">
+ <field name="tax_code_accountedge"/>
+ </field>
+ </field>
+ </record>
+
+
+ <record id="view_tax_form" model="ir.ui.view">
+ <field name="name">account.tax.form</field>
+ <field name="model">account.tax</field>
+ <field name="inherit_id" ref="account.view_tax_form"/>
+ <field name="arch" type="xml">
+ <field name="description" position="after">
+ <field name="tax_code_accountedge"/>
+ </field>
+
+ <tree string="Account Tax" position="replace">
+ <field name="tax_code_accountedge"/>
+ </tree>
+ </field>
+ </record>
+
+ </data>
+</openerp>
=== added directory 'account_tax_accountedge/i18n'
=== added file 'account_tax_accountedge/i18n/account_tax_accountedge.pot'
--- account_tax_accountedge/i18n/account_tax_accountedge.pot 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/i18n/account_tax_accountedge.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,37 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_tax_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:36+0000\n"
+"PO-Revision-Date: 2013-07-19 19:36+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_tax_accountedge
+#: sql_constraint:account.tax:0
+msgid "Tax Name must be unique per company!"
+msgstr ""
+
+#. module: account_tax_accountedge
+#: view:account.tax:0
+msgid "Account Tax"
+msgstr ""
+
+#. module: account_tax_accountedge
+#: field:account.tax,tax_code_accountedge:0
+msgid "Tax code in AccountEdge"
+msgstr ""
+
+#. module: account_tax_accountedge
+#: model:ir.model,name:account_tax_accountedge.model_account_tax
+msgid "account.tax"
+msgstr ""
+
=== added file 'account_tax_accountedge/i18n/fr.po'
--- account_tax_accountedge/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ account_tax_accountedge/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,37 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * account_tax_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:36+0000\n"
+"PO-Revision-Date: 2013-07-19 19:36+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_tax_accountedge
+#: sql_constraint:account.tax:0
+msgid "Tax Name must be unique per company!"
+msgstr "Le nom de la taxe doit être unique par société!"
+
+#. module: account_tax_accountedge
+#: view:account.tax:0
+msgid "Account Tax"
+msgstr "Compte de taxe"
+
+#. module: account_tax_accountedge
+#: field:account.tax,tax_code_accountedge:0
+msgid "Tax code in AccountEdge"
+msgstr "Code de la taxe dans AccountEdge"
+
+#. module: account_tax_accountedge
+#: model:ir.model,name:account_tax_accountedge.model_account_tax
+msgid "account.tax"
+msgstr "account.tax"
+
=== added directory 'hr_employee_accountedge'
=== added file 'hr_employee_accountedge/__init__.py'
--- hr_employee_accountedge/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_employee_accountedge
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_employee_accountedge/__openerp__.py'
--- hr_employee_accountedge/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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" : "Supplier id on expense line",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds the 'supplier_id_accountedge' field to the
+ hr.employee model.
+ """,
+ "depends" : ['hr_expense'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'hr_employee_accountedge.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_employee_accountedge/hr_employee_accountedge.py'
--- hr_employee_accountedge/hr_employee_accountedge.py 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/hr_employee_accountedge.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,33 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_employee(osv.osv):
+ _inherit = 'hr.employee'
+ _columns = {
+ 'supplier_id_accountedge': fields.char('Supplier ID in AccountEdge', size=16),
+ }
+
+hr_employee()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_employee_accountedge/hr_employee_accountedge.xml'
--- hr_employee_accountedge/hr_employee_accountedge.xml 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/hr_employee_accountedge.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_employee_form" model="ir.ui.view">
+ <field name="name">hr.employee.form</field>
+ <field name="model">hr.employee</field>
+ <field name="inherit_id" ref="hr.view_employee_form"/>
+ <field name="arch" type="xml">
+ <form string="Employee">
+ <notebook>
+ <page string="Harmonization with AccountEdge">
+ <field name="supplier_id_accountedge"/>
+ </page>
+ </notebook>
+ </form>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'hr_employee_accountedge/i18n'
=== added file 'hr_employee_accountedge/i18n/fr.po'
--- hr_employee_accountedge/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,38 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_employee_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:37+0000\n"
+"PO-Revision-Date: 2013-07-19 19:37+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: hr_employee_accountedge
+#: view:hr.employee:0
+#: model:ir.model,name:hr_employee_accountedge.model_hr_employee
+msgid "Employee"
+msgstr "Employé"
+
+#. module: hr_employee_accountedge
+#: view:hr.employee:0
+msgid "Harmonization with AccountEdge"
+msgstr "Harmonisation avec AccountEdge"
+
+#. module: hr_employee_accountedge
+#: field:hr.employee,supplier_id_accountedge:0
+msgid "Supplier ID in AccountEdge"
+msgstr "Identifiant du fournisseur dans AccountEdge"
+
+#. module: hr_employee_accountedge
+#: constraint:hr.employee:0
+msgid "Error ! You cannot create recursive Hierarchy of Employees."
+msgstr "Erreur! Vous ne pouvez pas créer de hiérarchie récursive des employés."
+
=== added file 'hr_employee_accountedge/i18n/hr_employee_accountedge.pot'
--- hr_employee_accountedge/i18n/hr_employee_accountedge.pot 1970-01-01 00:00:00 +0000
+++ hr_employee_accountedge/i18n/hr_employee_accountedge.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,38 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_employee_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:37+0000\n"
+"PO-Revision-Date: 2013-07-19 19:37+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: hr_employee_accountedge
+#: view:hr.employee:0
+#: model:ir.model,name:hr_employee_accountedge.model_hr_employee
+msgid "Employee"
+msgstr ""
+
+#. module: hr_employee_accountedge
+#: view:hr.employee:0
+msgid "Harmonization with AccountEdge"
+msgstr ""
+
+#. module: hr_employee_accountedge
+#: field:hr.employee,supplier_id_accountedge:0
+msgid "Supplier ID in AccountEdge"
+msgstr ""
+
+#. module: hr_employee_accountedge
+#: constraint:hr.employee:0
+msgid "Error ! You cannot create recursive Hierarchy of Employees."
+msgstr ""
+
=== added directory 'hr_expense_accountedge'
=== added file 'hr_expense_accountedge/__init__.py'
--- hr_expense_accountedge/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_accountedge
+import edi
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_accountedge/__openerp__.py'
--- hr_expense_accountedge/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,51 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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" : "Harmonization of expenses with AccountEdge",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module generates the csv reports for the exportation
+ of expenses in AccountEdge.
+ It also modifies the workflow of the expenses.
+ """,
+ "depends" : [
+ 'hr_employee_accountedge',
+ 'hr_expense_line_supplier',
+ 'hr_expense_line_supplier_tax',
+ 'hr_expense_line_account',
+ 'hr_expense_line_number',
+ 'account_account_halftax',
+ 'account_tax_accountedge'
+ ],
+ "init_xml" : [],
+ "update_xml" : [
+ 'hr_expense_accountedge.xml',
+ 'security/ir_rule.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added directory 'hr_expense_accountedge/edi'
=== added file 'hr_expense_accountedge/edi/__init__.py'
--- hr_expense_accountedge/edi/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/edi/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import hr_expense_expense
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_accountedge/edi/hr_expense_expense.py'
--- hr_expense_accountedge/edi/hr_expense_expense.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/edi/hr_expense_expense.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Business Applications
+# Copyright (c) 2011 OpenERP S.A. <http://openerp.com>
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields, osv, orm
+from edi import EDIMixin
+
+class hr_expense_expense(osv.osv, EDIMixin):
+ _inherit = 'hr.expense.expense'
+
+ def _edi_get_web_url_view(self, cr, uid, ids, field_name, arg, context):
+ res = {}
+
+ for id in ids:
+ web_root_url = self.pool.get('ir.config_parameter').get_param(cr, uid, 'web.base.url')
+ res[id] = "%s/web/webclient/home#id=%s&view_type=page&model=hr.expense.expense" % (web_root_url, id)
+
+ return res
+
+ _columns = {
+ 'web_url_view' : fields.function(
+ _edi_get_web_url_view,
+ string='Url of the expense view',
+ type='char',
+ size=255,
+ readonly=True),
+ }
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_accountedge/hr_expense_accountedge.py'
--- hr_expense_accountedge/hr_expense_accountedge.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/hr_expense_accountedge.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,204 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 base64
+
+from osv import osv, fields
+from datetime import datetime
+
+
+class hr_expense_expense(osv.osv):
+ _inherit = 'hr.expense.expense'
+
+ def _create_csv_report(self,cr,uid,ids,context={}):
+ res = {}
+ for id in ids:
+ this = self.browse(cr, uid, id)
+ empl_id = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', this.user_id.id)])
+ empl = self.pool.get('hr.employee').browse(cr, uid, empl_id)[0]
+
+ output = this.employee_id.name
+ output += "\r\n"
+ output += "Card ID\tDate\tVendor Invoice #\tAccount Number\tAmount\tDescription\
+ \tTax Code\tGST Amount\tPST/QST Amount\tCurrency Code\tExchange Rate\r\n"
+
+
+ for l in this.line_ids:
+ taxes = self._compute_taxes(cr,uid,l,context)
+ output += u"%s\t%s\t%s\t%s\t%.2f\t%s\t%s\t%.2f\t%.2f\t%s\t%.2f\r\n" % (
+ this.employee_id.supplier_id_accountedge,
+ datetime.strptime(l.date_value,"%Y-%m-%d").strftime("%d-%m-%Y"),
+ l.expense_id.id,
+ l.account_id.code,
+ taxes['amount_before_tax'],
+ l.name,
+ (l.tax_id.tax_code_accountedge or '000'),
+ taxes['amount_gst'],
+ taxes['amount_pst'],
+ (l.expense_id.currency_id.name or 'CAD'),
+ (float(l.expense_id.currency_id.rate) or '1.0'))
+
+ byte_string = output.encode('utf-8-sig')
+ res[id] = base64.encodestring(byte_string)
+
+ self.write(cr, uid, ids, {'csv_file':res[id]}, context=context)
+ self._add_attachment(cr,uid,id,byte_string,context)
+
+ return True
+
+
+ def _compute_taxes(self,cr,uid,expense_line,context={}):
+
+ res = {
+ 'amount_before_tax' : expense_line.total_amount,
+ 'amount_gst' : 0.0, # Goods and Services Tax, federal
+ 'amount_pst' : 0.0 # Provincial Sales Tax
+ }
+
+ tax = expense_line.tax_id
+ if not tax.amount:
+ return res
+
+ # Divide tax per two?
+ tax_factor = 1.0
+ if expense_line.account_id.tax_halftax:
+ tax_factor = 0.5
+
+ if tax.child_ids :
+ for child_tax in tax.child_ids: # TODO: the detection of the two taxes should be more reliable
+ if 'TPS' in child_tax.name or \
+ 'GST' in child_tax.name:
+ res['amount_gst'] = float(child_tax.amount) * tax_factor
+ else:
+ res['amount_pst'] = float(child_tax.amount) * tax_factor
+ else:
+ res['amount_gst'] = float(tax.amount)
+
+
+ res['amount_before_tax'] = expense_line.total_amount / (1 + res['amount_gst'] + res['amount_pst'])
+ res['amount_gst'] = res['amount_before_tax'] * res['amount_gst']
+ res['amount_pst'] = res['amount_before_tax'] * res['amount_pst']
+
+ # Make sure the addition of the 3 values matches the original amount entered by the user
+ res['amount_gst'] = round(res['amount_gst'], 2)
+ res['amount_pst'] = round(res['amount_pst'], 2)
+ res['amount_before_tax'] = expense_line.total_amount - res['amount_gst'] - res['amount_pst']
+
+ return res
+
+
+
+ def _add_attachment(self,cr,uid,ids,content,context={}):
+
+ file_name = 'rapport_'+time.strftime('%Y%m%d_%H%M%S')
+ attach_id = self.pool.get('ir.attachment').create(cr, uid, {
+ 'name' : file_name,
+ 'datas' : base64.encodestring(content),
+ 'datas_fname' : file_name,
+ 'res_model' : self._name,
+ 'res_id' : ids,
+ },
+ context=context
+ )
+ return True
+
+ def action_exported(self,cr,uid,ids,*args):
+ if not len(ids):
+ return False
+
+ # The user's recordID must match with their supplier account in
+ # AccountEdge to be able to generate the expense report
+ for id in ids:
+ this = self.browse(cr, uid, id)
+ if not this.employee_id.supplier_id_accountedge:
+ raise osv.except_osv('Supplier ID in AccountEdge missing',
+ 'Please add a supplier ID (card ID) for this employee before exporting.')
+
+ self._create_csv_report(cr,uid,ids,{})
+ self.write(cr,uid,ids,{'state': 'exported'})
+
+ return True
+
+
+ def action_imported(self,cr,uid,ids,*args):
+ if not len(ids):
+ return False
+ for id in ids:
+ self.write(cr,uid,ids,{'state': 'imported'})
+ return True
+
+
+ def _get_cur_account_manager(self, cr, uid, ids, field_name, arg, context):
+ res = {}
+ for id in ids:
+ emails = ''
+ grp_ids = self.pool.get('res.groups').search(cr, uid, [('name','=',u'Manager'),('category_id.name','=',u'Accounting & Finance')])
+ usr_ids = self.pool.get('res.users').search(cr, uid, [('groups_id','=',grp_ids[0])])
+ usrs = self.pool.get('res.users').browse(cr, uid, usr_ids)
+
+ if not usrs:
+ raise osv.except_osv('Found no Accounting & Finance Manager in the company',
+ 'Please add one before approving the expense.')
+
+ for user in usrs:
+ if user.user_email:
+ emails += user.user_email
+ emails += ','
+ else:
+ empl_id = self.pool.get('hr.employee').search(cr, uid,[('login','=',user.login)])[0]
+ empl = self.pool.get('hr.employee').browse(cr, uid, empl_id)
+ if empl.work_email:
+ emails += empl.work_email
+ emails += ','
+
+ emails = emails[:-1]
+ res[id] = emails
+ return res
+
+ _columns = {
+ 'manager_emails' : fields.function(
+ _get_cur_account_manager,
+ string='Manager Emails',
+ type='char',
+ size=255,
+ readonly=True),
+ 'state' : fields.selection([
+ ('draft', 'New'),
+ ('confirm', 'Waiting Approval'),
+ ('accepted', 'Approved'),
+ ('exported', 'Exported'),
+ ('imported', 'Imported'),
+ ('cancelled', 'Refused'),],
+ 'State', readonly=True, help='When the expense request is created the state is \'Draft\'.\
+ \n It is confirmed by the user and request is sent to admin, the state is \'Waiting Confirmation\'.\
+ \nIf the admin accepts it, the state is \'Accepted\'.\
+ \nIf the admin refuses it, the state is \'Refused\'.\
+ \n If a csv file has been generated for the expense request, the state is \'Exported\'.\
+ \n If the expense request has been imported in AccountEdge, the state is \'Imported\'.'
+ ),
+ }
+
+
+hr_expense_expense()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_accountedge/hr_expense_accountedge.xml'
--- hr_expense_accountedge/hr_expense_accountedge.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/hr_expense_accountedge.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,209 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <!-- EDI Export + Send email Action -->
+ <record id="ir_actions_server_edi_expense_approved" model="ir.actions.server">
+ <field name="code">object.edi_export_and_email(template_ext_id='hr_expense_accountedge.email_template_edi_expense_accepted', context=context)</field>
+ <field eval="6" name="sequence"/>
+ <field name="state">code</field>
+ <field name="type">ir.actions.server</field>
+ <field name="model_id" ref="model_hr_expense_expense"/>
+ <field name="condition">True</field>
+ <field name="name">Auto-email expense approved</field>
+ </record>
+
+ <record id="ir_actions_server_edi_expense_confirm" model="ir.actions.server">
+ <field name="code">object.edi_export_and_email(template_ext_id='hr_expense_accountedge.email_template_edi_expense_waiting_approval', context=context)</field>
+ <field eval="6" name="sequence"/>
+ <field name="state">code</field>
+ <field name="type">ir.actions.server</field>
+ <field name="model_id" ref="model_hr_expense_expense"/>
+ <field name="condition">True</field>
+ <field name="name">Auto-email expense waiting for approval</field>
+ </record>
+
+
+ <!-- EDI related Email Templates menu (HR -> Configuration -> Email Templates) -->
+ <record model="ir.actions.act_window" id="action_email_templates_expenses">
+ <field name="name">Email Templates</field>
+ <field name="res_model">email.template</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">form,tree</field>
+ <field name="view_id" ref="email_template.email_template_tree" />
+ <field name="search_view_id" ref="email_template.view_email_template_search"/>
+ <field name="context">{'search_default_model_id':'hr.expense.expense'}</field>
+ <field name="context" eval="{'search_default_model_id': ref('model_hr_expense_expense')}"/>
+ </record>
+ <menuitem id="menu_email_templates_expenses" parent="hr.menu_hr_configuration" action="action_email_templates_expenses" sequence="30"/>
+
+ </data>
+
+ <data noupdate="1">
+ <!--
+ Expenses
+ -->
+ <record id="view_expenses_form" model="ir.ui.view">
+ <field name="name">hr.expense.form</field>
+ <field name="type">form</field>
+ <field name="model">hr.expense.expense</field>
+ <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
+ <field name="arch" type="xml">
+ <field name="state" position="replace">
+ <field name="state" widget="statusbar" statusbar_visible="draft,confirm,accepted,exported,imported" statusbar_colors='{"confirm":"blue","cancelled":"red"}'/>
+ </field>
+ <group col="6" colspan="2" position="replace">
+ <group col="6" colspan="2">
+ <button name="draft" states="confirm,cancelled,exported" string="Set to Draft" type="workflow" icon="gtk-convert" groups="base.group_hr_user"/>
+ <button name="refuse" states="confirm,accepted" string="Refuse" type="workflow" icon="gtk-no" groups="base.group_hr_user" />
+ <button name="confirm" states="draft" string="Submit to Manager" type="workflow" icon="gtk-apply"/>
+ <button name="validate" states="confirm" string="Approve" type="workflow" icon="gtk-go-forward" groups="base.group_hr_user"/>
+ <button name="action_exported" states="accepted" string="Export CSV" type="workflow" groups="account.group_account_manager,account.group_account_invoice"/>
+ <button name="action_imported" states="exported" confirm="This action cannot be undone" string="Mark as imported" type="workflow" groups="account.group_account_manager,account.group_account_invoice"/>
+ </group>
+ </group>
+ </field>
+ </record>
+
+ <!--
+ Workflow definition
+ -->
+
+ <record id="hr_expense.act_confirm" model="workflow.activity">
+ <field name="action_id" ref="ir_actions_server_edi_expense_confirm"/>
+ </record>
+
+ <record id="hr_expense.act_accepted" model="workflow.activity">
+ <field name="action_id" ref="ir_actions_server_edi_expense_approved"/>
+ </record>
+
+ <record id="hr_expense.act_exported" model="workflow.activity">
+ <field name="wkf_id" ref="hr_expense.wkf_expenses"/>
+ <field name="name">exported</field>
+ <field name="kind">function</field>
+ <field name="action">action_exported()</field>
+ </record>
+
+ <record id="hr_expense.act_imported" model="workflow.activity">
+ <field name="wkf_id" ref="hr_expense.wkf_expenses"/>
+ <field name="name">imported</field>
+ <field name="kind">function</field>
+ <field name="action">action_imported()</field>
+ </record>
+
+
+ <record id="t_wait_accepted_to_exported" model="workflow.transition">
+ <field name="act_from" ref="hr_expense.act_accepted"/>
+ <field name="act_to" ref="hr_expense.act_exported"/>
+ <field name="signal">action_exported</field>
+ <field name="group_id" ref="base.group_hr_user"/>
+ </record>
+
+ <record id="t_exported_to_draft" model="workflow.transition">
+ <field name="act_from" ref="hr_expense.act_exported"/>
+ <field name="act_to" ref="hr_expense.act_draft"/>
+ <field name="signal">draft</field>
+ <field name="group_id" ref="base.group_hr_user"/>
+ </record>
+
+ <record id="t_exported_to_imported" model="workflow.transition">
+ <field name="act_from" ref="hr_expense.act_exported"/>
+ <field name="act_to" ref="hr_expense.act_imported"/>
+ <field name="signal">action_imported</field>
+ <field name="group_id" ref="base.group_hr_user"/>
+ </record>
+
+
+
+ <!--
+ Email template for expensed that are waiting for approval
+ -->
+ <record id="email_template_edi_expense_waiting_approval" model="email.template">
+ <field name="name">Automated Invoice Notification Mail</field>
+ <field name="email_from">${object.company_id.email or 'noreply@localhost'}</field>
+ <field name="subject">New expense waiting for approval</field>
+ <field name="email_to">${object.employee_id.parent_id.work_email or 'naysan.saran@xxxxxxxxx'}</field>
+ <field name="model_id" ref="model_hr_expense_expense"/>
+ <field name="auto_delete" eval="True"/>
+ <field name="lang">${object.employee_id.partner_id.lang}</field>
+ <field name="body_html"><![CDATA[
+ <div style="
+ font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;
+ font-size : 12px;
+ color : rgb(34, 34, 34);
+ background-color: #FFF;
+ ">
+
+ <p>Hello,</p>
+ <p>A new expense is waiting for approval. </p>
+ <p>You can view the expense using the following link: </p>
+ <a style="
+ display:block; width: 150px; height:20px;
+ margin-left: 20px; color: #DDD;
+ font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;
+ font-size: 13px; font-weight: bold; text-align: center;
+ text-decoration: none !important; line-height: 1;
+ padding: 5px 0px 0px 0px; background-color: #8E0000;
+ border-radius: 5px 5px; background-repeat: repeat no-repeat;"
+
+ href="${object.web_url_view or ''}">
+ View Expense
+ </a>
+ <br/>
+ </div>
+ ]]></field>
+ <field name="body_text"><![CDATA[
+ Hello,
+ A new expense is waiting for approval.
+ You can view the expense using the following link:
+ ${object.web_url_view or 'n/a'}
+ ]]></field>
+ </record>
+
+
+ <!--
+ Email template for approved expenses, asking the account manager to export the expense
+ -->
+ <record id="email_template_edi_expense_accepted" model="email.template">
+ <field name="name">Automated Invoice Notification Mail</field>
+ <field name="email_from">${object.company_id.email or 'noreply@localhost'}</field>
+ <field name="subject">New expense approved and ready for export</field>
+ <field name="email_to">${object.manager_emails}</field>
+ <field name="model_id" ref="model_hr_expense_expense"/>
+ <field name="auto_delete" eval="True"/>
+ <field name="lang">${object.employee_id.partner_id.lang}</field>
+ <field name="body_html"><![CDATA[
+ <div style="
+ font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;
+ font-size : 12px;
+ color : rgb(34, 34, 34);
+ background-color: #FFF;
+ ">
+
+ <p>Hello,</p>
+ <p>A new expense has been approved and is ready for export. </p>
+ <p>You can view the expense using the following link: </p>
+ <a style="
+ display:block; width: 150px; height:20px;
+ margin-left: 20px; color: #DDD;
+ font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;
+ font-size: 13px; font-weight: bold; text-align: center;
+ text-decoration: none !important; line-height: 1;
+ padding: 5px 0px 0px 0px; background-color: #8E0000;
+ border-radius: 5px 5px; background-repeat: repeat no-repeat;"
+
+ href="${object.web_url_view or ''}">
+ View Expense
+ </a>
+ <br/>
+ </div>
+ ]]></field>
+ <field name="body_text"><![CDATA[
+ Hello,
+ A new expense has been approved and is ready for export.
+ You can view the expense using the following link:
+ ${object.web_url_view or 'n/a'}
+ ]]></field>
+ </record>
+
+ </data>
+</openerp>
=== added directory 'hr_expense_accountedge/i18n'
=== added file 'hr_expense_accountedge/i18n/fr.po'
--- hr_expense_accountedge/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,232 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:38+0000\n"
+"PO-Revision-Date: 2013-07-19 19: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: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Refuse"
+msgstr "Refuser"
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.server,name:hr_expense_accountedge.ir_actions_server_edi_expense_confirm
+msgid "Auto-email expense waiting for approval"
+msgstr "Courriel automatique des notes de frais en approbation"
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_html:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Hello,</p>\n"
+" <p>A new expense has been approved and is ready for export. </p>\n"
+" <p>You can view the expense using the following link: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" View Expense\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+msgstr "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Bonjour,</p>\n"
+" <p>Une nouvelle note de frais a été approuvé et est prête pour l'export. </p>\n"
+" <p>Vous pouvez voir la note en utilisant le lien suivant: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" Voir la note de frais\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_text:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "\n"
+" Hello,\n"
+" A new expense has been approved and is ready for export.\n"
+" You can view the expense using the following link:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
+msgstr "\n"
+" Bonjour,\n"
+" Une nouvelle note de frais a été approuvé et est prête pour l'export.\n"
+" Vous pouvez voir la note en utilisant le lien suivant:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
+
+#. module: hr_expense_accountedge
+#: model:email.template,subject:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "New expense approved and ready for export"
+msgstr "Nouvelle note approuvée et prête pour l'export"
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Approve"
+msgstr "Approuver"
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Mark as imported"
+msgstr "Marquer comme importée"
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "This action cannot be undone"
+msgstr "Cette action est irréversible"
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Export CSV"
+msgstr "Exporter le CSV"
+
+#. module: hr_expense_accountedge
+#: model:email.template,subject:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "New expense waiting for approval"
+msgstr "Nouvelle note en attente d'approbation"
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.act_window,name:hr_expense_accountedge.action_email_templates_expenses
+#: model:ir.ui.menu,name:hr_expense_accountedge.menu_email_templates_expenses
+msgid "Email Templates"
+msgstr "Modèles de courriel"
+
+#. module: hr_expense_accountedge
+#: field:hr.expense.expense,web_url_view:0
+msgid "Url of the expense view"
+msgstr "URL de la note"
+
+#. module: hr_expense_accountedge
+#: field:hr.expense.expense,manager_emails:0
+msgid "Manager Emails"
+msgstr "Courriels des responsables"
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Set to Draft"
+msgstr "Mettre en brouillon"
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_html:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Hello,</p>\n"
+" <p>A new expense is waiting for approval. </p>\n"
+" <p>You can view the expense using the following link: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" View Expense\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+msgstr "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Bonjour,</p>\n"
+" <p>Une nouvelle note est en attente d'approbation. </p>\n"
+" <p>Vous pouvez voir la note en cliquant sur le lien suivant: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" Voir la note de frais\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Submit to Manager"
+msgstr "Soumettre au responsable"
+
+#. module: hr_expense_accountedge
+#: model:ir.model,name:hr_expense_accountedge.model_hr_expense_expense
+msgid "Expense"
+msgstr "Note de frais"
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.server,name:hr_expense_accountedge.ir_actions_server_edi_expense_approved
+msgid "Auto-email expense approved"
+msgstr "Courriel automatique des notes de frais approuvées"
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_text:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "\n"
+" Hello,\n"
+" A new expense is waiting for approval.\n"
+" You can view the expense using the following link:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
+msgstr "\n"
+" Bonjour,\n"
+" Une nouvelle note de frais est en attente d'approbation.\n"
+" Vous pouvez voir la note en cliquant sur le lien suivant:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
=== added file 'hr_expense_accountedge/i18n/hr_expense_accountedge.pot'
--- hr_expense_accountedge/i18n/hr_expense_accountedge.pot 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/i18n/hr_expense_accountedge.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,173 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_accountedge
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:38+0000\n"
+"PO-Revision-Date: 2013-07-19 19: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: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Refuse"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.server,name:hr_expense_accountedge.ir_actions_server_edi_expense_confirm
+msgid "Auto-email expense waiting for approval"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_html:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Hello,</p>\n"
+" <p>A new expense has been approved and is ready for export. </p>\n"
+" <p>You can view the expense using the following link: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" View Expense\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_text:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "\n"
+" Hello,\n"
+" A new expense has been approved and is ready for export.\n"
+" You can view the expense using the following link:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,subject:hr_expense_accountedge.email_template_edi_expense_accepted
+msgid "New expense approved and ready for export"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Approve"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Mark as imported"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "This action cannot be undone"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Export CSV"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,subject:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "New expense waiting for approval"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.act_window,name:hr_expense_accountedge.action_email_templates_expenses
+#: model:ir.ui.menu,name:hr_expense_accountedge.menu_email_templates_expenses
+msgid "Email Templates"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: field:hr.expense.expense,web_url_view:0
+msgid "Url of the expense view"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: field:hr.expense.expense,manager_emails:0
+msgid "Manager Emails"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Set to Draft"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_html:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "\n"
+" <div style=\"\n"
+" font-family : 'Lucica Grande', Ubuntu, Arial, Verdana, sans-serif;\n"
+" font-size : 12px;\n"
+" color : rgb(34, 34, 34);\n"
+" background-color: #FFF;\n"
+" \">\n"
+"\n"
+" <p>Hello,</p>\n"
+" <p>A new expense is waiting for approval. </p>\n"
+" <p>You can view the expense using the following link: </p>\n"
+" <a style=\"\n"
+" display:block; width: 150px; height:20px;\n"
+" margin-left: 20px; color: #DDD;\n"
+" font-family: 'Lucida Grande', Helvetica, Arial, sans-serif;\n"
+" font-size: 13px; font-weight: bold; text-align: center;\n"
+" text-decoration: none !important; line-height: 1;\n"
+" padding: 5px 0px 0px 0px; background-color: #8E0000;\n"
+" border-radius: 5px 5px; background-repeat: repeat no-repeat;\"\n"
+"\n"
+" href=\"${object.web_url_view or ''}\">\n"
+" View Expense\n"
+" </a>\n"
+" <br/>\n"
+" </div>\n"
+" "
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: view:hr.expense.expense:0
+msgid "Submit to Manager"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:ir.model,name:hr_expense_accountedge.model_hr_expense_expense
+msgid "Expense"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:ir.actions.server,name:hr_expense_accountedge.ir_actions_server_edi_expense_approved
+msgid "Auto-email expense approved"
+msgstr ""
+
+#. module: hr_expense_accountedge
+#: model:email.template,body_text:hr_expense_accountedge.email_template_edi_expense_waiting_approval
+msgid "\n"
+" Hello,\n"
+" A new expense is waiting for approval.\n"
+" You can view the expense using the following link:\n"
+" ${object.web_url_view or 'n/a'}\n"
+" "
+msgstr ""
+
=== added directory 'hr_expense_accountedge/security'
=== added file 'hr_expense_accountedge/security/ir_rule.xml'
--- hr_expense_accountedge/security/ir_rule.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/security/ir_rule.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,13 @@
+<?xml version="1.0" ?>
+<openerp>
+ <data noupdate="1">
+
+ <record id="property_rule_account_invoice_manager" model="ir.rule">
+ <field name="name">Account invoice and manager</field>
+ <field model="ir.model" name="model_id" ref="model_hr_expense_expense"/>
+ <field name="domain_force">[(1,'=',1)]</field>
+ <field name="groups" eval="[(4,ref('account.group_account_invoice'))]"/>
+ </record>
+ </data>
+</openerp>
+
=== added directory 'hr_expense_accountedge/tools'
=== added file 'hr_expense_accountedge/tools/.~lock.notes_de_frais_exportees.csv#'
--- hr_expense_accountedge/tools/.~lock.notes_de_frais_exportees.csv# 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/tools/.~lock.notes_de_frais_exportees.csv# 2013-07-19 21:14:26 +0000
@@ -0,0 +1,1 @@
+naysan ,naysan,ubuntu,11.07.2013 10:34,file:///home/naysan/.config/libreoffice/3;
\ No newline at end of file
=== added file 'hr_expense_accountedge/tools/hr_expense_accountedge.csv'
--- hr_expense_accountedge/tools/hr_expense_accountedge.csv 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/tools/hr_expense_accountedge.csv 2013-07-19 21:14:26 +0000
@@ -0,0 +1,10 @@
+Card ID Date Vendor Invoice # Account Number Amount Description Tax Code GST Amount PST/QST Amount Currency Code Exchange Rate
+2345 18-07-2023 6 6-5301 478.34 Basic PC 140 23.92 47.74 CAD 1.00
+2345 18-07-2023 6 6-5301 260.91 Basic PC 140 13.05 26.04 CAD 1.00
+
+3456 18-07-2013 5 6-5301 57.14 Shelf Panel 500 2.86 0.00 CAD 1.00
+3456 18-07-2013 5 6-5301 14.29 Side Panel 500 0.71 0.00 CAD 1.00
+3456 18-07-2013 5 6-5301 260.91 Basic PC 140 13.05 26.04 CAD 1.00
+3456 18-07-2013 5 6-5301 4.35 Mouse 140 0.22 0.43 CAD 1.00
+3456 18-07-2013 5 6-5301 4.35 Keyboard 140 0.22 0.43 CAD 1.00
+
=== added file 'hr_expense_accountedge/tools/import_script.py'
--- hr_expense_accountedge/tools/import_script.py 1970-01-01 00:00:00 +0000
+++ hr_expense_accountedge/tools/import_script.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,94 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 xmlrpclib
+import base64
+from datetime import datetime
+
+def main():
+ username = 'admin'
+ pwd = 'admin'
+ dbname = 'test_import_accountedge'
+ server_url = 'http://localhost:8069'
+
+ # Get the uid
+ sock_common = xmlrpclib.ServerProxy('%s/xmlrpc/common' % server_url)
+ uid = sock_common.login(dbname, username, pwd)
+
+ # Replace localhost with the address of the server
+ sock = xmlrpclib.ServerProxy('%s/xmlrpc/object' % server_url)
+
+ # Search for exported expense notes
+ args = [('state', '=', 'exported')]
+ expense_ids = sock.execute(dbname, uid, pwd, 'hr.expense.expense', 'search', args)
+
+ # Outpout file for AccountEdge
+ final_csv = open('hr_expense_accountedge.csv', 'w')
+
+ num_expense = 0
+
+ # For each exported expense note, search for he csv attachment
+ for expense_id in expense_ids:
+
+ args = [('res_model','=','hr.expense.expense'),('res_id', '=', expense_id)]
+ csv_ids = sock.execute(dbname, uid, pwd, 'ir.attachment', 'search', args)
+
+ fields = ['name', 'datas']
+ csv_obj = sock.execute(dbname, uid, pwd, 'ir.attachment', 'read', csv_ids, fields)
+
+ latest_csv = None
+ latest_date = datetime(2000, 1, 1, 0, 0, 0)
+
+ # Find the latest csv
+ for csv in csv_obj:
+ format = 'rapport_%Y%m%d_%H%M%S'
+ date_created = datetime.strptime(csv["name"], format)
+
+ if date_created > latest_date:
+ latest_date = date_created
+ latest_csv = csv
+
+ # Copy the lines to the new summary file
+ if latest_csv:
+ content = base64.b64decode(csv['datas'])
+ content = content.split("\r\n")
+
+ for num_line in range(len(content)):
+ if (num_line == 1 and num_expense == 0) or num_line > 1:
+ final_csv.write(content[num_line])
+ final_csv.write("\r\n")
+
+
+ num_expense = num_expense + 1
+
+
+ # Mark the expenses as imported
+ values = {'state': 'exported'}
+ result = sock.execute(dbname, uid, pwd, 'hr.expense.expense', 'write', expense_ids, values)
+
+ final_csv.close()
+
+if __name__ == "__main__":
+ main()
+
+
+
+
=== added directory 'hr_expense_line_account'
=== added file 'hr_expense_line_account/__init__.py'
--- hr_expense_line_account/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line_account
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_line_account/__openerp__.py'
--- hr_expense_line_account/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,40 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 id on expense line",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds the account id field to hr.expense.line
+ """,
+ "depends" : ['hr_expense'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'hr_expense_line_account.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_line_account/hr_expense_line_account.py'
--- hr_expense_line_account/hr_expense_line_account.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/hr_expense_line_account.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,73 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line(osv.osv):
+ _inherit = 'hr.expense.line'
+ _columns = {
+ 'account_id': fields.many2one('account.account', 'Financial Account'),
+ }
+
+ def get_account_id(self, cr, uid, product_id, context=None):
+ '''
+ Get the automatic value of the account_id field.
+ '''
+ # Retrieve the product
+ product = self.pool.get('product.product').browse(cr, uid, product_id)
+ # Product -> Accounting -> Expense account
+ exp_acc = product.product_tmpl_id.property_account_expense
+
+ # If the field is empty
+ if not exp_acc:
+ # Fidn the product's 'Parent category'
+ parent_category = product.product_tmpl_id.categ_id
+ # Try to find the expense account of the parent category
+ exp_acc = parent_category.property_account_expense_categ
+
+ if exp_acc:
+ return exp_acc.id
+
+ return None
+
+
+ def create(self, cr, user, vals, context=None):
+ '''
+ Overwrite the create() function to automatically set the default account id
+ since regular employees cannot access this field.
+ '''
+ vals['account_id'] = self.get_account_id(cr, user, vals['product_id'], context)
+ return super(hr_expense_line,self).create(cr, user, vals, context)
+
+
+ def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
+ if product_id:
+ values = super(hr_expense_line, self).onchange_product_id(cr, uid, ids, product_id, uom_id, employee_id, context=context)
+ for id in ids:
+ this = self.browse(cr, uid, id)
+ account_id = self.get_account_id(cr, uid, product_id, context)
+ values['value'].update({
+ 'account_id' : account_id
+ })
+ return values
+
+
+hr_expense_line()
=== added file 'hr_expense_line_account/hr_expense_line_account.xml'
--- hr_expense_line_account/hr_expense_line_account.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/hr_expense_line_account.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_expenses_tree" model="ir.ui.view">
+ <field name="name">hr.expense.line.tree</field>
+ <field name="model">hr.expense.line</field>
+ <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
+ <field name="arch" type="xml">
+ <field name="unit_amount" position="before">
+ <field name="account_id" groups="account.group_account_invoice"/>
+ </field>
+ </field>
+ </record>
+
+ <record id="view_expenses_form" model="ir.ui.view">
+ <field name="name">hr.expense.form</field>
+ <field name="model">hr.expense.expense</field>
+ <field name="inherit_id" ref="hr_expense.view_expenses_form"/>
+ <field name="arch" type="xml">
+ <field name="unit_quantity" position="after">
+ <newline/>
+ <field name="account_id" groups="account.group_account_invoice"/>
+ <newline/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'hr_expense_line_account/i18n'
=== added file 'hr_expense_line_account/i18n/fr.po'
--- hr_expense_line_account/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_account
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:39+0000\n"
+"PO-Revision-Date: 2013-07-19 19:39+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: hr_expense_line_account
+#: field:hr.expense.line,account_id:0
+msgid "Financial Account"
+msgstr "Compte financier"
+
+#. module: hr_expense_line_account
+#: model:ir.model,name:hr_expense_line_account.model_hr_expense_line
+msgid "Expense Line"
+msgstr "Ligne de frais"
+
=== added file 'hr_expense_line_account/i18n/hr_expense_line_account.pot'
--- hr_expense_line_account/i18n/hr_expense_line_account.pot 1970-01-01 00:00:00 +0000
+++ hr_expense_line_account/i18n/hr_expense_line_account.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_account
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:39+0000\n"
+"PO-Revision-Date: 2013-07-19 19:39+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: hr_expense_line_account
+#: field:hr.expense.line,account_id:0
+msgid "Financial Account"
+msgstr ""
+
+#. module: hr_expense_line_account
+#: model:ir.model,name:hr_expense_line_account.model_hr_expense_line
+msgid "Expense Line"
+msgstr ""
+
=== added directory 'hr_expense_line_number'
=== added file 'hr_expense_line_number/__init__.py'
--- hr_expense_line_number/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,23 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line_number
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_line_number/__openerp__.py'
--- hr_expense_line_number/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,41 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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" : "Line number on expense line",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds a 'line number' field on the expense line.
+ The field is called 'sequence'.
+ """,
+ "depends" : ['hr_expense'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'hr_expense_line_number.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_line_number/hr_expense_line_number.py'
--- hr_expense_line_number/hr_expense_line_number.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/hr_expense_line_number.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,65 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line(osv.osv):
+ _inherit = 'hr.expense.line'
+ _columns = {
+ 'sequence': fields.integer('N°', required=True),
+ }
+ _defaults = {
+ 'sequence': lambda obj, cr, uid, context:0
+ }
+
+ def update_sequences(self, cr, uid, expense, context=None):
+ ''' Updating the sequences (line numbers) of an hr.expense
+ object. '''
+ num = 0
+ for l in expense.line_ids:
+ num = num + 1
+ self.write(cr, uid, l.id, {'sequence':num})
+
+ def unlink(self, cr, uid, ids, context=None):
+ ''' Overwriting the unlink() method
+ to update the line numbers of the expense
+ the expense lines belong to'''
+ for id in ids:
+ expense = self.pool.get('hr.expense.line').browse(cr, uid, id).expense_id
+ ret = super(hr_expense_line,self).unlink(cr, uid, ids, context)
+ self.update_sequences(cr, uid, expense, context)
+ return ret
+
+ def create(self, cr, user, vals, context=None):
+ ''' Overwriting the create() method
+ to update the line numbers of the expense
+ the expense line belongs to'''
+ ret = super(hr_expense_line,self).create(cr, user, vals, context)
+
+ if ('sequence' not in vals) or (vals.get('sequence')==0):
+ expense = self.pool.get('hr.expense.expense').browse(cr, user, vals['expense_id'])
+ self.update_sequences(cr, user, expense, context)
+ return ret
+
+hr_expense_line()
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_line_number/hr_expense_line_number.xml'
--- hr_expense_line_number/hr_expense_line_number.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/hr_expense_line_number.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,14 @@
+<openerp>
+ <data>
+ <record id="view_expenses_tree" model="ir.ui.view">
+ <field name="name">hr.expense.line.tree.inherit</field>
+ <field name="model">hr.expense.line</field>
+ <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
+ <field name="arch" type="xml">
+ <field name="date_value" position="before">
+ <field name="sequence"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'hr_expense_line_number/i18n'
=== added file 'hr_expense_line_number/i18n/fr.po'
--- hr_expense_line_number/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,22 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_number
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:40+0000\n"
+"PO-Revision-Date: 2013-07-19 19:40+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: hr_expense_line_number
+#: model:ir.model,name:hr_expense_line_number.model_hr_expense_line
+msgid "Expense Line"
+msgstr "Ligne de frais"
+
=== added file 'hr_expense_line_number/i18n/hr_expense_line_number.pot'
--- hr_expense_line_number/i18n/hr_expense_line_number.pot 1970-01-01 00:00:00 +0000
+++ hr_expense_line_number/i18n/hr_expense_line_number.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,22 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_number
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:40+0000\n"
+"PO-Revision-Date: 2013-07-19 19:40+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: hr_expense_line_number
+#: model:ir.model,name:hr_expense_line_number.model_hr_expense_line
+msgid "Expense Line"
+msgstr ""
+
=== added directory 'hr_expense_line_supplier_tax'
=== added file 'hr_expense_line_supplier_tax/__init__.py'
--- hr_expense_line_supplier_tax/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/__init__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,22 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line_supplier_tax
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_line_supplier_tax/__openerp__.py'
--- hr_expense_line_supplier_tax/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/__openerp__.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,39 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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" : "Supplier tax id on hr.expense.line",
+ "version" : "1.0",
+ "author" : "Savoir-faire Linux",
+ "website" : "http://www.savoirfairelinux.com",
+ "category" : "Human Resources",
+ "description": """
+ This module adds the supplier tax id field to hr.expense.line
+ """,
+ "depends" : ['hr_expense', 'hr_expense_line_supplier'],
+ "init_xml" : [],
+ "update_xml" : [
+ 'hr_expense_line_supplier_tax.xml',
+ ],
+ "demo_xml" : [],
+ "installable" : True,
+ "certificate" : ''
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.py'
--- hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.py 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.py 2013-07-19 21:14:26 +0000
@@ -0,0 +1,100 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#····
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2010 Savoir-faire Linux (<http://www.savoirfairelinux.com>).
+#
+# 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 hr_expense_line(osv.osv):
+ _inherit = 'hr.expense.line'
+
+
+ def get_tax_id(self, cr, uid, product_id, partner_id, context=None):
+ '''
+ Get the automatic value of the tax id field.
+ '''
+ product = self.pool.get('product.product').browse(cr, uid, product_id)
+ purch_tax = product.product_tmpl_id.supplier_taxes_id
+
+ if purch_tax:
+ # Si le produit a une taxe à l'achat, elle devient la taxe par défaut
+ defaut_tax = purch_tax[0]
+
+ # Voir la fiche du fournisseur
+ supplier= self.pool.get('res.partner').browse(cr, uid, partner_id)
+ acc_pos = supplier.property_account_position
+
+ # Si la position fiscale a une table de mapping source/destination ...
+ if acc_pos.tax_ids:
+ for tax in acc_pos.tax_ids:
+ if tax.tax_src_id == defaut_tax:
+ # ... remplacer la taxe par défaut par son équivalent
+ defaut_tax = tax.tax_dest_id
+ break
+ return defaut_tax.id
+
+ return None
+
+
+ def create(self, cr, user, vals, context=None):
+ '''
+ Overwrite the create() function to automatically set the default supplier tax
+ since regular employees cannot access this field.
+ '''
+ vals['tax_id'] = self.get_tax_id(cr, user, vals['product_id'], vals['partner_id'], context)
+ return super(hr_expense_line,self).create(cr, user, vals, context)
+
+
+ def onchange_product_id(self, cr, uid, ids, product_id, uom_id, employee_id, context=None):
+ if product_id:
+ values = super(hr_expense_line, self).onchange_product_id(cr, uid, ids, product_id, uom_id, employee_id, context=context)
+ else:
+ values = {}
+
+ for id in ids:
+ this = self.browse(cr, uid, id)
+ if this.name:
+ tax_id = self.get_tax_id(cr, uid, product_id, this.partner_id.id, context)
+ values['value'].update({
+ 'tax_id' : tax_id
+ })
+ return values
+
+ def onchange_partner_id(self, cr, uid, ids, partner_id, context=None):
+ if partner_id:
+ values = {'value': {}}
+ for id in ids:
+ this = self.browse(cr, uid, id)
+ tax_id = self.get_tax_id(cr, uid, this.product_id.id, partner_id, context)
+ values['value'].update({
+ 'tax_id' : tax_id
+ })
+ return values
+
+
+ _columns = {
+ 'tax_id': fields.many2one('account.tax', 'Tax', domain= [('type_tax_use', '=', 'purchase')]),
+ }
+
+
+
+hr_expense_line()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.xml'
--- hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/hr_expense_line_supplier_tax.xml 2013-07-19 21:14:26 +0000
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="view_expenses_tree" model="ir.ui.view">
+ <field name="name">hr.expense.line.tree</field>
+ <field name="model">hr.expense.line</field>
+ <field name="inherit_id" ref="hr_expense.view_expenses_line_tree"/>
+ <field name="arch" type="xml">
+ <field name="unit_amount" position="before">
+ <field name="tax_id" groups="account.group_account_invoice"/>
+ </field>
+ </field>
+ </record>
+
+ <record id="view_expenses_form" model="ir.ui.view">
+ <field name="name">hr.expense.form</field>
+ <field name="model">hr.expense.expense</field>
+ <field name="inherit_id" ref="hr_expense_line_supplier.view_expenses_form"/>
+ <field name="arch" type="xml">
+ <field name="partner_id" position="replace"/>
+ <field name="product_id" position="after">
+ <field name="partner_id" domain="[('supplier','=',True)]" select="2" on_change="onchange_partner_id(partner_id)"/>
+ </field>
+ <field name="uom_id" position="before">
+ <field name="tax_id" groups="account.group_account_invoice"/>
+ </field>
+ </field>
+ </record>
+ </data>
+</openerp>
=== added directory 'hr_expense_line_supplier_tax/i18n'
=== added file 'hr_expense_line_supplier_tax/i18n/fr.po'
--- hr_expense_line_supplier_tax/i18n/fr.po 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/i18n/fr.po 2013-07-19 21:14:26 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_supplier_tax
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:41+0000\n"
+"PO-Revision-Date: 2013-07-19 19:41+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: hr_expense_line_supplier_tax
+#: field:hr.expense.line,tax_id:0
+msgid "Tax"
+msgstr "Taxe"
+
+#. module: hr_expense_line_supplier_tax
+#: model:ir.model,name:hr_expense_line_supplier_tax.model_hr_expense_line
+msgid "Expense Line"
+msgstr "Ligne de frais"
+
=== added file 'hr_expense_line_supplier_tax/i18n/hr_expense_line_supplier_tax.pot'
--- hr_expense_line_supplier_tax/i18n/hr_expense_line_supplier_tax.pot 1970-01-01 00:00:00 +0000
+++ hr_expense_line_supplier_tax/i18n/hr_expense_line_supplier_tax.pot 2013-07-19 21:14:26 +0000
@@ -0,0 +1,27 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+# * hr_expense_line_supplier_tax
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.1\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2013-07-19 19:41+0000\n"
+"PO-Revision-Date: 2013-07-19 19:41+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: hr_expense_line_supplier_tax
+#: field:hr.expense.line,tax_id:0
+msgid "Tax"
+msgstr ""
+
+#. module: hr_expense_line_supplier_tax
+#: model:ir.model,name:hr_expense_line_supplier_tax.model_hr_expense_line
+msgid "Expense Line"
+msgstr ""
+
Follow ups