diff --git a/account_move_base_import/README.rst b/account_move_base_import/README.rst index 4f223928..8d578ef5 100644 --- a/account_move_base_import/README.rst +++ b/account_move_base_import/README.rst @@ -52,10 +52,7 @@ both. .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch} - -.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt -.. branch is "8.0" for example + :target: https://runbot.odoo-community.org/runbot/98/10.0 Known issues / Roadmap ====================== diff --git a/account_move_base_import/__init__.py b/account_move_base_import/__init__.py index 8bbeba75..3f3a2791 100644 --- a/account_move_base_import/__init__.py +++ b/account_move_base_import/__init__.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion -# © 2011-2016 Camptocamp SA -# © 2013 Savoir-faire Linux -# © 2014 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + from . import parser from . import wizard from . import models diff --git a/account_move_base_import/__manifest__.py b/account_move_base_import/__manifest__.py index 12b49f01..e37ce448 100644 --- a/account_move_base_import/__manifest__.py +++ b/account_move_base_import/__manifest__.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) { 'name': "Journal Entry base import", - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'author': "Akretion,Camptocamp,Odoo Community Association (OCA)", 'category': 'Finance', 'depends': ['account'], @@ -26,7 +26,6 @@ 'test/refund.yml', 'test/completion_test.yml' ], - 'installable': False, - 'auto_install': False, + 'installable': True, 'license': 'AGPL-3', } diff --git a/account_move_base_import/models/__init__.py b/account_move_base_import/models/__init__.py index e945d363..bfd56a48 100644 --- a/account_move_base_import/models/__init__.py +++ b/account_move_base_import/models/__init__.py @@ -1,9 +1,5 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion -# © 2011-2016 Camptocamp SA -# © 2013 Savoir-faire Linux -# © 2014 ACSONE SA/NV -# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) + from . import account_journal from . import account_move from . import partner diff --git a/account_move_base_import/models/account_journal.py b/account_move_base_import/models/account_journal.py index a73af6e1..7b3a0688 100644 --- a/account_move_base_import/models/account_journal.py +++ b/account_move_base_import/models/account_journal.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV @@ -7,9 +7,9 @@ import sys import traceback import os -from openerp import _, api, fields, models +from odoo import _, api, fields, models from ..parser.parser import new_move_parser -from openerp.exceptions import UserError, ValidationError +from odoo.exceptions import UserError, ValidationError from operator import attrgetter @@ -289,10 +289,11 @@ class AccountJournal(models.Model): "The file is empty")) parsed_cols = parser.get_move_line_vals(result_row_list[0]).keys() for col in parsed_cols: - if col not in move_line_obj._columns: + print dir(move_line_obj) + if col not in move_line_obj._fields: raise UserError( _("Missing column! Column %s you try to import is not " - "present in the bank statement line!") % col) + "present in the move line!") % col) move_vals = self.prepare_move_vals(result_row_list, parser) move = move_obj.create(move_vals) try: diff --git a/account_move_base_import/models/account_move.py b/account_move_base_import/models/account_move.py index 4ab2812b..beb3d0a0 100644 --- a/account_move_base_import/models/account_move.py +++ b/account_move_base_import/models/account_move.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV @@ -10,8 +10,8 @@ import logging import psycopg2 -from openerp import _, api, fields, models -from openerp.exceptions import ValidationError +from odoo import _, api, fields, models +from odoo.exceptions import ValidationError _logger = logging.getLogger(__name__) @@ -260,12 +260,13 @@ class AccountMoveLine(models.Model): def _get_available_columns(self, move_store): """Return writeable by SQL columns""" - model_cols = self._columns + model_cols = self._fields avail = [ k for k, col in model_cols.iteritems() if not hasattr(col, '_fnct') ] keys = [k for k in move_store[0].keys() if k in avail] keys.sort() + print "keys==================", keys return keys def _prepare_insert(self, move, cols): @@ -275,7 +276,9 @@ class AccountMoveLine(models.Model): move_copy = move for k, col in move_copy.iteritems(): if k in cols: - move_copy[k] = self._columns[k]._symbol_set[1](col) + print "DIR self._fields[k]=", dir(self._fields[k]) + move_copy[k] = self._fields[k]._symbol_set[1](col) + print "move_copy[k]==========", move_copy[k] return move_copy def _prepare_manyinsert(self, move_store, cols): @@ -333,17 +336,19 @@ class AccountMove(models.Model): related='journal_id.used_for_completion', readonly=True) completion_logs = fields.Text(string='Completion Log', readonly=True) + # partner_id is a native field of the account module + # (related='line_ids.partner_id', store=True, readonly=True) partner_id = fields.Many2one(related=False, compute='_compute_partner_id') import_partner_id = fields.Many2one('res.partner', string="Partner from import") + @api.one @api.depends('line_ids.partner_id', 'import_partner_id') def _compute_partner_id(self): - for move in self: - if move.import_partner_id: - move.partner_id = move.import_partner_id - elif move.line_ids: - move.partner_id = move.line_ids[0].partner_id + if self.import_partner_id: + self.partner_id = self.import_partner_id + elif self.line_ids: + self.partner_id = self.line_ids[0].partner_id def write_completion_log(self, error_msg, number_imported): """Write the log in the completion_logs field of the bank statement to diff --git a/account_move_base_import/models/partner.py b/account_move_base_import/models/partner.py index 818868bc..7391479b 100644 --- a/account_move_base_import/models/partner.py +++ b/account_move_base_import/models/partner.py @@ -1,10 +1,10 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -from openerp import fields, models +from odoo import fields, models class ResPartner(models.Model): diff --git a/account_move_base_import/tests/test_base_completion.py b/account_move_base_import/tests/test_base_completion.py index 8e36ee10..15c48934 100644 --- a/account_move_base_import/tests/test_base_completion.py +++ b/account_move_base_import/tests/test_base_completion.py @@ -1,12 +1,12 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) -from openerp import fields, tools -from openerp.modules import get_module_resource -from openerp.tests import common +from odoo import fields, tools +from odoo.modules import get_module_resource +from odoo.tests import common from collections import namedtuple name_completion_case = namedtuple( diff --git a/account_move_base_import/tests/test_base_import.py b/account_move_base_import/tests/test_base_import.py index 4f62edb7..0c036091 100644 --- a/account_move_base_import/tests/test_base_import.py +++ b/account_move_base_import/tests/test_base_import.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2011 Akretion +# © 2011-2016 Akretion # © 2011-2016 Camptocamp SA # © 2013 Savoir-faire Linux # © 2014 ACSONE SA/NV @@ -8,9 +8,9 @@ import base64 import inspect import os from operator import attrgetter -from openerp.tests import common -from openerp import tools -from openerp.modules import get_module_resource +from odoo.tests import common +from odoo import tools +from odoo.modules import get_module_resource class TestCodaImport(common.TransactionCase): diff --git a/account_move_base_import/views/account_move_view.xml b/account_move_base_import/views/account_move_view.xml index e16e225d..6ba18df3 100644 --- a/account_move_base_import/views/account_move_view.xml +++ b/account_move_base_import/views/account_move_view.xml @@ -1,3 +1,4 @@ + account.move.view @@ -56,9 +57,8 @@ - Move Completion Rule + Move Completion Rules account.move.completion.rule - form tree,form diff --git a/account_move_base_import/views/journal_view.xml b/account_move_base_import/views/journal_view.xml index e5f95bde..99359fc3 100644 --- a/account_move_base_import/views/journal_view.xml +++ b/account_move_base_import/views/journal_view.xml @@ -28,14 +28,13 @@