Lorenzo Battistini - Agile BG has proposed merging 
lp:~agilebg/account-invoicing/7.0-add_account_invoice_template into 
lp:account-invoicing.

Requested reviews:
  Account Core Editors (account-core-editors)

For more details, see:
https://code.launchpad.net/~agilebg/account-invoicing/7.0-add_account_invoice_template/+merge/194733
-- 
https://code.launchpad.net/~agilebg/account-invoicing/7.0-add_account_invoice_template/+merge/194733
Your team Account Core Editors is requested to review the proposed merge of 
lp:~agilebg/account-invoicing/7.0-add_account_invoice_template into 
lp:account-invoicing.
=== added directory 'account_invoice_template'
=== added file 'account_invoice_template/AUTHORS.txt'
--- account_invoice_template/AUTHORS.txt	1970-01-01 00:00:00 +0000
+++ account_invoice_template/AUTHORS.txt	2013-11-11 18:03:00 +0000
@@ -0,0 +1,3 @@
+Lorenzo Battistini <lorenzo.battist...@agilebg.com>
+Leonardo Pistone <leonardo.pist...@agilebg.com>
+Franco Tampieri <franco.tampi...@agilebg.com>

=== added file 'account_invoice_template/__init__.py'
--- account_invoice_template/__init__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_template/__init__.py	2013-11-11 18:03:00 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
+#    Copyright (C) 2011 Domsense srl (<http://www.domsense.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 account_invoice_template
+import wizard

=== added file 'account_invoice_template/__openerp__.py'
--- account_invoice_template/__openerp__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_template/__openerp__.py	2013-11-11 18:03:00 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
+#    Copyright (C) 2011 Domsense srl (<http://www.domsense.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': "Account Invoice Template",
+    'version': '0.1',
+    'category': 'Generic Modules/Accounting',
+    'description': """
+Templates for Invoices
+
+User can configure invoice templates, useful for recurring invoices.
+The amount of each template line can be computed (through python code)
+or kept as user input. If user input, when using the template, user has to fill
+the amount of every input lines.
+The invoice form allows lo load, through a wizard, the template to use and the
+amounts to fill.
+""",
+    'author': 'Agile Business Group',
+    'website': 'http://www.agilebg.com',
+    'license': 'AGPL-3',
+    "depends": ['account_move_template'],
+    "data": [
+        'invoice_template.xml',
+        'wizard/select_template.xml',
+        'security/ir.model.access.csv',
+        ],
+    "active": False,
+    "installable": True
+}

=== added file 'account_invoice_template/account_invoice_template.py'
--- account_invoice_template/account_invoice_template.py	1970-01-01 00:00:00 +0000
+++ account_invoice_template/account_invoice_template.py	2013-11-11 18:03:00 +0000
@@ -0,0 +1,106 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
+#    Copyright (C) 2011 Domsense srl (<http://www.domsense.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 openerp.osv import fields, orm
+
+
+class account_invoice_template(orm.Model):
+
+    _inherit = 'account.document.template'
+    _name = 'account.invoice.template'
+
+    _columns = {
+        'partner_id': fields.many2one('res.partner', 'Partner', required=True),
+        'account_id': fields.many2one('account.account', 'Account', required=True),
+        'template_line_ids': fields.one2many('account.invoice.template.line',
+            'template_id', 'Template Lines'),
+        'type': fields.selection([
+            ('out_invoice', 'Customer Invoice'),
+            ('in_invoice', 'Supplier Invoice'),
+            ('out_refund', 'Customer Refund'),
+            ('in_refund', 'Supplier Refund'),
+            ], 'Type', required=True),
+        }
+
+
+class account_invoice_template_line(orm.Model):
+
+    _name = 'account.invoice.template.line'
+    _inherit = 'account.document.template.line'
+
+    _columns = {
+        'account_id': fields.many2one('account.account', 'Account',
+            required=True, domain=[('type', '<>', 'view'), ('type', '<>', 'closed')]),
+        'analytic_account_id': fields.many2one('account.analytic.account',
+            'Analytic Account', ondelete="cascade"),
+        'invoice_line_tax_id': fields.many2many('account.tax',
+            'account_invoice_template_line_tax', 'invoice_line_id', 'tax_id',
+            'Taxes', domain=[('parent_id', '=', False)]),
+        'template_id': fields.many2one('account.invoice.template', 'Template',
+            ondelete='cascade'),
+        'product_id': fields.many2one('product.product', 'Product'),
+        }
+
+    _sql_constraints = [
+        ('sequence_template_uniq', 'unique (template_id,sequence)',
+            'The sequence of the line must be unique per template !')
+    ]
+
+    def product_id_change(self, cr, uid, ids, product_id, type, context=None):
+        if context is None:
+            context = {}
+
+        result = {}
+        if not product_id:
+            return {}
+
+        product = self.pool.get('product.product').browse(cr, uid, product_id,
+            context=context)
+
+        # name
+        result.update({'name': product.name})
+
+        # account
+        account_id = False
+        if type in ('out_invoice', 'out_refund'):
+            account_id = product.product_tmpl_id.property_account_income.id
+            if not account_id:
+                account_id = product.categ_id.property_account_income_categ.id
+        else:
+            account_id = product.product_tmpl_id.property_account_expense.id
+            if not account_id:
+                account_id = product.categ_id.property_account_expense_categ.id
+
+        if account_id:
+            result['account_id'] = account_id
+
+        # taxes
+        account_obj = self.pool.get('account.account')
+        taxes = account_id and account_obj.browse(
+            cr, uid, account_id, context=context).tax_ids or False
+        if type in ('out_invoice', 'out_refund') and product.taxes_id:
+            taxes = product.taxes_id
+        elif product.supplier_taxes_id:
+            taxes = product.supplier_taxes_id
+        tax_ids = taxes and [tax.id for tax in taxes] or False
+        result.update({'invoice_line_tax_id': tax_ids})
+
+        return {'value': result}

=== added directory 'account_invoice_template/i18n'
=== added file 'account_invoice_template/i18n/account_invoice_template.pot'
--- account_invoice_template/i18n/account_invoice_template.pot	1970-01-01 00:00:00 +0000
+++ account_invoice_template/i18n/account_invoice_template.pot	2013-11-11 18:03:00 +0000
@@ -0,0 +1,204 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_invoice_template
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.3\n"
+"Report-Msgid-Bugs-To: supp...@openerp.com\n"
+"POT-Creation-Date: 2011-10-31 16:49+0000\n"
+"PO-Revision-Date: 2011-10-31 16:49+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_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Customer Refund"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_wizard_select_template_by_invoice
+#: model:ir.ui.menu,name:account_invoice_template.menu_action_wizard_select_template
+msgid "Create Invoice from Template"
+msgstr ""
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Customer Invoice"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_account_invoice_template_line
+msgid "account.invoice.template.line"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,sequence:0
+#: field:wizard.select.invoice.template.line,sequence:0
+msgid "Number"
+msgstr ""
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Supplier Invoice"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,template_id:0
+#: field:wizard.select.invoice.template.line,template_id:0
+msgid "Template"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template,type:0
+#: field:account.invoice.template.line,type:0
+#: field:wizard.select.invoice.template.line,type:0
+msgid "Type"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_account_invoice_template
+msgid "account.invoice.template"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_wizard_select_invoice_template
+msgid "wizard.select.invoice.template"
+msgstr ""
+
+#. module: account_invoice_template
+#: code:addons/account_invoice_template/wizard/select_template.py:66
+#, python-format
+msgid "Error !"
+msgstr ""
+
+#. module: account_invoice_template
+#: selection:account.invoice.template.line,type:0
+msgid "User input"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+#: view:wizard.select.invoice.template.line:0
+msgid "Invoice Template Line"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template,account_id:0
+#: field:account.invoice.template.line,account_id:0
+#: field:wizard.select.invoice.template.line,account_id:0
+msgid "Account"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template,name:0
+#: field:account.invoice.template.line,name:0
+#: field:wizard.select.invoice.template.line,name:0
+msgid "Name"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:wizard.select.invoice.template,line_ids:0
+msgid "Lines"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,invoice_line_tax_id:0
+msgid "Taxes"
+msgstr ""
+
+#. module: account_invoice_template
+#: code:addons/account_invoice_template/wizard/select_template.py:66
+#, python-format
+msgid "At least one amount has to be non-zero!"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:wizard.select.invoice.template.line,amount:0
+msgid "Amount"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+#: view:wizard.select.invoice.template:0
+#: field:wizard.select.invoice.template,template_id:0
+msgid "Invoice Template"
+msgstr ""
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Supplier Refund"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_wizard_select_template
+msgid "Select Invoice Template"
+msgstr ""
+
+#. module: account_invoice_template
+#: sql_constraint:account.invoice.template.line:0
+msgid "The sequence of the line must be unique per template !"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:wizard.select.invoice.template:0
+msgid "Load"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+msgid "You can refer to other lines using their sequence number (e.g. 'L(1)' for first line). Examples of code: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1) + L(2) + L(3)'; '1250'"
+msgstr ""
+
+#. module: account_invoice_template
+#: selection:account.invoice.template.line,type:0
+msgid "Computed"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+msgid "Group By..."
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+#: field:account.invoice.template.line,python_code:0
+msgid "Python Code"
+msgstr ""
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_invoice_template_form
+#: model:ir.ui.menu,name:account_invoice_template.menu_action_invoice_template_form
+msgid "Invoice Templates"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,analytic_account_id:0
+msgid "Analytic Account"
+msgstr ""
+
+#. module: account_invoice_template
+#: field:account.invoice.template,template_line_ids:0
+#: model:ir.model,name:account_invoice_template.model_wizard_select_invoice_template_line
+msgid "Template Lines"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:wizard.select.invoice.template:0
+msgid "Cancel"
+msgstr ""
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+#: field:account.invoice.template,partner_id:0
+msgid "Partner"
+msgstr ""
+

=== added file 'account_invoice_template/i18n/it.po'
--- account_invoice_template/i18n/it.po	1970-01-01 00:00:00 +0000
+++ account_invoice_template/i18n/it.po	2013-11-11 18:03:00 +0000
@@ -0,0 +1,228 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#	* account_invoice_template
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 6.0.3\n"
+"Report-Msgid-Bugs-To: supp...@openerp.com\n"
+"POT-Creation-Date: 2011-11-02 10:30+0000\n"
+"PO-Revision-Date: 2011-11-02 11:35+0100\n"
+"Last-Translator: Lorenzo Battistini <lorenzo.battist...@agilebg.com>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: \n"
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+#: view:wizard.select.invoice.template.line:0
+msgid "Invoice Template Line"
+msgstr "Riga template fattura"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Customer Refund"
+msgstr "Nota di credito"
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_wizard_select_template_by_invoice
+#: model:ir.ui.menu,name:account_invoice_template.menu_action_wizard_select_template
+msgid "Create Invoice from Template"
+msgstr "Crea fattura da template"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Customer Invoice"
+msgstr "Fattura cliente"
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_account_invoice_template_line
+msgid "account.invoice.template.line"
+msgstr "account.invoice.template.line"
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,sequence:0
+#: field:wizard.select.invoice.template.line,sequence:0
+msgid "Number"
+msgstr "Numero"
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+msgid "Group By..."
+msgstr "Raggruppa per..."
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,template_id:0
+#: field:wizard.select.invoice.template.line,template_id:0
+msgid "Template"
+msgstr "Template"
+
+#. module: account_invoice_template
+#: field:account.invoice.template,type:0
+#: field:account.invoice.template.line,type:0
+#: field:wizard.select.invoice.template.line,type:0
+msgid "Type"
+msgstr "Tipo"
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_account_invoice_template
+msgid "account.invoice.template"
+msgstr "account.invoice.template"
+
+#. module: account_invoice_template
+#: model:ir.model,name:account_invoice_template.model_wizard_select_invoice_template
+msgid "wizard.select.invoice.template"
+msgstr "wizard.select.invoice.template"
+
+#. module: account_invoice_template
+#: code:addons/account_invoice_template/wizard/select_template.py:67
+#, python-format
+msgid "Error !"
+msgstr "Errore !"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template.line,type:0
+msgid "User input"
+msgstr "Input utente"
+
+#. module: account_invoice_template
+#: model:ir.module.module,description:account_invoice_template.module_meta_information
+msgid ""
+"\n"
+"======================\n"
+"Templates for Invoices\n"
+"======================\n"
+"User can configure invoice templates, useful for recurring invoices.\n"
+"The amount of each template line can be computed (through python code) or kept as user input. If user input, when using the template, user has to fill the amount of every input lines.\n"
+"The invoice form allows lo load, through a wizard, the template to use and the amounts to fill.\n"
+msgstr ""
+"\n"
+"======================\n"
+"Templates for Invoices\n"
+"======================\n"
+"User can configure invoice templates, useful for recurring invoices.\n"
+"The amount of each template line can be computed (through python code) or kept as user input. If user input, when using the template, user has to fill the amount of every input lines.\n"
+"The invoice form allows lo load, through a wizard, the template to use and the amounts to fill.\n"
+
+#. module: account_invoice_template
+#: field:account.invoice.template,account_id:0
+#: field:account.invoice.template.line,account_id:0
+#: field:wizard.select.invoice.template.line,account_id:0
+msgid "Account"
+msgstr "Conto"
+
+#. module: account_invoice_template
+#: field:account.invoice.template,name:0
+#: field:account.invoice.template.line,name:0
+#: field:wizard.select.invoice.template.line,name:0
+msgid "Name"
+msgstr "Nome"
+
+#. module: account_invoice_template
+#: field:wizard.select.invoice.template,line_ids:0
+msgid "Lines"
+msgstr "Righe"
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,invoice_line_tax_id:0
+msgid "Taxes"
+msgstr "Imposte"
+
+#. module: account_invoice_template
+#: code:addons/account_invoice_template/wizard/select_template.py:67
+#, python-format
+msgid "At least one amount has to be non-zero!"
+msgstr "Almeno un importo deve essere diverso da zero!"
+
+#. module: account_invoice_template
+#: field:wizard.select.invoice.template.line,amount:0
+msgid "Amount"
+msgstr "Importo"
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+#: view:wizard.select.invoice.template:0
+#: field:wizard.select.invoice.template,template_id:0
+msgid "Invoice Template"
+msgstr "Template fattura"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Supplier Refund"
+msgstr "Reso a fornitore"
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_wizard_select_template
+msgid "Select Invoice Template"
+msgstr "Scegli template fattura"
+
+#. module: account_invoice_template
+#: sql_constraint:account.invoice.template.line:0
+msgid "The sequence of the line must be unique per template !"
+msgstr "Il numero della riga deve essere unico per template!"
+
+#. module: account_invoice_template
+#: model:ir.module.module,shortdesc:account_invoice_template.module_meta_information
+msgid "Account Invoice Template"
+msgstr "Account Invoice Template"
+
+#. module: account_invoice_template
+#: view:wizard.select.invoice.template:0
+msgid "Load"
+msgstr "Carica"
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+msgid "You can refer to other lines using their sequence number (e.g. 'L(1)' for first line). Examples of code: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1) + L(2) + L(3)'; '1250'"
+msgstr "E' possibile fare riferimento alle altre righe usando il loro numero (ad es. 'L(1)' rappresenta la prima riga). Esempi di codice: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1) + L(2) + L(3)'; '1250'"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template.line,type:0
+msgid "Computed"
+msgstr "Calcolato"
+
+#. module: account_invoice_template
+#: selection:account.invoice.template,type:0
+#: selection:wizard.select.invoice.template.line,type:0
+msgid "Supplier Invoice"
+msgstr "Fattura fornitore"
+
+#. module: account_invoice_template
+#: view:account.invoice.template.line:0
+#: field:account.invoice.template.line,python_code:0
+msgid "Python Code"
+msgstr "Codice python"
+
+#. module: account_invoice_template
+#: model:ir.actions.act_window,name:account_invoice_template.action_invoice_template_form
+#: model:ir.ui.menu,name:account_invoice_template.menu_action_invoice_template_form
+msgid "Invoice Templates"
+msgstr "Template fatture"
+
+#. module: account_invoice_template
+#: field:account.invoice.template.line,analytic_account_id:0
+msgid "Analytic Account"
+msgstr "Conto analitico"
+
+#. module: account_invoice_template
+#: field:account.invoice.template,template_line_ids:0
+#: model:ir.model,name:account_invoice_template.model_wizard_select_invoice_template_line
+msgid "Template Lines"
+msgstr "Righe template"
+
+#. module: account_invoice_template
+#: view:wizard.select.invoice.template:0
+msgid "Cancel"
+msgstr "Annulla"
+
+#. module: account_invoice_template
+#: view:account.invoice.template:0
+#: field:account.invoice.template,partner_id:0
+msgid "Partner"
+msgstr "Partner"
+

=== added file 'account_invoice_template/invoice_template.xml'
--- account_invoice_template/invoice_template.xml	1970-01-01 00:00:00 +0000
+++ account_invoice_template/invoice_template.xml	2013-11-11 18:03:00 +0000
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="view_invoice_template_line_tree" model="ir.ui.view">
+            <field name="name">account.invoice.template.line.tree</field>
+            <field name="model">account.invoice.template.line</field>
+            <field name="arch" type="xml">
+                <tree string="Invoice Template Line">
+                    <field name="product_id"/>
+                    <field name="sequence"/>
+                    <field name="name"/>
+                    <field name="account_id" />
+                    <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
+                    <field name="type"/>
+                    <field name="python_code"/>
+                </tree>
+            </field>
+        </record>
+
+
+        <record id="view_invoice_template_line_form" model="ir.ui.view">
+            <field name="name">account.invoice.template.line.form</field>
+            <field name="model">account.invoice.template.line</field>
+            <field name="arch" type="xml">
+                <form string="Invoice Template Line">
+                    <field name="product_id" on_change="product_id_change(product_id, parent.type)"/>
+                    <field name="name" select="1"/>
+                    <field name="sequence"/>
+                    <field name="account_id" />
+                    <field name="analytic_account_id" groups="analytic.group_analytic_accounting"/>
+                    <field name="type"/>
+                    <separator string="Python Code" colspan="4"/>
+                    <field name="python_code" colspan="4" attrs="{'readonly': [('type', '!=', 'computed')]}" nolabel="1"/>
+                    <label string="You can refer to other lines using their sequence number (e.g. 'L(1)' for first line). Examples of code: 'L(1) * 0.2'; 'L(2) - L(1)'; 'L(1) + L(2) + L(3)'; '1250'" colspan="4"/>
+                    <field name="invoice_line_tax_id" colspan="4"  nolabel="1"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="view_invoice_template_form" model="ir.ui.view">
+            <field name="name">account.invoice.template.form</field>
+            <field name="model">account.invoice.template</field>
+            <field name="arch" type="xml">
+                <form string="Invoice Template">
+                    <field name="name"/>
+                    <field name="partner_id"/>
+                    <field name="account_id" />
+                    <field name="type" />
+                    <field colspan="4" nolabel="1" name="template_line_ids"/>
+                </form>
+            </field>
+        </record>
+
+        <record id="view_invoice_template_tree" model="ir.ui.view">
+            <field name="name">account.invoice.template.tree</field>
+            <field name="model">account.invoice.template</field>
+            <field name="arch" type="xml">
+                <tree string="Invoice Template">
+                    <field name="name"/>
+                    <field name="partner_id"/>
+                    <field name="account_id" />
+                    <field name="type" />
+                </tree>
+            </field>
+        </record>
+
+        <record id="view_invoice_template_search" model="ir.ui.view">
+            <field name="name">account.invoice.template.search</field>
+            <field name="model">account.invoice.template</field>
+            <field name="arch" type="xml">
+                <search string="Invoice Template">
+                  <group>
+                      <field name="name"/>
+                      <field name="partner_id" />
+                      <field name="account_id" />
+                    <field name="type" />
+                    </group>
+                    <newline/>
+                    <group expand="0" string="Group By...">
+                      <filter string="Partner" icon="terp-folder-orange" domain="[]" context="{'group_by':'partner_id'}"/>
+                    </group>
+                </search>
+            </field>
+        </record>
+
+        <record id="action_invoice_template_form" model="ir.actions.act_window">
+            <field name="name">Invoice Templates</field>
+            <field name="res_model">account.invoice.template</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">tree,form</field>
+            <field name="search_view_id" ref="view_invoice_template_search"/>
+        </record>
+        <menuitem
+            action="action_invoice_template_form" id="menu_action_invoice_template_form" sequence="5"
+            parent="account.menu_configuration_misc" groups="account.group_account_manager"/>
+    </data>
+</openerp>

=== added directory 'account_invoice_template/security'
=== added file 'account_invoice_template/security/ir.model.access.csv'
--- account_invoice_template/security/ir.model.access.csv	1970-01-01 00:00:00 +0000
+++ account_invoice_template/security/ir.model.access.csv	2013-11-11 18:03:00 +0000
@@ -0,0 +1,5 @@
+"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
+"access_account_invoice_template_user","account_invoice_template_user","model_account_invoice_template","account.group_account_user","1","1","1","1"
+"access_account_invoice_template_manager","account_invoice_template_manager","model_account_invoice_template","account.group_account_manager","1","1","1","1"
+"access_account_invoice_template_line_user","account_invoice_template_line_user","model_account_invoice_template_line","account.group_account_user","1","1","1","1"
+"access_account_invoice_template_line_manager","account_invoice_template_line_manager","model_account_invoice_template_line","account.group_account_manager","1","1","1","1"

=== added directory 'account_invoice_template/wizard'
=== added file 'account_invoice_template/wizard/__init__.py'
--- account_invoice_template/wizard/__init__.py	1970-01-01 00:00:00 +0000
+++ account_invoice_template/wizard/__init__.py	2013-11-11 18:03:00 +0000
@@ -0,0 +1,21 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
+#    Copyright (C) 2011 Domsense srl (<http://www.domsense.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 select_template

=== added file 'account_invoice_template/wizard/select_template.py'
--- account_invoice_template/wizard/select_template.py	1970-01-01 00:00:00 +0000
+++ account_invoice_template/wizard/select_template.py	2013-11-11 18:03:00 +0000
@@ -0,0 +1,154 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#    
+#    Copyright (C) 2011 Agile Business Group sagl (<http://www.agilebg.com>)
+#    Copyright (C) 2011 Domsense srl (<http://www.domsense.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 openerp.osv import fields, orm
+from openerp.tools.translate import _
+
+
+class wizard_select_template(orm.TransientModel):
+
+    _name = "wizard.select.invoice.template"
+    _columns = {
+        'template_id': fields.many2one('account.invoice.template',
+            'Invoice Template', required=True),
+        'line_ids': fields.one2many('wizard.select.invoice.template.line',
+            'template_id', 'Lines'),
+        'state': fields.selection([
+            ('template_selected', 'Template selected'),
+            ], 'State'),
+    }
+
+    def load_lines(self, cr, uid, ids, context=None):
+        wizard = self.browse(cr, uid, ids, context=context)[0]
+        template_pool = self.pool.get('account.invoice.template')
+        wizard_line_pool = self.pool.get('wizard.select.invoice.template.line')
+        model_data_obj = self.pool.get('ir.model.data')
+
+        template = template_pool.browse(cr, uid, wizard.template_id.id,
+            context=context)
+        for line in template.template_line_ids:
+            if line.type == 'input':
+                wizard_line_pool.create(cr, uid, {
+                    'template_id': wizard.id,
+                    'sequence': line.sequence,
+                    'name': line.name,
+                    'amount': line.product_id and line.product_id.list_price or 0.0,
+                    'account_id': line.account_id.id,
+                    'product_id': line.product_id.id,
+                    }, context=context)
+        if not wizard.line_ids:
+            return self.load_template(cr, uid, ids, context=context)
+        wizard.write({'state': 'template_selected'}, context=context)
+
+        view_rec = model_data_obj.get_object_reference(cr, uid,
+            'account_invoice_template', 'wizard_select_template')
+        view_id = view_rec and view_rec[1] or False
+
+        return {
+            'view_type': 'form',
+            'view_id': [view_id],
+            'view_mode': 'form',
+            'res_model': 'wizard.select.invoice.template',
+            'res_id': wizard.id,
+            'type': 'ir.actions.act_window',
+            'target': 'new',
+            'context': context,
+        }
+
+    def load_template(self, cr, uid, ids, context=None):
+        if context is None:
+            context = {}
+        template_obj = self.pool.get('account.invoice.template')
+        account_invoice_obj = self.pool.get('account.invoice')
+        account_invoice_line_obj = self.pool.get('account.invoice.line')
+        mod_obj = self.pool.get('ir.model.data')
+
+        wizard = self.browse(cr, uid, ids, context=context)[0]
+        if not template_obj.check_zero_lines(cr, uid, wizard):
+            raise orm.except_orm(_('Error !'),
+                _('At least one amount has to be non-zero!'))
+        input_lines = {}
+        for template_line in wizard.line_ids:
+            input_lines[template_line.sequence] = template_line.amount
+
+        computed_lines = template_obj.compute_lines(cr, uid,
+            wizard.template_id.id, input_lines)
+
+        inv_values = account_invoice_obj.onchange_partner_id(
+            cr, uid, ids, wizard.template_id.type,
+            wizard.template_id.partner_id.id)['value']
+        inv_values['partner_id'] = wizard.template_id.partner_id.id
+        inv_values['account_id'] = wizard.template_id.account_id.id
+        inv_values['type'] = wizard.template_id.type
+        context['type'] = wizard.template_id.type
+        inv_id = account_invoice_obj.create(cr, uid, inv_values, context=context)
+        for line in wizard.template_id.template_line_ids:
+            analytic_account_id = False
+            if line.analytic_account_id:
+                analytic_account_id = line.analytic_account_id.id
+            invoice_line_tax_id = []
+            if line.invoice_line_tax_id:
+                tax_ids = []
+                for tax in line.invoice_line_tax_id:
+                    tax_ids.append(tax.id)
+                invoice_line_tax_id.append((6, 0, tax_ids))
+            val = {
+                'name': line.name,
+                'invoice_id': inv_id,
+                'account_analytic_id': analytic_account_id,
+                'account_id': line.account_id.id,
+                'invoice_line_tax_id': invoice_line_tax_id,
+                'price_unit': computed_lines[line.sequence],
+                'product_id': line.product_id.id,
+            }
+            account_invoice_line_obj.create(cr, uid, val, context=context)
+
+        if wizard.template_id.type in ('out_invoice', 'out_refund'):
+            xml_id = 'invoice_form'
+        else:
+            xml_id = 'invoice_supplier_form'
+        resource_id = mod_obj.get_object_reference(cr, uid, 'account', xml_id)[1]
+
+        return {
+            'domain': "[('id','in', [" + str(inv_id) + "])]",
+            'name': 'Invoice',
+            'view_type': 'form',
+            'view_mode': 'form',
+            'res_model': 'account.invoice',
+            'views': [(resource_id, 'form')],
+            'type': 'ir.actions.act_window',
+            'target': 'current',
+            'res_id': inv_id or False,
+        }
+
+
+class wizard_select_template_line(orm.TransientModel):
+    _description = 'Template Lines'
+    _name = "wizard.select.invoice.template.line"
+    _columns = {
+        'template_id': fields.many2one('wizard.select.invoice.template', 'Template'),
+        'sequence': fields.integer('Number', required=True),
+        'name': fields.char('Name', size=64, required=True, readonly=True),
+        'account_id': fields.many2one('account.account', 'Account',
+            required=True, readonly=True),
+        'amount': fields.float('Amount', required=True),
+        'product_id': fields.many2one('product.product', 'Product'),
+    }

=== added file 'account_invoice_template/wizard/select_template.xml'
--- account_invoice_template/wizard/select_template.xml	1970-01-01 00:00:00 +0000
+++ account_invoice_template/wizard/select_template.xml	2013-11-11 18:03:00 +0000
@@ -0,0 +1,75 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+
+        <record id="wizard_select_template" model="ir.ui.view">
+            <field name="name">Select Invoice Template</field>
+            <field name="model">wizard.select.invoice.template</field>
+            <field name="arch" type="xml">
+                <form string="Invoice Template" >
+                    <group col="2" width="600" height="500">
+                        <group>
+                            <field name="template_id" colspan="2" attrs="{'invisible':[('state','=','template_selected')]}"/>
+                            <field name="line_ids" colspan="2" nolabel="1" attrs="{'invisible':[('state','!=','template_selected')]}"/>
+                            <field name="state" invisible="1"/>
+                        </group>
+                        <newline/>
+                        <group col="3">
+                            <button icon="gtk-cancel" special="cancel" string="Cancel" colspan="1"/>
+                            <button icon="gtk-ok" name="load_template" string="Load" type="object" colspan="1" attrs="{'invisible':[('state','!=','template_selected')]}" />
+                            <button name="load_lines" string="Next" icon="terp-gtk-go-back-rtl" type="object" colspan="1" attrs="{'invisible':[('state','=','template_selected')]}" />
+                        </group>
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="wizard_select_template_line" model="ir.ui.view">
+            <field name="name">Select Invoice Template Line</field>
+            <field name="model">wizard.select.invoice.template.line</field>
+            <field name="arch" type="xml">
+                <form string="Invoice Template Line">
+                    <group col="2">
+                        <field name="sequence" invisible="1"/>
+                        <field name="name" />
+                        <field name="account_id" />
+                        <field name="amount" />
+                    </group>
+                </form>
+            </field>
+        </record>
+
+        <record id="wizard_select_template_line_tree" model="ir.ui.view">
+            <field name="name">Select Invoice Template Line</field>
+            <field name="model">wizard.select.invoice.template.line</field>
+            <field name="arch" type="xml">
+                <tree string="Invoice Template Line" editable="bottom">
+                    <field name="sequence" invisible="1"/>
+                    <field name="name" />
+                    <field name="account_id" />
+                    <field name="amount" />
+                </tree>
+            </field>
+        </record>
+
+        <record id="action_wizard_select_template" model="ir.actions.act_window">
+            <field name="name">Select Invoice Template</field>
+            <field name="res_model">wizard.select.invoice.template</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form</field>
+               <field name="view_id" ref="wizard_select_template"/>
+               <field name="target">new</field>
+        </record>
+
+       <act_window name="Create Invoice from Template"
+            res_model="wizard.select.invoice.template"
+            src_model="account.invoice"
+            view_mode="form"
+            target="new"
+            key2="client_action_multi"
+            id="action_wizard_select_template_by_invoice"
+            view_id="wizard_select_template"/>
+
+        <menuitem name="Create Invoice from Template" action="action_wizard_select_template" id="menu_action_wizard_select_template" sequence="10" parent="account.menu_finance_recurrent_entries"/>
+    </data>
+</openerp>

-- 
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

Reply via email to