diff --git a/account_invoice_currency/README.rst b/account_invoice_currency/README.rst new file mode 100644 index 000000000..49a0d8303 --- /dev/null +++ b/account_invoice_currency/README.rst @@ -0,0 +1,30 @@ +Account invoices in company currency +==================================== + +This module adds functional fields to show invoices in the company currency: +amount untaxed, amount taxed and amount total. + +These fields are shown in "Other information" tab in invoice form. + +Credits +======= + +Contributors +------------ + +* Jordi Esteve +* Joaquín Gutierrez +* Pedro M. Baeza + +Maintainer +---------- + +.. image:: http://odoo-community.org/logo.png + :alt: Odoo Community Association + :target: http://odoo-community.org + +This module is maintained by the OCA. + +OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. + +To contribute to this module, please visit http://odoo-community.org. \ No newline at end of file diff --git a/account_invoice_currency/__init__.py b/account_invoice_currency/__init__.py new file mode 100644 index 000000000..ad1603250 --- /dev/null +++ b/account_invoice_currency/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.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 . +# +############################################################################## +from . import models diff --git a/account_invoice_currency/__openerp__.py b/account_invoice_currency/__openerp__.py new file mode 100644 index 000000000..6d3ea8708 --- /dev/null +++ b/account_invoice_currency/__openerp__.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP - Account invoice currency +# Copyright (C) 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com) +# Jordi Esteve +# Copyright (c) 2013 Joaquin Gutierrez (http://www.gutierrezweb.es) +# Copyright (c) 2014-2015 Serv. Tecnol. Avanzados - Pedro M. Baeza +# +# 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 . +# +############################################################################## + +{ + 'name': "Company currency in invoices", + 'version': "1.0", + 'author': "Zikzakmedia SL, " + "Joaquín Gutierrez, " + "Serv. Tecnol. Avanzados - Pedro M. Baeza", + 'website': "http://www.zikzakmedia.com, " + "http://www.gutierrezweb.es, " + "http://www.serviciosbaeza.com", + 'category': "Localisation / Accounting", + 'license': "AGPL-3", + 'depends': ["account"], + 'data': [ + "views/account_invoice_view.xml" + ], + 'installable': True, +} diff --git a/account_invoice_currency/i18n/account_invoice_currency.pot b/account_invoice_currency/i18n/account_invoice_currency.pot new file mode 100644 index 000000000..07b9e1152 --- /dev/null +++ b/account_invoice_currency/i18n/account_invoice_currency.pot @@ -0,0 +1,57 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_invoice_currency +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 7.0-20130927-231103\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-18 11:53+0000\n" +"PO-Revision-Date: 2013-11-18 11:53+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_currency +#: help:account.invoice,cc_amount_total:0 +msgid "Invoice total amount in the company currency (useful when invoice currency is different from company currency)." +msgstr "Invoice total amount in the company currency (useful when invoice currency is different from company currency)." + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_total:0 +msgid "Company Cur. Total" +msgstr "Company Cur. Total" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_tax:0 +msgid "Company Cur. Tax" +msgstr "Company Cur. Tax" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_tax:0 +msgid "Invoice tax amount in the company currency (useful when invoice currency is different from company currency)." +msgstr "Invoice tax amount in the company currency (useful when invoice currency is different from company currency)." + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_untaxed:0 +msgid "Invoice untaxed amount in the company currency(useful when invoice currency is different from company currency)." +msgstr "Invoice untaxed amount in the company currency(useful when invoice currency is different from company currency)." + +#. module: account_invoice_currency +#: view:account.invoice:0 +msgid "Amounts in company currency" +msgstr "Amounts in company currency" + +#. module: account_invoice_currency +#: model:ir.model,name:account_invoice_currency.model_account_invoice +msgid "Invoice" +msgstr "Invoice" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_untaxed:0 +msgid "Company Cur. Untaxed" +msgstr "Company Cur. Untaxed" + diff --git a/account_invoice_currency/i18n/ca.po b/account_invoice_currency/i18n/ca.po new file mode 100644 index 000000000..3ed0d59c5 --- /dev/null +++ b/account_invoice_currency/i18n/ca.po @@ -0,0 +1,68 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_invoice_currency +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.9\n" +"Report-Msgid-Bugs-To: support@openerp.com\n" +"POT-Creation-Date: 2013-11-18 11:53+0000\n" +"PO-Revision-Date: 2014-02-04 16:50+0000\n" +"Last-Translator: Jordi Esteve (www.zikzakmedia.com) " +"\n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-06-12 06:31+0000\n" +"X-Generator: Launchpad (build 17041)\n" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_total:0 +msgid "" +"Invoice total amount in the company currency (useful when invoice currency " +"is different from company currency)." +msgstr "" +"Total de la factura en la moneda de la companyia (útil quan les monedes de " +"la factura i de la companyia són diferents)." + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_total:0 +msgid "Company Cur. Total" +msgstr "Total moneda companyia" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_tax:0 +msgid "Company Cur. Tax" +msgstr "Impostos moneda companyia" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_tax:0 +msgid "" +"Invoice tax amount in the company currency (useful when invoice currency is " +"different from company currency)." +msgstr "" +"Impostos de la factura en la moneda de la companyia (útil quan les monedes " +"de la factura i de la companyia són diferents)." + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_untaxed:0 +msgid "" +"Invoice untaxed amount in the company currency(useful when invoice currency " +"is different from company currency)." +msgstr "" + +#. module: account_invoice_currency +#: view:account.invoice:0 +msgid "Amounts in company currency" +msgstr "" + +#. module: account_invoice_currency +#: model:ir.model,name:account_invoice_currency.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_untaxed:0 +msgid "Company Cur. Untaxed" +msgstr "Base moneda companyia" diff --git a/account_invoice_currency/i18n/es.po b/account_invoice_currency/i18n/es.po new file mode 100644 index 000000000..4d0008fb1 --- /dev/null +++ b/account_invoice_currency/i18n/es.po @@ -0,0 +1,70 @@ +# Translation of OpenERP Server. +# This file contains the translation of the following modules: +# * account_invoice_currency +# +msgid "" +msgstr "" +"Project-Id-Version: OpenERP Server 5.0.9\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2013-11-18 11:53+0000\n" +"PO-Revision-Date: 2014-04-08 19:42+0000\n" +"Last-Translator: Pedro Manuel Baeza \n" +"Language-Team: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-06-12 06:31+0000\n" +"X-Generator: Launchpad (build 17041)\n" +"Language: \n" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_total:0 +msgid "" +"Invoice total amount in the company currency (useful when invoice currency " +"is different from company currency)." +msgstr "" +"Total de la factura en la moneda de la compañía (útil cuando las monedas de " +"la factura y de la compañía son distintas)." + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_total:0 +msgid "Company Cur. Total" +msgstr "Total moneda compañía" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_tax:0 +msgid "Company Cur. Tax" +msgstr "Impuestos moneda compañía" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_tax:0 +msgid "" +"Invoice tax amount in the company currency (useful when invoice currency is " +"different from company currency)." +msgstr "" +"Impuestos de la factura en la moneda de la compañía (útil cuando las monedas " +"de la factura y de la compañía son distintas)." + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_untaxed:0 +msgid "" +"Invoice untaxed amount in the company currency(useful when invoice currency " +"is different from company currency)." +msgstr "" +"Importe sin impuestos de la factura en la moneda de la compañía (útil cuando " +" la moneda de la factura es diferente de la moneda de la compañía)." + +#. module: account_invoice_currency +#: view:account.invoice:0 +msgid "Amounts in company currency" +msgstr "Importes moneda compañía" + +#. module: account_invoice_currency +#: model:ir.model,name:account_invoice_currency.model_account_invoice +msgid "Invoice" +msgstr "Factura" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_untaxed:0 +msgid "Company Cur. Untaxed" +msgstr "Base moneda compañía" diff --git a/account_invoice_currency/i18n/pt.po b/account_invoice_currency/i18n/pt.po new file mode 100644 index 000000000..8808f6c0a --- /dev/null +++ b/account_invoice_currency/i18n/pt.po @@ -0,0 +1,68 @@ +# Portuguese translation for openobject-addons +# Copyright (c) 2011 Rosetta Contributors and Canonical Ltd 2011 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2011. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2013-11-18 11:53+0000\n" +"PO-Revision-Date: 2014-02-04 16:49+0000\n" +"Last-Translator: Joaquin Gutierrez \n" +"Language-Team: Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-06-12 06:31+0000\n" +"X-Generator: Launchpad (build 17041)\n" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_total:0 +msgid "" +"Invoice total amount in the company currency (useful when invoice currency " +"is different from company currency)." +msgstr "" +"Montante da factura total na moeda da empresa (útil quando moeda de " +"facturação é diferente da moeda da empresa)." + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_total:0 +msgid "Company Cur. Total" +msgstr "Total Moeda da Empresas" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_tax:0 +msgid "Company Cur. Tax" +msgstr "Imposto da Moeda da Empresa" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_tax:0 +msgid "" +"Invoice tax amount in the company currency (useful when invoice currency is " +"different from company currency)." +msgstr "" +"Montante de factura de imposto na moeda da empresa(Útil quando moeda de " +"facturação é diferente da moeda da empresa)." + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_untaxed:0 +msgid "" +"Invoice untaxed amount in the company currency(useful when invoice currency " +"is different from company currency)." +msgstr "" + +#. module: account_invoice_currency +#: view:account.invoice:0 +msgid "Amounts in company currency" +msgstr "" + +#. module: account_invoice_currency +#: model:ir.model,name:account_invoice_currency.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_untaxed:0 +msgid "Company Cur. Untaxed" +msgstr "Moeda da Empresa não Tributada" diff --git a/account_invoice_currency/i18n/pt_BR.po b/account_invoice_currency/i18n/pt_BR.po new file mode 100644 index 000000000..3a8af858e --- /dev/null +++ b/account_invoice_currency/i18n/pt_BR.po @@ -0,0 +1,64 @@ +# Brazilian Portuguese translation for account-financial-tools +# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 +# This file is distributed under the same license as the account-financial-tools package. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: account-financial-tools\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2013-11-18 11:53+0000\n" +"PO-Revision-Date: 2014-06-15 10:06+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Brazilian Portuguese \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-06-16 06:09+0000\n" +"X-Generator: Launchpad (build 17045)\n" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_total:0 +msgid "" +"Invoice total amount in the company currency (useful when invoice currency " +"is different from company currency)." +msgstr "" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_total:0 +msgid "Company Cur. Total" +msgstr "" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_tax:0 +msgid "Company Cur. Tax" +msgstr "" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_tax:0 +msgid "" +"Invoice tax amount in the company currency (useful when invoice currency is " +"different from company currency)." +msgstr "" + +#. module: account_invoice_currency +#: help:account.invoice,cc_amount_untaxed:0 +msgid "" +"Invoice untaxed amount in the company currency(useful when invoice currency " +"is different from company currency)." +msgstr "" + +#. module: account_invoice_currency +#: view:account.invoice:0 +msgid "Amounts in company currency" +msgstr "" + +#. module: account_invoice_currency +#: model:ir.model,name:account_invoice_currency.model_account_invoice +msgid "Invoice" +msgstr "" + +#. module: account_invoice_currency +#: field:account.invoice,cc_amount_untaxed:0 +msgid "Company Cur. Untaxed" +msgstr "" diff --git a/account_invoice_currency/models/__init__.py b/account_invoice_currency/models/__init__.py new file mode 100644 index 000000000..9b006a320 --- /dev/null +++ b/account_invoice_currency/models/__init__.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.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 . +# +############################################################################## +from . import account_invoice diff --git a/account_invoice_currency/models/account_invoice.py b/account_invoice_currency/models/account_invoice.py new file mode 100644 index 000000000..08d51a94a --- /dev/null +++ b/account_invoice_currency/models/account_invoice.py @@ -0,0 +1,77 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# Copyright (C) 2004-2011 +# Pexego Sistemas Informáticos. (http://pexego.es) +# Zikzakmedia S.L. (http://zikzakmedia.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 . +# +############################################################################## +from openerp import models, fields, api +import openerp.addons.decimal_precision as dp + + +class AccountInvoice(models.Model): + _inherit = "account.invoice" + + @api.one + @api.depends('amount_total', 'amount_untaxed', 'amount_tax', + 'currency_id', 'move_id') + def _cc_amount_all(self): + if self.company_id.currency_id == self.currency_id: + self.cc_amount_untaxed = self.amount_untaxed + self.cc_amount_tax = self.amount_tax + self.cc_amount_total = self.amount_total + else: + self.cc_amount_untaxed = 0.0 + self.cc_amount_tax = 0.0 + self.cc_amount_total = 0.0 + # It could be computed only in open or paid invoices with a + # generated account move + if self.move_id: + # Accounts to compute amount_untaxed + line_accounts = set([x.account_id.id for x in + self.invoice_line]) + # Accounts to compute amount_tax + tax_accounts = set([x.account_id.id for x in + self.tax_line if x.amount != 0]) + # The company currency amounts are the debit-credit + # amounts in the account moves + for line in self.move_id.line_id: + if line.account_id.id in line_accounts: + self.cc_amount_untaxed += line.debit - line.credit + if line.account_id.id in tax_accounts: + self.cc_amount_tax += line.debit - line.credit + if self.type in ('out_invoice', 'in_refund'): + self.cc_amount_untaxed = -self.cc_amount_untaxed + self.cc_amount_tax = -self.cc_amount_tax + self.cc_amount_total = (self.cc_amount_tax + + self.cc_amount_untaxed) + + cc_amount_untaxed = fields.Float( + compute="_cc_amount_all", digits_compute=dp.get_precision('Account'), + string='Company Cur. Untaxed', + help="Invoice untaxed amount in the company currency (useful when " + "invoice currency is different from company currency).") + cc_amount_tax = fields.Float( + compute="_cc_amount_all", digits_compute=dp.get_precision('Account'), + string='Company Cur. Tax', + help="Invoice tax amount in the company currency (useful when invoice " + "currency is different from company currency).") + cc_amount_total = fields.Float( + compute="_cc_amount_all", digits_compute=dp.get_precision('Account'), + string='Company Cur. Total', + help="Invoice total amount in the company currency (useful when " + "invoice currency is different from company currency).") diff --git a/account_invoice_currency/views/account_invoice_view.xml b/account_invoice_currency/views/account_invoice_view.xml new file mode 100644 index 000000000..14270ace6 --- /dev/null +++ b/account_invoice_currency/views/account_invoice_view.xml @@ -0,0 +1,42 @@ + + + + + + + + + Account invoice supplier (form) - add company currency + account.invoice + + + + + + + + + + + + + + + Account invoice (form) - add company currency + account.invoice + + + + + + + + + + + + + +