mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
account_invoice_currency
This commit is contained in:
committed by
Aitor Bouzas
parent
6b7bd30cd6
commit
79ece3f0b9
@@ -1,3 +1,8 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
====================================
|
||||
Account invoices in company currency
|
||||
====================================
|
||||
|
||||
@@ -7,13 +12,39 @@ amount untaxed, amount taxed and amount total.
|
||||
These fields are shown in "Other information" tab in invoice form.
|
||||
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
**NOTE #1**: Amount untaxed and amount total are official account fields in v9.
|
||||
This addon adds amount taxes and shows all of them in invoice form.
|
||||
|
||||
**NOTE #2**: Please note that these fields are negative (as done in v9 account addon)
|
||||
for credit notes (for example a refund invoice)
|
||||
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
These fields name change from v8:
|
||||
|
||||
* cc_amount_untaxed -> amount_untaxed_signed (already in account v9)
|
||||
* cc_amount_tax -> amount_tax_signed (added by this addon)
|
||||
* cc_amount_total -> amount_total_company_signed (already in account v9)
|
||||
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/92/9.0
|
||||
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/account-financial-tools/issues>`_.
|
||||
In case of trouble, please check there if your issue has already been reported.
|
||||
If you spotted it first, help us smashing it by providing a detailed and welcomed feedback
|
||||
`here <https://github.com/OCA/account-financial-tools/issues/new?body=module:%20account_invoice_currency%0Aversion:%208.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/account-financial-tools/issues>`_. In case of trouble, please
|
||||
check there if your issue has already been reported. If you spotted it first,
|
||||
help us smashing it by providing a detailed and welcomed feedback.
|
||||
|
||||
|
||||
Credits
|
||||
@@ -25,16 +56,19 @@ Contributors
|
||||
* Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
* Joaquín Gutierrez <joaquing.pedrosa@gmail.com>
|
||||
* Pedro M. Baeza <pedro.baeza@serviciosbaeza.com>
|
||||
* Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: http://odoo-community.org/logo.png
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: http://odoo-community.org
|
||||
:target: https://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.
|
||||
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.
|
||||
To contribute to this module, please visit https://odoo-community.org.
|
||||
|
||||
@@ -1,20 +1,9 @@
|
||||
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# © 2004-2011 Pexego Sistemas Informáticos. (http://pexego.es)
|
||||
# © 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com)
|
||||
# Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
# © 2014-2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antiun Ingenieria S.L. - Antonio Espinosa
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
|
||||
@@ -1,41 +1,25 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP - Account invoice currency
|
||||
# Copyright (C) 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com)
|
||||
# Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
# 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# © 2004-2011 Pexego Sistemas Informáticos. (http://pexego.es)
|
||||
# © 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com)
|
||||
# Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
# © 2014-2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antonio Espinosa - <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': "Company currency in invoices",
|
||||
'version': "8.0.1.0.0",
|
||||
'author': "Zikzakmedia SL, ,Odoo Community Association (OCA)"
|
||||
'version': "9.0.1.0.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",
|
||||
"Serv. Tecnol. Avanzados - Pedro M. Baeza, "
|
||||
"Tecnativa, "
|
||||
"Odoo Community Association (OCA) ",
|
||||
'website': "https://odoo-community.org/",
|
||||
'category': "Localisation / Accounting",
|
||||
'license': "AGPL-3",
|
||||
'depends': ["account"],
|
||||
'data': [
|
||||
"views/account_invoice_view.xml"
|
||||
],
|
||||
'installable': False,
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * account_invoice_currency
|
||||
#
|
||||
#
|
||||
# Translators:
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: account-financial-tools (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
|
||||
"PO-Revision-Date: 2015-06-03 16:14+0000\n"
|
||||
"POT-Creation-Date: 2016-03-03 01:39+0000\n"
|
||||
"PO-Revision-Date: 2016-03-02 17:10+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>\n"
|
||||
"Language-Team: Spanish (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -23,7 +23,43 @@ msgstr ""
|
||||
msgid "Amounts in company currency"
|
||||
msgstr "Importes 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
|
||||
#: 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_untaxed:0
|
||||
msgid "Company Cur. Untaxed"
|
||||
msgstr "Base imponible 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
|
||||
#: 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 en la moneda de la compañía (útil cuando la moneda de la factura es diferente a la de la compañía)."
|
||||
|
||||
#. 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 factura en la moneda de la compañía (útil cuando la moneda de la factura es diferente a la de la compañía)."
|
||||
|
||||
#. 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 "Base imponible en la moneda de la compañía (útil cuando la moneda de la factura es diferente a la de la compañía)."
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
# * account_invoice_currency
|
||||
#
|
||||
# Translators:
|
||||
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015
|
||||
# Matjaž Mozetič <m.mozetic@matmoz.si>, 2015-2016
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: account-financial-tools (8.0)\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-07-01 13:25+0000\n"
|
||||
"PO-Revision-Date: 2015-07-04 11:49+0000\n"
|
||||
"POT-Creation-Date: 2016-03-03 01:39+0000\n"
|
||||
"PO-Revision-Date: 2016-03-03 05:29+0000\n"
|
||||
"Last-Translator: Matjaž Mozetič <m.mozetic@matmoz.si>\n"
|
||||
"Language-Team: Slovenian (http://www.transifex.com/oca/OCA-account-financial-tools-8-0/language/sl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -24,7 +24,43 @@ msgstr ""
|
||||
msgid "Amounts in company currency"
|
||||
msgstr "Zneski v valuti družbe"
|
||||
|
||||
#. module: account_invoice_currency
|
||||
#: field:account.invoice,cc_amount_tax:0
|
||||
msgid "Company Cur. Tax"
|
||||
msgstr "Valuta davka družbe"
|
||||
|
||||
#. module: account_invoice_currency
|
||||
#: field:account.invoice,cc_amount_total:0
|
||||
msgid "Company Cur. Total"
|
||||
msgstr "Valuta skupnega zneska družbe"
|
||||
|
||||
#. module: account_invoice_currency
|
||||
#: field:account.invoice,cc_amount_untaxed:0
|
||||
msgid "Company Cur. Untaxed"
|
||||
msgstr "Valuta neobdavčenega družbe"
|
||||
|
||||
#. module: account_invoice_currency
|
||||
#: model:ir.model,name:account_invoice_currency.model_account_invoice
|
||||
msgid "Invoice"
|
||||
msgstr "Račun"
|
||||
|
||||
#. 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 "Obračun davčnega zneska v valuti družbe (koristno kadar je valuta računa drugačna od valute družbe)."
|
||||
|
||||
#. 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 "Skupni znesek računa v valuti družbe (koristno kadar je valuta računa drugačna od valute družbe)."
|
||||
|
||||
#. 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 "Neobdavčeni znesek računa v valuti družbe (koristno kadar je valuta računa drugačna od valute družbe)."
|
||||
|
||||
23
account_invoice_currency/migrations/9.0.1.0.0/pre-migrate.py
Normal file
23
account_invoice_currency/migrations/9.0.1.0.0/pre-migrate.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openupgradelib import openupgrade
|
||||
|
||||
column_renames = {
|
||||
'account_invoice': [
|
||||
('cc_amount_tax', 'amount_tax_signed'),
|
||||
],
|
||||
}
|
||||
|
||||
column_copies = {
|
||||
'account_invoice': [
|
||||
('cc_amount_untaxed', 'amount_untaxed_signed', None),
|
||||
('cc_amount_total', 'amount_total_company_signed', None),
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def migrate(cr, version):
|
||||
openupgrade.rename_columns(cr, column_renames)
|
||||
openupgrade.copy_columns(cr, column_copies)
|
||||
@@ -1,20 +1,4 @@
|
||||
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import account_invoice
|
||||
|
||||
@@ -1,77 +1,27 @@
|
||||
# -*- 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
# © 2004-2011 Pexego Sistemas Informáticos. (http://pexego.es)
|
||||
# © 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com)
|
||||
# Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
# © 2014-2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
# © 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
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)
|
||||
amount_tax_signed = fields.Monetary(
|
||||
string='Tax', currency_field='company_currency_id',
|
||||
store=True, readonly=True, compute='_compute_amount',
|
||||
help="Invoice tax amount in the company currency, "
|
||||
"negative for credit notes.")
|
||||
|
||||
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).")
|
||||
@api.one
|
||||
@api.depends('invoice_line_ids.price_subtotal', 'tax_line_ids.amount',
|
||||
'currency_id', 'company_id')
|
||||
def _compute_amount(self):
|
||||
super(AccountInvoice, self)._compute_amount()
|
||||
self.amount_tax_signed = (
|
||||
self.amount_total_company_signed - self.amount_untaxed_signed)
|
||||
|
||||
4
account_invoice_currency/tests/__init__.py
Normal file
4
account_invoice_currency/tests/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import test_account_invoice_currency
|
||||
@@ -0,0 +1,59 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2016 Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
from openerp.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestAccountInvoiceCurrency(TransactionCase):
|
||||
def setUp(self, *args, **kwargs):
|
||||
super(TestAccountInvoiceCurrency, self).setUp(*args, **kwargs)
|
||||
|
||||
type_revenue = self.env.ref('account.data_account_type_revenue')
|
||||
type_payable = self.env.ref('account.data_account_type_payable')
|
||||
tax_group_taxes = self.env.ref('account.tax_group_taxes')
|
||||
self.account_sale = self.env['account.account'].create({
|
||||
'name': 'Sale',
|
||||
'code': 'XX_700',
|
||||
'user_type_id': type_revenue.id,
|
||||
'reconcile': True,
|
||||
})
|
||||
self.account_customer = self.env['account.account'].create({
|
||||
'name': 'Customer',
|
||||
'code': 'XX_430',
|
||||
'user_type_id': type_payable.id,
|
||||
'reconcile': True,
|
||||
})
|
||||
self.journal_sale = self.env['account.journal'].create({
|
||||
'name': 'Test journal for sale',
|
||||
'type': 'sale',
|
||||
'code': 'TSALE',
|
||||
'default_debit_account_id': self.account_sale.id,
|
||||
'default_credit_account_id': self.account_sale.id,
|
||||
})
|
||||
self.partner = self.env['res.partner'].create({
|
||||
'name': 'Test partner',
|
||||
})
|
||||
self.tax = self.env['account.tax'].create({
|
||||
'name': 'Tax for sale 10%',
|
||||
'type_tax_use': 'sale',
|
||||
'tax_group_id': tax_group_taxes.id,
|
||||
'amount_type': 'percent',
|
||||
'amount': 10.0,
|
||||
})
|
||||
self.invoice = self.env['account.invoice'].create({
|
||||
'partner_id': self.partner.id,
|
||||
'account_id': self.account_customer.id,
|
||||
'type': 'out_invoice',
|
||||
'journal_id': self.journal_sale.id,
|
||||
'invoice_line_ids': [(0, 0, {
|
||||
'name': 'Test product',
|
||||
'account_id': self.account_sale.id,
|
||||
'price_unit': 100,
|
||||
'quantity': 1,
|
||||
'invoice_line_tax_ids': [(6, 0, [self.tax.id])],
|
||||
})],
|
||||
})
|
||||
|
||||
def test_amount_tax_signed(self):
|
||||
self.assertEqual(10.0, self.invoice.amount_tax_signed)
|
||||
@@ -1,42 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- Copyright 2004-2011 Pexego Sistemas Informáticos. (http://pexego.es)
|
||||
Copyright 2004-2011 Zikzakmedia S.L. (http://zikzakmedia.com)
|
||||
Jordi Esteve <jesteve@zikzakmedia.com>
|
||||
Copyright 2014-2015 Serv. Tecnol. Avanzados - Pedro M. Baeza
|
||||
Copyright 2016 - Antonio Espinosa <antonio.espinosa@tecnativa.com>
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||
<odoo>
|
||||
|
||||
<!-- ###############################################
|
||||
INVOICE INHERITANCE
|
||||
############################################### -->
|
||||
|
||||
<!-- ## Suppliers ## -->
|
||||
<record id="invoice_supplier_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice supplier (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="cc_amount_untaxed"/>
|
||||
<field name="cc_amount_tax"/>
|
||||
<field name="cc_amount_total"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- ## Suppliers ## -->
|
||||
<record id="invoice_supplier_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice supplier (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="amount_untaxed_signed"/>
|
||||
<field name="amount_tax_signed"/>
|
||||
<field name="amount_total_company_signed"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<!-- ## Customers ## -->
|
||||
<record id="invoice_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="amount_untaxed_signed"/>
|
||||
<field name="amount_tax_signed"/>
|
||||
<field name="amount_total_company_signed"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- ## Customers ## -->
|
||||
<record id="invoice_company_currency_form" model="ir.ui.view">
|
||||
<field name="name">Account invoice (form) - add company currency</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='move_id']/.." position="after">
|
||||
<group string="Amounts in company currency">
|
||||
<field name="cc_amount_untaxed"/>
|
||||
<field name="cc_amount_tax"/>
|
||||
<field name="cc_amount_total"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
</odoo>
|
||||
|
||||
Reference in New Issue
Block a user