You have been requested to review the proposed merge of lp:~savoirfairelinux-openerp/openerp-sage-50/6.1-exportsage50 into lp:openerp-sage-50/6.1.
For more details, see: https://code.launchpad.net/~savoirfairelinux-openerp/openerp-sage-50/6.1-exportsage50/+merge/158246 [ADD] exportsage50 -- https://code.launchpad.net/~savoirfairelinux-openerp/openerp-sage-50/6.1-exportsage50/+merge/158246 Your team OpenERP Community Reviewer/Maintainer is requested to review the proposed merge of lp:~savoirfairelinux-openerp/openerp-sage-50/6.1-exportsage50 into lp:openerp-sage-50/6.1.
=== added directory 'exportsage50' === added file 'exportsage50/AUTHORS.txt' --- exportsage50/AUTHORS.txt 1970-01-01 00:00:00 +0000 +++ exportsage50/AUTHORS.txt 2013-11-15 15:41:37 +0000 @@ -0,0 +1,2 @@ +EL HADJI DEM <elhadji....@savoirfairelinux.com> +Savoir-faire Linux <cont...@savoirfairelinux.com> \ No newline at end of file === added file 'exportsage50/__init__.py' --- exportsage50/__init__.py 1970-01-01 00:00:00 +0000 +++ exportsage50/__init__.py 2013-11-15 15:41:37 +0000 @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.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 wizard +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'exportsage50/__openerp__.py' --- exportsage50/__openerp__.py 1970-01-01 00:00:00 +0000 +++ exportsage50/__openerp__.py 2013-11-15 15:41:37 +0000 @@ -0,0 +1,128 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.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/>. +# +############################################################################## + +{ + 'name': 'Export to Sage50', + 'version': '1.0', + "category": 'Accounting & Finance', + 'complexity': "easy", + 'description': """ +French version below + +Export accounting data from OpenErp to Sage50. +==================================== + Export accounting data from OpenErp to Sage50. The exportation generates the imp file to import in Sage50. + + +Documentation : layout of the import file (.IMP) +==================================== +A PDF document (in the /doc repository) gives more details about the .IMP file layout that can be imported +into Sage 50.This document is part of the Sage 50 SDK (Software Development Kit) available for download at +the following address : http://na.sage.com/sage-simply-accounting/lp/partners/sdk/?isnow=ssa. + + + +Sage 50: After creating .IMP file +==================================== +Solution: +Importing purchase invoices, purchase quotes, sales invoices and sales orders into Sage 50 +How to import purchase invoices, purchase quotes, sales invoices and sales orders? +You can import purchase invoices, purchase quotes, sales invoices and sales orders into Sage 50. +The transaction(s) details should be in a text file with extension .IMP. + + +After you have created the .IMP file, you can import the transaction(s) into Sage 50 by following these steps: +(Account information is not included in the .IMP format because when importing the file, you will receive +a pop-up screen to ask you "Select an Account to match".) + +From the Home Window, go to File, Import/Export +Click on Import Transactions (the Import Transactions Wizard appears) +Select on 'Import purchase invoices, purchase quotes, sales invoices, sales orders or time slips' and click Next +You can now create a backup of your file +Click Next +Click on Browse and select the .IMP file previously created +If the customer (or vendor) in the transaction(s) you are trying to import does not exist in the Sage 50 company, +you will get a new window asking you if you want to add this customer (or vendor), or if you want to select +another customer (or vendor) from the existing ones +You will also get a similar window if the import file uses an inventory item which does not exist in Sage 50. +You will see a summary of the imported transactions, click OK and then Finish. +If you got any errors importing the data, open the .IMP file in Notepad and use the attached .PDF document +to verify the file format. Once the errors have been corrected, you can try the import again. +Note: View KB25664 for information about some possible errors when importing .IMP file. +Sage Business Care plan does NOT include support for SDK. Please, contact one of our partners website +for further assistance. + +Possible errors when importing purchase invoices, purchase quotes, sales invoices and/or sales orders +==================================== +Questions and Answers +Import started... Errors occurred while importing. +Line x does not contain compatible tax information. +Invalid date. The date must be between <date1> and <date2>. + + +A: These are the possible reasons for getting any of these error messages when importing transactions +into Simply Accounting: + +- The import file (extension .IMP) you are using does not have the proper format. + Refer to the KB article 25659 for more information about the format of the import file. + +- The transaction type is not enabled in the Simply Accounting company. To enable the feature, from the Home Window +in Simply Accounting, go to Setup, Settings, Company, Features, make sure the type of transaction you want to import +is checked + +- The dates in the import file do not match the fiscal year dates in Simply Accounting. + Open the import file in Notepad and make the necessary changes + + +Exportation des données comptables de OpenERP vers Sage50. +============================================== +Ce module exporte des données comptables de OpenERP vers Sage50. Le module génére un fichier imp file qui peut +être importé dans Sage50. + +Documentation : Format du fichier à importer (.IMP) +==================================== +Un document .PDF (dans le répertoire /doc) donne plus de détails sur le format du fichier .IMP qui peut être +importé dans Sage 50. Ce document fait parti du Kit de développement - SDK de Sage 50 qui peut-être téléchargé +à l'adresse suivante : http://na.sage.com/sage-simply-accounting/lp/partners/sdk/?isnow=ssa. + +Guide d'utilisation export Sage 50 +======================================== +Comment exporter les données comptables à partir d'OpenERP? +Un manuel d'utilisation est disponible dans le répertoire /doc du module. + + """, + "author": "Gestion-Ressources", + "website": "http://www.gestion-ressources.com", + "license": "AGPL-3", + 'images': [], + 'depends': ['account'], + 'update_xml': [ + 'wizard/exportsage50.xml', + 'security/ir.model.access.csv', + ], + 'demo_xml': [], + 'test':[], + 'installable': True, + 'auto_install': False, + 'certificate': '', + 'application': True, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added directory 'exportsage50/docs' === added file 'exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf' Binary files exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/Guide_Export_Sage_50_OpenERP_FR.pdf 2013-11-15 15:41:37 +0000 differ === added file 'exportsage50/docs/dev-import.pdf' Binary files exportsage50/docs/dev-import.pdf 1970-01-01 00:00:00 +0000 and exportsage50/docs/dev-import.pdf 2013-11-15 15:41:37 +0000 differ === added directory 'exportsage50/i18n' === added file 'exportsage50/i18n/exportsage50.pot' --- exportsage50/i18n/exportsage50.pot 1970-01-01 00:00:00 +0000 +++ exportsage50/i18n/exportsage50.pot 2013-11-15 15:41:37 +0000 @@ -0,0 +1,116 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * exportsage50 +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 6.1\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-15 15:35+0000\n" +"PO-Revision-Date: 2013-11-15 15: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: exportsage50 +#: field:exportsage,format:0 +msgid "File Format" +msgstr "" + +#. module: exportsage50 +#: help:exportsage,invoice_ids:0 +msgid "This is the list of invoices that have been generated for this sales order. The same sales order may have been invoiced in several times (by line for example)." +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +msgid "Export done" +msgstr "" + +#. module: exportsage50 +#: selection:exportsage,state:0 +msgid "get" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +#: field:exportsage,invoice_ids:0 +msgid "Invoices" +msgstr "" + +#. module: exportsage50 +#: field:exportsage,state:0 +msgid "unknown" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +msgid "Create" +msgstr "" + +#. module: exportsage50 +#: code:addons/exportsage50/wizard/exportsage50.py:71 +#, python-format +msgid "You have to select at least 1 Invoice. And try again" +msgstr "" + +#. module: exportsage50 +#: field:exportsage,name:0 +msgid "Filename" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +#: model:ir.ui.menu,name:exportsage50.menu_report +msgid "Export to Sage50" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +msgid "This action allows you to export accounting data from OpenErp to Simply account.You should have the same configuration about the tax information" +msgstr "" + +#. module: exportsage50 +#: model:ir.model,name:exportsage50.model_exportsage +msgid "Create imp file to export in sage50" +msgstr "" + +#. module: exportsage50 +#: selection:exportsage,state:0 +msgid "choose" +msgstr "" + +#. module: exportsage50 +#: field:exportsage,data:0 +msgid "File" +msgstr "" + +#. module: exportsage50 +#: code:addons/exportsage50/wizard/exportsage50.py:71 +#, python-format +msgid "Error" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +msgid "Cancel" +msgstr "" + +#. module: exportsage50 +#: view:exportsage:0 +msgid "_Close" +msgstr "" + +#. module: exportsage50 +#: field:exportsage,config_logo:0 +msgid "Image" +msgstr "" + +#. module: exportsage50 +#: model:ir.actions.act_window,name:exportsage50.action_account_invoice_generate_export +msgid "Export accounting data to Sage50" +msgstr "" + === added directory 'exportsage50/security' === added file 'exportsage50/security/ir.model.access.csv' --- exportsage50/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 +++ exportsage50/security/ir.model.access.csv 2013-11-15 15:41:37 +0000 @@ -0,0 +1,2 @@ +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink +access_exportsage,exportsage,model_exportsage,account.group_account_user,1,0,0,0 === added directory 'exportsage50/static' === added directory 'exportsage50/static/src' === added directory 'exportsage50/static/src/img' === added file 'exportsage50/static/src/img/icon.png' Binary files exportsage50/static/src/img/icon.png 1970-01-01 00:00:00 +0000 and exportsage50/static/src/img/icon.png 2013-11-15 15:41:37 +0000 differ === added directory 'exportsage50/wizard' === added file 'exportsage50/wizard/__init__.py' --- exportsage50/wizard/__init__.py 1970-01-01 00:00:00 +0000 +++ exportsage50/wizard/__init__.py 2013-11-15 15:41:37 +0000 @@ -0,0 +1,23 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.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 exportsage50 +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file === added file 'exportsage50/wizard/exportsage50.py' --- exportsage50/wizard/exportsage50.py 1970-01-01 00:00:00 +0000 +++ exportsage50/wizard/exportsage50.py 2013-11-15 15:41:37 +0000 @@ -0,0 +1,196 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2013 Gestion-Ressources (<http://www.gestion-ressources.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 osv, fields +import web +import base64 +import tools +from tools.translate import _ +from tools.misc import get_iso_codes +import pooler +from datetime import datetime +import decimal_precision as dp + + +class exportsage(osv.osv): + + """ + Wizard + """ + _name = "exportsage" + _description = "Create imp file to export in sage50" + _inherit = "ir.wizard.screen" + _columns = { + 'data': fields.binary('File', readonly=True), + 'name': fields.char('Filename', 20, readonly=True), + 'format': fields.char('File Format', 10), + 'state': fields.selection([('choose', 'choose'), # choose date + ('get', 'get')]), + 'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_export_rel', 'order_id', 'invoice_id', + 'Invoices', required=True, + help="This is the list of invoices that have been generated for this sales order. The same sales order may have been invoiced in several times (by line for example)."), + } + + _defaults = { + 'state': lambda *a: 'choose', + } + def act_cancel(self, cr, uid, ids, context=None): + #self.unlink(cr, uid, ids, context) + return {'type':'ir.actions.act_window_close' } + + + def act_destroy(self, *args): + return {'type':'ir.actions.act_window_close' } + + + def create_report(self, cr, uid, ids, context=None): + if context == None: + context = {} + this = self.browse(cr, uid, ids)[0] + data = self.read(cr, uid, ids, [], context=context)[0] + + if not data['invoice_ids']: + raise osv.except_osv(_('Error'), _('You have to select at least 1 Invoice. And try again')) + + output = '<Version>''\n' + '"12001"' + ',' + '"1"''\n' + '</Version>\n\n' + #Faire le traitement des autres lignes dans les lignes de factures + pool = pooler.get_pool(cr.dbname) + line_obj = pool.get('account.invoice') + + for line in line_obj.browse(cr, uid, data['invoice_ids'], context): + # tag de debut pour les lignes de factures + output += '<SalInvoice>''\n' + #informations sur le client + costumer_name = line.partner_id.name + oneTimefield = "" + contact_name = line.partner_id.address[0].name or "" + street1 = line.partner_id.address[0].street or "" + street2 = line.partner_id.address[0].street2 or "" + city = line.partner_id.address[0].city or "" + province_state = line.partner_id.address[0].state_id.name or "" + zip_code = line.partner_id.address[0].zip or "" + country = line.partner_id.address[0].country_id.name or "" + phone1 = line.partner_id.address[0].phone or "" + mobile = line.partner_id.address[0].mobile or "" + fax = line.partner_id.address[0].fax or "" + email = line.partner_id.address[0].email or "" + # ligne de client + fields = [costumer_name, oneTimefield, contact_name, street1, street2, + city, province_state, zip_code, country, phone1, mobile, fax, email + ] + costumer = ','.join(['"%s"' % field for field in fields]) + #print costumer + #exit(0) + output += costumer.encode('UTF-8') + '\n' + #informations sur la facture + no_of_details = str(len(line.invoice_line)) + order_no = "" + # Invoice number (Max 20 chars) + invoice_no = str(line.number) + # date de la facture + if line.date_invoice: + entry_date = datetime.strptime(line.date_invoice, "%Y-%m-%d").strftime('%m-%d-%Y') # date format : mm-dd-yyyy + else: + entry_date = "" + # Informations sur le type de paiement (between 0 and 3) + # 0 = pay later , 1 = cash , 2 = cheque , 3 = credit card + # Selectionner le dernier paiement + list_id = [] + # Paid by source (20 Chars) : Blank- pay later and cash Cheque number or credit card + paid_by_source = "" + if line.payment_ids: + for oneId in line.payment_ids: + list_id.append(oneId.id) + lastId = max(list_id) + # acceder à partir du dernier paiement à l'objet account_move_line + account_move_line_obj = self.pool.get('account.move.line') + account_move_line = account_move_line_obj.browse(cr, uid, lastId, context=context) + paiement_type = account_move_line.journal_id.type + if paiement_type == 'cash': + paid_by_type = str(1) + paid_by_source = account_move_line.ref + elif paiement_type == 'bank': + paid_by_type = str(2) + else: + paid_by_type = str(0) # default value 0 = pay later + + else: + paid_by_type = str(0) # default value 0 = pay later + total_amount = str(line.amount_total) or "" + freight_amount = "0.0" + fields_sale_invoice = [no_of_details, order_no, invoice_no, entry_date, paid_by_type, + paid_by_source, total_amount, freight_amount, + ] + sale_invoice = ','.join(['"%s"' % field_sale_invoice for field_sale_invoice in fields_sale_invoice]) + #sale_invoice = '"' + no_of_details + '"' + ',"' + order_no + '"' + ',"' + invoice_no + '"' + ',"' + entry_date + '"' + ',"' + paid_by_type + '"' + ',"' + paid_by_source + '"' + ',"' + total_amount + '"' + ',"' + freight_amount + '"' + output += sale_invoice.encode('UTF-8') + '\n' + product_line_invoice_with_taxe = "" + #Sale invoice detail lines + account_invoice_line_obj =self.pool.get('account.invoice.line') + product_ids = account_invoice_line_obj.search(cr, uid, [('invoice_id','=',line.id)]) + + if product_ids: + for product in account_invoice_line_obj.browse(cr, uid, product_ids): + item_number = str(product.name) + quantity = str(product.quantity) + price = str(product.price_unit) + amount = product.quantity * product.price_unit + amount = str(round(amount, self.pool.get('decimal.precision').precision_get(cr, uid, 'Account'))) + fields_one_product_invoice = [item_number, quantity, price, amount] + one_product_invoice = ','.join(['"%s"' % field_one_product_invoice for field_one_product_invoice in fields_one_product_invoice]) + #one_product_invoice = '"' + item_number + '"' + ',"' + quantity + '"' + ',"' + price + '"' + ',"' + amount + '"' + one_product_invoice = one_product_invoice.encode('UTF-8') + tax_product_line = "" + # tax information pour chaque produit + if product.invoice_line_tax_id: + for one_taxe in product.invoice_line_tax_id: + tax_name = one_taxe.description # or one_taxe.description or one_taxe.name + if one_taxe.price_include: + tax_included = str(1) # 1=yes,0=No + else: + tax_included = str(0) # 1=yes,0=No + tax_refundable = str(1) # 1=yes,0=No + tax_rate = str(one_taxe.amount) + tax_amount = str(one_taxe.amount) + fields_tax_product_line = [tax_name, tax_included, tax_refundable, tax_rate, tax_amount, + ] + tax_product_line = ',' + ','.join(['"%s"' % field_tax_product_line for field_tax_product_line in fields_tax_product_line]) + #tax_product_line += ',"' + tax_name + '"' + ',"' + tax_included + '"' + ',"' + tax_refundable + '"' + ',"' + tax_rate + '"' + ',"' + tax_amount + '"' + + #tax_product_line = tax_product_line[:-1] + tax_product_line = tax_product_line.encode('UTF-8') + product_line_invoice_with_taxe += one_product_invoice + tax_product_line + '\n' + #print product_line_invoice_with_taxe , exit(0) + + output += product_line_invoice_with_taxe + # tag de fin pour les lignes de factures + #output += '</SalInvoice>\n' + output += '</SalInvoice>\n\n\n' + #output += '\n' + this.start_date + ',' + this.end_date + this.format = 'imp' + filename = 'export_to_sage50' + this.name = "%s.%s" % (filename, this.format) + out = base64.encodestring(output) + self.write(cr, uid, ids, {'state':'get', 'data':out, 'name':this.name, 'format' : this.format}, context=context) + +exportsage() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === added file 'exportsage50/wizard/exportsage50.xml' --- exportsage50/wizard/exportsage50.xml 1970-01-01 00:00:00 +0000 +++ exportsage50/wizard/exportsage50.xml 2013-11-15 15:41:37 +0000 @@ -0,0 +1,50 @@ +<?xml version="1.0" encoding="utf-8"?> +<openerp> + <data> + <!-- =========== VIEWS =========== --> + <record id="account_invoice_generate_export_view" model="ir.ui.view"> + <field name="name">Export to Sage50</field> + <field name="model">exportsage</field> + <field name="type">form</field> + <field name="arch" type="xml"> + <form string="Export to Sage50" col="3" > + <group col="2" fill="0" height="2500" states="choose"> + <label colspan="4" width="220" string="This action allows you to export accounting + data from OpenErp to Simply account.You should have the same configuration about the tax information"/> + <separator string="Invoices" colspan="4"/> + <field name="invoice_ids" colspan="4" nolabel="1"/> + <separator colspan="2"/> + <group colspan="2"> + <button special="cancel" icon="gtk-cancel" string="Cancel"/> + <button type="object" name="create_report" icon="gtk-go-forward" string="Create"/> + </group> + <field invisible="1" name="state"/> + <field invisible="1" name="format"/> + </group> + <group col="3" fill="0" states="get"> + <separator colspan="3" string="Export done"/> + <field name="name" invisible="1" width="100"/> + <field name="data" nolabel="1" readonly="1" filename="name" colspan="4"/> + <button icon="gtk-close" name="act_destroy" special="cancel" string="_Close" type="object"/> + </group> + </form> + </field> + </record> + <!-- =========== ACTIONS =========== --> + <record id="action_account_invoice_generate_export" model="ir.actions.act_window"> + <field name="name">Export accounting data to Sage50</field> + <field name="type">ir.actions.act_window</field> + <field name="res_model">exportsage</field> + <field name="view_type">form</field> + <field name="view_mode">form</field> + <field name="view_id" ref="account_invoice_generate_export_view"/> + <field name="target">new</field> + </record> + <!-- =========== MENU ITEMS =========== --> + <menuitem id="menu_report" + name="Export to Sage50" + action="action_account_invoice_generate_export" + parent="account.menu_finance_reporting" + sequence="40" /> + </data> +</openerp> \ No newline at end of file
-- Mailing list: https://launchpad.net/~openerp-community-reviewer Post to : openerp-community-reviewer@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-community-reviewer More help : https://help.launchpad.net/ListHelp