diff --git a/account_invoice_currency/README.rst b/account_invoice_currency/README.rst index 86d88fc2a..6c6e9efca 100644 --- a/account_invoice_currency/README.rst +++ b/account_invoice_currency/README.rst @@ -57,6 +57,7 @@ Contributors * Joaquín Gutierrez * Pedro M. Baeza * Antonio Espinosa +* Sébastien Namèche Maintainer ---------- diff --git a/account_invoice_currency/__manifest__.py b/account_invoice_currency/__manifest__.py index 9d7cea0b2..fc4cf95b5 100644 --- a/account_invoice_currency/__manifest__.py +++ b/account_invoice_currency/__manifest__.py @@ -8,18 +8,18 @@ { 'name': "Company currency in invoices", - 'version': "9.0.1.0.0", + 'version': "10.0.1.0.0", 'author': "Zikzakmedia SL, " "Joaquín Gutierrez, " "Serv. Tecnol. Avanzados - Pedro M. Baeza, " "Tecnativa, " "Odoo Community Association (OCA) ", 'website': "https://odoo-community.org/", - 'category': "Localisation / Accounting", + 'category': "Accounting", 'license': "AGPL-3", 'depends': ["account"], 'data': [ - "views/account_invoice_view.xml" + "views/account_invoice.xml" ], 'installable': True, } diff --git a/account_invoice_currency/migrations/9.0.1.0.0/pre-migrate.py b/account_invoice_currency/migrations/9.0.1.0.0/pre-migrate.py deleted file mode 100644 index fe73a927d..000000000 --- a/account_invoice_currency/migrations/9.0.1.0.0/pre-migrate.py +++ /dev/null @@ -1,23 +0,0 @@ -# -*- coding: utf-8 -*- -# Copyright 2016 Antonio Espinosa -# 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) diff --git a/account_invoice_currency/models/account_invoice.py b/account_invoice_currency/models/account_invoice.py index a080aff48..cff4dfdaa 100644 --- a/account_invoice_currency/models/account_invoice.py +++ b/account_invoice_currency/models/account_invoice.py @@ -6,7 +6,7 @@ # © 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). -from openerp import models, fields, api +from odoo import models, fields, api class AccountInvoice(models.Model): @@ -18,10 +18,11 @@ class AccountInvoice(models.Model): help="Invoice tax amount in the company currency, " "negative for credit notes.") - @api.one + @api.multi @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) + for inv in self: + inv.amount_tax_signed = ( + inv.amount_total_company_signed - inv.amount_untaxed_signed) diff --git a/account_invoice_currency/tests/test_account_invoice_currency.py b/account_invoice_currency/tests/test_account_invoice_currency.py index f5586d0b5..750a78c33 100644 --- a/account_invoice_currency/tests/test_account_invoice_currency.py +++ b/account_invoice_currency/tests/test_account_invoice_currency.py @@ -2,13 +2,12 @@ # Copyright 2016 Antonio Espinosa # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp.tests.common import TransactionCase +from odoo.tests.common import TransactionCase class TestAccountInvoiceCurrency(TransactionCase): - def setUp(self, *args, **kwargs): - super(TestAccountInvoiceCurrency, self).setUp(*args, **kwargs) - + def setUp(self): + super(TestAccountInvoiceCurrency, self).setUp() 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') diff --git a/account_invoice_currency/views/account_invoice.xml b/account_invoice_currency/views/account_invoice.xml new file mode 100644 index 000000000..70c5a9b6c --- /dev/null +++ b/account_invoice_currency/views/account_invoice.xml @@ -0,0 +1,87 @@ + + + + + + + Account invoice supplier (form) - add company currency + account.invoice + + + + + + + + + + + + + + + account.invoice.supplier.currency.tree + account.invoice + + + + + + + + + + + + + + + + + + + Account invoice (form) - add company currency + account.invoice + + + + + + + + + + + + + + + account.invoice.currency.tree + account.invoice + + + + + + + + + + + + + + + + + diff --git a/account_invoice_currency/views/account_invoice_view.xml b/account_invoice_currency/views/account_invoice_view.xml deleted file mode 100644 index 3951f6b63..000000000 --- a/account_invoice_currency/views/account_invoice_view.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - Account invoice supplier (form) - add company currency - account.invoice - - - - - - - - - - - - - - Account invoice (form) - add company currency - account.invoice - - - - - - - - - - - - -