From 490fa26411c508cf527009871e07f083b50d80df Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 17 Aug 2016 13:02:51 +0200 Subject: [PATCH 01/99] Add module base_business_document_import and start to move some code to it. --- base_business_document_import/README.rst | 56 ++++++++ base_business_document_import/__init__.py | 3 + base_business_document_import/__openerp__.py | 17 +++ .../models/__init__.py | 3 + .../models/business_document_import.py | 125 ++++++++++++++++++ 5 files changed, 204 insertions(+) create mode 100644 base_business_document_import/README.rst create mode 100644 base_business_document_import/__init__.py create mode 100644 base_business_document_import/__openerp__.py create mode 100644 base_business_document_import/models/__init__.py create mode 100644 base_business_document_import/models/business_document_import.py diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst new file mode 100644 index 0000000000..170cc01ea7 --- /dev/null +++ b/base_business_document_import/README.rst @@ -0,0 +1,56 @@ +.. 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 + +============================= +Base Business Document Import +============================= + +This is a technical module ; it doesn't bring any useful feature by itself. This module is the base modules for 2 other modules : + +* *account_invoice_import* which imports supplier invoices as PDF or XML files (this module also requires some additionnal modules such as *account_invoice_import_invoice2data*, *account_invoice_import_ubl*, etc... to support specific invoice formats), + +* *sale_invoice_import* which imports sale orders as CSV, XML or PDF files (this module also requires some additionnal modules such as *sale_invoice_import_csv* or *sale_invoice_import_ubl* to support specific order formats) + +Configuration +============= + +No configuration needed. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/95/8.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Contributors +------------ + +* Alexis de Lattre + +Maintainer +---------- + +.. image:: https://odoo-community.org/logo.png + :alt: Odoo Community Association + :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. + +To contribute to this module, please visit https://odoo-community.org. diff --git a/base_business_document_import/__init__.py b/base_business_document_import/__init__.py new file mode 100644 index 0000000000..cde864bae2 --- /dev/null +++ b/base_business_document_import/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import models diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__openerp__.py new file mode 100644 index 0000000000..80e1fff5b2 --- /dev/null +++ b/base_business_document_import/__openerp__.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +{ + 'name': 'Base Business Document Import', + 'version': '8.0.1.0.0', + 'category': 'Hidden', + 'license': 'AGPL-3', + 'summary': 'Provides technical tools to import sale orders or supplier ' + 'invoices', + 'author': 'Akretion,Odoo Community Association (OCA)', + 'website': 'http://www.akretion.com', + 'depends': ['product', 'base_vat_sanitized'], + 'external_dependencies': {'python': ['PyPDF2']}, + 'installable': True, +} diff --git a/base_business_document_import/models/__init__.py b/base_business_document_import/models/__init__.py new file mode 100644 index 0000000000..4a3c2e6a58 --- /dev/null +++ b/base_business_document_import/models/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import business_document_import diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py new file mode 100644 index 0000000000..40fe999c67 --- /dev/null +++ b/base_business_document_import/models/business_document_import.py @@ -0,0 +1,125 @@ +# -*- coding: utf-8 -*- +# © 2015-2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp import models, api, _ +from openerp.exceptions import Warning as UserError +import logging + +logger = logging.getLogger(__name__) + + +class BusinessDocumentImport(models.AbstractModel): + _name = 'business.document.import' + _description = 'Common methods to import business documents' + + @api.model + def _match_partner(self, parsed_inv, partner_type='supplier'): + if parsed_inv.get('partner'): + return parsed_inv['partner'] + if parsed_inv.get('partner_vat'): + vat = parsed_inv['partner_vat'].replace(' ', '').upper() + # use base_vat_sanitized + partners = self.env['res.partner'].search([ + (partner_type, '=', True), + ('parent_id', '=', False), + ('sanitized_vat', '=', vat)]) + if partners: + return partners[0] + else: + # TODO: update error msg + raise UserError(_( + "The analysis of the invoice returned '%s' as " + "partner VAT number. But there are no supplier " + "with this VAT number in Odoo.") % vat) + if parsed_inv.get('partner_email'): + partners = self.env['res.partner'].search([ + ('email', '=ilike', parsed_inv['partner_email']), + (partner_type, '=', True)]) + if partners: + return partners[0].commercial_partner_id + if parsed_inv.get('partner_name'): + partners = self.env['res.partner'].search([ + ('name', '=ilike', parsed_inv['partner_name']), + ('is_company', '=', True), + (partner_type, '=', True)]) + if partners: + return partners[0] + raise UserError(_( + "Invoice parsing didn't return the VAT number of the " + "partner. In this case, invoice parsing should return the " + "email or the name of the partner, but it was not returned " + "or it was returned but it didn't match any " + "existing partner.")) + # TODO : now that we use it for sale order, we may not want to + # always return a parent partner + + @api.model + def _match_product(self, parsed_line, partner=False): + """This method is designed to be inherited""" + ppo = self.env['product.product'] + if parsed_line.get('product'): + return parsed_line['product'] + if parsed_line.get('product_ean13'): + # Don't filter on purchase_ok = 1 because we don't depend + # on the purchase module + products = ppo.search([ + ('ean13', '=', parsed_line['product_ean13'])]) + if products: + return products[0] + if parsed_line.get('product_code'): + # Should probably be modified to match via the supplier code + products = ppo.search( + [('default_code', '=', parsed_line['product_code'])]) + if products: + return products[0] + # WARNING: Won't work for multi-variant products + # because product.supplierinfo is attached to product template + if partner: + sinfo = self.env['product.supplierinfo'].search([ + ('name', '=', partner.id), + ('product_code', '=', parsed_line['product_code']), + ]) + if ( + sinfo and + sinfo[0].product_tmpl_id.product_variant_ids and + len( + sinfo[0].product_tmpl_id.product_variant_ids) == 1 + ): + return sinfo[0].product_tmpl_id.product_variant_ids[0] + raise UserError(_( + "Could not find any corresponding product in the Odoo database " + "with EAN13 '%s' or Default Code '%s' or " + "Supplier Product Code '%s' with supplier '%s'.") % ( + parsed_line.get('product_ean13'), + parsed_line.get('product_code'), + parsed_line.get('product_code'), + partner and partner.name or 'None')) + + @api.model + def _match_currency(self, parsed_inv): + if parsed_inv.get('currency'): + return parsed_inv['currency'] + if parsed_inv.get('currency_iso'): + currency_iso = parsed_inv['currency_iso'].upper() + currencies = self.env['res.currency'].search( + [('name', '=', currency_iso)]) + if currencies: + return currencies[0] + else: + raise UserError(_( + "The analysis of the invoice returned '%s' as " + "the currency ISO code. But there are no currency " + "with that name in Odoo.") % currency_iso) + if parsed_inv.get('currency_symbol'): + cur_symbol = parsed_inv['currency_symbol'] + currencies = self.env['res.currency'].search( + [('symbol', '=', cur_symbol)]) + if currencies: + return currencies[0] + else: + raise UserError(_( + "The analysis of the invoice returned '%s' as " + "the currency symbol. But there are no currency " + "with that symbol in Odoo.") % cur_symbol) + return self.env.user.company_id.currency_id From 2837d215a0233e1dc66c172e3d885e624e2182bb Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 19 Aug 2016 00:22:39 +0200 Subject: [PATCH 02/99] Better/cleaner pivot invoice dict format (no more IDs in the pivot invoice dict, cleaner organisation) Code refactoring: move code in base_business_document_import, factorise code for tax matching (it was duplicated in UBL and ZUGFeRD) Now support PDF with embedded UBL XML file Enable unittests on account_invoice_import_ubl More absolute xpath in account_invoice_import_ubl instead of relative xpath WARNING: these are big changes, I may have broken a few details --- base_business_document_import/__openerp__.py | 6 +- .../models/business_document_import.py | 356 ++++++++++++++---- 2 files changed, 298 insertions(+), 64 deletions(-) diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__openerp__.py index 80e1fff5b2..cf4bf7eed3 100644 --- a/base_business_document_import/__openerp__.py +++ b/base_business_document_import/__openerp__.py @@ -11,7 +11,11 @@ 'invoices', 'author': 'Akretion,Odoo Community Association (OCA)', 'website': 'http://www.akretion.com', - 'depends': ['product', 'base_vat_sanitized'], + 'depends': [ + 'base_vat_sanitized', + 'account_tax_unece', + 'product_uom_unece', + ], 'external_dependencies': {'python': ['PyPDF2']}, 'installable': True, } diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 40fe999c67..8007bae815 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -3,7 +3,12 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from openerp import models, api, _ +from openerp.tools import float_compare from openerp.exceptions import Warning as UserError +import PyPDF2 +from lxml import etree +from StringIO import StringIO +import mimetypes import logging logger = logging.getLogger(__name__) @@ -14,63 +19,97 @@ class BusinessDocumentImport(models.AbstractModel): _description = 'Common methods to import business documents' @api.model - def _match_partner(self, parsed_inv, partner_type='supplier'): - if parsed_inv.get('partner'): - return parsed_inv['partner'] - if parsed_inv.get('partner_vat'): - vat = parsed_inv['partner_vat'].replace(' ', '').upper() + def _match_partner( + self, partner_dict, chatter_msg, partner_type='supplier'): + rpo = self.env['res.partner'] + if partner_dict.get('recordset'): + return partner_dict['recordset'] + if partner_dict.get('id'): + return rpo.browse(partner_dict['id']) + if partner_type == 'supplier': + domain = [('supplier', '=', True)] + partner_type_label = _('supplier') + elif partner_type == 'customer': + domain = [('customer', '=', True)] + partner_type_label = _('customer') + else: + domain = [] + partner_type_label = _('partner') + if partner_dict.get('vat'): + vat = partner_dict['vat'].replace(' ', '').upper() # use base_vat_sanitized - partners = self.env['res.partner'].search([ - (partner_type, '=', True), - ('parent_id', '=', False), - ('sanitized_vat', '=', vat)]) + partners = rpo.search( + domain + [ + ('parent_id', '=', False), + ('sanitized_vat', '=', vat)]) if partners: return partners[0] else: - # TODO: update error msg raise UserError(_( - "The analysis of the invoice returned '%s' as " - "partner VAT number. But there are no supplier " - "with this VAT number in Odoo.") % vat) - if parsed_inv.get('partner_email'): - partners = self.env['res.partner'].search([ - ('email', '=ilike', parsed_inv['partner_email']), - (partner_type, '=', True)]) + "The analysis of the business document returned '%s' as " + "%s VAT number. But there are no %s " + "with this VAT number in Odoo.") + % (partner_type_label, partner_type_label, vat)) + if partner_dict.get('email') and '@' in partner_dict['email']: + partners = rpo.search( + domain + [('email', '=ilike', partner_dict['email'])]) if partners: - return partners[0].commercial_partner_id - if parsed_inv.get('partner_name'): - partners = self.env['res.partner'].search([ - ('name', '=ilike', parsed_inv['partner_name']), - ('is_company', '=', True), - (partner_type, '=', True)]) + return partners[0] + else: + partner_domain_name = partner_dict['email'].split('@')[1] + partners = rpo.search( + domain + + [('website', '=ilike', '%' + partner_domain_name)]) + # I can't search on email addresses with partner_domain_name + # because of the emails such as @gmail.com, @yahoo.com that may + # match random partners + if partners: + chatter_msg.append(_( + "The %s has been identified by the domain name of " + "the email address '%s', so please check carefully " + "that the %s is correct.") % ( + partner_type_label, + partner_dict['email'], + partner_type_label)) + return partners[0] + if partner_dict.get('name'): + partners = rpo.search( + domain + [ + ('name', '=ilike', partner_dict['name']), + ('is_company', '=', True), + ]) if partners: return partners[0] raise UserError(_( - "Invoice parsing didn't return the VAT number of the " - "partner. In this case, invoice parsing should return the " - "email or the name of the partner, but it was not returned " - "or it was returned but it didn't match any " - "existing partner.")) - # TODO : now that we use it for sale order, we may not want to - # always return a parent partner + "Odoo couldn't find any %s corresponding to the following " + "information extracted from the business document:\n" + "VAT number: %s\n" + "E-mail: %s\n" + "Name: %s\n") + % ( + partner_type_label, + partner_dict.get('vat'), + partner_dict.get('email'), + partner_dict.get('name'))) @api.model - def _match_product(self, parsed_line, partner=False): + def _match_product(self, product_dict, chatter_msg, partner=False): """This method is designed to be inherited""" ppo = self.env['product.product'] - if parsed_line.get('product'): - return parsed_line['product'] - if parsed_line.get('product_ean13'): - # Don't filter on purchase_ok = 1 because we don't depend - # on the purchase module + if product_dict.get('recordset'): + return product_dict['recordset'] + if product_dict.get('id'): + return ppo.browse(product_dict['id']) + if product_dict.get('ean13'): products = ppo.search([ - ('ean13', '=', parsed_line['product_ean13'])]) + ('ean13', '=', product_dict['ean13'])]) if products: return products[0] - if parsed_line.get('product_code'): - # Should probably be modified to match via the supplier code - products = ppo.search( - [('default_code', '=', parsed_line['product_code'])]) + if product_dict.get('code'): + products = ppo.search([ + '|', + ('ean13', '=', product_dict['code']), + ('default_code', '=', product_dict['code'])]) if products: return products[0] # WARNING: Won't work for multi-variant products @@ -78,7 +117,7 @@ def _match_product(self, parsed_line, partner=False): if partner: sinfo = self.env['product.supplierinfo'].search([ ('name', '=', partner.id), - ('product_code', '=', parsed_line['product_code']), + ('product_code', '=', product_dict['code']), ]) if ( sinfo and @@ -88,38 +127,229 @@ def _match_product(self, parsed_line, partner=False): ): return sinfo[0].product_tmpl_id.product_variant_ids[0] raise UserError(_( - "Could not find any corresponding product in the Odoo database " - "with EAN13 '%s' or Default Code '%s' or " - "Supplier Product Code '%s' with supplier '%s'.") % ( - parsed_line.get('product_ean13'), - parsed_line.get('product_code'), - parsed_line.get('product_code'), + "Odoo couldn't find any product corresponding to the " + "following information extracted from the business document: " + "EAN13: %s\n" + "Product code: %s\n" + "Supplier: %s\n") % ( + product_dict.get('ean13'), + product_dict.get('code'), partner and partner.name or 'None')) @api.model - def _match_currency(self, parsed_inv): - if parsed_inv.get('currency'): - return parsed_inv['currency'] - if parsed_inv.get('currency_iso'): - currency_iso = parsed_inv['currency_iso'].upper() - currencies = self.env['res.currency'].search( + def _match_currency(self, currency_dict, chatter_msg): + if not currency_dict: + currency_dict = {} + rco = self.env['res.currency'] + if currency_dict.get('recordset'): + return currency_dict['recordset'] + if currency_dict.get('id'): + return rco.browse(currency_dict['id']) + if currency_dict.get('iso'): + currency_iso = currency_dict['iso'].upper() + currencies = rco.search( [('name', '=', currency_iso)]) if currencies: return currencies[0] else: raise UserError(_( - "The analysis of the invoice returned '%s' as " + "The analysis of the business document returned '%s' as " "the currency ISO code. But there are no currency " - "with that name in Odoo.") % currency_iso) - if parsed_inv.get('currency_symbol'): - cur_symbol = parsed_inv['currency_symbol'] - currencies = self.env['res.currency'].search( - [('symbol', '=', cur_symbol)]) + "with that code in Odoo.") % currency_iso) + if currency_dict.get('symbol'): + currencies = rco.search( + [('symbol', '=', currency_dict['symbol'])]) if currencies: return currencies[0] else: raise UserError(_( - "The analysis of the invoice returned '%s' as " + "The analysis of the business document returned '%s' as " "the currency symbol. But there are no currency " - "with that symbol in Odoo.") % cur_symbol) - return self.env.user.company_id.currency_id + "with that symbol in Odoo.") % currency_dict['symbol']) + if currency_dict.get('iso_or_symbol'): + currencies = rco.search([ + '|', + ('name', '=', currency_dict['iso_or_symbol'].upper()), + ('symbol', '=', currency_dict['iso_or_symbol'])]) + if currencies: + return currencies[0] + else: + raise UserError(_( + "The analysis of the business document returned '%s' as " + "the currency symbol or ISO code. But there are no " + "currency with the symbol nor ISO code in Odoo.") + % currency_dict['iso_or_symbol']) + if currency_dict.get('country_code'): + country_code = currency_dict['country_code'].upper() + countries = self.env['res.country'].search([ + ('code', '=', country_code)]) + if countries: + country = countries[0] + if country.currency_id: + return country.currency_id + else: + raise UserError(_( + "The analysis of the business document returned '%s' " + "as the country code to find the related currency. " + "But the country '%s' doesn't have any related " + "currency configured in Odoo.") + % (country_code, country.name)) + else: + raise UserError(_( + "The analysis of the business document returned '%s' " + "as the country code to find the related currency. " + "But there is no country with that code in Odoo.") + % country_code) + company_cur = self.env.user.company_id.currency_id + chatter_msg.append(_( + 'No currency specified, so Odoo used the company currency (%s)') + % company_cur.name) + return company_cur + + @api.model + def _match_uom(self, uom_dict, chatter_msg, product=False): + puo = self.env['product.uom'] + if not uom_dict: + uom_dict = {} + if uom_dict.get('recordset'): + return uom_dict['recordset'] + if uom_dict.get('id'): + return puo.browse(uom_dict['id']) + if uom_dict.get('unece_code'): + uoms = puo.search([ + ('unece_code', '=', uom_dict['unece_code'])]) + if uoms: + return uoms[0] + else: + chatter_msg.append(_( + "The analysis of the business document returned '%s' " + "as the unit of measure UNECE code, but there is no " + "unit of measure with that UNECE code in Odoo. Please " + "check the configuration of the units of measures in " + "Odoo.") % uom_dict['unece_code']) + if uom_dict.get('name'): + uoms = puo.search([ + ('name', '=ilike', uom_dict['name'] + '%')]) + if uoms: + return uoms[0] + if product: + return product.uom_id + chatter_msg.append(_( + "

Odoo couldn't find any unit of measure corresponding to the " + "following information extracted from the business document:

" + "
  • UNECE code: %s
  • " + "
  • Name of the unit of measure: %s
" + "

So the unit of measure 'Unit(s)' has been used. You may " + "have to change it manually.

") + % (uom_dict.get('unece_code'), uom_dict.get('name'))) + return self.env.ref('product.product_uom_unit') + + @api.model + def _match_taxes( + self, taxes_list, chatter_msg, + type_tax_use='purchase', price_include=False): + """taxes_list must be a list of tax_dict""" + taxes_recordset = self.env['account.tax'].browse(False) + for tax_dict in taxes_list: + taxes_recordset += self._match_tax( + tax_dict, chatter_msg, type_tax_use=type_tax_use, + price_include=price_include) + return taxes_recordset + + @api.model + def _match_tax( + self, tax_dict, chatter_msg, + type_tax_use='purchase', price_include=False): + """Example: + tax_dict = { + 'type': 'percent', # required param, 'fixed' or 'percent' + 'amount': 20.0, # required + 'unece_type_code': 'VAT', + 'unece_categ_code': 'S', + } + With l10n_fr, it will return 20% VAT tax. + """ + ato = self.env['account.tax'] + if tax_dict.get('recordset'): + return tax_dict['recordset'] + if tax_dict.get('id'): + return ato.browse(tax_dict['id']) + domain = [] + prec = self.env['decimal.precision'].precision_get('Account') + # we should not use the Account prec directly, but... + if type_tax_use == 'purchase': + domain.append(('type_tax_use', 'in', ('purchase', 'all'))) + elif type_tax_use == 'sale': + domain.append(('type_tax_use', 'in', ('sale', 'all'))) + if price_include is False: + domain.append(('price_include', '=', False)) + elif price_include is True: + domain.append(('price_include', '=', True)) + # with the code abose, if you set price_include=None, it will + # won't depend on the value of the price_include parameter + assert tax_dict.get('type') in ['fixed', 'percent'], 'bad tax type' + assert 'amount' in tax_dict, 'Missing amount key in tax_dict' + domain.append(('type', '=', tax_dict['type'])) + if tax_dict.get('unece_type_code'): + domain.append( + ('unece_type_code', '=', tax_dict['unece_type_code'])) + if tax_dict.get('unece_categ_code'): + domain.append( + ('unece_categ_code', '=', tax_dict['unece_categ_code'])) + taxes = ato.search(domain) + for tax in taxes: + tax_amount = tax.amount + if tax_dict['type'] == 'percent': + tax_amount *= 100 + if not float_compare( + tax_dict['amount'], tax_amount, precision_digits=prec): + return tax + raise UserError(_( + "Odoo couldn't find any tax with 'Tax Application' = '%s' " + "and 'Tax Included in Price' = '%s' which correspond to the " + "following information extracted from the business document:\n" + "UNECE Tax Type code: %s\n" + "UNECE Tax Category code: %s\n" + "Tax amount: %s %s") % ( + type_tax_use, + price_include, + tax_dict.get('unece_type_code'), + tax_dict.get('unece_categ_code'), + tax_dict['amount'], + tax_dict['type'] == 'percent' and '%' or _('(fixed)'))) + + def get_xml_files_from_pdf(self, pdf_file): + """Returns a dict with key = filename, value = XML file obj""" + logger.info('Trying to find an embedded XML file inside PDF') + res = {} + try: + fd = StringIO(pdf_file) + pdf = PyPDF2.PdfFileReader(fd) + logger.debug('pdf.trailer=%s', pdf.trailer) + pdf_root = pdf.trailer['/Root'] + logger.debug('pdf_root=%s', pdf_root) + embeddedfiles = pdf_root['/Names']['/EmbeddedFiles']['/Names'] + i = 0 + xmlfiles = {} # key = filename, value = PDF obj + for embeddedfile in embeddedfiles[:-1]: + mime_res = mimetypes.guess_type(embeddedfile) + if mime_res and mime_res[0] == 'application/xml': + xmlfiles[embeddedfile] = embeddedfiles[i+1] + i += 1 + logger.debug('xmlfiles=%s', xmlfiles) + for filename, xml_file_dict_obj in xmlfiles.iteritems(): + try: + xml_file_dict = xml_file_dict_obj.getObject() + logger.debug('xml_file_dict=%s', xml_file_dict) + xml_string = xml_file_dict['/EF']['/F'].getData() + xml_root = etree.fromstring(xml_string) + logger.debug( + 'A valid XML file %s has been found in the PDF file', + filename) + res[filename] = xml_root + except: + continue + except: + pass + logger.info('Valid XML files found in PDF: %s', res.keys()) + return res From 01ae749b3f1a9eea7d726a004d0523cd2bd923fc Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 21 Aug 2016 18:10:04 +0200 Subject: [PATCH 03/99] Add module base_ubl (common methods to generate and parse UBL files) Adapt module account_invoice_import_ubl to use the new base_ubl module Small fixes --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 8007bae815..7efdefb612 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -49,7 +49,7 @@ def _match_partner( "The analysis of the business document returned '%s' as " "%s VAT number. But there are no %s " "with this VAT number in Odoo.") - % (partner_type_label, partner_type_label, vat)) + % (vat, partner_type_label, partner_type_label)) if partner_dict.get('email') and '@' in partner_dict['email']: partners = rpo.search( domain + [('email', '=ilike', partner_dict['email'])]) From 729648a8e33d69c96d7a968403cc82ec9eedad87 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 22 Aug 2016 01:19:47 +0200 Subject: [PATCH 04/99] Parse customer/supplier ref in UBL and allow to match partner on 'ref' Better generation of address block in UBL (make it coherent with the datamodel of Odoo) Add generation of several UBL blocks: language, delivery, payment terms, customer party, spplier party Add parsing of zip in UBL party (will be used in the future for delivery partner match) --- .../models/business_document_import.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 7efdefb612..fd3404fe69 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -72,6 +72,13 @@ def _match_partner( partner_dict['email'], partner_type_label)) return partners[0] + if partner_dict.get('ref'): + partners = rpo.search( + domain + [ + ('ref', '=', partner_dict['ref']), + ('is_company', '=', True)]) + if partners: + return partners[0] if partner_dict.get('name'): partners = rpo.search( domain + [ @@ -85,11 +92,13 @@ def _match_partner( "information extracted from the business document:\n" "VAT number: %s\n" "E-mail: %s\n" + "Reference: %s\n" "Name: %s\n") % ( partner_type_label, partner_dict.get('vat'), partner_dict.get('email'), + partner_dict.get('ref'), partner_dict.get('name'))) @api.model From ed0152b6404e708be3c360c527e0e7114211a970 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 23 Aug 2016 02:15:28 +0200 Subject: [PATCH 05/99] Add matching of delivery partner Use country code and state code to match partners UBL: Add delivery terms and line item UBL XML block generation UBL: add parsing of delivery block --- .../models/business_document_import.py | 105 +++++++++++++++++- 1 file changed, 104 insertions(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index fd3404fe69..b22f0f5ead 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -21,6 +21,16 @@ class BusinessDocumentImport(models.AbstractModel): @api.model def _match_partner( self, partner_dict, chatter_msg, partner_type='supplier'): + """Example: + partner_dict = { + 'country_code': 'FR', + 'state_code': False, + 'vat': 'FR12448890432', + 'email': 'roger.lemaire@akretion.com', + 'name': 'Akretion France', + 'ref': 'C1242', + } + """ rpo = self.env['res.partner'] if partner_dict.get('recordset'): return partner_dict['recordset'] @@ -35,6 +45,30 @@ def _match_partner( else: domain = [] partner_type_label = _('partner') + country = False + if partner_dict.get('country_code'): + countries = self.env['res.country'].search([ + ('code', '=', partner_dict['country_code'])]) + if countries: + country = countries[0] + domain += [ + '|', + ('country_id', '=', False), + ('country_id', '=', country.id)] + else: + chatter_msg.append(_( + "The analysis of the business document returned '%s' as " + "country code. But there are no country with that code " + "in Odoo.") % partner_dict['country_code']) + if country and partner_dict.get('state_code'): + states = self.env['res.country.state'].search([ + ('code', '=', partner_dict['state_code']), + ('country_id', '=', country.id)]) + if states: + domain += [ + '|', + ('state_id', '=', False), + ('state_id', '=', states[0].id)] if partner_dict.get('vat'): vat = partner_dict['vat'].replace(' ', '').upper() # use base_vat_sanitized @@ -90,20 +124,73 @@ def _match_partner( raise UserError(_( "Odoo couldn't find any %s corresponding to the following " "information extracted from the business document:\n" + "Country code: %s\n" + "State code: %s\n" "VAT number: %s\n" "E-mail: %s\n" "Reference: %s\n" "Name: %s\n") % ( partner_type_label, + partner_dict.get('country_code'), + partner_dict.get('state_code'), partner_dict.get('vat'), partner_dict.get('email'), partner_dict.get('ref'), partner_dict.get('name'))) + @api.model + def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): + rpo = self.env['res.partner'] + if shipping_dict.get('partner'): + partner = self._match_partner( + shipping_dict['partner'], chatter_msg, partner_type=False) + domain = [('parent_id', '=', partner.id)] + address_dict = shipping_dict['address'] + country = False + if address_dict.get('country_code'): + countries = self.env['res.country'].search([ + ('code', '=', address_dict['country_code'])]) + if countries: + country = countries[0] + domain += [ + '|', + ('country_id', '=', False), + ('country_id', '=', country.id)] + else: + chatter_msg.append(_( + "The analysis of the business document returned '%s' as " + "country code. But there are no country with that code " + "in Odoo.") % address_dict['country_code']) + if country and address_dict.get('state_code'): + states = self.env['res.country.state'].search([ + ('code', '=', address_dict['state_code']), + ('country_id', '=', country.id)]) + if states: + domain += [ + '|', + ('state_id', '=', False), + ('state_id', '=', states[0].id)] + if address_dict.get('zip'): + domain.append(('zip', '=', address_dict['zip'])) + # TODO: sanitize ZIP ? + partners = rpo.search(domain + [('type', '=', 'delivery')]) + if partners: + partner = partners[0] + else: + partners = rpo.search(domain) + if partners: + partner = partners[0] + return partner + @api.model def _match_product(self, product_dict, chatter_msg, partner=False): - """This method is designed to be inherited""" + """Example: + product_dict = { + 'ean13': '5449000054227', + 'code': 'COCA1L', + } + """ ppo = self.env['product.product'] if product_dict.get('recordset'): return product_dict['recordset'] @@ -147,6 +234,13 @@ def _match_product(self, product_dict, chatter_msg, partner=False): @api.model def _match_currency(self, currency_dict, chatter_msg): + """Example: + currency_dict = { + 'iso': 'USD', # If we have ISO, no need to have more keys + 'symbol': '$', + 'country_code': 'US', + } + """ if not currency_dict: currency_dict = {} rco = self.env['res.currency'] @@ -217,6 +311,12 @@ def _match_currency(self, currency_dict, chatter_msg): @api.model def _match_uom(self, uom_dict, chatter_msg, product=False): + """Example: + uom_dict = { + 'unece_code': 'LTR', + 'name': 'Liter', + } + """ puo = self.env['product.uom'] if not uom_dict: uom_dict = {} @@ -225,6 +325,9 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): if uom_dict.get('id'): return puo.browse(uom_dict['id']) if uom_dict.get('unece_code'): + # Map NIU to Unit + if uom_dict['unece_code'] == 'NIU': + uom_dict['unece_code'] = 'C62' uoms = puo.search([ ('unece_code', '=', uom_dict['unece_code'])]) if uoms: From db341f0890c42465fa63fcb19d9097be168e9293 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 24 Aug 2016 22:37:22 +0200 Subject: [PATCH 06/99] Add module base_phone_business_document_import Add unitests in base_business_document_import Small code enhancements/simplifications --- base_business_document_import/__openerp__.py | 2 +- .../models/business_document_import.py | 68 +++++-- .../tests/__init__.py | 3 + .../tests/test_business_document_import.py | 183 ++++++++++++++++++ 4 files changed, 244 insertions(+), 12 deletions(-) create mode 100644 base_business_document_import/tests/__init__.py create mode 100644 base_business_document_import/tests/test_business_document_import.py diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__openerp__.py index cf4bf7eed3..833b97709d 100644 --- a/base_business_document_import/__openerp__.py +++ b/base_business_document_import/__openerp__.py @@ -5,7 +5,7 @@ { 'name': 'Base Business Document Import', 'version': '8.0.1.0.0', - 'category': 'Hidden', + 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' 'invoices', diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index b22f0f5ead..1360ba0b89 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -18,6 +18,17 @@ class BusinessDocumentImport(models.AbstractModel): _name = 'business.document.import' _description = 'Common methods to import business documents' + @api.model + def _strip_cleanup_dict(self, match_dict): + if match_dict: + for key, value in match_dict.iteritems(): + if value and isinstance(value, (str, unicode)): + match_dict[key] = value.strip() + if match_dict.get('country_code'): + match_dict['country_code'] = match_dict['country_code'].upper() + if match_dict.get('state_code'): + match_dict['state_code'] = match_dict['state_code'].upper() + @api.model def _match_partner( self, partner_dict, chatter_msg, partner_type='supplier'): @@ -29,9 +40,14 @@ def _match_partner( 'email': 'roger.lemaire@akretion.com', 'name': 'Akretion France', 'ref': 'C1242', + 'phone': '01.41.98.12.42', + 'fax': '01.41.98.12.43', } + The keys 'phone' and 'fax' are used by the module + base_phone_business_document_import """ rpo = self.env['res.partner'] + self._strip_cleanup_dict(partner_dict) if partner_dict.get('recordset'): return partner_dict['recordset'] if partner_dict.get('id'): @@ -69,6 +85,11 @@ def _match_partner( '|', ('state_id', '=', False), ('state_id', '=', states[0].id)] + # Hook to plug alternative matching methods + partner = self._hook_match_partner( + partner_dict, chatter_msg, domain, partner_type_label) + if partner: + return partner if partner_dict.get('vat'): vat = partner_dict['vat'].replace(' ', '').upper() # use base_vat_sanitized @@ -79,7 +100,7 @@ def _match_partner( if partners: return partners[0] else: - raise UserError(_( + chatter_msg.append(_( "The analysis of the business document returned '%s' as " "%s VAT number. But there are no %s " "with this VAT number in Odoo.") @@ -139,14 +160,34 @@ def _match_partner( partner_dict.get('ref'), partner_dict.get('name'))) + @api.model + def _hook_match_partner( + self, partner_dict, chatter_msg, domain, partner_type_label): + return False + @api.model def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): + """Example: + shipping_dict = { + 'partner': { + 'email': 'contact@akretion.com', + 'name': 'Akretion France', + }, + 'address': { + 'zip': '69100', + 'country_code': 'FR', + }, + } + The partner argument is a bit special: it is a fallback in case + shipping_dict['partner'] = {} + """ rpo = self.env['res.partner'] if shipping_dict.get('partner'): partner = self._match_partner( shipping_dict['partner'], chatter_msg, partner_type=False) domain = [('parent_id', '=', partner.id)] address_dict = shipping_dict['address'] + self._strip_cleanup_dict(address_dict) country = False if address_dict.get('country_code'): countries = self.env['res.country'].search([ @@ -173,7 +214,7 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): ('state_id', '=', states[0].id)] if address_dict.get('zip'): domain.append(('zip', '=', address_dict['zip'])) - # TODO: sanitize ZIP ? + # sanitize ZIP ? partners = rpo.search(domain + [('type', '=', 'delivery')]) if partners: partner = partners[0] @@ -184,7 +225,7 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): return partner @api.model - def _match_product(self, product_dict, chatter_msg, partner=False): + def _match_product(self, product_dict, chatter_msg, seller=False): """Example: product_dict = { 'ean13': '5449000054227', @@ -192,6 +233,7 @@ def _match_product(self, product_dict, chatter_msg, partner=False): } """ ppo = self.env['product.product'] + self._strip_cleanup_dict(product_dict) if product_dict.get('recordset'): return product_dict['recordset'] if product_dict.get('id'): @@ -210,9 +252,9 @@ def _match_product(self, product_dict, chatter_msg, partner=False): return products[0] # WARNING: Won't work for multi-variant products # because product.supplierinfo is attached to product template - if partner: + if seller: sinfo = self.env['product.supplierinfo'].search([ - ('name', '=', partner.id), + ('name', '=', seller.id), ('product_code', '=', product_dict['code']), ]) if ( @@ -230,7 +272,7 @@ def _match_product(self, product_dict, chatter_msg, partner=False): "Supplier: %s\n") % ( product_dict.get('ean13'), product_dict.get('code'), - partner and partner.name or 'None')) + seller and seller.name or 'None')) @api.model def _match_currency(self, currency_dict, chatter_msg): @@ -244,6 +286,7 @@ def _match_currency(self, currency_dict, chatter_msg): if not currency_dict: currency_dict = {} rco = self.env['res.currency'] + self._strip_cleanup_dict(currency_dict) if currency_dict.get('recordset'): return currency_dict['recordset'] if currency_dict.get('id'): @@ -262,13 +305,14 @@ def _match_currency(self, currency_dict, chatter_msg): if currency_dict.get('symbol'): currencies = rco.search( [('symbol', '=', currency_dict['symbol'])]) - if currencies: + if len(currencies) == 1: return currencies[0] else: - raise UserError(_( + chatter_msg.append(_( "The analysis of the business document returned '%s' as " - "the currency symbol. But there are no currency " - "with that symbol in Odoo.") % currency_dict['symbol']) + "the currency symbol. But there are none or several " + "currencies with that symbol in Odoo.") + % currency_dict['symbol']) if currency_dict.get('iso_or_symbol'): currencies = rco.search([ '|', @@ -283,7 +327,7 @@ def _match_currency(self, currency_dict, chatter_msg): "currency with the symbol nor ISO code in Odoo.") % currency_dict['iso_or_symbol']) if currency_dict.get('country_code'): - country_code = currency_dict['country_code'].upper() + country_code = currency_dict['country_code'] countries = self.env['res.country'].search([ ('code', '=', country_code)]) if countries: @@ -320,6 +364,7 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): puo = self.env['product.uom'] if not uom_dict: uom_dict = {} + self._strip_cleanup_dict(uom_dict) if uom_dict.get('recordset'): return uom_dict['recordset'] if uom_dict.get('id'): @@ -382,6 +427,7 @@ def _match_tax( With l10n_fr, it will return 20% VAT tax. """ ato = self.env['account.tax'] + self._strip_cleanup_dict(tax_dict) if tax_dict.get('recordset'): return tax_dict['recordset'] if tax_dict.get('id'): diff --git a/base_business_document_import/tests/__init__.py b/base_business_document_import/tests/__init__.py new file mode 100644 index 0000000000..4f964c4100 --- /dev/null +++ b/base_business_document_import/tests/__init__.py @@ -0,0 +1,3 @@ +# -*- coding: utf-8 -*- + +from . import test_business_document_import diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py new file mode 100644 index 0000000000..89df14b8f4 --- /dev/null +++ b/base_business_document_import/tests/test_business_document_import.py @@ -0,0 +1,183 @@ +# -*- coding: utf-8 -*- +# © 2016 Akretion (Alexis de Lattre ) +# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). + +from openerp.tests.common import TransactionCase + + +class TestFrIntrastatService(TransactionCase): + + def test_match_partner(self): + bdio = self.env['business.document.import'] + partner_dict = {'email': u' Agrolait@yourcompany.example.com'} + res = bdio._match_partner( + partner_dict, [], partner_type='customer') + + self.assertEquals(res, self.env.ref('base.res_partner_2')) + partner_dict = {'name': u'delta pc '} + res = bdio._match_partner( + partner_dict, [], partner_type='supplier') + self.assertEquals(res, self.env.ref('base.res_partner_4')) + + def test_match_shipping_partner(self): + rpo = self.env['res.partner'] + bdio = self.env['business.document.import'] + partner1 = rpo.create({ + 'name': 'Akretion France', + 'street': u'35B rue Montgolfier', + 'zip': '69100', + 'country_id': self.env.ref('base.fr').id, + 'email': 'contact@akretion.com', + }) + cpartner1 = rpo.create({ + 'parent_id': partner1.id, + 'name': u'Alexis de Lattre', + 'email': 'alexis.delattre@akretion.com', + 'use_parent_address': True, + 'type': 'delivery', + }) + rpo.create({ + 'parent_id': partner1.id, + 'name': u'Sébastien BEAU', + 'email': 'sebastien.beau@akretion.com', + 'use_parent_address': True, + 'type': 'default', + }) + cpartner3 = rpo.create({ + 'parent_id': partner1.id, + 'name': 'Flo', + 'email': 'flo@akretion.com', + 'street': "42 rue des lilas d'Espagne", + 'zip': '92400', + 'city': u'Courbevoie', + 'country_id': self.env.ref('base.fr').id, + 'type': 'invoice', + }) + agrolait = self.env.ref('base.res_partner_2') + shipping_dict = { + 'partner': {'email': 'contact@akretion.com'}, + 'address': {}, + } + res = bdio._match_shipping_partner(shipping_dict, agrolait, []) + self.assertEquals(res, cpartner1) + shipping_dict['address'] = { + 'zip': '92400', + 'country_code': 'fr', + } + res = bdio._match_shipping_partner(shipping_dict, agrolait, []) + self.assertEquals(res, cpartner3) + shipping_dict['address']['zip'] = '92500' + res = bdio._match_shipping_partner(shipping_dict, agrolait, []) + self.assertEquals(res, partner1) + shipping_dict = { + 'partner': {}, + 'address': {}, + } + res = bdio._match_shipping_partner(shipping_dict, partner1, []) + self.assertEquals(res, cpartner1) + + def test_match_currency(self): + bdio = self.env['business.document.import'] + currency_dict = {'iso': u'EUR'} + res = bdio._match_currency(currency_dict, []) + self.assertEquals(res, self.env.ref('base.EUR')) + currency_dict = {'symbol': u'€'} + res = bdio._match_currency(currency_dict, []) + self.assertEquals(res, self.env.ref('base.EUR')) + currency_dict = {'country_code': u'fr '} + res = bdio._match_currency(currency_dict, []) + self.assertEquals(res, self.env.ref('base.EUR')) + currency_dict = {'iso_or_symbol': u'€'} + res = bdio._match_currency(currency_dict, []) + self.assertEquals(res, self.env.ref('base.EUR')) + self.env.user.company_id.currency_id = self.env.ref('base.KRW') + currency_dict = {} + res = bdio._match_currency(currency_dict, []) + self.assertEquals(res, self.env.ref('base.KRW')) + + def test_match_product(self): + bdio = self.env['business.document.import'] + ppo = self.env['product.product'] + product1 = ppo.create({ + 'name': u'Test Product', + 'ean13': '9782203121102', + 'seller_ids': [ + (0, 0, { + 'name': self.env.ref('base.res_partner_2').id, + 'product_code': 'TEST1242', + }), + ] + }) + product_dict = {'code': u'A2324 '} + res = bdio._match_product(product_dict, []) + self.assertEquals(res, self.env.ref('product.product_product_4b')) + product_dict = {'ean13': u'9782203121102'} + res = bdio._match_product(product_dict, []) + self.assertEquals(res, product1) + product_dict = {'code': 'TEST1242'} + res = bdio._match_product( + product_dict, [], seller=self.env.ref('base.res_partner_2')) + self.assertEquals(res, product1) + raise_test = True + try: + bdio._match_product(product_dict, [], seller=False) + raise_test = False + except: + pass + self.assertTrue(raise_test) + + def test_match_uom(self): + bdio = self.env['business.document.import'] + uom_dict = {'unece_code': 'KGM'} + res = bdio._match_uom(uom_dict, []) + self.assertEquals(res, self.env.ref('product.product_uom_kgm')) + uom_dict = {'unece_code': 'NIU'} + res = bdio._match_uom(uom_dict, []) + self.assertEquals(res, self.env.ref('product.product_uom_unit')) + uom_dict = {'name': 'day'} + res = bdio._match_uom(uom_dict, []) + self.assertEquals(res, self.env.ref('product.product_uom_day')) + uom_dict = {'name': ' Liter '} + res = bdio._match_uom(uom_dict, []) + self.assertEquals(res, self.env.ref('product.product_uom_litre')) + + def test_match_tax(self): + # on purpose, I use a rate that doesn't exist + # so that this test works even if the l10n_de is installed + de_tax_21 = self.env['account.tax'].create({ + 'name': u'German VAT purchase 18.0%', + 'description': 'DE-VAT-buy-18.0', + 'type_tax_use': 'purchase', + 'price_include': False, + 'amount': 0.18, + 'type': 'percent', + 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, + 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, + }) + de_tax_21_ttc = self.env['account.tax'].create({ + 'name': u'German VAT purchase 18.0% TTC', + 'description': 'DE-VAT-buy-18.0-TTC', + 'type_tax_use': 'purchase', + 'price_include': True, + 'amount': 0.18, + 'type': 'percent', + 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, + 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, + }) + bdio = self.env['business.document.import'] + tax_dict = { + 'type': 'percent', + 'amount': 18, + 'unece_type_code': 'VAT', + 'unece_categ_code': 'S', + } + res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') + self.assertEquals(res, de_tax_21) + tax_dict.pop('unece_categ_code') + res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') + self.assertEquals(res, de_tax_21) + res = bdio._match_tax( + tax_dict, [], type_tax_use='purchase', price_include=True) + self.assertEquals(res, de_tax_21_ttc) + res = bdio._match_taxes([tax_dict], [], type_tax_use='purchase') + self.assertEquals(res, de_tax_21) From a661f54bc5c711eb844337d427402cf973a92462 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 24 Aug 2016 23:05:32 +0200 Subject: [PATCH 07/99] Add unitest on partner matching and update code of partner matching --- .../models/business_document_import.py | 40 +++++++++---------- .../tests/test_business_document_import.py | 17 +++++++- 2 files changed, 34 insertions(+), 23 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 1360ba0b89..265ea6e64e 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -112,34 +112,30 @@ def _match_partner( return partners[0] else: partner_domain_name = partner_dict['email'].split('@')[1] - partners = rpo.search( - domain + - [('website', '=ilike', '%' + partner_domain_name)]) - # I can't search on email addresses with partner_domain_name - # because of the emails such as @gmail.com, @yahoo.com that may - # match random partners - if partners: - chatter_msg.append(_( - "The %s has been identified by the domain name of " - "the email address '%s', so please check carefully " - "that the %s is correct.") % ( - partner_type_label, - partner_dict['email'], - partner_type_label)) - return partners[0] + if partner_domain_name: + partners = rpo.search( + domain + + [('website', '=ilike', '%' + partner_domain_name)]) + # I can't search on email addresses with + # partner_domain_name because of the emails such as + # @gmail.com, @yahoo.com that may match random partners + if partners: + chatter_msg.append(_( + "The %s has been identified by the domain name of " + "the email address '%s', so please check " + "carefully that the %s is correct.") % ( + partner_type_label, + partner_dict['email'], + partner_type_label)) + return partners[0] if partner_dict.get('ref'): partners = rpo.search( - domain + [ - ('ref', '=', partner_dict['ref']), - ('is_company', '=', True)]) + domain + [('ref', '=', partner_dict['ref'])]) if partners: return partners[0] if partner_dict.get('name'): partners = rpo.search( - domain + [ - ('name', '=ilike', partner_dict['name']), - ('is_company', '=', True), - ]) + domain + [('name', '=ilike', partner_dict['name'])]) if partners: return partners[0] raise UserError(_( diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 89df14b8f4..0ace4a26dd 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -8,16 +8,31 @@ class TestFrIntrastatService(TransactionCase): def test_match_partner(self): + partner1 = self.env['res.partner'].create({ + 'name': 'Total SA', + 'supplier': False, + 'customer': False, + 'ref': 'TOTAL', + 'website': 'www.total.com', + }) bdio = self.env['business.document.import'] partner_dict = {'email': u' Agrolait@yourcompany.example.com'} res = bdio._match_partner( partner_dict, [], partner_type='customer') - self.assertEquals(res, self.env.ref('base.res_partner_2')) + # match on domain extracted from email with warning + partner_dict = {'email': u'alexis.delattre@total.com'} + warn = [] + res = bdio._match_partner(partner_dict, warn, partner_type=False) + self.assertEquals(res, partner1) + self.assertTrue(warn) partner_dict = {'name': u'delta pc '} res = bdio._match_partner( partner_dict, [], partner_type='supplier') self.assertEquals(res, self.env.ref('base.res_partner_4')) + partner_dict = {'ref': u'TOTAL'} + res = bdio._match_partner(partner_dict, [], partner_type=False) + self.assertEquals(res, partner1) def test_match_shipping_partner(self): rpo = self.env['res.partner'] From e7d08d9cbbfcf9f2af68c0b427a40dfcfb98a832 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 25 Aug 2016 02:33:39 +0200 Subject: [PATCH 08/99] Add a unittest on _match_uom Code cleanup/minor changes --- .../tests/test_business_document_import.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 0ace4a26dd..aff3bb37f6 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -155,6 +155,10 @@ def test_match_uom(self): uom_dict = {'name': ' Liter '} res = bdio._match_uom(uom_dict, []) self.assertEquals(res, self.env.ref('product.product_uom_litre')) + uom_dict = {} + product = self.env.ref('product.product_product_1') + res = bdio._match_uom(uom_dict, [], product=product) + self.assertEquals(res, product.uom_id) def test_match_tax(self): # on purpose, I use a rate that doesn't exist From 0c2317631af1e25bdc67020f961bad8fa44816f9 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 27 Aug 2016 01:07:03 +0200 Subject: [PATCH 09/99] Add module base_business_document_import_stock Rename key 'quantity' to 'qty' in all parsing dicts['lines'] Add common methods compare_lines() and post_create_or_update() Make sure price_unit is always untaxed in UBL XML files --- .../models/business_document_import.py | 147 ++++++++++++++++++ 1 file changed, 147 insertions(+) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 265ea6e64e..0c0cfa7fbb 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -472,6 +472,134 @@ def _match_tax( tax_dict['amount'], tax_dict['type'] == 'percent' and '%' or _('(fixed)'))) + def compare_lines( + self, existing_lines, import_lines, chatter_msg, + qty_precision=None, price_precision=None, seller=False): + """ Example: + existing_lines = [{ + 'product': odoo_recordset, + 'name': 'USB Adapter', + 'qty': 1.5, + 'price_unit': 23.43, # without taxes + 'uom': uom, + 'line': recordset, + # Add taxes + }] + import_lines = [{ + 'product': { + 'ean13': '2100002000003', + 'code': 'EAZY1', + }, + 'quantity': 2, + 'price_unit': 12.42, # without taxes + 'uom': {'unece_code': 'C62'}, + }] + + Result of the method: + { + 'to_remove': line_multirecordset, + 'to_add': [ + {'product': recordset1, 'uom', recordset, 'import_line': {import dict}, + # We provide product and uom as recordset to avoid the + # need to compute a second match + ] + 'to_update': { + 'line1_recordset': {'qty': [1, 2], 'price_unit': [4.5, 4.6]}, + # qty must be updated from 1 to 2 ; price must be updated from 4.5 to 4.6 + 'line2_recordset': {'qty': [12, 13]}, # only qty must be updated + } + } + + The check existing_currency == import_currency must be done before + the call to compare_lines() + """ + dpo = self.env['decimal.precision'] + if qty_precision is None: + qty_precision = dpo.precision_get('Product Unit of Measure') + if price_precision is None: + price_precision = dpo.precision_get('Product Price') + existing_lines_dict = {} + for eline in existing_lines: + if not eline.get('product'): + chatter.append(_( + "The existing line '%s' doesn't have any product, " + "so the lines haven't been updated.") + % eline.get('name')) + return False + if eline['product'] in existing_lines_dict: + chatter.append(_( + "The product '%s' is used on several existing " + "lines, so the lines haven't been updated.") + % eline['product'].name_get()[0][1]) + return False + existing_lines_dict[eline['product']] = eline + unique_import_products = [] + res = { + 'to_remove': False, + 'to_add': [], + 'to_update': {}, + } + for iline in import_lines: + if not iline.get('product'): + chatter.append(_( + "One of the imported lines doesn't have any product, " + "so the lines haven't been updated.")) + return False + product = self._match_product( + iline['product'], chatter_msg, seller=seller) + uom = self._match_uom(iline.get('uom'), chatter_msg, product) + if product in unique_import_products: + chatter.append(_( + "The product '%s' is used on several imported lines, " + "so the lines haven't been updated.") + % product.name_get()[0][1]) + return False + unique_import_products.append(product) + if product in existing_lines_dict: + if uom != existing_lines_dict[product]['uom']: + chatter.append(_( + "For product '%s', the unit of measure is %s on the " + "existing line, but it is %s on the imported line. " + "We don't support this scenario for the moment, so " + "the lines haven't been updated.") % ( + product.name_get()[0][1], + existing_lines_dict[product]['uom'].name, + uom.name, + )) + return False + existing_lines_dict[product]['import'] = True # used for to_remove + oline = existing_lines_dict[product]['line'] + res['to_update'][oline] = {} + if float_compare( + iline['qty'], + existing_lines_dict[product]['qty'], + precision_digits=qty_precision): + res['to_update'][oline]['qty'] = [ + existing_lines_dict[product]['qty'], + iline['qty']] + if ( + 'price_unit' in iline and + float_compare( + iline['price_unit'], + existing_lines_dict[product]['price_unit'], + precision_digits=price_precision)): + res['to_update'][oline]['price_unit'] = [ + existing_lines_dict[product]['price_unit'], + iline['price_unit']] + else: + res['to_add'].append({ + 'product': product, + 'uom': uom, + 'import_line': iline, + }) + for exiting_dict in existing_lines_dict.itervalues(): + if not exiting_dict.get('import'): + if res['to_remove']: + res['to_remove'] += exiting_dict['line'] + else: + res['to_remove'] = exiting_dict['line'] + return res + def get_xml_files_from_pdf(self, pdf_file): """Returns a dict with key = filename, value = XML file obj""" logger.info('Trying to find an embedded XML file inside PDF') @@ -507,3 +635,22 @@ def get_xml_files_from_pdf(self, pdf_file): pass logger.info('Valid XML files found in PDF: %s', res.keys()) return res + + @api.model + def post_create_or_update(self, parsed_dict, record): + if parsed_dict.get('attachments'): + for filename, data_base64 in\ + parsed_dict['attachments'].iteritems(): + self.env['ir.attachment'].create({ + 'name': filename, + 'res_id': record.id, + 'res_model': unicode(record._model), + 'datas': data_base64, + 'datas_fname': filename, + }) + for msg in parsed_dict['chatter_msg']: + record.message_post(msg) + if parsed_dict.get('note'): + record.message_post(_( + 'Notes in file %s: %s') + % (filename, parsed_dict['note'])) From 1e4b469e5f7850e4a96e8e71b98ec5573f435508 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 30 Aug 2016 23:49:50 +0200 Subject: [PATCH 10/99] Fix code + PEP8 --- .../models/business_document_import.py | 28 +++++++++++-------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 0c0cfa7fbb..c26cca81d7 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -499,14 +499,19 @@ def compare_lines( { 'to_remove': line_multirecordset, 'to_add': [ - {'product': recordset1, 'uom', recordset, 'import_line': {import dict}, - # We provide product and uom as recordset to avoid the - # need to compute a second match + { + 'product': recordset1, + 'uom', recordset, + 'import_line': {import dict}, + # We provide product and uom as recordset to avoid the + # need to compute a second match ] 'to_update': { 'line1_recordset': {'qty': [1, 2], 'price_unit': [4.5, 4.6]}, - # qty must be updated from 1 to 2 ; price must be updated from 4.5 to 4.6 - 'line2_recordset': {'qty': [12, 13]}, # only qty must be updated + # qty must be updated from 1 to 2 + # price must be updated from 4.5 to 4.6 + 'line2_recordset': {'qty': [12, 13]}, + # only qty must be updated } } @@ -521,13 +526,13 @@ def compare_lines( existing_lines_dict = {} for eline in existing_lines: if not eline.get('product'): - chatter.append(_( + chatter_msg.append(_( "The existing line '%s' doesn't have any product, " "so the lines haven't been updated.") % eline.get('name')) return False if eline['product'] in existing_lines_dict: - chatter.append(_( + chatter_msg.append(_( "The product '%s' is used on several existing " "lines, so the lines haven't been updated.") % eline['product'].name_get()[0][1]) @@ -541,7 +546,7 @@ def compare_lines( } for iline in import_lines: if not iline.get('product'): - chatter.append(_( + chatter_msg.append(_( "One of the imported lines doesn't have any product, " "so the lines haven't been updated.")) return False @@ -549,7 +554,7 @@ def compare_lines( iline['product'], chatter_msg, seller=seller) uom = self._match_uom(iline.get('uom'), chatter_msg, product) if product in unique_import_products: - chatter.append(_( + chatter_msg.append(_( "The product '%s' is used on several imported lines, " "so the lines haven't been updated.") % product.name_get()[0][1]) @@ -557,7 +562,7 @@ def compare_lines( unique_import_products.append(product) if product in existing_lines_dict: if uom != existing_lines_dict[product]['uom']: - chatter.append(_( + chatter_msg.append(_( "For product '%s', the unit of measure is %s on the " "existing line, but it is %s on the imported line. " "We don't support this scenario for the moment, so " @@ -567,7 +572,8 @@ def compare_lines( uom.name, )) return False - existing_lines_dict[product]['import'] = True # used for to_remove + # used for to_remove + existing_lines_dict[product]['import'] = True oline = existing_lines_dict[product]['line'] res['to_update'][oline] = {} if float_compare( From f2f5f26b6a5ab11c15c834ecbd98ce61b2f276cb Mon Sep 17 00:00:00 2001 From: "Adrien Peiffer (ACSONE)" Date: Tue, 4 Oct 2016 16:33:44 +0200 Subject: [PATCH 11/99] handle the case where the xml file is generated with mime type 'text/xml' --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index c26cca81d7..cb69ae8ae5 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -621,7 +621,7 @@ def get_xml_files_from_pdf(self, pdf_file): xmlfiles = {} # key = filename, value = PDF obj for embeddedfile in embeddedfiles[:-1]: mime_res = mimetypes.guess_type(embeddedfile) - if mime_res and mime_res[0] == 'application/xml': + if mime_res and mime_res[0] in ['application/xml','text/xml']: xmlfiles[embeddedfile] = embeddedfiles[i+1] i += 1 logger.debug('xmlfiles=%s', xmlfiles) From 6fbda1190250ab606ca0821f67e4c6ad6d258e04 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 4 Oct 2016 19:48:09 +0200 Subject: [PATCH 12/99] Add support for extraction + matching on website PEP8 fix --- .../models/business_document_import.py | 53 ++++++++++++------- 1 file changed, 35 insertions(+), 18 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index cb69ae8ae5..e69e0e0890 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -9,6 +9,7 @@ from lxml import etree from StringIO import StringIO import mimetypes +from urlparse import urlparse import logging logger = logging.getLogger(__name__) @@ -38,6 +39,7 @@ def _match_partner( 'state_code': False, 'vat': 'FR12448890432', 'email': 'roger.lemaire@akretion.com', + 'website': 'www.akretion.com', 'name': 'Akretion France', 'ref': 'C1242', 'phone': '01.41.98.12.42', @@ -105,29 +107,42 @@ def _match_partner( "%s VAT number. But there are no %s " "with this VAT number in Odoo.") % (vat, partner_type_label, partner_type_label)) + website_domain = False + email_domain = False if partner_dict.get('email') and '@' in partner_dict['email']: partners = rpo.search( domain + [('email', '=ilike', partner_dict['email'])]) if partners: return partners[0] else: - partner_domain_name = partner_dict['email'].split('@')[1] - if partner_domain_name: - partners = rpo.search( - domain + - [('website', '=ilike', '%' + partner_domain_name)]) - # I can't search on email addresses with - # partner_domain_name because of the emails such as - # @gmail.com, @yahoo.com that may match random partners - if partners: - chatter_msg.append(_( - "The %s has been identified by the domain name of " - "the email address '%s', so please check " - "carefully that the %s is correct.") % ( - partner_type_label, - partner_dict['email'], - partner_type_label)) - return partners[0] + email_domain = partner_dict['email'].split('@')[1] + if partner_dict.get('website'): + urlp = urlparse(partner_dict['website']) + netloc = urlp.netloc + if not urlp.scheme and not netloc: + netloc = urlp.path + if netloc and netloc.split('.') >= 2: + website_domain = '.'.join(netloc.split('.')[-2:]) + if website_domain or email_domain: + partner_domain = website_domain or email_domain + partners = rpo.search( + domain + + [('website', '=ilike', '%' + partner_domain + '%')]) + # I can't search on email addresses with + # email_domain because of the emails such as + # @gmail.com, @yahoo.com that may match random partners + if not partners and website_domain: + partners = rpo.search( + domain + + [('email', '=ilike', '%@' + website_domain)]) + if partners: + chatter_msg.append(_( + "The %s has been identified by the domain name '%s' " + "so please check carefully that the %s is correct.") % ( + partner_type_label, + partner_domain, + partner_type_label)) + return partners[0] if partner_dict.get('ref'): partners = rpo.search( domain + [('ref', '=', partner_dict['ref'])]) @@ -145,6 +160,7 @@ def _match_partner( "State code: %s\n" "VAT number: %s\n" "E-mail: %s\n" + "Website: %s\n" "Reference: %s\n" "Name: %s\n") % ( @@ -153,6 +169,7 @@ def _match_partner( partner_dict.get('state_code'), partner_dict.get('vat'), partner_dict.get('email'), + partner_dict.get('website'), partner_dict.get('ref'), partner_dict.get('name'))) @@ -621,7 +638,7 @@ def get_xml_files_from_pdf(self, pdf_file): xmlfiles = {} # key = filename, value = PDF obj for embeddedfile in embeddedfiles[:-1]: mime_res = mimetypes.guess_type(embeddedfile) - if mime_res and mime_res[0] in ['application/xml','text/xml']: + if mime_res and mime_res[0] in ['application/xml', 'text/xml']: xmlfiles[embeddedfile] = embeddedfiles[i+1] i += 1 logger.debug('xmlfiles=%s', xmlfiles) From 97e438a395d38db6a7d5aa752ffff4d98328df99 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 18 Oct 2016 23:02:55 +0200 Subject: [PATCH 13/99] 8.0 Add support for partner bank matching on invoice update (#6) Add support for partner bank matching on invoice update (before, it was only supported on invoice creation) --- base_business_document_import/README.rst | 4 +-- .../models/business_document_import.py | 30 +++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 170cc01ea7..1f32b35033 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -22,13 +22,13 @@ Usage .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/95/8.0 + :target: https://runbot.odoo-community.org/runbot/226/8.0 Bug Tracker =========== Bugs are tracked on `GitHub Issues -`_. In case of trouble, please +`_. 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. diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index e69e0e0890..703d66fb9c 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -237,6 +237,36 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): partner = partners[0] return partner + @api.model + def _match_partner_bank( + self, partner, iban, bic, chatter_msg, create_if_not_found=False): + assert iban, 'iban is a required arg' + assert partner, 'partner is a required arg' + partner = partner.commercial_partner_id + iban = iban.replace(' ', '') + rpbo = self.env['res.partner.bank'] + self._cr.execute( + """SELECT id FROM res_partner_bank + WHERE replace(acc_number, ' ', '')=%s + AND state='iban' + AND partner_id=%s + """, (iban, partner.id)) + rpb_res = self._cr.fetchall() + if rpb_res: + return rpbo.browse(rpb_res[0][0]) + elif create_if_not_found and bic: + partner_bank = rpbo.create({ + 'partner_id': partner.id, + 'state': 'iban', + 'acc_number': iban, + 'bank_bic': bic, + }) + chatter_msg.append(_( + "The bank account IBAN %s has been automatically " + "added on the supplier %s") % ( + iban, partner.name)) + return partner_bank + @api.model def _match_product(self, product_dict, chatter_msg, seller=False): """Example: From feab4ddf2fef30fd1dbb37c4bfc17565bf4d4525 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 19 Oct 2016 08:58:57 +0200 Subject: [PATCH 14/99] 8.0 Use try/except when importing external libs (#8) [FIX] LINT Use try/except when importing external libs Remove self.ensure_one() that has nothing to do in an api.model method --- .../models/business_document_import.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 703d66fb9c..9e42beeb98 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -5,15 +5,18 @@ from openerp import models, api, _ from openerp.tools import float_compare from openerp.exceptions import Warning as UserError -import PyPDF2 from lxml import etree from StringIO import StringIO import mimetypes from urlparse import urlparse import logging - logger = logging.getLogger(__name__) +try: + import PyPDF2 +except ImportError: + logger.debug('Cannot import PyPDF2') + class BusinessDocumentImport(models.AbstractModel): _name = 'business.document.import' From 49b91195019797c8b14da35eff483cb080a5345f Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Sat, 12 Nov 2016 14:17:15 +0100 Subject: [PATCH 15/99] Make modules uninstallable --- base_business_document_import/__openerp__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__openerp__.py index 833b97709d..e8f43b20ef 100644 --- a/base_business_document_import/__openerp__.py +++ b/base_business_document_import/__openerp__.py @@ -17,5 +17,5 @@ 'product_uom_unece', ], 'external_dependencies': {'python': ['PyPDF2']}, - 'installable': True, + 'installable': False, } From 0bd4d3924e961756c6b9593b5cef4d69da2514fa Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Thu, 29 Dec 2016 17:09:40 +0100 Subject: [PATCH 16/99] migration of account_invoice_import_invoice2data and dependencies --- base_business_document_import/__openerp__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__openerp__.py index e8f43b20ef..8ba0be41bf 100644 --- a/base_business_document_import/__openerp__.py +++ b/base_business_document_import/__openerp__.py @@ -4,7 +4,7 @@ { 'name': 'Base Business Document Import', - 'version': '8.0.1.0.0', + 'version': '9.0.1.0.0', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' @@ -17,5 +17,5 @@ 'product_uom_unece', ], 'external_dependencies': {'python': ['PyPDF2']}, - 'installable': False, + 'installable': True, } From e50715d7278b42c65c9932983ac7504b07cfec3d Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sat, 7 Jan 2017 00:00:49 +0100 Subject: [PATCH 17/99] Fix wrong class name --- .../tests/test_business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index aff3bb37f6..66b98d5d87 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -5,7 +5,7 @@ from openerp.tests.common import TransactionCase -class TestFrIntrastatService(TransactionCase): +class TestBaseBusinessDocumentImport(TransactionCase): def test_match_partner(self): partner1 = self.env['res.partner'].create({ From af6b3e97b812dde310b5cdf8829de44ac1aa37f2 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 9 Jan 2017 08:45:16 +0100 Subject: [PATCH 18/99] product.product#ean13 was renamed to barcode --- .../models/business_document_import.py | 12 ++++++------ .../tests/test_business_document_import.py | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 9e42beeb98..2aa1e91068 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -274,7 +274,7 @@ def _match_partner_bank( def _match_product(self, product_dict, chatter_msg, seller=False): """Example: product_dict = { - 'ean13': '5449000054227', + 'barcode': '5449000054227', 'code': 'COCA1L', } """ @@ -284,15 +284,15 @@ def _match_product(self, product_dict, chatter_msg, seller=False): return product_dict['recordset'] if product_dict.get('id'): return ppo.browse(product_dict['id']) - if product_dict.get('ean13'): + if product_dict.get('barcode'): products = ppo.search([ - ('ean13', '=', product_dict['ean13'])]) + ('barcode', '=', product_dict['barcode'])]) if products: return products[0] if product_dict.get('code'): products = ppo.search([ '|', - ('ean13', '=', product_dict['code']), + ('barcode', '=', product_dict['code']), ('default_code', '=', product_dict['code'])]) if products: return products[0] @@ -316,7 +316,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): "EAN13: %s\n" "Product code: %s\n" "Supplier: %s\n") % ( - product_dict.get('ean13'), + product_dict.get('barcode'), product_dict.get('code'), seller and seller.name or 'None')) @@ -537,7 +537,7 @@ def compare_lines( }] import_lines = [{ 'product': { - 'ean13': '2100002000003', + 'barcode': '2100002000003', 'code': 'EAZY1', }, 'quantity': 2, diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 66b98d5d87..b76447f237 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -115,7 +115,7 @@ def test_match_product(self): ppo = self.env['product.product'] product1 = ppo.create({ 'name': u'Test Product', - 'ean13': '9782203121102', + 'barcode': '9782203121102', 'seller_ids': [ (0, 0, { 'name': self.env.ref('base.res_partner_2').id, @@ -126,7 +126,7 @@ def test_match_product(self): product_dict = {'code': u'A2324 '} res = bdio._match_product(product_dict, []) self.assertEquals(res, self.env.ref('product.product_product_4b')) - product_dict = {'ean13': u'9782203121102'} + product_dict = {'barcode': u'9782203121102'} res = bdio._match_product(product_dict, []) self.assertEquals(res, product1) product_dict = {'code': 'TEST1242'} From 7238a811c004b2edfe476a4be99eeaa596a33078 Mon Sep 17 00:00:00 2001 From: Holger Brunn Date: Mon, 9 Jan 2017 09:08:14 +0100 Subject: [PATCH 19/99] tests --- .../models/business_document_import.py | 11 ++++++----- .../tests/test_business_document_import.py | 8 ++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 2aa1e91068..ee86b11cf2 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -465,7 +465,7 @@ def _match_tax( type_tax_use='purchase', price_include=False): """Example: tax_dict = { - 'type': 'percent', # required param, 'fixed' or 'percent' + 'amount_type': 'percent', # required param, 'fixed' or 'percent' 'amount': 20.0, # required 'unece_type_code': 'VAT', 'unece_categ_code': 'S', @@ -491,9 +491,10 @@ def _match_tax( domain.append(('price_include', '=', True)) # with the code abose, if you set price_include=None, it will # won't depend on the value of the price_include parameter - assert tax_dict.get('type') in ['fixed', 'percent'], 'bad tax type' + assert tax_dict.get('amount_type') in ['fixed', 'percent'],\ + 'bad tax type' assert 'amount' in tax_dict, 'Missing amount key in tax_dict' - domain.append(('type', '=', tax_dict['type'])) + domain.append(('amount_type', '=', tax_dict['amount_type'])) if tax_dict.get('unece_type_code'): domain.append( ('unece_type_code', '=', tax_dict['unece_type_code'])) @@ -503,7 +504,7 @@ def _match_tax( taxes = ato.search(domain) for tax in taxes: tax_amount = tax.amount - if tax_dict['type'] == 'percent': + if tax_dict['amount_type'] == 'percent': tax_amount *= 100 if not float_compare( tax_dict['amount'], tax_amount, precision_digits=prec): @@ -520,7 +521,7 @@ def _match_tax( tax_dict.get('unece_type_code'), tax_dict.get('unece_categ_code'), tax_dict['amount'], - tax_dict['type'] == 'percent' and '%' or _('(fixed)'))) + tax_dict['amount_type'] == 'percent' and '%' or _('(fixed)'))) def compare_lines( self, existing_lines, import_lines, chatter_msg, diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index b76447f237..3480339378 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -56,7 +56,7 @@ def test_match_shipping_partner(self): 'name': u'Sébastien BEAU', 'email': 'sebastien.beau@akretion.com', 'use_parent_address': True, - 'type': 'default', + 'type': 'contact', }) cpartner3 = rpo.create({ 'parent_id': partner1.id, @@ -169,7 +169,7 @@ def test_match_tax(self): 'type_tax_use': 'purchase', 'price_include': False, 'amount': 0.18, - 'type': 'percent', + 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, }) @@ -179,13 +179,13 @@ def test_match_tax(self): 'type_tax_use': 'purchase', 'price_include': True, 'amount': 0.18, - 'type': 'percent', + 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, }) bdio = self.env['business.document.import'] tax_dict = { - 'type': 'percent', + 'amount_type': 'percent', 'amount': 18, 'unece_type_code': 'VAT', 'unece_categ_code': 'S', From de8095b209477ee5eaca4cc45f1aa349f0b0b40e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 15 Feb 2017 15:11:22 +0100 Subject: [PATCH 20/99] Prepare v10 branch Rename __openerp__.py to __manifest__.py and set installable to False --- .../{__openerp__.py => __manifest__.py} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename base_business_document_import/{__openerp__.py => __manifest__.py} (96%) diff --git a/base_business_document_import/__openerp__.py b/base_business_document_import/__manifest__.py similarity index 96% rename from base_business_document_import/__openerp__.py rename to base_business_document_import/__manifest__.py index 8ba0be41bf..a36a812398 100644 --- a/base_business_document_import/__openerp__.py +++ b/base_business_document_import/__manifest__.py @@ -17,5 +17,5 @@ 'product_uom_unece', ], 'external_dependencies': {'python': ['PyPDF2']}, - 'installable': True, + 'installable': False, } From b777098ed3b776ffeb42b03548648193ae73cab6 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 15 Feb 2017 18:46:54 +0100 Subject: [PATCH 21/99] Port base_business_document_import to v10 Add match for accounts and journals --- base_business_document_import/README.rst | 2 +- base_business_document_import/__manifest__.py | 4 +- .../models/business_document_import.py | 84 ++++++++++++++++++- .../tests/test_business_document_import.py | 2 +- 4 files changed, 85 insertions(+), 7 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 1f32b35033..ea0a68f613 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -22,7 +22,7 @@ Usage .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/226/8.0 + :target: https://runbot.odoo-community.org/runbot/226/10.0 Bug Tracker =========== diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index a36a812398..91d3611418 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { 'name': 'Base Business Document Import', - 'version': '9.0.1.0.0', + 'version': '10.0.1.0.0', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' @@ -17,5 +17,5 @@ 'product_uom_unece', ], 'external_dependencies': {'python': ['PyPDF2']}, - 'installable': False, + 'installable': True, } diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index ee86b11cf2..4c5a67c5c7 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -2,9 +2,9 @@ # © 2015-2016 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from openerp import models, api, _ -from openerp.tools import float_compare -from openerp.exceptions import Warning as UserError +from odoo import models, api, _ +from odoo.tools import float_compare +from odoo.exceptions import UserError from lxml import etree from StringIO import StringIO import mimetypes @@ -657,6 +657,84 @@ def compare_lines( res['to_remove'] = exiting_dict['line'] return res + def _prepare_account_speed_dict(self): + res = self.env['account.account'].search_read([ + ('company_id', '=', self.env.user.company_id.id), + ('deprecated', '=', False)], ['code']) + speed_dict = {} + for l in res: + speed_dict[l['code']] = l['id'] + return speed_dict + + @api.model + def _match_account(self, account_dict, chatter_msg, speed_dict=None): + """Example: + account_dict = { + 'code': '411100', + } + speed_dict is usefull to gain performance when you have a lot of + accounts to match + """ + if not account_dict: + account_dict = {} + aao = self.env['account.account'] + if speed_dict is None: + speed_dict = self._prepare_account_speed_dict() + self._strip_cleanup_dict(account_dict) + if account_dict.get('recordset'): + return account_dict['recordset'] + if account_dict.get('id'): + return aao.browse(account_dict['id']) + if account_dict.get('code'): + if account_dict['code'] in speed_dict: + return aao.browse(speed_dict[account_dict['code']]) + for code, account_id in speed_dict.iteritems(): + if code.startswith(account_dict['code']): + chatter_msg.append(_( + "Approximate match: account %s has been matched " + "with account %s") % (account_dict['code'], code)) + return aao.browse(account_id) + raise UserError(_( + "Odoo couldn't find any account corresponding to the " + "following information extracted from the business document: " + "Account code: %s") % account_dict.get('code')) + + def _prepare_journal_speed_dict(self): + res = self.env['account.journal'].search_read([ + ('company_id', '=', self.env.user.company_id.id)], ['code']) + speed_dict = {} + for l in res: + speed_dict[l['code']] = l['id'] + return speed_dict + + @api.model + def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): + """Example: + journal_dict = { + 'code': 'MISC', + } + speed_dict is usefull to gain performance when you have a lot of + journals to match + """ + if not journal_dict: + journal_dict = {} + ajo = self.env['account.account'] + if speed_dict is None: + speed_dict = self._prepare_journal_speed_dict() + self._strip_cleanup_dict(journal_dict) + if journal_dict.get('recordset'): + return journal_dict['recordset'] + if journal_dict.get('id'): + return ajo.browse(journal_dict['id']) + if journal_dict.get('code'): + if journal_dict['code'] in speed_dict: + return ajo.browse(speed_dict[journal_dict['code']]) + # case insensitive + raise UserError(_( + "Odoo couldn't find any journal corresponding to the " + "following information extracted from the business document: " + "Journal code: %s") % journal_dict.get('code')) + def get_xml_files_from_pdf(self, pdf_file): """Returns a dict with key = filename, value = XML file obj""" logger.info('Trying to find an embedded XML file inside PDF') diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 3480339378..b00e5e78c8 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -2,7 +2,7 @@ # © 2016 Akretion (Alexis de Lattre ) # 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 TestBaseBusinessDocumentImport(TransactionCase): From e503b9b1366bd0dae82292c0a4ecdd62427f14af Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 15 Feb 2017 22:26:42 +0100 Subject: [PATCH 22/99] Add match on analytic accounts Improve match for journals and accounts --- .../models/business_document_import.py | 55 ++++++++++++++++--- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 4c5a67c5c7..4c4d2cf1de 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -663,7 +663,7 @@ def _prepare_account_speed_dict(self): ('deprecated', '=', False)], ['code']) speed_dict = {} for l in res: - speed_dict[l['code']] = l['id'] + speed_dict[l['code'].upper()] = l['id'] return speed_dict @api.model @@ -686,10 +686,11 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): if account_dict.get('id'): return aao.browse(account_dict['id']) if account_dict.get('code'): - if account_dict['code'] in speed_dict: - return aao.browse(speed_dict[account_dict['code']]) + acc_code = account_dict['code'].upper() + if acc_code in speed_dict: + return aao.browse(speed_dict[acc_code]) for code, account_id in speed_dict.iteritems(): - if code.startswith(account_dict['code']): + if code.startswith(acc_code): chatter_msg.append(_( "Approximate match: account %s has been matched " "with account %s") % (account_dict['code'], code)) @@ -699,12 +700,51 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): "following information extracted from the business document: " "Account code: %s") % account_dict.get('code')) + def _prepare_analytic_account_speed_dict(self): + res = self.env['account.analytic.account'].search_read( + [('company_id', '=', self.env.user.company_id.id)], + ['code']) + speed_dict = {} + for l in res: + if l['code']: + speed_dict[l['code'].upper()] = l['id'] + return speed_dict + + @api.model + def _match_analytic_account( + self, aaccount_dict, chatter_msg, speed_dict=None): + """Example: + aaccount_dict = { + 'code': '627', + } + speed_dict is usefull to gain performance when you have a lot of + analytic accounts to match + """ + if not aaccount_dict: + aaccount_dict = {} + aaao = self.env['account.analytic.account'] + if speed_dict is None: + speed_dict = self._prepare_analytic_account_speed_dict() + self._strip_cleanup_dict(aaccount_dict) + if aaccount_dict.get('recordset'): + return aaccount_dict['recordset'] + if aaccount_dict.get('id'): + return aaao.browse(aaccount_dict['id']) + if aaccount_dict.get('code'): + aacode = aaccount_dict['code'].upper() + if aacode in speed_dict: + return aaao.browse(speed_dict[aacode]) + raise UserError(_( + "Odoo couldn't find any analytic account corresponding to the " + "following information extracted from the business document: " + "Analytic account code: %s") % aaccount_dict.get('code')) + def _prepare_journal_speed_dict(self): res = self.env['account.journal'].search_read([ ('company_id', '=', self.env.user.company_id.id)], ['code']) speed_dict = {} for l in res: - speed_dict[l['code']] = l['id'] + speed_dict[l['code'].upper()] = l['id'] return speed_dict @api.model @@ -727,8 +767,9 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): if journal_dict.get('id'): return ajo.browse(journal_dict['id']) if journal_dict.get('code'): - if journal_dict['code'] in speed_dict: - return ajo.browse(speed_dict[journal_dict['code']]) + jcode = journal_dict['code'].upper() + if jcode in speed_dict: + return ajo.browse(speed_dict[jcode]) # case insensitive raise UserError(_( "Odoo couldn't find any journal corresponding to the " From 7071bc603a2eb40d825510477d46f610d1ff4dca Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 20 Feb 2017 00:12:07 +0100 Subject: [PATCH 23/99] Port base_business_document_import* to v10 Also port all the modules that generate the XML documents: account_invoice_ubl, account_invoice_zugferd, purchase_order_ubl and sale_order_ubl --- base_business_document_import/__manifest__.py | 2 +- .../models/business_document_import.py | 4 ++-- .../tests/test_business_document_import.py | 8 +++----- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 91d3611418..2eff6c6314 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2016 Akretion (Alexis de Lattre ) +# © 2016-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 4c4d2cf1de..edcdd61bd3 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2015-2016 Akretion (Alexis de Lattre ) +# © 2015-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, api, _ @@ -313,7 +313,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): raise UserError(_( "Odoo couldn't find any product corresponding to the " "following information extracted from the business document: " - "EAN13: %s\n" + "Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n") % ( product_dict.get('barcode'), diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index b00e5e78c8..029da90ffd 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# © 2016 Akretion (Alexis de Lattre ) +# © 2016-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase @@ -48,14 +48,12 @@ def test_match_shipping_partner(self): 'parent_id': partner1.id, 'name': u'Alexis de Lattre', 'email': 'alexis.delattre@akretion.com', - 'use_parent_address': True, 'type': 'delivery', }) rpo.create({ 'parent_id': partner1.id, 'name': u'Sébastien BEAU', 'email': 'sebastien.beau@akretion.com', - 'use_parent_address': True, 'type': 'contact', }) cpartner3 = rpo.create({ @@ -123,9 +121,9 @@ def test_match_product(self): }), ] }) - product_dict = {'code': u'A2324 '} + product_dict = {'code': u'PROD_DEL '} res = bdio._match_product(product_dict, []) - self.assertEquals(res, self.env.ref('product.product_product_4b')) + self.assertEquals(res, self.env.ref('product.product_delivery_01')) product_dict = {'barcode': u'9782203121102'} res = bdio._match_product(product_dict, []) self.assertEquals(res, product1) From 58d314318e2de80548d018abef441f81f0528fc3 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 27 Feb 2017 09:49:54 +0100 Subject: [PATCH 24/99] First working version of account_invoice_import Note: it requires this fix on odoo 10: https://github.com/odoo/odoo/pull/15649 --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index edcdd61bd3..05b06b1d87 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -820,7 +820,7 @@ def post_create_or_update(self, parsed_dict, record): self.env['ir.attachment'].create({ 'name': filename, 'res_id': record.id, - 'res_model': unicode(record._model), + 'res_model': unicode(record._name), 'datas': data_base64, 'datas_fname': filename, }) From dd0f944eb043174a4b24d1f594145d7944290574 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 27 Feb 2017 23:23:59 +0100 Subject: [PATCH 25/99] Continue port of modules for v10.0, in particular sale_order_import_* module Fix spelling mistake and other remarks on README by Tarteo --- base_business_document_import/README.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index ea0a68f613..5992105216 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -8,9 +8,9 @@ Base Business Document Import This is a technical module ; it doesn't bring any useful feature by itself. This module is the base modules for 2 other modules : -* *account_invoice_import* which imports supplier invoices as PDF or XML files (this module also requires some additionnal modules such as *account_invoice_import_invoice2data*, *account_invoice_import_ubl*, etc... to support specific invoice formats), +* *account_invoice_import* which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as *account_invoice_import_invoice2data*, *account_invoice_import_ubl*, etc... to support specific invoice formats), -* *sale_invoice_import* which imports sale orders as CSV, XML or PDF files (this module also requires some additionnal modules such as *sale_invoice_import_csv* or *sale_invoice_import_ubl* to support specific order formats) +* *sale_invoice_import* which imports sale orders as CSV, XML or PDF files (this module also requires some additional modules such as *sale_invoice_import_csv* or *sale_invoice_import_ubl* to support specific order formats) Configuration ============= From 8b4e199802c1c2e03c260a7792da344fb24954e1 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 28 Feb 2017 09:24:46 +0100 Subject: [PATCH 26/99] Port account_invoice_import_factur-x and account_invoice_import_ubl to v10.0 base_business_document_import: Add support for the creation of res.bank --- .../models/business_document_import.py | 41 +++++++++++-------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 05b06b1d87..61629d1e88 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -246,23 +246,32 @@ def _match_partner_bank( assert iban, 'iban is a required arg' assert partner, 'partner is a required arg' partner = partner.commercial_partner_id - iban = iban.replace(' ', '') + iban = iban.replace(' ', '').upper() rpbo = self.env['res.partner.bank'] - self._cr.execute( - """SELECT id FROM res_partner_bank - WHERE replace(acc_number, ' ', '')=%s - AND state='iban' - AND partner_id=%s - """, (iban, partner.id)) - rpb_res = self._cr.fetchall() - if rpb_res: - return rpbo.browse(rpb_res[0][0]) - elif create_if_not_found and bic: + rbo = self.env['res.bank'] + bankaccounts = rpbo.search([ + ('acc_type', '=', 'iban'), + ('sanitized_acc_number', '=', iban), + ('partner_id', '=', partner.id)]) + if bankaccounts: + return bankaccounts[0] + elif create_if_not_found: + bank_id = False + if bic: + bic = bic.replace(' ', '').upper() + banks = rbo.search([('bic', '=', bic)]) + if banks: + bank_id = banks[0].id + else: + bank = rbo.create({ + 'bic': bic, + 'name': bic, # TODO: see if we could do better + }) + bank_id = bank.id partner_bank = rpbo.create({ 'partner_id': partner.id, - 'state': 'iban', 'acc_number': iban, - 'bank_bic': bic, + 'bank_id': bank_id, }) chatter_msg.append(_( "The bank account IBAN %s has been automatically " @@ -482,9 +491,9 @@ def _match_tax( prec = self.env['decimal.precision'].precision_get('Account') # we should not use the Account prec directly, but... if type_tax_use == 'purchase': - domain.append(('type_tax_use', 'in', ('purchase', 'all'))) + domain.append(('type_tax_use', '=', 'purchase')) elif type_tax_use == 'sale': - domain.append(('type_tax_use', 'in', ('sale', 'all'))) + domain.append(('type_tax_use', '=', 'sale')) if price_include is False: domain.append(('price_include', '=', False)) elif price_include is True: @@ -504,8 +513,6 @@ def _match_tax( taxes = ato.search(domain) for tax in taxes: tax_amount = tax.amount - if tax_dict['amount_type'] == 'percent': - tax_amount *= 100 if not float_compare( tax_dict['amount'], tax_amount, precision_digits=prec): return tax From c056b4c4db0a88549acf1efe5c28a0b999c3578d Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 22 Mar 2017 21:54:21 +0100 Subject: [PATCH 27/99] Smarter account code matching + add unittests Add support for insertion of title in error messages --- .../models/business_document_import.py | 38 ++++++++++++++----- .../tests/test_business_document_import.py | 35 +++++++++++++++++ 2 files changed, 63 insertions(+), 10 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 61629d1e88..582192a361 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -22,6 +22,14 @@ class BusinessDocumentImport(models.AbstractModel): _name = 'business.document.import' _description = 'Common methods to import business documents' + @api.model + def user_error_wrap(self, error_msg): + assert error_msg + prefix = self._context.get('error_prefix') + if prefix and isinstance(prefix, (str, unicode)): + error_msg = '%s\n%s' % (prefix, error_msg) + raise UserError(error_msg) + @api.model def _strip_cleanup_dict(self, match_dict): if match_dict: @@ -156,7 +164,7 @@ def _match_partner( domain + [('name', '=ilike', partner_dict['name'])]) if partners: return partners[0] - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any %s corresponding to the following " "information extracted from the business document:\n" "Country code: %s\n" @@ -319,7 +327,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): sinfo[0].product_tmpl_id.product_variant_ids) == 1 ): return sinfo[0].product_tmpl_id.product_variant_ids[0] - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any product corresponding to the " "following information extracted from the business document: " "Barcode: %s\n" @@ -353,7 +361,7 @@ def _match_currency(self, currency_dict, chatter_msg): if currencies: return currencies[0] else: - raise UserError(_( + raise self.user_error_wrap(_( "The analysis of the business document returned '%s' as " "the currency ISO code. But there are no currency " "with that code in Odoo.") % currency_iso) @@ -376,7 +384,7 @@ def _match_currency(self, currency_dict, chatter_msg): if currencies: return currencies[0] else: - raise UserError(_( + raise self.user_error_wrap(_( "The analysis of the business document returned '%s' as " "the currency symbol or ISO code. But there are no " "currency with the symbol nor ISO code in Odoo.") @@ -390,14 +398,14 @@ def _match_currency(self, currency_dict, chatter_msg): if country.currency_id: return country.currency_id else: - raise UserError(_( + raise self.user_error_wrap(_( "The analysis of the business document returned '%s' " "as the country code to find the related currency. " "But the country '%s' doesn't have any related " "currency configured in Odoo.") % (country_code, country.name)) else: - raise UserError(_( + raise self.user_error_wrap(_( "The analysis of the business document returned '%s' " "as the country code to find the related currency. " "But there is no country with that code in Odoo.") @@ -516,7 +524,7 @@ def _match_tax( if not float_compare( tax_dict['amount'], tax_amount, precision_digits=prec): return tax - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any tax with 'Tax Application' = '%s' " "and 'Tax Included in Price' = '%s' which correspond to the " "following information extracted from the business document:\n" @@ -696,13 +704,23 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): acc_code = account_dict['code'].upper() if acc_code in speed_dict: return aao.browse(speed_dict[acc_code]) + # Match when account_dict['code'] is longer than Odoo's account + # codes because of trailing '0' + # I don't think we need a warning for this kind of match + acc_code_tmp = acc_code + while acc_code_tmp and acc_code_tmp[-1] == '0': + acc_code_tmp = acc_code_tmp[:-1] + if acc_code_tmp and acc_code_tmp in speed_dict: + return aao.browse(speed_dict[acc_code_tmp]) + # Match when account_dict['code'] is shorter than Odoo's accounts + # -> warns the user about this for code, account_id in speed_dict.iteritems(): if code.startswith(acc_code): chatter_msg.append(_( "Approximate match: account %s has been matched " "with account %s") % (account_dict['code'], code)) return aao.browse(account_id) - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any account corresponding to the " "following information extracted from the business document: " "Account code: %s") % account_dict.get('code')) @@ -741,7 +759,7 @@ def _match_analytic_account( aacode = aaccount_dict['code'].upper() if aacode in speed_dict: return aaao.browse(speed_dict[aacode]) - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any analytic account corresponding to the " "following information extracted from the business document: " "Analytic account code: %s") % aaccount_dict.get('code')) @@ -778,7 +796,7 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): if jcode in speed_dict: return ajo.browse(speed_dict[jcode]) # case insensitive - raise UserError(_( + raise self.user_error_wrap(_( "Odoo couldn't find any journal corresponding to the " "following information extracted from the business document: " "Journal code: %s") % journal_dict.get('code')) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 029da90ffd..1f341d083b 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -198,3 +198,38 @@ def test_match_tax(self): self.assertEquals(res, de_tax_21_ttc) res = bdio._match_taxes([tax_dict], [], type_tax_use='purchase') self.assertEquals(res, de_tax_21) + + def test_match_account_exact(self): + bdio = self.env['business.document.import'] + acc = self.env['account.account'].create({ + 'name': 'Test 898999', + 'code': '898999', + 'user_type_id': + self.env.ref('account.data_account_type_expense').id, + }) + res = bdio._match_account({'code': '898999'}, []) + self.assertEquals(acc, res) + + def test_match_account_bigger_in(self): + bdio = self.env['business.document.import'] + acc = self.env['account.account'].create({ + 'name': 'Test 898999', + 'code': '898999', + 'user_type_id': + self.env.ref('account.data_account_type_expense').id, + }) + res = bdio._match_account({'code': '89899900'}, []) + self.assertEquals(acc, res) + + def test_match_account_smaller_in(self): + bdio = self.env['business.document.import'] + acc = self.env['account.account'].create({ + 'name': 'Test 89899910', + 'code': '89899910', + 'user_type_id': + self.env.ref('account.data_account_type_expense').id, + }) + chatter = [] + res = bdio._match_account({'code': '898999'}, chatter) + self.assertEquals(acc, res) + self.assertEquals(len(chatter), 1) From 401b4215d4e797454b863a436b22afa8e7bcbb84 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 26 Mar 2017 18:10:17 +0200 Subject: [PATCH 28/99] FIX xmlid in tests --- .../tests/test_business_document_import.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 1f341d083b..63d701fdc8 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -205,7 +205,7 @@ def test_match_account_exact(self): 'name': 'Test 898999', 'code': '898999', 'user_type_id': - self.env.ref('account.data_account_type_expense').id, + self.env.ref('account.data_account_type_expenses').id, }) res = bdio._match_account({'code': '898999'}, []) self.assertEquals(acc, res) @@ -216,7 +216,7 @@ def test_match_account_bigger_in(self): 'name': 'Test 898999', 'code': '898999', 'user_type_id': - self.env.ref('account.data_account_type_expense').id, + self.env.ref('account.data_account_type_expenses').id, }) res = bdio._match_account({'code': '89899900'}, []) self.assertEquals(acc, res) @@ -227,7 +227,7 @@ def test_match_account_smaller_in(self): 'name': 'Test 89899910', 'code': '89899910', 'user_type_id': - self.env.ref('account.data_account_type_expense').id, + self.env.ref('account.data_account_type_expenses').id, }) chatter = [] res = bdio._match_account({'code': '898999'}, chatter) From 413eb1eef4da93baf7954e52668f5827f1fb3102 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 31 Mar 2017 20:07:05 +0200 Subject: [PATCH 29/99] FIX crash when pivot format had a 'note' key (and no attachment) Add method to create SO in sale.order.import accessible via JSON-RPC --- .../models/business_document_import.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 582192a361..ef20a0c57f 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -838,7 +838,7 @@ def get_xml_files_from_pdf(self, pdf_file): return res @api.model - def post_create_or_update(self, parsed_dict, record): + def post_create_or_update(self, parsed_dict, record, doc_filename=None): if parsed_dict.get('attachments'): for filename, data_base64 in\ parsed_dict['attachments'].iteritems(): @@ -852,6 +852,9 @@ def post_create_or_update(self, parsed_dict, record): for msg in parsed_dict['chatter_msg']: record.message_post(msg) if parsed_dict.get('note'): - record.message_post(_( - 'Notes in file %s: %s') - % (filename, parsed_dict['note'])) + if doc_filename: + msg = _('Notes in file %s:') % doc_filename + else: + msg = _('Notes in imported document:') + record.message_post( + '%s %s' % (msg, parsed_dict['note'])) From fba620f29d822b20ed1a8a6e0b64599f2dc9d778 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 1 Jun 2017 13:41:59 +0200 Subject: [PATCH 30/99] Update test suite --- .../tests/test_business_document_import.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 63d701fdc8..4fd113dffc 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -166,7 +166,7 @@ def test_match_tax(self): 'description': 'DE-VAT-buy-18.0', 'type_tax_use': 'purchase', 'price_include': False, - 'amount': 0.18, + 'amount': 18, 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, @@ -176,7 +176,7 @@ def test_match_tax(self): 'description': 'DE-VAT-buy-18.0-TTC', 'type_tax_use': 'purchase', 'price_include': True, - 'amount': 0.18, + 'amount': 18, 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, From 01885b4fde1cefc255849983d865674d74f1893d Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 10 Aug 2017 02:02:13 +0200 Subject: [PATCH 31/99] Add first support for the import of Factur-X invoices Add support for start/end dates on lines Better handling of invalid IBANs --- .../models/business_document_import.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index ef20a0c57f..4a7f266d37 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -4,6 +4,7 @@ from odoo import models, api, _ from odoo.tools import float_compare +from odoo.addons.base_iban.models.res_partner_bank import validate_iban from odoo.exceptions import UserError from lxml import etree from StringIO import StringIO @@ -257,6 +258,12 @@ def _match_partner_bank( iban = iban.replace(' ', '').upper() rpbo = self.env['res.partner.bank'] rbo = self.env['res.bank'] + try: + validate_iban(iban) + except: + chatter_msg.append(_( + "IBAN %s is not valid, so it has been ignored.") % iban) + return False bankaccounts = rpbo.search([ ('acc_type', '=', 'iban'), ('sanitized_acc_number', '=', iban), From b24bb5e714cad6d923ff161041cb519cf846ad7f Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Mon, 14 Aug 2017 01:27:24 +0200 Subject: [PATCH 32/99] Fix bug #16 : add support for adjustment lines (per line and global) Add support for Tax Due Date on invoice import --- .../models/business_document_import.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 4a7f266d37..5d8d7585d9 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -493,8 +493,8 @@ def _match_tax( 'amount': 20.0, # required 'unece_type_code': 'VAT', 'unece_categ_code': 'S', + 'unece_due_date_code': '432', } - With l10n_fr, it will return 20% VAT tax. """ ato = self.env['account.tax'] self._strip_cleanup_dict(tax_dict) @@ -513,7 +513,7 @@ def _match_tax( domain.append(('price_include', '=', False)) elif price_include is True: domain.append(('price_include', '=', True)) - # with the code abose, if you set price_include=None, it will + # with the code above, if you set price_include=None, it will # won't depend on the value of the price_include parameter assert tax_dict.get('amount_type') in ['fixed', 'percent'],\ 'bad tax type' @@ -525,7 +525,12 @@ def _match_tax( if tax_dict.get('unece_categ_code'): domain.append( ('unece_categ_code', '=', tax_dict['unece_categ_code'])) - taxes = ato.search(domain) + if tax_dict.get('unece_due_date_code'): + domain += [ + '|', + ('unece_due_date_code', '=', tax_dict['unece_due_date_code']), + ('unece_due_date_code', '=', False)] + taxes = ato.search(domain, order='unece_due_date_code') for tax in taxes: tax_amount = tax.amount if not float_compare( From 8ad65f962ebf0b1440688c8a4879db8a3f5e8ef7 Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Sat, 27 Jan 2018 22:36:20 +0100 Subject: [PATCH 33/99] base_business_document_import migrate to 11.0 --- base_business_document_import/README.rst | 5 +- base_business_document_import/__init__.py | 2 - base_business_document_import/__manifest__.py | 10 +- .../models/__init__.py | 2 - .../models/business_document_import.py | 56 ++++---- .../tests/__init__.py | 2 - .../tests/test_business_document_import.py | 127 +++++++++--------- 7 files changed, 98 insertions(+), 106 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 5992105216..6cf0f46443 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -22,7 +22,7 @@ Usage .. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/226/10.0 + :target: https://runbot.odoo-community.org/runbot/226/11.0 Bug Tracker =========== @@ -39,6 +39,9 @@ Contributors ------------ * Alexis de Lattre +* Nicolas JEUDY + +Do not contact contributors directly about support or help with technical issues. Maintainer ---------- diff --git a/base_business_document_import/__init__.py b/base_business_document_import/__init__.py index cde864bae2..0650744f6b 100644 --- a/base_business_document_import/__init__.py +++ b/base_business_document_import/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import models diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 2eff6c6314..7a44fc7e9c 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -1,21 +1,19 @@ -# -*- coding: utf-8 -*- # © 2016-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Base Business Document Import', - 'version': '10.0.1.0.0', + 'version': '11.0.1.0.0', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' 'invoices', - 'author': 'Akretion,Odoo Community Association (OCA)', - 'website': 'http://www.akretion.com', + 'author': 'Akretion, Nicolas JEUDY, Odoo Community Association (OCA)', + 'website': 'https://github.com/OCA/edi', 'depends': [ 'base_vat_sanitized', 'account_tax_unece', 'product_uom_unece', - ], + ], 'external_dependencies': {'python': ['PyPDF2']}, - 'installable': True, } diff --git a/base_business_document_import/models/__init__.py b/base_business_document_import/models/__init__.py index 4a3c2e6a58..d695bc5f59 100644 --- a/base_business_document_import/models/__init__.py +++ b/base_business_document_import/models/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import business_document_import diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 5d8d7585d9..08a5b3ae9a 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2015-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -7,9 +6,9 @@ from odoo.addons.base_iban.models.res_partner_bank import validate_iban from odoo.exceptions import UserError from lxml import etree -from StringIO import StringIO +from io import BytesIO import mimetypes -from urlparse import urlparse +from urllib.parse import urlparse import logging logger = logging.getLogger(__name__) @@ -27,15 +26,15 @@ class BusinessDocumentImport(models.AbstractModel): def user_error_wrap(self, error_msg): assert error_msg prefix = self._context.get('error_prefix') - if prefix and isinstance(prefix, (str, unicode)): + if prefix and isinstance(prefix, str): error_msg = '%s\n%s' % (prefix, error_msg) raise UserError(error_msg) @api.model def _strip_cleanup_dict(self, match_dict): if match_dict: - for key, value in match_dict.iteritems(): - if value and isinstance(value, (str, unicode)): + for key, value in match_dict.items(): + if value and isinstance(value, str): match_dict[key] = value.strip() if match_dict.get('country_code'): match_dict['country_code'] = match_dict['country_code'].upper() @@ -55,9 +54,8 @@ def _match_partner( 'name': 'Akretion France', 'ref': 'C1242', 'phone': '01.41.98.12.42', - 'fax': '01.41.98.12.43', } - The keys 'phone' and 'fax' are used by the module + The keys 'phone' are used by the module base_phone_business_document_import """ rpo = self.env['res.partner'] @@ -133,7 +131,7 @@ def _match_partner( netloc = urlp.netloc if not urlp.scheme and not netloc: netloc = urlp.path - if netloc and netloc.split('.') >= 2: + if netloc and len(netloc.split('.')) >= 2: website_domain = '.'.join(netloc.split('.')[-2:]) if website_domain or email_domain: partner_domain = website_domain or email_domain @@ -260,7 +258,7 @@ def _match_partner_bank( rbo = self.env['res.bank'] try: validate_iban(iban) - except: + except Exception as e: chatter_msg.append(_( "IBAN %s is not valid, so it has been ignored.") % iban) return False @@ -281,13 +279,13 @@ def _match_partner_bank( bank = rbo.create({ 'bic': bic, 'name': bic, # TODO: see if we could do better - }) + }) bank_id = bank.id partner_bank = rpbo.create({ 'partner_id': partner.id, 'acc_number': iban, 'bank_id': bank_id, - }) + }) chatter_msg.append(_( "The bank account IBAN %s has been automatically " "added on the supplier %s") % ( @@ -326,13 +324,13 @@ def _match_product(self, product_dict, chatter_msg, seller=False): sinfo = self.env['product.supplierinfo'].search([ ('name', '=', seller.id), ('product_code', '=', product_dict['code']), - ]) + ]) if ( sinfo and sinfo[0].product_tmpl_id.product_variant_ids and len( sinfo[0].product_tmpl_id.product_variant_ids) == 1 - ): + ): return sinfo[0].product_tmpl_id.product_variant_ids[0] raise self.user_error_wrap(_( "Odoo couldn't find any product corresponding to the " @@ -621,7 +619,7 @@ def compare_lines( 'to_remove': False, 'to_add': [], 'to_update': {}, - } + } for iline in import_lines: if not iline.get('product'): chatter_msg.append(_( @@ -648,7 +646,7 @@ def compare_lines( product.name_get()[0][1], existing_lines_dict[product]['uom'].name, uom.name, - )) + )) return False # used for to_remove existing_lines_dict[product]['import'] = True @@ -675,8 +673,8 @@ def compare_lines( 'product': product, 'uom': uom, 'import_line': iline, - }) - for exiting_dict in existing_lines_dict.itervalues(): + }) + for exiting_dict in existing_lines_dict.values(): if not exiting_dict.get('import'): if res['to_remove']: res['to_remove'] += exiting_dict['line'] @@ -726,7 +724,7 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): return aao.browse(speed_dict[acc_code_tmp]) # Match when account_dict['code'] is shorter than Odoo's accounts # -> warns the user about this - for code, account_id in speed_dict.iteritems(): + for code, account_id in speed_dict.items(): if code.startswith(acc_code): chatter_msg.append(_( "Approximate match: account %s has been matched " @@ -818,7 +816,7 @@ def get_xml_files_from_pdf(self, pdf_file): logger.info('Trying to find an embedded XML file inside PDF') res = {} try: - fd = StringIO(pdf_file) + fd = BytesIO(pdf_file) pdf = PyPDF2.PdfFileReader(fd) logger.debug('pdf.trailer=%s', pdf.trailer) pdf_root = pdf.trailer['/Root'] @@ -829,10 +827,10 @@ def get_xml_files_from_pdf(self, pdf_file): for embeddedfile in embeddedfiles[:-1]: mime_res = mimetypes.guess_type(embeddedfile) if mime_res and mime_res[0] in ['application/xml', 'text/xml']: - xmlfiles[embeddedfile] = embeddedfiles[i+1] + xmlfiles[embeddedfile] = embeddedfiles[i + 1] i += 1 logger.debug('xmlfiles=%s', xmlfiles) - for filename, xml_file_dict_obj in xmlfiles.iteritems(): + for filename, xml_file_dict_obj in xmlfiles.items(): try: xml_file_dict = xml_file_dict_obj.getObject() logger.debug('xml_file_dict=%s', xml_file_dict) @@ -842,25 +840,25 @@ def get_xml_files_from_pdf(self, pdf_file): 'A valid XML file %s has been found in the PDF file', filename) res[filename] = xml_root - except: + except Exception as e: continue - except: + except Exception as e: pass - logger.info('Valid XML files found in PDF: %s', res.keys()) + logger.info('Valid XML files found in PDF: %s', list(res.keys())) return res @api.model def post_create_or_update(self, parsed_dict, record, doc_filename=None): if parsed_dict.get('attachments'): for filename, data_base64 in\ - parsed_dict['attachments'].iteritems(): + parsed_dict['attachments'].items(): self.env['ir.attachment'].create({ 'name': filename, 'res_id': record.id, - 'res_model': unicode(record._name), + 'res_model': str(record._name), 'datas': data_base64, 'datas_fname': filename, - }) + }) for msg in parsed_dict['chatter_msg']: record.message_post(msg) if parsed_dict.get('note'): @@ -868,5 +866,5 @@ def post_create_or_update(self, parsed_dict, record, doc_filename=None): msg = _('Notes in file %s:') % doc_filename else: msg = _('Notes in imported document:') - record.message_post( + record.message_post( # pylint: disable=translation-required '%s %s' % (msg, parsed_dict['note'])) diff --git a/base_business_document_import/tests/__init__.py b/base_business_document_import/tests/__init__.py index 4f964c4100..12d28211d4 100644 --- a/base_business_document_import/tests/__init__.py +++ b/base_business_document_import/tests/__init__.py @@ -1,3 +1 @@ -# -*- coding: utf-8 -*- - from . import test_business_document_import diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 4fd113dffc..62cf42a72c 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # © 2016-2017 Akretion (Alexis de Lattre ) # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -14,128 +13,128 @@ def test_match_partner(self): 'customer': False, 'ref': 'TOTAL', 'website': 'www.total.com', - }) + }) bdio = self.env['business.document.import'] - partner_dict = {'email': u' Agrolait@yourcompany.example.com'} + partner_dict = {'email': ' Agrolait@yourcompany.example.com'} res = bdio._match_partner( partner_dict, [], partner_type='customer') - self.assertEquals(res, self.env.ref('base.res_partner_2')) + self.assertEqual(res, self.env.ref('base.res_partner_2')) # match on domain extracted from email with warning - partner_dict = {'email': u'alexis.delattre@total.com'} + partner_dict = {'email': 'alexis.delattre@total.com'} warn = [] res = bdio._match_partner(partner_dict, warn, partner_type=False) - self.assertEquals(res, partner1) + self.assertEqual(res, partner1) self.assertTrue(warn) - partner_dict = {'name': u'delta pc '} + partner_dict = {'name': 'delta pc '} res = bdio._match_partner( partner_dict, [], partner_type='supplier') - self.assertEquals(res, self.env.ref('base.res_partner_4')) - partner_dict = {'ref': u'TOTAL'} + self.assertEqual(res, self.env.ref('base.res_partner_4')) + partner_dict = {'ref': 'TOTAL'} res = bdio._match_partner(partner_dict, [], partner_type=False) - self.assertEquals(res, partner1) + self.assertEqual(res, partner1) def test_match_shipping_partner(self): rpo = self.env['res.partner'] bdio = self.env['business.document.import'] partner1 = rpo.create({ 'name': 'Akretion France', - 'street': u'35B rue Montgolfier', + 'street': '35B rue Montgolfier', 'zip': '69100', 'country_id': self.env.ref('base.fr').id, 'email': 'contact@akretion.com', - }) + }) cpartner1 = rpo.create({ 'parent_id': partner1.id, - 'name': u'Alexis de Lattre', + 'name': 'Alexis de Lattre', 'email': 'alexis.delattre@akretion.com', 'type': 'delivery', - }) + }) rpo.create({ 'parent_id': partner1.id, - 'name': u'Sébastien BEAU', + 'name': 'Sébastien BEAU', 'email': 'sebastien.beau@akretion.com', 'type': 'contact', - }) + }) cpartner3 = rpo.create({ 'parent_id': partner1.id, 'name': 'Flo', 'email': 'flo@akretion.com', 'street': "42 rue des lilas d'Espagne", 'zip': '92400', - 'city': u'Courbevoie', + 'city': 'Courbevoie', 'country_id': self.env.ref('base.fr').id, 'type': 'invoice', - }) + }) agrolait = self.env.ref('base.res_partner_2') shipping_dict = { 'partner': {'email': 'contact@akretion.com'}, 'address': {}, - } + } res = bdio._match_shipping_partner(shipping_dict, agrolait, []) - self.assertEquals(res, cpartner1) + self.assertEqual(res, cpartner1) shipping_dict['address'] = { 'zip': '92400', 'country_code': 'fr', - } + } res = bdio._match_shipping_partner(shipping_dict, agrolait, []) - self.assertEquals(res, cpartner3) + self.assertEqual(res, cpartner3) shipping_dict['address']['zip'] = '92500' res = bdio._match_shipping_partner(shipping_dict, agrolait, []) - self.assertEquals(res, partner1) + self.assertEqual(res, partner1) shipping_dict = { 'partner': {}, 'address': {}, - } + } res = bdio._match_shipping_partner(shipping_dict, partner1, []) - self.assertEquals(res, cpartner1) + self.assertEqual(res, cpartner1) def test_match_currency(self): bdio = self.env['business.document.import'] - currency_dict = {'iso': u'EUR'} + currency_dict = {'iso': 'EUR'} res = bdio._match_currency(currency_dict, []) - self.assertEquals(res, self.env.ref('base.EUR')) - currency_dict = {'symbol': u'€'} + self.assertEqual(res, self.env.ref('base.EUR')) + currency_dict = {'symbol': '€'} res = bdio._match_currency(currency_dict, []) - self.assertEquals(res, self.env.ref('base.EUR')) - currency_dict = {'country_code': u'fr '} + self.assertEqual(res, self.env.ref('base.EUR')) + currency_dict = {'country_code': 'fr '} res = bdio._match_currency(currency_dict, []) - self.assertEquals(res, self.env.ref('base.EUR')) - currency_dict = {'iso_or_symbol': u'€'} + self.assertEqual(res, self.env.ref('base.EUR')) + currency_dict = {'iso_or_symbol': '€'} res = bdio._match_currency(currency_dict, []) - self.assertEquals(res, self.env.ref('base.EUR')) + self.assertEqual(res, self.env.ref('base.EUR')) self.env.user.company_id.currency_id = self.env.ref('base.KRW') currency_dict = {} res = bdio._match_currency(currency_dict, []) - self.assertEquals(res, self.env.ref('base.KRW')) + self.assertEqual(res, self.env.ref('base.KRW')) def test_match_product(self): bdio = self.env['business.document.import'] ppo = self.env['product.product'] product1 = ppo.create({ - 'name': u'Test Product', + 'name': 'Test Product', 'barcode': '9782203121102', 'seller_ids': [ (0, 0, { 'name': self.env.ref('base.res_partner_2').id, 'product_code': 'TEST1242', }), - ] - }) - product_dict = {'code': u'PROD_DEL '} + ] + }) + product_dict = {'code': 'PROD_DEL '} res = bdio._match_product(product_dict, []) - self.assertEquals(res, self.env.ref('product.product_delivery_01')) - product_dict = {'barcode': u'9782203121102'} + self.assertEqual(res, self.env.ref('product.product_delivery_01')) + product_dict = {'barcode': '9782203121102'} res = bdio._match_product(product_dict, []) - self.assertEquals(res, product1) + self.assertEqual(res, product1) product_dict = {'code': 'TEST1242'} res = bdio._match_product( product_dict, [], seller=self.env.ref('base.res_partner_2')) - self.assertEquals(res, product1) + self.assertEqual(res, product1) raise_test = True try: bdio._match_product(product_dict, [], seller=False) raise_test = False - except: + except Exception as e: pass self.assertTrue(raise_test) @@ -143,26 +142,26 @@ def test_match_uom(self): bdio = self.env['business.document.import'] uom_dict = {'unece_code': 'KGM'} res = bdio._match_uom(uom_dict, []) - self.assertEquals(res, self.env.ref('product.product_uom_kgm')) + self.assertEqual(res, self.env.ref('product.product_uom_kgm')) uom_dict = {'unece_code': 'NIU'} res = bdio._match_uom(uom_dict, []) - self.assertEquals(res, self.env.ref('product.product_uom_unit')) + self.assertEqual(res, self.env.ref('product.product_uom_unit')) uom_dict = {'name': 'day'} res = bdio._match_uom(uom_dict, []) - self.assertEquals(res, self.env.ref('product.product_uom_day')) + self.assertEqual(res, self.env.ref('product.product_uom_day')) uom_dict = {'name': ' Liter '} res = bdio._match_uom(uom_dict, []) - self.assertEquals(res, self.env.ref('product.product_uom_litre')) + self.assertEqual(res, self.env.ref('product.product_uom_litre')) uom_dict = {} product = self.env.ref('product.product_product_1') res = bdio._match_uom(uom_dict, [], product=product) - self.assertEquals(res, product.uom_id) + self.assertEqual(res, product.uom_id) def test_match_tax(self): # on purpose, I use a rate that doesn't exist # so that this test works even if the l10n_de is installed de_tax_21 = self.env['account.tax'].create({ - 'name': u'German VAT purchase 18.0%', + 'name': 'German VAT purchase 18.0%', 'description': 'DE-VAT-buy-18.0', 'type_tax_use': 'purchase', 'price_include': False, @@ -170,9 +169,9 @@ def test_match_tax(self): 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, - }) + }) de_tax_21_ttc = self.env['account.tax'].create({ - 'name': u'German VAT purchase 18.0% TTC', + 'name': 'German VAT purchase 18.0% TTC', 'description': 'DE-VAT-buy-18.0-TTC', 'type_tax_use': 'purchase', 'price_include': True, @@ -180,24 +179,24 @@ def test_match_tax(self): 'amount_type': 'percent', 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, - }) + }) bdio = self.env['business.document.import'] tax_dict = { 'amount_type': 'percent', 'amount': 18, 'unece_type_code': 'VAT', 'unece_categ_code': 'S', - } + } res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') - self.assertEquals(res, de_tax_21) + self.assertEqual(res, de_tax_21) tax_dict.pop('unece_categ_code') res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') - self.assertEquals(res, de_tax_21) + self.assertEqual(res, de_tax_21) res = bdio._match_tax( tax_dict, [], type_tax_use='purchase', price_include=True) - self.assertEquals(res, de_tax_21_ttc) + self.assertEqual(res, de_tax_21_ttc) res = bdio._match_taxes([tax_dict], [], type_tax_use='purchase') - self.assertEquals(res, de_tax_21) + self.assertEqual(res, de_tax_21) def test_match_account_exact(self): bdio = self.env['business.document.import'] @@ -206,9 +205,9 @@ def test_match_account_exact(self): 'code': '898999', 'user_type_id': self.env.ref('account.data_account_type_expenses').id, - }) + }) res = bdio._match_account({'code': '898999'}, []) - self.assertEquals(acc, res) + self.assertEqual(acc, res) def test_match_account_bigger_in(self): bdio = self.env['business.document.import'] @@ -217,9 +216,9 @@ def test_match_account_bigger_in(self): 'code': '898999', 'user_type_id': self.env.ref('account.data_account_type_expenses').id, - }) + }) res = bdio._match_account({'code': '89899900'}, []) - self.assertEquals(acc, res) + self.assertEqual(acc, res) def test_match_account_smaller_in(self): bdio = self.env['business.document.import'] @@ -228,8 +227,8 @@ def test_match_account_smaller_in(self): 'code': '89899910', 'user_type_id': self.env.ref('account.data_account_type_expenses').id, - }) + }) chatter = [] res = bdio._match_account({'code': '898999'}, chatter) - self.assertEquals(acc, res) - self.assertEquals(len(chatter), 1) + self.assertEqual(acc, res) + self.assertEqual(len(chatter), 1) From 2d3e920229c81807536d7a6b3eafecd1d0cc938a Mon Sep 17 00:00:00 2001 From: OCA Transbot Date: Mon, 28 Nov 2016 22:27:08 -0500 Subject: [PATCH 34/99] OCA Transbot updated translations from Transifex --- base_business_document_import/i18n/cs_CZ.po | 304 ++++++++++++++++++++ base_business_document_import/i18n/fr.po | 285 ++++++++++++++++++ 2 files changed, 589 insertions(+) create mode 100644 base_business_document_import/i18n/cs_CZ.po create mode 100644 base_business_document_import/i18n/fr.po diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po new file mode 100644 index 0000000000..d7ef2c9813 --- /dev/null +++ b/base_business_document_import/i18n/cs_CZ.po @@ -0,0 +1,304 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +# Translators: +# Lukáš Spurný , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-22 03:40+0000\n" +"PO-Revision-Date: 2018-02-22 03:40+0000\n" +"Last-Translator: Lukáš Spurný , 2018\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/teams/23907/cs_CZ/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: cs_CZ\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:549 +#, python-format +msgid "(fixed)" +msgstr "(Úprávy)" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:866 +#, python-format +msgid "Notes in file %s:" +msgstr "Poznámky v souboru %s:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:868 +#, python-format +msgid "Notes in imported document:" +msgstr "Poznámky v importovaném dokumentu:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:462 +#, python-format +msgid "" +"

Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

  • UNECE code: " +"%s
  • Name of the unit of measure: %s

So the unit of " +"measure 'Unit(s)' has been used. You may have to change it " +"manually.

" +msgstr "" +"Společnost Odoo nemohla najít žádnou měrnou jednotku, která by odpovídala " +"těmto informacím získaným z obchodního dokladu: Kód UNECE %s Náměrová " +"jednotka: %s Je použita měrná jednotka 'Jednotky)' Musíte ji ručně změnit." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:729 +#, python-format +msgid "Approximate match: account %s has been matched with account %s" +msgstr "Přibližná shoda: účet %s byl přiřazen účtu %s" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "Společné metody importu obchodních dokumentů" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_display_name +msgid "Display Name" +msgstr "Zobrazovaný název" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:641 +#, python-format +msgid "" +"For product '%s', the unit of measure is %s on the existing line, but it is " +"%s on the imported line. We don't support this scenario for the moment, so " +"the lines haven't been updated." +msgstr "" +"U produktu '%s' je měrnou jednotkou %s na existujícím řádku, ale na " +"importované řádce je %s. Momentálně nepodporujeme tento scénář, takže 1 " +"řádky nebyly aktualizovány." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:262 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "IBAN %s není platný, takže byl ignorován." + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_id +msgid "ID" +msgstr "ID" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import___last_update +msgid "Last Modified on" +msgstr "Poslední změna dne" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:419 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "Není uvedena žádná měna, takže Odoo použil měnu společnosti (%s)" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:166 +#, python-format +msgid "" +"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Country code: %s\n" +"State code: %s\n" +"VAT number: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Reference: %s\n" +"Name: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:733 +#, python-format +msgid "" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document: Account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:772 +#, python-format +msgid "" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document: Analytic account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:809 +#, python-format +msgid "" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document: Journal code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:335 +#, python-format +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Product code: %s\n" +"Supplier: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:537 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"Tax amount: %s %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:625 +#, python-format +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:149 +#, python-format +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully" +" that the %s is correct." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:115 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as %s VAT number. But " +"there are no %s with this VAT number in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:87 +#: code:addons/base_business_document_import/models/business_document_import.py:225 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:406 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But the country '%s' doesn't have any related " +"currency configured in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:413 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:369 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:392 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol " +"or ISO code. But there are no currency with the symbol nor ISO code in Odoo." +msgstr "" +"Analýza obchodního dokladu vrátila hodnotu \"%s\" jako symbol měny nebo kód " +"ISO. Neexistuje však žádná měna se symbolem ani kódem ISO v Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:379 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." +msgstr "" +"Analýza obchodního dokladu vrátila jako symbol měny symbol '%s'. Ale v Odoo " +"neexistuje žádný nebo několik měn s tímto symbolem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:449 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the unit of measure " +"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " +"Please check the configuration of the units of measures in Odoo." +msgstr "" +"Analýza obchodního dokladu vrátila \"%s\" jako měrnou jednotku UNECE, avšak " +"s tímto kódem UNECE v Odoo neexistuje žádná měrná jednotka. Zkontrolujte " +"prosím konfiguraci jednotek opatření v Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:289 +#, python-format +msgid "" +"The bank account IBAN %s has been automatically added on the supplier" +" %s" +msgstr "Bankovní účet 1IBAN %s byl automaticky přidán na dodavatele %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:605 +#, python-format +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"Existující řádek '%s' nemá žádný produkt, takže 1 řádky nebyly " +"aktualizovány." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:611 +#, python-format +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." +msgstr "" +"Produkt '%s' se používá na několika existujících linkách, takže řádky nebyly" +" aktualizovány." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:633 +#, python-format +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." +msgstr "" +"Produkt '%s' se používá na několika importovaných řádcích, takže 1 řádky " +"nebyly aktualizovány." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:72 +#, python-format +msgid "customer" +msgstr "zákazník" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:75 +#, python-format +msgid "partner" +msgstr "partner" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:69 +#, python-format +msgid "supplier" +msgstr "dodavatele" diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po new file mode 100644 index 0000000000..985b26ac0f --- /dev/null +++ b/base_business_document_import/i18n/fr.po @@ -0,0 +1,285 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +# Translators: +# OCA Transbot , 2018 +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 11.0\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2018-02-22 03:40+0000\n" +"PO-Revision-Date: 2018-02-22 03:40+0000\n" +"Last-Translator: OCA Transbot , 2018\n" +"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Language: fr\n" +"Plural-Forms: nplurals=2; plural=(n > 1);\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:549 +#, python-format +msgid "(fixed)" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:866 +#, python-format +msgid "Notes in file %s:" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:868 +#, python-format +msgid "Notes in imported document:" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:462 +#, python-format +msgid "" +"

Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

  • UNECE code: " +"%s
  • Name of the unit of measure: %s

So the unit of " +"measure 'Unit(s)' has been used. You may have to change it " +"manually.

" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:729 +#, python-format +msgid "Approximate match: account %s has been matched with account %s" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_display_name +msgid "Display Name" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:641 +#, python-format +msgid "" +"For product '%s', the unit of measure is %s on the existing line, but it is " +"%s on the imported line. We don't support this scenario for the moment, so " +"the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:262 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_id +msgid "ID" +msgstr "ID" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import___last_update +msgid "Last Modified on" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:419 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:166 +#, python-format +msgid "" +"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Country code: %s\n" +"State code: %s\n" +"VAT number: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Reference: %s\n" +"Name: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:733 +#, python-format +msgid "" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document: Account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:772 +#, python-format +msgid "" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document: Analytic account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:809 +#, python-format +msgid "" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document: Journal code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:335 +#, python-format +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Product code: %s\n" +"Supplier: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:537 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"Tax amount: %s %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:625 +#, python-format +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:149 +#, python-format +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully" +" that the %s is correct." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:115 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as %s VAT number. But " +"there are no %s with this VAT number in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:87 +#: code:addons/base_business_document_import/models/business_document_import.py:225 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:406 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But the country '%s' doesn't have any related " +"currency configured in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:413 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:369 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:392 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol " +"or ISO code. But there are no currency with the symbol nor ISO code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:379 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:449 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the unit of measure " +"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " +"Please check the configuration of the units of measures in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:289 +#, python-format +msgid "" +"The bank account IBAN %s has been automatically added on the supplier" +" %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:605 +#, python-format +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:611 +#, python-format +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:633 +#, python-format +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:72 +#, python-format +msgid "customer" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:75 +#, python-format +msgid "partner" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:69 +#, python-format +msgid "supplier" +msgstr "" From 4732589f66de5faa8f7e6826abbb790a3728c465 Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Fri, 13 Apr 2018 10:47:22 +0200 Subject: [PATCH 35/99] use SQL to change company --- .../tests/test_business_document_import.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 62cf42a72c..354d6420d9 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -102,7 +102,9 @@ def test_match_currency(self): currency_dict = {'iso_or_symbol': '€'} res = bdio._match_currency(currency_dict, []) self.assertEqual(res, self.env.ref('base.EUR')) - self.env.user.company_id.currency_id = self.env.ref('base.KRW') + currency_id = self.env.ref('base.KRW').id + self.cr.execute("UPDATE res_company SET currency_id = %s WHERE id = 1", + (currency_id,)) currency_dict = {} res = bdio._match_currency(currency_dict, []) self.assertEqual(res, self.env.ref('base.KRW')) From f2f5e45c7287fe25a9d9aad3e758bbfb58cf1728 Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 18 May 2018 15:48:56 +0200 Subject: [PATCH 36/99] Fix for multicompany --- base_business_document_import/__manifest__.py | 2 +- .../models/business_document_import.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 7a44fc7e9c..7c1fd2b075 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -3,7 +3,7 @@ { 'name': 'Base Business Document Import', - 'version': '11.0.1.0.0', + 'version': '11.0.1.0.1', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 08a5b3ae9a..927cdf154f 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -55,9 +55,12 @@ def _match_partner( 'ref': 'C1242', 'phone': '01.41.98.12.42', } - The keys 'phone' are used by the module + The key 'phone' is used by the module base_phone_business_document_import """ + company = self.env.user.company_id + if hasattr(self, 'company_id') and self.company_id: + company = self.company_id rpo = self.env['res.partner'] self._strip_cleanup_dict(partner_dict) if partner_dict.get('recordset'): @@ -108,7 +111,10 @@ def _match_partner( partners = rpo.search( domain + [ ('parent_id', '=', False), - ('sanitized_vat', '=', vat)]) + ('sanitized_vat', '=', vat), + '|', + ('company_id', '=', False), + ('company_id', '=', company.id)]) if partners: return partners[0] else: From eecfe894828271f922e6ec525305b9d2a9961d22 Mon Sep 17 00:00:00 2001 From: Nicolas JEUDY Date: Wed, 15 Aug 2018 18:37:33 +0200 Subject: [PATCH 37/99] include some of the fixes proposed in #64 --- .../models/business_document_import.py | 33 ++++++++++--------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 927cdf154f..5650c776a9 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -100,11 +100,6 @@ def _match_partner( '|', ('state_id', '=', False), ('state_id', '=', states[0].id)] - # Hook to plug alternative matching methods - partner = self._hook_match_partner( - partner_dict, chatter_msg, domain, partner_type_label) - if partner: - return partner if partner_dict.get('vat'): vat = partner_dict['vat'].replace(' ', '').upper() # use base_vat_sanitized @@ -123,6 +118,11 @@ def _match_partner( "%s VAT number. But there are no %s " "with this VAT number in Odoo.") % (vat, partner_type_label, partner_type_label)) + # Hook to plug alternative matching methods + partner = self._hook_match_partner( + partner_dict, chatter_msg, domain, partner_type_label) + if partner: + return partner website_domain = False email_domain = False if partner_dict.get('email') and '@' in partner_dict['email']: @@ -172,22 +172,23 @@ def _match_partner( raise self.user_error_wrap(_( "Odoo couldn't find any %s corresponding to the following " "information extracted from the business document:\n" - "Country code: %s\n" - "State code: %s\n" + "Name: %s\n" "VAT number: %s\n" + "Reference: %s\n" "E-mail: %s\n" "Website: %s\n" - "Reference: %s\n" - "Name: %s\n") + "State code: %s\n" + "Country code: %s\n") % ( partner_type_label, - partner_dict.get('country_code'), - partner_dict.get('state_code'), + partner_dict.get('name'), partner_dict.get('vat'), + partner_dict.get('ref'), partner_dict.get('email'), partner_dict.get('website'), - partner_dict.get('ref'), - partner_dict.get('name'))) + partner_dict.get('state_code'), + partner_dict.get('country_code'), + )) @api.model def _hook_match_partner( @@ -617,7 +618,7 @@ def compare_lines( chatter_msg.append(_( "The product '%s' is used on several existing " "lines, so the lines haven't been updated.") - % eline['product'].name_get()[0][1]) + % eline['product'].display_name) return False existing_lines_dict[eline['product']] = eline unique_import_products = [] @@ -639,7 +640,7 @@ def compare_lines( chatter_msg.append(_( "The product '%s' is used on several imported lines, " "so the lines haven't been updated.") - % product.name_get()[0][1]) + % product.display_name) return False unique_import_products.append(product) if product in existing_lines_dict: @@ -649,7 +650,7 @@ def compare_lines( "existing line, but it is %s on the imported line. " "We don't support this scenario for the moment, so " "the lines haven't been updated.") % ( - product.name_get()[0][1], + product.display_name, existing_lines_dict[product]['uom'].name, uom.name, )) From 205b29235bc4eba52324b8ca9498276b77a09773 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 26 Aug 2018 00:05:16 +0200 Subject: [PATCH 38/99] Check the VAT number of the destination partner, to make sure the business document is imported in the right company --- .../models/business_document_import.py | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 5650c776a9..209b46aee4 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -818,6 +818,33 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): "following information extracted from the business document: " "Journal code: %s") % journal_dict.get('code')) + @api.model + def _check_company(self, company_dict, chatter_msg): + if not company_dict: + company_dict = {} + rco = self.env['res.company'] + if self._context.get('force_company'): + company = rco.browse(self._context['force_company']) + else: + company = self.env.user.company_id + if company_dict.get('vat'): + parsed_company_vat = company_dict['vat'].replace( + ' ', '').upper() + if company.partner_id.sanitized_vat: + if company.partner_id.sanitized_vat != parsed_company_vat: + raise self.user_error_wrap(_( + "The VAT number of the customer written in the " + "business document (%s) doesn't match the VAT number " + "of the company '%s' (%s) in which you are trying to " + "import this document.") % ( + parsed_company_vat, + company.display_name, + company.partner_id.sanitized_vat)) + else: + chatter_msg.append(_( + "Missing VAT number on company '%s'") + % company.display_name) + def get_xml_files_from_pdf(self, pdf_file): """Returns a dict with key = filename, value = XML file obj""" logger.info('Trying to find an embedded XML file inside PDF') From f6683880dd669a58db96bb53f4d80ed8b99d1df7 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Thu, 21 Feb 2019 00:15:39 +0100 Subject: [PATCH 39/99] [MIG] base_business_document_import from 11 to 12 Migrate base_business_document_import_phone from v10 to v12 Convert readme to the new format --- base_business_document_import/__manifest__.py | 5 +- .../models/business_document_import.py | 115 +++++++++++++----- .../readme/CONTRIBUTORS.rst | 2 + .../readme/DESCRIPTION.rst | 5 + .../tests/test_business_document_import.py | 19 ++- 5 files changed, 100 insertions(+), 46 deletions(-) create mode 100644 base_business_document_import/readme/CONTRIBUTORS.rst create mode 100644 base_business_document_import/readme/DESCRIPTION.rst diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 7c1fd2b075..2f60674b0c 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -1,9 +1,10 @@ -# © 2016-2017 Akretion (Alexis de Lattre ) +# Copyright 2016-2019 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { 'name': 'Base Business Document Import', - 'version': '11.0.1.0.1', + 'version': '12.0.1.0.0', 'category': 'Tools', 'license': 'AGPL-3', 'summary': 'Provides technical tools to import sale orders or supplier ' diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 209b46aee4..9cd5e959cd 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -1,4 +1,5 @@ -# © 2015-2017 Akretion (Alexis de Lattre ) +# Copyright 2015-2019 Akretion France +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo import models, api, _ @@ -58,23 +59,24 @@ def _match_partner( The key 'phone' is used by the module base_phone_business_document_import """ - company = self.env.user.company_id - if hasattr(self, 'company_id') and self.company_id: - company = self.company_id rpo = self.env['res.partner'] self._strip_cleanup_dict(partner_dict) if partner_dict.get('recordset'): return partner_dict['recordset'] if partner_dict.get('id'): return rpo.browse(partner_dict['id']) + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id + domain = [ + '|', ('company_id', '=', False), + ('company_id', '=', company_id)] if partner_type == 'supplier': - domain = [('supplier', '=', True)] + domain += [('supplier', '=', True)] partner_type_label = _('supplier') elif partner_type == 'customer': - domain = [('customer', '=', True)] + domain += [('customer', '=', True)] partner_type_label = _('customer') else: - domain = [] partner_type_label = _('partner') country = False if partner_dict.get('country_code'): @@ -106,10 +108,7 @@ def _match_partner( partners = rpo.search( domain + [ ('parent_id', '=', False), - ('sanitized_vat', '=', vat), - '|', - ('company_id', '=', False), - ('company_id', '=', company.id)]) + ('sanitized_vat', '=', vat)]) if partners: return partners[0] else: @@ -215,7 +214,13 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): if shipping_dict.get('partner'): partner = self._match_partner( shipping_dict['partner'], chatter_msg, partner_type=False) - domain = [('parent_id', '=', partner.id)] + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id + domain = [ + '|', ('company_id', '=', False), + ('company_id', '=', company_id), + ('parent_id', '=', partner.id), + ] address_dict = shipping_dict['address'] self._strip_cleanup_dict(address_dict) country = False @@ -269,8 +274,11 @@ def _match_partner_bank( chatter_msg.append(_( "IBAN %s is not valid, so it has been ignored.") % iban) return False + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id bankaccounts = rpbo.search([ - ('acc_type', '=', 'iban'), + '|', ('company_id', '=', False), + ('company_id', '=', company_id), ('sanitized_acc_number', '=', iban), ('partner_id', '=', partner.id)]) if bankaccounts: @@ -313,13 +321,17 @@ def _match_product(self, product_dict, chatter_msg, seller=False): return product_dict['recordset'] if product_dict.get('id'): return ppo.browse(product_dict['id']) + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id + cdomain = [ + '|', ('company_id', '=', False), ('company_id', '=', company_id)] if product_dict.get('barcode'): - products = ppo.search([ + products = ppo.search(cdomain + [ ('barcode', '=', product_dict['barcode'])]) if products: return products[0] if product_dict.get('code'): - products = ppo.search([ + products = ppo.search(cdomain + [ '|', ('barcode', '=', product_dict['code']), ('default_code', '=', product_dict['code'])]) @@ -328,10 +340,10 @@ def _match_product(self, product_dict, chatter_msg, seller=False): # WARNING: Won't work for multi-variant products # because product.supplierinfo is attached to product template if seller: - sinfo = self.env['product.supplierinfo'].search([ + sinfo = self.env['product.supplierinfo'].search(cdomain + [ ('name', '=', seller.id), ('product_code', '=', product_dict['code']), - ]) + ]) if ( sinfo and sinfo[0].product_tmpl_id.product_variant_ids and @@ -422,7 +434,12 @@ def _match_currency(self, currency_dict, chatter_msg): "as the country code to find the related currency. " "But there is no country with that code in Odoo.") % country_code) - company_cur = self.env.user.company_id.currency_id + if self._context.get('force_company'): + company = self.env['res.company'].browse( + self._context['force_company']) + else: + company = self.env.user.company_id + company_cur = company.currency_id chatter_msg.append(_( 'No currency specified, so Odoo used the company currency (%s)') % company_cur.name) @@ -436,19 +453,19 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): 'name': 'Liter', } """ - puo = self.env['product.uom'] + uuo = self.env['uom.uom'] if not uom_dict: uom_dict = {} self._strip_cleanup_dict(uom_dict) if uom_dict.get('recordset'): return uom_dict['recordset'] if uom_dict.get('id'): - return puo.browse(uom_dict['id']) + return uuo.browse(uom_dict['id']) if uom_dict.get('unece_code'): # Map NIU to Unit if uom_dict['unece_code'] == 'NIU': uom_dict['unece_code'] = 'C62' - uoms = puo.search([ + uoms = uuo.search([ ('unece_code', '=', uom_dict['unece_code'])]) if uoms: return uoms[0] @@ -460,7 +477,7 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): "check the configuration of the units of measures in " "Odoo.") % uom_dict['unece_code']) if uom_dict.get('name'): - uoms = puo.search([ + uoms = uuo.search([ ('name', '=ilike', uom_dict['name'] + '%')]) if uoms: return uoms[0] @@ -474,7 +491,7 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): "

So the unit of measure 'Unit(s)' has been used. You may " "have to change it manually.

") % (uom_dict.get('unece_code'), uom_dict.get('name'))) - return self.env.ref('product.product_uom_unit') + return self.env.ref('uom.product_uom_unit') @api.model def _match_taxes( @@ -498,7 +515,7 @@ def _match_tax( 'amount': 20.0, # required 'unece_type_code': 'VAT', 'unece_categ_code': 'S', - 'unece_due_date_code': '432', + 'unece_due_date_code': '72', } """ ato = self.env['account.tax'] @@ -507,9 +524,9 @@ def _match_tax( return tax_dict['recordset'] if tax_dict.get('id'): return ato.browse(tax_dict['id']) - domain = [] - prec = self.env['decimal.precision'].precision_get('Account') - # we should not use the Account prec directly, but... + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id + domain = [('company_id', '=', company_id)] if type_tax_use == 'purchase': domain.append(('type_tax_use', '=', 'purchase')) elif type_tax_use == 'sale': @@ -537,9 +554,9 @@ def _match_tax( ('unece_due_date_code', '=', False)] taxes = ato.search(domain, order='unece_due_date_code') for tax in taxes: - tax_amount = tax.amount + tax_amount = tax.amount # 'amount' field : digits=(16, 4) if not float_compare( - tax_dict['amount'], tax_amount, precision_digits=prec): + tax_dict['amount'], tax_amount, precision_digits=4): return tax raise self.user_error_wrap(_( "Odoo couldn't find any tax with 'Tax Application' = '%s' " @@ -690,8 +707,10 @@ def compare_lines( return res def _prepare_account_speed_dict(self): + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id res = self.env['account.account'].search_read([ - ('company_id', '=', self.env.user.company_id.id), + ('company_id', '=', company_id), ('deprecated', '=', False)], ['code']) speed_dict = {} for l in res: @@ -743,8 +762,10 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): "Account code: %s") % account_dict.get('code')) def _prepare_analytic_account_speed_dict(self): + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id res = self.env['account.analytic.account'].search_read( - [('company_id', '=', self.env.user.company_id.id)], + [('company_id', '=', company_id)], ['code']) speed_dict = {} for l in res: @@ -782,8 +803,10 @@ def _match_analytic_account( "Analytic account code: %s") % aaccount_dict.get('code')) def _prepare_journal_speed_dict(self): + company_id = self._context.get('force_company') or\ + self.env.user.company_id.id res = self.env['account.journal'].search_read([ - ('company_id', '=', self.env.user.company_id.id)], ['code']) + ('company_id', '=', company_id)], ['code']) speed_dict = {} for l in res: speed_dict[l['code'].upper()] = l['id'] @@ -800,7 +823,7 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): """ if not journal_dict: journal_dict = {} - ajo = self.env['account.account'] + ajo = self.env['account.journal'] if speed_dict is None: speed_dict = self._prepare_journal_speed_dict() self._strip_cleanup_dict(journal_dict) @@ -818,6 +841,31 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): "following information extracted from the business document: " "Journal code: %s") % journal_dict.get('code')) + # Code moved from base_business_document_import_stock + # Now that the incoterm obj (account.incoterms) is defined in + # the 'account' module (since Odoo v12) instead of 'stock' + @api.model + def _match_incoterm(self, incoterm_dict, chatter_msg): + aio = self.env['account.incoterms'] + if not incoterm_dict: + return False + if incoterm_dict.get('recordset'): + return incoterm_dict['recordset'] + if incoterm_dict.get('id'): + return aio.browse(incoterm_dict['id']) + if incoterm_dict.get('code'): + incoterms = aio.search([ + '|', + ('name', '=ilike', incoterm_dict['code']), + ('code', '=ilike', incoterm_dict['code'])]) + if incoterms: + return incoterms[0] + else: + self.user_error_wrap(_( + "Could not find any Incoterm in Odoo corresponding " + "to '%s'") % incoterm_dict['code']) + return False + @api.model def _check_company(self, company_dict, chatter_msg): if not company_dict: @@ -855,6 +903,7 @@ def get_xml_files_from_pdf(self, pdf_file): logger.debug('pdf.trailer=%s', pdf.trailer) pdf_root = pdf.trailer['/Root'] logger.debug('pdf_root=%s', pdf_root) + # TODO add support for /Kids embeddedfiles = pdf_root['/Names']['/EmbeddedFiles']['/Names'] i = 0 xmlfiles = {} # key = filename, value = PDF obj diff --git a/base_business_document_import/readme/CONTRIBUTORS.rst b/base_business_document_import/readme/CONTRIBUTORS.rst new file mode 100644 index 0000000000..3382e3fd15 --- /dev/null +++ b/base_business_document_import/readme/CONTRIBUTORS.rst @@ -0,0 +1,2 @@ +* Alexis de Lattre +* Nicolas JEUDY diff --git a/base_business_document_import/readme/DESCRIPTION.rst b/base_business_document_import/readme/DESCRIPTION.rst new file mode 100644 index 0000000000..a5b1f2cc73 --- /dev/null +++ b/base_business_document_import/readme/DESCRIPTION.rst @@ -0,0 +1,5 @@ +This is a technical module ; it doesn't bring any useful feature by itself. This module is the base modules for 2 other modules : + +* *account_invoice_import* which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as *account_invoice_import_invoice2data*, *account_invoice_import_ubl*, etc... to support specific invoice formats), + +* *sale_invoice_import* which imports sale orders as CSV, XML or PDF files (this module also requires some additional modules such as *sale_invoice_import_csv* or *sale_invoice_import_ubl* to support specific order formats) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 354d6420d9..8eebd2fc1c 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -1,4 +1,5 @@ -# © 2016-2017 Akretion (Alexis de Lattre ) +# Copyright 2016-2019 Akretion France (http://www.akretion.com/) +# @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase @@ -15,17 +16,13 @@ def test_match_partner(self): 'website': 'www.total.com', }) bdio = self.env['business.document.import'] - partner_dict = {'email': ' Agrolait@yourcompany.example.com'} - res = bdio._match_partner( - partner_dict, [], partner_type='customer') - self.assertEqual(res, self.env.ref('base.res_partner_2')) # match on domain extracted from email with warning partner_dict = {'email': 'alexis.delattre@total.com'} warn = [] res = bdio._match_partner(partner_dict, warn, partner_type=False) self.assertEqual(res, partner1) self.assertTrue(warn) - partner_dict = {'name': 'delta pc '} + partner_dict = {'name': 'ready mat '} res = bdio._match_partner( partner_dict, [], partner_type='supplier') self.assertEqual(res, self.env.ref('base.res_partner_4')) @@ -122,7 +119,7 @@ def test_match_product(self): }), ] }) - product_dict = {'code': 'PROD_DEL '} + product_dict = {'code': 'FURN_7777 '} res = bdio._match_product(product_dict, []) self.assertEqual(res, self.env.ref('product.product_delivery_01')) product_dict = {'barcode': '9782203121102'} @@ -144,16 +141,16 @@ def test_match_uom(self): bdio = self.env['business.document.import'] uom_dict = {'unece_code': 'KGM'} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('product.product_uom_kgm')) + self.assertEqual(res, self.env.ref('uom.product_uom_kgm')) uom_dict = {'unece_code': 'NIU'} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('product.product_uom_unit')) + self.assertEqual(res, self.env.ref('uom.product_uom_unit')) uom_dict = {'name': 'day'} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('product.product_uom_day')) + self.assertEqual(res, self.env.ref('uom.product_uom_day')) uom_dict = {'name': ' Liter '} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('product.product_uom_litre')) + self.assertEqual(res, self.env.ref('uom.product_uom_litre')) uom_dict = {} product = self.env.ref('product.product_product_1') res = bdio._match_uom(uom_dict, [], product=product) From 702c8454f0647ac3efac2a523114529c66f3513e Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Sun, 24 Feb 2019 13:47:21 +0100 Subject: [PATCH 40/99] Module product_uom_unece renamed to uom_unece --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 2f60674b0c..6ecb280c18 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -14,7 +14,7 @@ 'depends': [ 'base_vat_sanitized', 'account_tax_unece', - 'product_uom_unece', + 'uom_unece', ], 'external_dependencies': {'python': ['PyPDF2']}, } From 513568b846783d427f6638042d274dc8a8b2107a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 3 Jul 2019 23:46:28 +0200 Subject: [PATCH 41/99] Use limit=1 where relevant Improve code for shipping addresse matching Improve tests --- base_business_document_import/README.rst | 70 +-- .../models/business_document_import.py | 199 ++++---- .../static/description/icon.png | Bin 0 -> 9455 bytes .../static/description/index.html | 425 ++++++++++++++++++ .../tests/test_business_document_import.py | 32 +- 5 files changed, 604 insertions(+), 122 deletions(-) create mode 100644 base_business_document_import/static/description/icon.png create mode 100644 base_business_document_import/static/description/index.html diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 6cf0f46443..fb6cd91421 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -1,59 +1,79 @@ -.. 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 - ============================= Base Business Document Import ============================= +.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! This file is generated by oca-gen-addon-readme !! + !! changes will be overwritten. !! + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png + :target: https://odoo-community.org/page/development-status + :alt: Beta +.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png + :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html + :alt: License: AGPL-3 +.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github + :target: https://github.com/OCA/edi/tree/12.0/base_business_document_import + :alt: OCA/edi +.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png + :target: https://translation.odoo-community.org/projects/edi-12-0/edi-12-0-base_business_document_import + :alt: Translate me on Weblate +.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png + :target: https://runbot.odoo-community.org/runbot/226/12.0 + :alt: Try me on Runbot + +|badge1| |badge2| |badge3| |badge4| |badge5| + This is a technical module ; it doesn't bring any useful feature by itself. This module is the base modules for 2 other modules : * *account_invoice_import* which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as *account_invoice_import_invoice2data*, *account_invoice_import_ubl*, etc... to support specific invoice formats), * *sale_invoice_import* which imports sale orders as CSV, XML or PDF files (this module also requires some additional modules such as *sale_invoice_import_csv* or *sale_invoice_import_ubl* to support specific order formats) -Configuration -============= - -No configuration needed. - -Usage -===== +**Table of contents** -.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas - :alt: Try me on Runbot - :target: https://runbot.odoo-community.org/runbot/226/11.0 +.. contents:: + :local: Bug Tracker =========== -Bugs are tracked on `GitHub 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. +Bugs are tracked on `GitHub 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 `_. + +Do not contact contributors directly about support or help with technical issues. Credits ======= +Authors +~~~~~~~ + +* Akretion +* Nicolas JEUDY + Contributors ------------- +~~~~~~~~~~~~ * Alexis de Lattre * Nicolas JEUDY -Do not contact contributors directly about support or help with technical issues. +Maintainers +~~~~~~~~~~~ -Maintainer ----------- +This module is maintained by the OCA. .. image:: https://odoo-community.org/logo.png :alt: Odoo Community Association :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. -To contribute to this module, please visit https://odoo-community.org. +This module is part of the `OCA/edi `_ project on GitHub. + +You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 9cd5e959cd..c4bdd3dbbc 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -80,10 +80,9 @@ def _match_partner( partner_type_label = _('partner') country = False if partner_dict.get('country_code'): - countries = self.env['res.country'].search([ - ('code', '=', partner_dict['country_code'])]) - if countries: - country = countries[0] + country = self.env['res.country'].search([ + ('code', '=', partner_dict['country_code'])], limit=1) + if country: domain += [ '|', ('country_id', '=', False), @@ -94,23 +93,23 @@ def _match_partner( "country code. But there are no country with that code " "in Odoo.") % partner_dict['country_code']) if country and partner_dict.get('state_code'): - states = self.env['res.country.state'].search([ + state = self.env['res.country.state'].search([ ('code', '=', partner_dict['state_code']), - ('country_id', '=', country.id)]) - if states: + ('country_id', '=', country.id)], limit=1) + if state: domain += [ '|', ('state_id', '=', False), - ('state_id', '=', states[0].id)] + ('state_id', '=', state.id)] if partner_dict.get('vat'): vat = partner_dict['vat'].replace(' ', '').upper() # use base_vat_sanitized - partners = rpo.search( + partner = rpo.search( domain + [ ('parent_id', '=', False), - ('sanitized_vat', '=', vat)]) - if partners: - return partners[0] + ('sanitized_vat', '=', vat)], limit=1) + if partner: + return partner else: chatter_msg.append(_( "The analysis of the business document returned '%s' as " @@ -125,10 +124,10 @@ def _match_partner( website_domain = False email_domain = False if partner_dict.get('email') and '@' in partner_dict['email']: - partners = rpo.search( - domain + [('email', '=ilike', partner_dict['email'])]) - if partners: - return partners[0] + partner = rpo.search( + domain + [('email', '=ilike', partner_dict['email'])], limit=1) + if partner: + return partner else: email_domain = partner_dict['email'].split('@')[1] if partner_dict.get('website'): @@ -140,34 +139,34 @@ def _match_partner( website_domain = '.'.join(netloc.split('.')[-2:]) if website_domain or email_domain: partner_domain = website_domain or email_domain - partners = rpo.search( + partner = rpo.search( domain + - [('website', '=ilike', '%' + partner_domain + '%')]) + [('website', '=ilike', '%' + partner_domain + '%')], limit=1) # I can't search on email addresses with # email_domain because of the emails such as # @gmail.com, @yahoo.com that may match random partners - if not partners and website_domain: - partners = rpo.search( + if not partner and website_domain: + partner = rpo.search( domain + - [('email', '=ilike', '%@' + website_domain)]) - if partners: + [('email', '=ilike', '%@' + website_domain)], limit=1) + if partner: chatter_msg.append(_( "The %s has been identified by the domain name '%s' " "so please check carefully that the %s is correct.") % ( partner_type_label, partner_domain, partner_type_label)) - return partners[0] + return partner if partner_dict.get('ref'): - partners = rpo.search( - domain + [('ref', '=', partner_dict['ref'])]) - if partners: - return partners[0] + partner = rpo.search( + domain + [('ref', '=', partner_dict['ref'])], limit=1) + if partner: + return partner if partner_dict.get('name'): - partners = rpo.search( - domain + [('name', '=ilike', partner_dict['name'])]) - if partners: - return partners[0] + partner = rpo.search( + domain + [('name', '=ilike', partner_dict['name'])], limit=1) + if partner: + return partner raise self.user_error_wrap(_( "Odoo couldn't find any %s corresponding to the following " "information extracted from the business document:\n" @@ -224,40 +223,59 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): address_dict = shipping_dict['address'] self._strip_cleanup_dict(address_dict) country = False + parent_partner_matches = True if address_dict.get('country_code'): - countries = self.env['res.country'].search([ - ('code', '=', address_dict['country_code'])]) - if countries: - country = countries[0] + country = self.env['res.country'].search([ + ('code', '=', address_dict['country_code'])], limit=1) + if country: domain += [ '|', ('country_id', '=', False), ('country_id', '=', country.id)] + if partner.country_id != country: + parent_partner_matches = False else: chatter_msg.append(_( "The analysis of the business document returned '%s' as " "country code. But there are no country with that code " "in Odoo.") % address_dict['country_code']) if country and address_dict.get('state_code'): - states = self.env['res.country.state'].search([ + state = self.env['res.country.state'].search([ ('code', '=', address_dict['state_code']), - ('country_id', '=', country.id)]) - if states: + ('country_id', '=', country.id)], limit=1) + if state: domain += [ '|', ('state_id', '=', False), - ('state_id', '=', states[0].id)] + ('state_id', '=', state.id)] + if partner.state_id and partner.state_id != state: + parent_partner_matches = False if address_dict.get('zip'): domain.append(('zip', '=', address_dict['zip'])) # sanitize ZIP ? - partners = rpo.search(domain + [('type', '=', 'delivery')]) - if partners: - partner = partners[0] - else: - partners = rpo.search(domain) - if partners: - partner = partners[0] - return partner + if partner.zip != address_dict['zip']: + parent_partner_matches = False + spartner = rpo.search(domain + [('type', '=', 'delivery')], limit=1) + if spartner: + return spartner + spartner = rpo.search(domain, limit=1) + if spartner: + return spartner + if parent_partner_matches: + return partner + raise self.user_error_wrap(_( + "Odoo couldn't find any shipping partner corresponding to the " + "following information extracted from the business document:\n" + "Parent Partner: %s\n" + "ZIP: %s\n" + "State code: %s\n" + "Country code: %s\n") + % ( + partner.display_name, + address_dict.get('zip'), + address_dict.get('state_code'), + address_dict.get('country_code'), + )) @api.model def _match_partner_bank( @@ -276,20 +294,20 @@ def _match_partner_bank( return False company_id = self._context.get('force_company') or\ self.env.user.company_id.id - bankaccounts = rpbo.search([ + bankaccount = rpbo.search([ '|', ('company_id', '=', False), ('company_id', '=', company_id), ('sanitized_acc_number', '=', iban), - ('partner_id', '=', partner.id)]) - if bankaccounts: - return bankaccounts[0] + ('partner_id', '=', partner.id)], limit=1) + if bankaccount: + return bankaccount elif create_if_not_found: bank_id = False if bic: bic = bic.replace(' ', '').upper() - banks = rbo.search([('bic', '=', bic)]) - if banks: - bank_id = banks[0].id + bank = rbo.search([('bic', '=', bic)], limit=1) + if bank: + bank_id = bank.id else: bank = rbo.create({ 'bic': bic, @@ -326,31 +344,31 @@ def _match_product(self, product_dict, chatter_msg, seller=False): cdomain = [ '|', ('company_id', '=', False), ('company_id', '=', company_id)] if product_dict.get('barcode'): - products = ppo.search(cdomain + [ - ('barcode', '=', product_dict['barcode'])]) - if products: - return products[0] + product = ppo.search(cdomain + [ + ('barcode', '=', product_dict['barcode'])], limit=1) + if product: + return product if product_dict.get('code'): - products = ppo.search(cdomain + [ + product = ppo.search(cdomain + [ '|', ('barcode', '=', product_dict['code']), - ('default_code', '=', product_dict['code'])]) - if products: - return products[0] + ('default_code', '=', product_dict['code'])], limit=1) + if product: + return product # WARNING: Won't work for multi-variant products # because product.supplierinfo is attached to product template if seller: sinfo = self.env['product.supplierinfo'].search(cdomain + [ ('name', '=', seller.id), ('product_code', '=', product_dict['code']), - ]) + ], limit=1) if ( sinfo and - sinfo[0].product_tmpl_id.product_variant_ids and + sinfo.product_tmpl_id.product_variant_ids and len( - sinfo[0].product_tmpl_id.product_variant_ids) == 1 + sinfo.product_tmpl_id.product_variant_ids) == 1 ): - return sinfo[0].product_tmpl_id.product_variant_ids[0] + return sinfo.product_tmpl_id.product_variant_ids[0] raise self.user_error_wrap(_( "Odoo couldn't find any product corresponding to the " "following information extracted from the business document: " @@ -380,10 +398,10 @@ def _match_currency(self, currency_dict, chatter_msg): return rco.browse(currency_dict['id']) if currency_dict.get('iso'): currency_iso = currency_dict['iso'].upper() - currencies = rco.search( - [('name', '=', currency_iso)]) - if currencies: - return currencies[0] + currency = rco.search( + [('name', '=', currency_iso)], limit=1) + if currency: + return currency else: raise self.user_error_wrap(_( "The analysis of the business document returned '%s' as " @@ -405,20 +423,19 @@ def _match_currency(self, currency_dict, chatter_msg): '|', ('name', '=', currency_dict['iso_or_symbol'].upper()), ('symbol', '=', currency_dict['iso_or_symbol'])]) - if currencies: + if len(currencies) == 1: return currencies[0] else: raise self.user_error_wrap(_( "The analysis of the business document returned '%s' as " - "the currency symbol or ISO code. But there are no " - "currency with the symbol nor ISO code in Odoo.") + "the currency symbol or ISO code. But there are none or " + "several currencies with the symbol/ISO code in Odoo.") % currency_dict['iso_or_symbol']) if currency_dict.get('country_code'): country_code = currency_dict['country_code'] - countries = self.env['res.country'].search([ - ('code', '=', country_code)]) - if countries: - country = countries[0] + country = self.env['res.country'].search([ + ('code', '=', country_code)], limit=1) + if country: if country.currency_id: return country.currency_id else: @@ -465,10 +482,10 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): # Map NIU to Unit if uom_dict['unece_code'] == 'NIU': uom_dict['unece_code'] = 'C62' - uoms = uuo.search([ - ('unece_code', '=', uom_dict['unece_code'])]) - if uoms: - return uoms[0] + uom = uuo.search([ + ('unece_code', '=', uom_dict['unece_code'])], limit=1) + if uom: + return uom else: chatter_msg.append(_( "The analysis of the business document returned '%s' " @@ -477,10 +494,10 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): "check the configuration of the units of measures in " "Odoo.") % uom_dict['unece_code']) if uom_dict.get('name'): - uoms = uuo.search([ - ('name', '=ilike', uom_dict['name'] + '%')]) - if uoms: - return uoms[0] + uom = uuo.search([ + ('name', '=ilike', uom_dict['name'] + '%')], limit=1) + if uom: + return uom if product: return product.uom_id chatter_msg.append(_( @@ -854,12 +871,12 @@ def _match_incoterm(self, incoterm_dict, chatter_msg): if incoterm_dict.get('id'): return aio.browse(incoterm_dict['id']) if incoterm_dict.get('code'): - incoterms = aio.search([ + incoterm = aio.search([ '|', ('name', '=ilike', incoterm_dict['code']), - ('code', '=ilike', incoterm_dict['code'])]) - if incoterms: - return incoterms[0] + ('code', '=ilike', incoterm_dict['code'])], limit=1) + if incoterm: + return incoterm else: self.user_error_wrap(_( "Could not find any Incoterm in Odoo corresponding " @@ -943,11 +960,11 @@ def post_create_or_update(self, parsed_dict, record, doc_filename=None): 'datas_fname': filename, }) for msg in parsed_dict['chatter_msg']: - record.message_post(msg) + record.message_post(body=msg) if parsed_dict.get('note'): if doc_filename: msg = _('Notes in file %s:') % doc_filename else: msg = _('Notes in imported document:') record.message_post( # pylint: disable=translation-required - '%s %s' % (msg, parsed_dict['note'])) + body='%s %s' % (msg, parsed_dict['note'])) diff --git a/base_business_document_import/static/description/icon.png b/base_business_document_import/static/description/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..3a0328b516c4980e8e44cdb63fd945757ddd132d GIT binary patch literal 9455 zcmW++2RxMjAAjx~&dlBk9S+%}OXg)AGE&Cb*&}d0jUxM@u(PQx^-s)697TX`ehR4?GS^qbkof1cslKgkU)h65qZ9Oc=ml_0temigYLJfnz{IDzUf>bGs4N!v3=Z3jMq&A#7%rM5eQ#dc?k~! zVpnB`o+K7|Al`Q_U;eD$B zfJtP*jH`siUq~{KE)`jP2|#TUEFGRryE2`i0**z#*^6~AI|YzIWy$Cu#CSLW3q=GA z6`?GZymC;dCPk~rBS%eCb`5OLr;RUZ;D`}um=H)BfVIq%7VhiMr)_#G0N#zrNH|__ zc+blN2UAB0=617@>_u;MPHN;P;N#YoE=)R#i$k_`UAA>WWCcEVMh~L_ zj--gtp&|K1#58Yz*AHCTMziU1Jzt_jG0I@qAOHsk$2}yTmVkBp_eHuY$A9)>P6o~I z%aQ?!(GqeQ-Y+b0I(m9pwgi(IIZZzsbMv+9w{PFtd_<_(LA~0H(xz{=FhLB@(1&qHA5EJw1>>=%q2f&^X>IQ{!GJ4e9U z&KlB)z(84HmNgm2hg2C0>WM{E(DdPr+EeU_N@57;PC2&DmGFW_9kP&%?X4}+xWi)( z;)z%wI5>D4a*5XwD)P--sPkoY(a~WBw;E~AW`Yue4kFa^LM3X`8x|}ZUeMnqr}>kH zG%WWW>3ml$Yez?i%)2pbKPI7?5o?hydokgQyZsNEr{a|mLdt;X2TX(#B1j35xPnPW z*bMSSOauW>o;*=kO8ojw91VX!qoOQb)zHJ!odWB}d+*K?#sY_jqPdg{Sm2HdYzdEx zOGVPhVRTGPtv0o}RfVP;Nd(|CB)I;*t&QO8h zFfekr30S!-LHmV_Su-W+rEwYXJ^;6&3|L$mMC8*bQptyOo9;>Qb9Q9`ySe3%V$A*9 zeKEe+b0{#KWGp$F+tga)0RtI)nhMa-K@JS}2krK~n8vJ=Ngm?R!9G<~RyuU0d?nz# z-5EK$o(!F?hmX*2Yt6+coY`6jGbb7tF#6nHA zuKk=GGJ;ZwON1iAfG$E#Y7MnZVmrY|j0eVI(DN_MNFJmyZ|;w4tf@=CCDZ#5N_0K= z$;R~bbk?}TpfDjfB&aiQ$VA}s?P}xPERJG{kxk5~R`iRS(SK5d+Xs9swCozZISbnS zk!)I0>t=A<-^z(cmSFz3=jZ23u13X><0b)P)^1T_))Kr`e!-pb#q&J*Q`p+B6la%C zuVl&0duN<;uOsB3%T9Fp8t{ED108<+W(nOZd?gDnfNBC3>M8WE61$So|P zVvqH0SNtDTcsUdzaMDpT=Ty0pDHHNL@Z0w$Y`XO z2M-_r1S+GaH%pz#Uy0*w$Vdl=X=rQXEzO}d6J^R6zjM1u&c9vYLvLp?W7w(?np9x1 zE_0JSAJCPB%i7p*Wvg)pn5T`8k3-uR?*NT|J`eS#_#54p>!p(mLDvmc-3o0mX*mp_ zN*AeS<>#^-{S%W<*mz^!X$w_2dHWpcJ6^j64qFBft-o}o_Vx80o0>}Du;>kLts;$8 zC`7q$QI(dKYG`Wa8#wl@V4jVWBRGQ@1dr-hstpQL)Tl+aqVpGpbSfN>5i&QMXfiZ> zaA?T1VGe?rpQ@;+pkrVdd{klI&jVS@I5_iz!=UMpTsa~mBga?1r}aRBm1WS;TT*s0f0lY=JBl66Upy)-k4J}lh=P^8(SXk~0xW=T9v*B|gzIhN z>qsO7dFd~mgxAy4V?&)=5ieYq?zi?ZEoj)&2o)RLy=@hbCRcfT5jigwtQGE{L*8<@Yd{zg;CsL5mvzfDY}P-wos_6PfprFVaeqNE%h zKZhLtcQld;ZD+>=nqN~>GvROfueSzJD&BE*}XfU|H&(FssBqY=hPCt`d zH?@s2>I(|;fcW&YM6#V#!kUIP8$Nkdh0A(bEVj``-AAyYgwY~jB zT|I7Bf@%;7aL7Wf4dZ%VqF$eiaC38OV6oy3Z#TER2G+fOCd9Iaoy6aLYbPTN{XRPz z;U!V|vBf%H!}52L2gH_+j;`bTcQRXB+y9onc^wLm5wi3-Be}U>k_u>2Eg$=k!(l@I zcCg+flakT2Nej3i0yn+g+}%NYb?ta;R?(g5SnwsQ49U8Wng8d|{B+lyRcEDvR3+`O{zfmrmvFrL6acVP%yG98X zo&+VBg@px@i)%o?dG(`T;n*$S5*rnyiR#=wW}}GsAcfyQpE|>a{=$Hjg=-*_K;UtD z#z-)AXwSRY?OPefw^iI+ z)AXz#PfEjlwTes|_{sB?4(O@fg0AJ^g8gP}ex9Ucf*@_^J(s_5jJV}c)s$`Myn|Kd z$6>}#q^n{4vN@+Os$m7KV+`}c%4)4pv@06af4-x5#wj!KKb%caK{A&Y#Rfs z-po?Dcb1({W=6FKIUirH&(yg=*6aLCekcKwyfK^JN5{wcA3nhO(o}SK#!CINhI`-I z1)6&n7O&ZmyFMuNwvEic#IiOAwNkR=u5it{B9n2sAJV5pNhar=j5`*N!Na;c7g!l$ z3aYBqUkqqTJ=Re-;)s!EOeij=7SQZ3Hq}ZRds%IM*PtM$wV z@;rlc*NRK7i3y5BETSKuumEN`Xu_8GP1Ri=OKQ$@I^ko8>H6)4rjiG5{VBM>B|%`&&s^)jS|-_95&yc=GqjNo{zFkw%%HHhS~e=s zD#sfS+-?*t|J!+ozP6KvtOl!R)@@-z24}`9{QaVLD^9VCSR2b`b!KC#o;Ki<+wXB6 zx3&O0LOWcg4&rv4QG0)4yb}7BFSEg~=IR5#ZRj8kg}dS7_V&^%#Do==#`u zpy6{ox?jWuR(;pg+f@mT>#HGWHAJRRDDDv~@(IDw&R>9643kK#HN`!1vBJHnC+RM&yIh8{gG2q zA%e*U3|N0XSRa~oX-3EAneep)@{h2vvd3Xvy$7og(sayr@95+e6~Xvi1tUqnIxoIH zVWo*OwYElb#uyW{Imam6f2rGbjR!Y3`#gPqkv57dB6K^wRGxc9B(t|aYDGS=m$&S!NmCtrMMaUg(c zc2qC=2Z`EEFMW-me5B)24AqF*bV5Dr-M5ig(l-WPS%CgaPzs6p_gnCIvTJ=Y<6!gT zVt@AfYCzjjsMEGi=rDQHo0yc;HqoRNnNFeWZgcm?f;cp(6CNylj36DoL(?TS7eU#+ z7&mfr#y))+CJOXQKUMZ7QIdS9@#-}7y2K1{8)cCt0~-X0O!O?Qx#E4Og+;A2SjalQ zs7r?qn0H044=sDN$SRG$arw~n=+T_DNdSrarmu)V6@|?1-ZB#hRn`uilTGPJ@fqEy zGt(f0B+^JDP&f=r{#Y_wi#AVDf-y!RIXU^0jXsFpf>=Ji*TeqSY!H~AMbJdCGLhC) zn7Rx+sXw6uYj;WRYrLd^5IZq@6JI1C^YkgnedZEYy<&4(z%Q$5yv#Boo{AH8n$a zhb4Y3PWdr269&?V%uI$xMcUrMzl=;w<_nm*qr=c3Rl@i5wWB;e-`t7D&c-mcQl7x! zZWB`UGcw=Y2=}~wzrfLx=uet<;m3~=8I~ZRuzvMQUQdr+yTV|ATf1Uuomr__nDf=X zZ3WYJtHp_ri(}SQAPjv+Y+0=fH4krOP@S&=zZ-t1jW1o@}z;xk8 z(Nz1co&El^HK^NrhVHa-_;&88vTU>_J33=%{if;BEY*J#1n59=07jrGQ#IP>@u#3A z;!q+E1Rj3ZJ+!4bq9F8PXJ@yMgZL;>&gYA0%_Kbi8?S=XGM~dnQZQ!yBSgcZhY96H zrWnU;k)qy`rX&&xlDyA%(a1Hhi5CWkmg(`Gb%m(HKi-7Z!LKGRP_B8@`7&hdDy5n= z`OIxqxiVfX@OX1p(mQu>0Ai*v_cTMiw4qRt3~NBvr9oBy0)r>w3p~V0SCm=An6@3n)>@z!|o-$HvDK z|3D2ZMJkLE5loMKl6R^ez@Zz%S$&mbeoqH5`Bb){Ei21q&VP)hWS2tjShfFtGE+$z zzCR$P#uktu+#!w)cX!lWN1XU%K-r=s{|j?)Akf@q#3b#{6cZCuJ~gCxuMXRmI$nGtnH+-h z+GEi!*X=AP<|fG`1>MBdTb?28JYc=fGvAi2I<$B(rs$;eoJCyR6_bc~p!XR@O-+sD z=eH`-ye})I5ic1eL~TDmtfJ|8`0VJ*Yr=hNCd)G1p2MMz4C3^Mj?7;!w|Ly%JqmuW zlIEW^Ft%z?*|fpXda>Jr^1noFZEwFgVV%|*XhH@acv8rdGxeEX{M$(vG{Zw+x(ei@ zmfXb22}8-?Fi`vo-YVrTH*C?a8%M=Hv9MqVH7H^J$KsD?>!SFZ;ZsvnHr_gn=7acz z#W?0eCdVhVMWN12VV^$>WlQ?f;P^{(&pYTops|btm6aj>_Uz+hqpGwB)vWp0Cf5y< zft8-je~nn?W11plq}N)4A{l8I7$!ks_x$PXW-2XaRFswX_BnF{R#6YIwMhAgd5F9X zGmwdadS6(a^fjHtXg8=l?Rc0Sm%hk6E9!5cLVloEy4eh(=FwgP`)~I^5~pBEWo+F6 zSf2ncyMurJN91#cJTy_u8Y}@%!bq1RkGC~-bV@SXRd4F{R-*V`bS+6;W5vZ(&+I<9$;-V|eNfLa5n-6% z2(}&uGRF;p92eS*sE*oR$@pexaqr*meB)VhmIg@h{uzkk$9~qh#cHhw#>O%)b@+(| z^IQgqzuj~Sk(J;swEM-3TrJAPCq9k^^^`q{IItKBRXYe}e0Tdr=Huf7da3$l4PdpwWDop%^}n;dD#K4s#DYA8SHZ z&1!riV4W4R7R#C))JH1~axJ)RYnM$$lIR%6fIVA@zV{XVyx}C+a-Dt8Y9M)^KU0+H zR4IUb2CJ{Hg>CuaXtD50jB(_Tcx=Z$^WYu2u5kubqmwp%drJ6 z?Fo40g!Qd<-l=TQxqHEOuPX0;^z7iX?Ke^a%XT<13TA^5`4Xcw6D@Ur&VT&CUe0d} z1GjOVF1^L@>O)l@?bD~$wzgf(nxX1OGD8fEV?TdJcZc2KoUe|oP1#=$$7ee|xbY)A zDZq+cuTpc(fFdj^=!;{k03C69lMQ(|>uhRfRu%+!k&YOi-3|1QKB z z?n?eq1XP>p-IM$Z^C;2L3itnbJZAip*Zo0aw2bs8@(s^~*8T9go!%dHcAz2lM;`yp zD=7&xjFV$S&5uDaiScyD?B-i1ze`+CoRtz`Wn+Zl&#s4&}MO{@N!ufrzjG$B79)Y2d3tBk&)TxUTw@QS0TEL_?njX|@vq?Uz(nBFK5Pq7*xj#u*R&i|?7+6# z+|r_n#SW&LXhtheZdah{ZVoqwyT{D>MC3nkFF#N)xLi{p7J1jXlmVeb;cP5?e(=f# zuT7fvjSbjS781v?7{)-X3*?>tq?)Yd)~|1{BDS(pqC zC}~H#WXlkUW*H5CDOo<)#x7%RY)A;ShGhI5s*#cRDA8YgqG(HeKDx+#(ZQ?386dv! zlXCO)w91~Vw4AmOcATuV653fa9R$fyK8ul%rG z-wfS zihugoZyr38Im?Zuh6@RcF~t1anQu7>#lPpb#}4cOA!EM11`%f*07RqOVkmX{p~KJ9 z^zP;K#|)$`^Rb{rnHGH{~>1(fawV0*Z#)}M`m8-?ZJV<+e}s9wE# z)l&az?w^5{)`S(%MRzxdNqrs1n*-=jS^_jqE*5XDrA0+VE`5^*p3CuM<&dZEeCjoz zR;uu_H9ZPZV|fQq`Cyw4nscrVwi!fE6ciMmX$!_hN7uF;jjKG)d2@aC4ropY)8etW=xJvni)8eHi`H$%#zn^WJ5NLc-rqk|u&&4Z6fD_m&JfSI1Bvb?b<*n&sfl0^t z=HnmRl`XrFvMKB%9}>PaA`m-fK6a0(8=qPkWS5bb4=v?XcWi&hRY?O5HdulRi4?fN zlsJ*N-0Qw+Yic@s0(2uy%F@ib;GjXt01Fmx5XbRo6+n|pP(&nodMoap^z{~q ziEeaUT@Mxe3vJSfI6?uLND(CNr=#^W<1b}jzW58bIfyWTDle$mmS(|x-0|2UlX+9k zQ^EX7Nw}?EzVoBfT(-LT|=9N@^hcn-_p&sqG z&*oVs2JSU+N4ZD`FhCAWaS;>|wH2G*Id|?pa#@>tyxX`+4HyIArWDvVrX)2WAOQff z0qyHu&-S@i^MS-+j--!pr4fPBj~_8({~e1bfcl0wI1kaoN>mJL6KUPQm5N7lB(ui1 zE-o%kq)&djzWJ}ob<-GfDlkB;F31j-VHKvQUGQ3sp`CwyGJk_i!y^sD0fqC@$9|jO zOqN!r!8-p==F@ZVP=U$qSpY(gQ0)59P1&t@y?5rvg<}E+GB}26NYPp4f2YFQrQtot5mn3wu_qprZ=>Ig-$ zbW26Ws~IgY>}^5w`vTB(G`PTZaDiGBo5o(tp)qli|NeV( z@H_=R8V39rt5J5YB2Ky?4eJJ#b`_iBe2ot~6%7mLt5t8Vwi^Jy7|jWXqa3amOIoRb zOr}WVFP--DsS`1WpN%~)t3R!arKF^Q$e12KEqU36AWwnCBICpH4XCsfnyrHr>$I$4 z!DpKX$OKLWarN7nv@!uIA+~RNO)l$$w}p(;b>mx8pwYvu;dD_unryX_NhT8*Tj>BTrTTL&!?O+%Rv;b?B??gSzdp?6Uug9{ zd@V08Z$BdI?fpoCS$)t4mg4rT8Q_I}h`0d-vYZ^|dOB*Q^S|xqTV*vIg?@fVFSmMpaw0qtTRbx} z({Pg?#{2`sc9)M5N$*N|4;^t$+QP?#mov zGVC@I*lBVrOU-%2y!7%)fAKjpEFsgQc4{amtiHb95KQEwvf<(3T<9-Zm$xIew#P22 zc2Ix|App^>v6(3L_MCU0d3W##AB0M~3D00EWoKZqsJYT(#@w$Y_H7G22M~ApVFTRHMI_3be)Lkn#0F*V8Pq zc}`Cjy$bE;FJ6H7p=0y#R>`}-m4(0F>%@P|?7fx{=R^uFdISRnZ2W_xQhD{YuR3t< z{6yxu=4~JkeA;|(J6_nv#>Nvs&FuLA&PW^he@t(UwFFE8)|a!R{`E`K`i^ZnyE4$k z;(749Ix|oi$c3QbEJ3b~D_kQsPz~fIUKym($a_7dJ?o+40*OLl^{=&oq$<#Q(yyrp z{J-FAniyAw9tPbe&IhQ|a`DqFTVQGQ&Gq3!C2==4x{6EJwiPZ8zub-iXoUtkJiG{} zPaR&}_fn8_z~(=;5lD-aPWD3z8PZS@AaUiomF!G8I}Mf>e~0g#BelA-5#`cj;O5>N Xviia!U7SGha1wx#SCgwmn*{w2TRX*I literal 0 HcmV?d00001 diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html new file mode 100644 index 0000000000..0abe539a72 --- /dev/null +++ b/base_business_document_import/static/description/index.html @@ -0,0 +1,425 @@ + + + + + + +Base Business Document Import + + + +
+

Base Business Document Import

+ + +

Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

+

This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

+
    +
  • account_invoice_import which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as account_invoice_import_invoice2data, account_invoice_import_ubl, etc… to support specific invoice formats),
  • +
  • sale_invoice_import which imports sale orders as CSV, XML or PDF files (this module also requires some additional modules such as sale_invoice_import_csv or sale_invoice_import_ubl to support specific order formats)
  • +
+

Table of contents

+ +
+

Bug Tracker

+

Bugs are tracked on GitHub 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.

+

Do not contact contributors directly about support or help with technical issues.

+
+
+

Credits

+
+

Authors

+
    +
  • Akretion
  • +
  • Nicolas JEUDY
  • +
+
+
+

Contributors

+ +
+
+

Maintainers

+

This module is maintained by the OCA.

+Odoo Community Association +

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.

+

This module is part of the OCA/edi project on GitHub.

+

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

+
+
+
+ + diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 8eebd2fc1c..282b135b7a 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -3,6 +3,7 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.tests.common import TransactionCase +from odoo.exceptions import UserError class TestBaseBusinessDocumentImport(TransactionCase): @@ -35,7 +36,7 @@ def test_match_shipping_partner(self): bdio = self.env['business.document.import'] partner1 = rpo.create({ 'name': 'Akretion France', - 'street': '35B rue Montgolfier', + 'street': '27 rue Henri Rolland', 'zip': '69100', 'country_id': self.env.ref('base.fr').id, 'email': 'contact@akretion.com', @@ -62,22 +63,41 @@ def test_match_shipping_partner(self): 'country_id': self.env.ref('base.fr').id, 'type': 'invoice', }) - agrolait = self.env.ref('base.res_partner_2') + demo_partner2 = self.env.ref('base.res_partner_2') shipping_dict = { 'partner': {'email': 'contact@akretion.com'}, 'address': {}, } - res = bdio._match_shipping_partner(shipping_dict, agrolait, []) + res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner1) shipping_dict['address'] = { 'zip': '92400', 'country_code': 'fr', } - res = bdio._match_shipping_partner(shipping_dict, agrolait, []) + res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner3) shipping_dict['address']['zip'] = '92500' - res = bdio._match_shipping_partner(shipping_dict, agrolait, []) - self.assertEqual(res, partner1) + with self.assertRaises(UserError): + bdio._match_shipping_partner(shipping_dict, None, []) + partner2 = rpo.create({ + 'name': 'Alex Corp', + 'zip': '69009', + 'country_id': self.env.ref('base.fr').id, + 'email': 'contact@alex.com', + }) + cpartner2 = rpo.create({ + 'name': 'Joe Taylor', + 'parent_id': partner2.id, + 'type': 'delivery', + 'zip': '69005', + 'country_id': self.env.ref('base.fr').id, + }) + shipping_dict = { + 'partner': {'email': 'contact@alex.com'}, + 'address': {'country_code': 'FR', 'zip': '69009'}, + } + res = bdio._match_shipping_partner(shipping_dict, None, []) + self.assertEqual(res, partner2) shipping_dict = { 'partner': {}, 'address': {}, From d9c86e5a18b2756c6cde2a0e8493fef29f1d6b64 Mon Sep 17 00:00:00 2001 From: Andrea Date: Fri, 3 Jan 2020 12:54:26 +0100 Subject: [PATCH 42/99] [FIX] base_business_document_import: flake8 --- .../tests/test_business_document_import.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 282b135b7a..a93a32bcc1 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -63,7 +63,6 @@ def test_match_shipping_partner(self): 'country_id': self.env.ref('base.fr').id, 'type': 'invoice', }) - demo_partner2 = self.env.ref('base.res_partner_2') shipping_dict = { 'partner': {'email': 'contact@akretion.com'}, 'address': {}, @@ -85,13 +84,6 @@ def test_match_shipping_partner(self): 'country_id': self.env.ref('base.fr').id, 'email': 'contact@alex.com', }) - cpartner2 = rpo.create({ - 'name': 'Joe Taylor', - 'parent_id': partner2.id, - 'type': 'delivery', - 'zip': '69005', - 'country_id': self.env.ref('base.fr').id, - }) shipping_dict = { 'partner': {'email': 'contact@alex.com'}, 'address': {'country_code': 'FR', 'zip': '69009'}, From 2338e16f81a43e841c1ed70959b44d2f6475725a Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Tue, 14 Apr 2020 16:32:54 +0200 Subject: [PATCH 43/99] [MIG] account_invoice_import_facturx to v12 Update technical name of module to remove '-' Up-port PR #78 Auto-creation of bank accounts upon invoice import is now optional Fix returned action when using the import wizard --- .../i18n/base_business_document_import.pot | 271 ++++++++++++++++++ base_business_document_import/i18n/cs_CZ.po | 172 +++++++---- base_business_document_import/i18n/fr.po | 153 ++++++---- .../models/business_document_import.py | 14 +- 4 files changed, 496 insertions(+), 114 deletions(-) create mode 100644 base_business_document_import/i18n/base_business_document_import.pot diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot new file mode 100644 index 0000000000..b5a748a97d --- /dev/null +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -0,0 +1,271 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 12.0\n" +"Report-Msgid-Bugs-To: \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: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:600 +#, python-format +msgid "(fixed)" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:976 +#, python-format +msgid "Notes in file %s:" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:978 +#, python-format +msgid "Notes in imported document:" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:513 +#, python-format +msgid "

Odoo couldn't find any unit of measure corresponding to the following information extracted from the business document:

  • UNECE code: %s
  • Name of the unit of measure: %s

So the unit of measure 'Unit(s)' has been used. You may have to change it manually.

" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:782 +#, python-format +msgid "Approximate match: account %s has been matched with account %s" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:891 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name +msgid "Display Name" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:692 +#, python-format +msgid "For product '%s', the unit of measure is %s on the existing line, but it is %s on the imported line. We don't support this scenario for the moment, so the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:292 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id +msgid "ID" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update +msgid "Last Modified on" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:919 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:470 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:170 +#, python-format +msgid "Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"State code: %s\n" +"Country code: %s\n" +"" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:786 +#, python-format +msgid "Odoo couldn't find any account corresponding to the following information extracted from the business document: Account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:827 +#, python-format +msgid "Odoo couldn't find any analytic account corresponding to the following information extracted from the business document: Analytic account code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:866 +#, python-format +msgid "Odoo couldn't find any journal corresponding to the following information extracted from the business document: Journal code: %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:382 +#, python-format +msgid "Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Product code: %s\n" +"Supplier: %s\n" +"" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:266 +#, python-format +msgid "Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Parent Partner: %s\n" +"ZIP: %s\n" +"State code: %s\n" +"Country code: %s\n" +"" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:588 +#, python-format +msgid "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"Tax amount: %s %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:676 +#, python-format +msgid "One of the imported lines doesn't have any product, so the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:153 +#, python-format +msgid "The %s has been identified by the domain name '%s' so please check carefully that the %s is correct." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:910 +#, python-format +msgid "The VAT number of the customer written in the business document (%s) doesn't match the VAT number of the company '%s' (%s) in which you are trying to import this document." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:114 +#, python-format +msgid "The analysis of the business document returned '%s' as %s VAT number. But there are no %s with this VAT number in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:91 +#: code:addons/base_business_document_import/models/business_document_import.py:238 +#, python-format +msgid "The analysis of the business document returned '%s' as country code. But there are no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:452 +#, python-format +msgid "The analysis of the business document returned '%s' as the country code to find the related currency. But the country '%s' doesn't have any related currency configured in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:459 +#, python-format +msgid "The analysis of the business document returned '%s' as the country code to find the related currency. But there is no country with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:416 +#, python-format +msgid "The analysis of the business document returned '%s' as the currency ISO code. But there are no currency with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:439 +#, python-format +msgid "The analysis of the business document returned '%s' as the currency symbol or ISO code. But there are none or several currencies with the symbol/ISO code in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:426 +#, python-format +msgid "The analysis of the business document returned '%s' as the currency symbol. But there are none or several currencies with that symbol in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:500 +#, python-format +msgid "The analysis of the business document returned '%s' as the unit of measure UNECE code, but there is no unit of measure with that UNECE code in Odoo. Please check the configuration of the units of measures in Odoo." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:329 +#, python-format +msgid "The analysis of the business document returned IBAN %s as bank account, but there is no such bank account in Odoo linked to partner %s and the option to automatically create bank accounts upon import is disabled." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:322 +#, python-format +msgid "The bank account IBAN %s has been automatically added on the supplier %s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:656 +#, python-format +msgid "The existing line '%s' doesn't have any product, so the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:662 +#, python-format +msgid "The product '%s' is used on several existing lines, so the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:684 +#, python-format +msgid "The product '%s' is used on several imported lines, so the lines haven't been updated." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:78 +#, python-format +msgid "customer" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:80 +#, python-format +msgid "partner" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:75 +#, python-format +msgid "supplier" +msgstr "" + diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index d7ef2c9813..01b940c517 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * base_business_document_import -# +# # Translators: # Lukáš Spurný , 2018 msgid "" @@ -11,47 +11,47 @@ msgstr "" "POT-Creation-Date: 2018-02-22 03:40+0000\n" "PO-Revision-Date: 2018-02-22 03:40+0000\n" "Last-Translator: Lukáš Spurný , 2018\n" -"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/teams/23907/cs_CZ/)\n" +"Language-Team: Czech (Czech Republic) (https://www.transifex.com/oca/" +"teams/23907/cs_CZ/)\n" +"Language: cs_CZ\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: cs_CZ\n" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:549 +#: code:addons/base_business_document_import/models/business_document_import.py:600 #, python-format msgid "(fixed)" msgstr "(Úprávy)" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:866 +#: code:addons/base_business_document_import/models/business_document_import.py:976 #, python-format msgid "Notes in file %s:" msgstr "Poznámky v souboru %s:" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:868 +#: code:addons/base_business_document_import/models/business_document_import.py:978 #, python-format msgid "Notes in imported document:" msgstr "Poznámky v importovaném dokumentu:" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:462 +#: code:addons/base_business_document_import/models/business_document_import.py:513 #, python-format msgid "" "

Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

  • UNECE code: " -"%s
  • Name of the unit of measure: %s

So the unit of " -"measure 'Unit(s)' has been used. You may have to change it " -"manually.

" +"information extracted from the business document:

  • UNECE code: %s
  • Name of the unit of measure: %s

So the unit of measure " +"'Unit(s)' has been used. You may have to change it manually.

" msgstr "" "Společnost Odoo nemohla najít žádnou měrnou jednotku, která by odpovídala " "těmto informacím získaným z obchodního dokladu: Kód UNECE %s Náměrová " "jednotka: %s Je použita měrná jednotka 'Jednotky)' Musíte ji ručně změnit." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:729 +#: code:addons/base_business_document_import/models/business_document_import.py:782 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "Přibližná shoda: účet %s byl přiřazen účtu %s" @@ -62,12 +62,18 @@ msgid "Common methods to import business documents" msgstr "Společné metody importu obchodních dokumentů" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_display_name +#: code:addons/base_business_document_import/models/business_document_import.py:891 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name msgid "Display Name" msgstr "Zobrazovaný název" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:641 +#: code:addons/base_business_document_import/models/business_document_import.py:692 #, python-format msgid "" "For product '%s', the unit of measure is %s on the existing line, but it is " @@ -79,43 +85,50 @@ msgstr "" "řádky nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:262 +#: code:addons/base_business_document_import/models/business_document_import.py:292 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s není platný, takže byl ignorován." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_id +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id msgid "ID" msgstr "ID" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import___last_update +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" msgstr "Poslední změna dne" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:419 +#: code:addons/base_business_document_import/models/business_document_import.py:919 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:470 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "Není uvedena žádná měna, takže Odoo použil měnu společnosti (%s)" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:166 +#: code:addons/base_business_document_import/models/business_document_import.py:170 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" -"Country code: %s\n" -"State code: %s\n" +"Odoo couldn't find any %s corresponding to the following information " +"extracted from the business document:\n" +"Name: %s\n" "VAT number: %s\n" +"Reference: %s\n" "E-mail: %s\n" "Website: %s\n" -"Reference: %s\n" -"Name: %s\n" +"State code: %s\n" +"Country code: %s\n" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:733 +#: code:addons/base_business_document_import/models/business_document_import.py:786 #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " @@ -123,7 +136,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:772 +#: code:addons/base_business_document_import/models/business_document_import.py:827 #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " @@ -131,7 +144,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:809 +#: code:addons/base_business_document_import/models/business_document_import.py:866 #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " @@ -139,26 +152,41 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:335 +#: code:addons/base_business_document_import/models/business_document_import.py:382 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document: Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:537 +#: code:addons/base_business_document_import/models/business_document_import.py:266 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" +"Parent Partner: %s\n" +"ZIP: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:588 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " +"in Price' = '%s' which correspond to the following information extracted " +"from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" "Tax amount: %s %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:625 +#: code:addons/base_business_document_import/models/business_document_import.py:676 #, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " @@ -166,15 +194,24 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:149 +#: code:addons/base_business_document_import/models/business_document_import.py:153 +#, python-format +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully " +"that the %s is correct." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:910 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully" -" that the %s is correct." +"The VAT number of the customer written in the business document (%s) doesn't " +"match the VAT number of the company '%s' (%s) in which you are trying to " +"import this document." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:115 +#: code:addons/base_business_document_import/models/business_document_import.py:114 #, python-format msgid "" "The analysis of the business document returned '%s' as %s VAT number. But " @@ -182,8 +219,8 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:87 -#: code:addons/base_business_document_import/models/business_document_import.py:225 +#: code:addons/base_business_document_import/models/business_document_import.py:91 +#: code:addons/base_business_document_import/models/business_document_import.py:238 #, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " @@ -191,7 +228,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:406 +#: code:addons/base_business_document_import/models/business_document_import.py:452 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -200,7 +237,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:413 +#: code:addons/base_business_document_import/models/business_document_import.py:459 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -208,7 +245,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:369 +#: code:addons/base_business_document_import/models/business_document_import.py:416 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " @@ -216,17 +253,22 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:392 -#, python-format +#: code:addons/base_business_document_import/models/business_document_import.py:439 +#, fuzzy, python-format +#| msgid "" +#| "The analysis of the business document returned '%s' as the currency " +#| "symbol or ISO code. But there are no currency with the symbol nor ISO " +#| "code in Odoo." msgid "" "The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are no currency with the symbol nor ISO code in Odoo." +"or ISO code. But there are none or several currencies with the symbol/ISO " +"code in Odoo." msgstr "" "Analýza obchodního dokladu vrátila hodnotu \"%s\" jako symbol měny nebo kód " "ISO. Neexistuje však žádná měna se symbolem ani kódem ISO v Odoo." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:379 +#: code:addons/base_business_document_import/models/business_document_import.py:426 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " @@ -236,7 +278,7 @@ msgstr "" "neexistuje žádný nebo několik měn s tímto symbolem." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:449 +#: code:addons/base_business_document_import/models/business_document_import.py:500 #, python-format msgid "" "The analysis of the business document returned '%s' as the unit of measure " @@ -248,35 +290,47 @@ msgstr "" "prosím konfiguraci jednotek opatření v Odoo." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:289 +#: code:addons/base_business_document_import/models/business_document_import.py:329 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier" -" %s" +"The analysis of the business document returned IBAN %s as bank " +"account, but there is no such bank account in Odoo linked to partner %s and the option to " +"automatically create bank accounts upon import is disabled." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:322 +#, fuzzy, python-format +#| msgid "" +#| "The bank account IBAN %s has been automatically added on the " +#| "supplier %s" +msgid "" +"The bank account IBAN %s has been automatically added on the supplier " +"%s" msgstr "Bankovní účet 1IBAN %s byl automaticky přidán na dodavatele %s" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:605 +#: code:addons/base_business_document_import/models/business_document_import.py:656 #, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." msgstr "" -"Existující řádek '%s' nemá žádný produkt, takže 1 řádky nebyly " -"aktualizovány." +"Existující řádek '%s' nemá žádný produkt, takže 1 řádky nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:611 +#: code:addons/base_business_document_import/models/business_document_import.py:662 #, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." msgstr "" -"Produkt '%s' se používá na několika existujících linkách, takže řádky nebyly" -" aktualizovány." +"Produkt '%s' se používá na několika existujících linkách, takže řádky nebyly " +"aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:633 +#: code:addons/base_business_document_import/models/business_document_import.py:684 #, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " @@ -286,19 +340,19 @@ msgstr "" "nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:72 +#: code:addons/base_business_document_import/models/business_document_import.py:78 #, python-format msgid "customer" msgstr "zákazník" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:75 +#: code:addons/base_business_document_import/models/business_document_import.py:80 #, python-format msgid "partner" msgstr "partner" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:69 +#: code:addons/base_business_document_import/models/business_document_import.py:75 #, python-format msgid "supplier" msgstr "dodavatele" diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 985b26ac0f..5f0d04a0bb 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -1,7 +1,7 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: # * base_business_document_import -# +# # Translators: # OCA Transbot , 2018 msgid "" @@ -12,43 +12,42 @@ msgstr "" "PO-Revision-Date: 2018-02-22 03:40+0000\n" "Last-Translator: OCA Transbot , 2018\n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" +"Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:549 +#: code:addons/base_business_document_import/models/business_document_import.py:600 #, python-format msgid "(fixed)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:866 +#: code:addons/base_business_document_import/models/business_document_import.py:976 #, python-format msgid "Notes in file %s:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:868 +#: code:addons/base_business_document_import/models/business_document_import.py:978 #, python-format msgid "Notes in imported document:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:462 +#: code:addons/base_business_document_import/models/business_document_import.py:513 #, python-format msgid "" "

Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

  • UNECE code: " -"%s
  • Name of the unit of measure: %s

So the unit of " -"measure 'Unit(s)' has been used. You may have to change it " -"manually.

" +"information extracted from the business document:

  • UNECE code: %s
  • Name of the unit of measure: %s

So the unit of measure " +"'Unit(s)' has been used. You may have to change it manually.

" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:729 +#: code:addons/base_business_document_import/models/business_document_import.py:782 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "" @@ -59,12 +58,18 @@ msgid "Common methods to import business documents" msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_display_name +#: code:addons/base_business_document_import/models/business_document_import.py:891 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name msgid "Display Name" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:641 +#: code:addons/base_business_document_import/models/business_document_import.py:692 #, python-format msgid "" "For product '%s', the unit of measure is %s on the existing line, but it is " @@ -73,43 +78,50 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:262 +#: code:addons/base_business_document_import/models/business_document_import.py:292 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import_id +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id msgid "ID" msgstr "ID" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import___last_update +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:419 +#: code:addons/base_business_document_import/models/business_document_import.py:919 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:470 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:166 +#: code:addons/base_business_document_import/models/business_document_import.py:170 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" -"Country code: %s\n" -"State code: %s\n" +"Odoo couldn't find any %s corresponding to the following information " +"extracted from the business document:\n" +"Name: %s\n" "VAT number: %s\n" +"Reference: %s\n" "E-mail: %s\n" "Website: %s\n" -"Reference: %s\n" -"Name: %s\n" +"State code: %s\n" +"Country code: %s\n" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:733 +#: code:addons/base_business_document_import/models/business_document_import.py:786 #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " @@ -117,7 +129,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:772 +#: code:addons/base_business_document_import/models/business_document_import.py:827 #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " @@ -125,7 +137,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:809 +#: code:addons/base_business_document_import/models/business_document_import.py:866 #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " @@ -133,26 +145,41 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:335 +#: code:addons/base_business_document_import/models/business_document_import.py:382 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document: Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:537 +#: code:addons/base_business_document_import/models/business_document_import.py:266 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" +"Parent Partner: %s\n" +"ZIP: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:588 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " +"in Price' = '%s' which correspond to the following information extracted " +"from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" "Tax amount: %s %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:625 +#: code:addons/base_business_document_import/models/business_document_import.py:676 #, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " @@ -160,15 +187,24 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:149 +#: code:addons/base_business_document_import/models/business_document_import.py:153 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully" -" that the %s is correct." +"The %s has been identified by the domain name '%s' so please check carefully " +"that the %s is correct." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:115 +#: code:addons/base_business_document_import/models/business_document_import.py:910 +#, python-format +msgid "" +"The VAT number of the customer written in the business document (%s) doesn't " +"match the VAT number of the company '%s' (%s) in which you are trying to " +"import this document." +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:114 #, python-format msgid "" "The analysis of the business document returned '%s' as %s VAT number. But " @@ -176,8 +212,8 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:87 -#: code:addons/base_business_document_import/models/business_document_import.py:225 +#: code:addons/base_business_document_import/models/business_document_import.py:91 +#: code:addons/base_business_document_import/models/business_document_import.py:238 #, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " @@ -185,7 +221,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:406 +#: code:addons/base_business_document_import/models/business_document_import.py:452 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -194,7 +230,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:413 +#: code:addons/base_business_document_import/models/business_document_import.py:459 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -202,7 +238,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:369 +#: code:addons/base_business_document_import/models/business_document_import.py:416 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " @@ -210,15 +246,16 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:392 +#: code:addons/base_business_document_import/models/business_document_import.py:439 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are no currency with the symbol nor ISO code in Odoo." +"or ISO code. But there are none or several currencies with the symbol/ISO " +"code in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:379 +#: code:addons/base_business_document_import/models/business_document_import.py:426 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " @@ -226,7 +263,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:449 +#: code:addons/base_business_document_import/models/business_document_import.py:500 #, python-format msgid "" "The analysis of the business document returned '%s' as the unit of measure " @@ -235,15 +272,25 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:289 +#: code:addons/base_business_document_import/models/business_document_import.py:329 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier" -" %s" +"The analysis of the business document returned IBAN %s as bank " +"account, but there is no such bank account in Odoo linked to partner %s and the option to " +"automatically create bank accounts upon import is disabled." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:605 +#: code:addons/base_business_document_import/models/business_document_import.py:322 +#, python-format +msgid "" +"The bank account IBAN %s has been automatically added on the supplier " +"%s" +msgstr "" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:656 #, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " @@ -251,7 +298,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:611 +#: code:addons/base_business_document_import/models/business_document_import.py:662 #, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " @@ -259,7 +306,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:633 +#: code:addons/base_business_document_import/models/business_document_import.py:684 #, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " @@ -267,19 +314,19 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:72 +#: code:addons/base_business_document_import/models/business_document_import.py:78 #, python-format msgid "customer" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:75 +#: code:addons/base_business_document_import/models/business_document_import.py:80 #, python-format msgid "partner" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:69 +#: code:addons/base_business_document_import/models/business_document_import.py:75 #, python-format msgid "supplier" msgstr "" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index c4bdd3dbbc..91fbb48876 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -321,9 +321,19 @@ def _match_partner_bank( }) chatter_msg.append(_( "The bank account IBAN %s has been automatically " - "added on the supplier %s") % ( - iban, partner.name)) + "added on the supplier " + "%s") % ( + iban, partner.id, partner.display_name)) return partner_bank + else: + chatter_msg.append(_( + "The analysis of the business document returned " + "IBAN %s as bank account, but there is no such " + "bank account in Odoo linked to partner " + "%s and " + "the option to automatically create bank " + "accounts upon import is disabled.") + % (iban, partner.id, partner.display_name)) @api.model def _match_product(self, product_dict, chatter_msg, seller=False): From 0fb4eb9dccf2af9adcc2cdc31436f18bce772ad6 Mon Sep 17 00:00:00 2001 From: sebalix Date: Wed, 13 May 2020 16:04:25 +0200 Subject: [PATCH 44/99] [IMP] base_business_document_import: black, isort, prettier --- base_business_document_import/__manifest__.py | 23 +- .../models/business_document_import.py | 1181 +++++++++-------- .../tests/test_business_document_import.py | 344 ++--- 3 files changed, 844 insertions(+), 704 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 6ecb280c18..b26531d227 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -3,18 +3,13 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). { - 'name': 'Base Business Document Import', - 'version': '12.0.1.0.0', - 'category': 'Tools', - 'license': 'AGPL-3', - 'summary': 'Provides technical tools to import sale orders or supplier ' - 'invoices', - 'author': 'Akretion, Nicolas JEUDY, Odoo Community Association (OCA)', - 'website': 'https://github.com/OCA/edi', - 'depends': [ - 'base_vat_sanitized', - 'account_tax_unece', - 'uom_unece', - ], - 'external_dependencies': {'python': ['PyPDF2']}, + "name": "Base Business Document Import", + "version": "12.0.1.0.0", + "category": "Tools", + "license": "AGPL-3", + "summary": "Provides technical tools to import sale orders or supplier invoices", + "author": "Akretion, Nicolas JEUDY, Odoo Community Association (OCA)", + "website": "https://github.com/OCA/edi", + "depends": ["base_vat_sanitized", "account_tax_unece", "uom_unece"], + "external_dependencies": {"python": ["PyPDF2"]}, } diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 91fbb48876..4e7fbdcaf3 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -2,33 +2,37 @@ # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo import models, api, _ -from odoo.tools import float_compare -from odoo.addons.base_iban.models.res_partner_bank import validate_iban -from odoo.exceptions import UserError -from lxml import etree -from io import BytesIO +import logging import mimetypes +from io import BytesIO from urllib.parse import urlparse -import logging + +from lxml import etree + +from odoo import _, api, models +from odoo.exceptions import UserError +from odoo.tools import float_compare + +from odoo.addons.base_iban.models.res_partner_bank import validate_iban + logger = logging.getLogger(__name__) try: import PyPDF2 except ImportError: - logger.debug('Cannot import PyPDF2') + logger.debug("Cannot import PyPDF2") class BusinessDocumentImport(models.AbstractModel): - _name = 'business.document.import' - _description = 'Common methods to import business documents' + _name = "business.document.import" + _description = "Common methods to import business documents" @api.model def user_error_wrap(self, error_msg): assert error_msg - prefix = self._context.get('error_prefix') + prefix = self._context.get("error_prefix") if prefix and isinstance(prefix, str): - error_msg = '%s\n%s' % (prefix, error_msg) + error_msg = "{}\n{}".format(prefix, error_msg) raise UserError(error_msg) @api.model @@ -37,14 +41,13 @@ def _strip_cleanup_dict(self, match_dict): for key, value in match_dict.items(): if value and isinstance(value, str): match_dict[key] = value.strip() - if match_dict.get('country_code'): - match_dict['country_code'] = match_dict['country_code'].upper() - if match_dict.get('state_code'): - match_dict['state_code'] = match_dict['state_code'].upper() + if match_dict.get("country_code"): + match_dict["country_code"] = match_dict["country_code"].upper() + if match_dict.get("state_code"): + match_dict["state_code"] = match_dict["state_code"].upper() - @api.model - def _match_partner( - self, partner_dict, chatter_msg, partner_type='supplier'): + @api.model # noqa: C901 + def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): """Example: partner_dict = { 'country_code': 'FR', @@ -59,138 +62,152 @@ def _match_partner( The key 'phone' is used by the module base_phone_business_document_import """ - rpo = self.env['res.partner'] + rpo = self.env["res.partner"] self._strip_cleanup_dict(partner_dict) - if partner_dict.get('recordset'): - return partner_dict['recordset'] - if partner_dict.get('id'): - return rpo.browse(partner_dict['id']) - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - domain = [ - '|', ('company_id', '=', False), - ('company_id', '=', company_id)] - if partner_type == 'supplier': - domain += [('supplier', '=', True)] - partner_type_label = _('supplier') - elif partner_type == 'customer': - domain += [('customer', '=', True)] - partner_type_label = _('customer') + if partner_dict.get("recordset"): + return partner_dict["recordset"] + if partner_dict.get("id"): + return rpo.browse(partner_dict["id"]) + company_id = self._context.get("force_company") or self.env.user.company_id.id + domain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + if partner_type == "supplier": + domain += [("supplier", "=", True)] + partner_type_label = _("supplier") + elif partner_type == "customer": + domain += [("customer", "=", True)] + partner_type_label = _("customer") else: - partner_type_label = _('partner') + partner_type_label = _("partner") country = False - if partner_dict.get('country_code'): - country = self.env['res.country'].search([ - ('code', '=', partner_dict['country_code'])], limit=1) + if partner_dict.get("country_code"): + country = self.env["res.country"].search( + [("code", "=", partner_dict["country_code"])], limit=1 + ) if country: domain += [ - '|', - ('country_id', '=', False), - ('country_id', '=', country.id)] + "|", + ("country_id", "=", False), + ("country_id", "=", country.id), + ] else: - chatter_msg.append(_( - "The analysis of the business document returned '%s' as " - "country code. But there are no country with that code " - "in Odoo.") % partner_dict['country_code']) - if country and partner_dict.get('state_code'): - state = self.env['res.country.state'].search([ - ('code', '=', partner_dict['state_code']), - ('country_id', '=', country.id)], limit=1) + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "country code. But there are no country with that code " + "in Odoo." + ) + % partner_dict["country_code"] + ) + if country and partner_dict.get("state_code"): + state = self.env["res.country.state"].search( + [ + ("code", "=", partner_dict["state_code"]), + ("country_id", "=", country.id), + ], + limit=1, + ) if state: - domain += [ - '|', - ('state_id', '=', False), - ('state_id', '=', state.id)] - if partner_dict.get('vat'): - vat = partner_dict['vat'].replace(' ', '').upper() + domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] + if partner_dict.get("vat"): + vat = partner_dict["vat"].replace(" ", "").upper() # use base_vat_sanitized partner = rpo.search( - domain + [ - ('parent_id', '=', False), - ('sanitized_vat', '=', vat)], limit=1) + domain + [("parent_id", "=", False), ("sanitized_vat", "=", vat)], + limit=1, + ) if partner: return partner else: - chatter_msg.append(_( - "The analysis of the business document returned '%s' as " - "%s VAT number. But there are no %s " - "with this VAT number in Odoo.") - % (vat, partner_type_label, partner_type_label)) + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "%s VAT number. But there are no %s " + "with this VAT number in Odoo." + ) + % (vat, partner_type_label, partner_type_label) + ) # Hook to plug alternative matching methods partner = self._hook_match_partner( - partner_dict, chatter_msg, domain, partner_type_label) + partner_dict, chatter_msg, domain, partner_type_label + ) if partner: return partner website_domain = False email_domain = False - if partner_dict.get('email') and '@' in partner_dict['email']: + if partner_dict.get("email") and "@" in partner_dict["email"]: partner = rpo.search( - domain + [('email', '=ilike', partner_dict['email'])], limit=1) + domain + [("email", "=ilike", partner_dict["email"])], limit=1 + ) if partner: return partner else: - email_domain = partner_dict['email'].split('@')[1] - if partner_dict.get('website'): - urlp = urlparse(partner_dict['website']) + email_domain = partner_dict["email"].split("@")[1] + if partner_dict.get("website"): + urlp = urlparse(partner_dict["website"]) netloc = urlp.netloc if not urlp.scheme and not netloc: netloc = urlp.path - if netloc and len(netloc.split('.')) >= 2: - website_domain = '.'.join(netloc.split('.')[-2:]) + if netloc and len(netloc.split(".")) >= 2: + website_domain = ".".join(netloc.split(".")[-2:]) if website_domain or email_domain: partner_domain = website_domain or email_domain partner = rpo.search( - domain + - [('website', '=ilike', '%' + partner_domain + '%')], limit=1) + domain + [("website", "=ilike", "%" + partner_domain + "%")], limit=1 + ) # I can't search on email addresses with # email_domain because of the emails such as # @gmail.com, @yahoo.com that may match random partners if not partner and website_domain: partner = rpo.search( - domain + - [('email', '=ilike', '%@' + website_domain)], limit=1) + domain + [("email", "=ilike", "%@" + website_domain)], limit=1 + ) if partner: - chatter_msg.append(_( - "The %s has been identified by the domain name '%s' " - "so please check carefully that the %s is correct.") % ( - partner_type_label, - partner_domain, - partner_type_label)) + chatter_msg.append( + _( + "The %s has been identified by the domain name '%s' " + "so please check carefully that the %s is correct." + ) + % (partner_type_label, partner_domain, partner_type_label) + ) return partner - if partner_dict.get('ref'): - partner = rpo.search( - domain + [('ref', '=', partner_dict['ref'])], limit=1) + if partner_dict.get("ref"): + partner = rpo.search(domain + [("ref", "=", partner_dict["ref"])], limit=1) if partner: return partner - if partner_dict.get('name'): + if partner_dict.get("name"): partner = rpo.search( - domain + [('name', '=ilike', partner_dict['name'])], limit=1) + domain + [("name", "=ilike", partner_dict["name"])], limit=1 + ) if partner: return partner - raise self.user_error_wrap(_( - "Odoo couldn't find any %s corresponding to the following " - "information extracted from the business document:\n" - "Name: %s\n" - "VAT number: %s\n" - "Reference: %s\n" - "E-mail: %s\n" - "Website: %s\n" - "State code: %s\n" - "Country code: %s\n") + raise self.user_error_wrap( + _( + "Odoo couldn't find any %s corresponding to the following " + "information extracted from the business document:\n" + "Name: %s\n" + "VAT number: %s\n" + "Reference: %s\n" + "E-mail: %s\n" + "Website: %s\n" + "State code: %s\n" + "Country code: %s\n" + ) % ( partner_type_label, - partner_dict.get('name'), - partner_dict.get('vat'), - partner_dict.get('ref'), - partner_dict.get('email'), - partner_dict.get('website'), - partner_dict.get('state_code'), - partner_dict.get('country_code'), - )) + partner_dict.get("name"), + partner_dict.get("vat"), + partner_dict.get("ref"), + partner_dict.get("email"), + partner_dict.get("website"), + partner_dict.get("state_code"), + partner_dict.get("country_code"), + ) + ) @api.model def _hook_match_partner( - self, partner_dict, chatter_msg, domain, partner_type_label): + self, partner_dict, chatter_msg, domain, partner_type_label + ): return False @api.model @@ -209,53 +226,61 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): The partner argument is a bit special: it is a fallback in case shipping_dict['partner'] = {} """ - rpo = self.env['res.partner'] - if shipping_dict.get('partner'): + rpo = self.env["res.partner"] + if shipping_dict.get("partner"): partner = self._match_partner( - shipping_dict['partner'], chatter_msg, partner_type=False) - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id + shipping_dict["partner"], chatter_msg, partner_type=False + ) + company_id = self._context.get("force_company") or self.env.user.company_id.id domain = [ - '|', ('company_id', '=', False), - ('company_id', '=', company_id), - ('parent_id', '=', partner.id), - ] - address_dict = shipping_dict['address'] + "|", + ("company_id", "=", False), + ("company_id", "=", company_id), + ("parent_id", "=", partner.id), + ] + address_dict = shipping_dict["address"] self._strip_cleanup_dict(address_dict) country = False parent_partner_matches = True - if address_dict.get('country_code'): - country = self.env['res.country'].search([ - ('code', '=', address_dict['country_code'])], limit=1) + if address_dict.get("country_code"): + country = self.env["res.country"].search( + [("code", "=", address_dict["country_code"])], limit=1 + ) if country: domain += [ - '|', - ('country_id', '=', False), - ('country_id', '=', country.id)] + "|", + ("country_id", "=", False), + ("country_id", "=", country.id), + ] if partner.country_id != country: parent_partner_matches = False else: - chatter_msg.append(_( - "The analysis of the business document returned '%s' as " - "country code. But there are no country with that code " - "in Odoo.") % address_dict['country_code']) - if country and address_dict.get('state_code'): - state = self.env['res.country.state'].search([ - ('code', '=', address_dict['state_code']), - ('country_id', '=', country.id)], limit=1) + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "country code. But there are no country with that code " + "in Odoo." + ) + % address_dict["country_code"] + ) + if country and address_dict.get("state_code"): + state = self.env["res.country.state"].search( + [ + ("code", "=", address_dict["state_code"]), + ("country_id", "=", country.id), + ], + limit=1, + ) if state: - domain += [ - '|', - ('state_id', '=', False), - ('state_id', '=', state.id)] + domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] if partner.state_id and partner.state_id != state: parent_partner_matches = False - if address_dict.get('zip'): - domain.append(('zip', '=', address_dict['zip'])) + if address_dict.get("zip"): + domain.append(("zip", "=", address_dict["zip"])) # sanitize ZIP ? - if partner.zip != address_dict['zip']: + if partner.zip != address_dict["zip"]: parent_partner_matches = False - spartner = rpo.search(domain + [('type', '=', 'delivery')], limit=1) + spartner = rpo.search(domain + [("type", "=", "delivery")], limit=1) if spartner: return spartner spartner = rpo.search(domain, limit=1) @@ -263,77 +288,89 @@ def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): return spartner if parent_partner_matches: return partner - raise self.user_error_wrap(_( - "Odoo couldn't find any shipping partner corresponding to the " - "following information extracted from the business document:\n" - "Parent Partner: %s\n" - "ZIP: %s\n" - "State code: %s\n" - "Country code: %s\n") + raise self.user_error_wrap( + _( + "Odoo couldn't find any shipping partner corresponding to the " + "following information extracted from the business document:\n" + "Parent Partner: %s\n" + "ZIP: %s\n" + "State code: %s\n" + "Country code: %s\n" + ) % ( partner.display_name, - address_dict.get('zip'), - address_dict.get('state_code'), - address_dict.get('country_code'), - )) + address_dict.get("zip"), + address_dict.get("state_code"), + address_dict.get("country_code"), + ) + ) @api.model def _match_partner_bank( - self, partner, iban, bic, chatter_msg, create_if_not_found=False): - assert iban, 'iban is a required arg' - assert partner, 'partner is a required arg' + self, partner, iban, bic, chatter_msg, create_if_not_found=False + ): + assert iban, "iban is a required arg" + assert partner, "partner is a required arg" partner = partner.commercial_partner_id - iban = iban.replace(' ', '').upper() - rpbo = self.env['res.partner.bank'] - rbo = self.env['res.bank'] + iban = iban.replace(" ", "").upper() + rpbo = self.env["res.partner.bank"] + rbo = self.env["res.bank"] try: validate_iban(iban) - except Exception as e: - chatter_msg.append(_( - "IBAN %s is not valid, so it has been ignored.") % iban) + except Exception: + chatter_msg.append( + _("IBAN %s is not valid, so it has been ignored.") % iban + ) return False - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - bankaccount = rpbo.search([ - '|', ('company_id', '=', False), - ('company_id', '=', company_id), - ('sanitized_acc_number', '=', iban), - ('partner_id', '=', partner.id)], limit=1) + company_id = self._context.get("force_company") or self.env.user.company_id.id + bankaccount = rpbo.search( + [ + "|", + ("company_id", "=", False), + ("company_id", "=", company_id), + ("sanitized_acc_number", "=", iban), + ("partner_id", "=", partner.id), + ], + limit=1, + ) if bankaccount: return bankaccount elif create_if_not_found: bank_id = False if bic: - bic = bic.replace(' ', '').upper() - bank = rbo.search([('bic', '=', bic)], limit=1) + bic = bic.replace(" ", "").upper() + bank = rbo.search([("bic", "=", bic)], limit=1) if bank: bank_id = bank.id else: - bank = rbo.create({ - 'bic': bic, - 'name': bic, # TODO: see if we could do better - }) + bank = rbo.create( + {"bic": bic, "name": bic} # TODO: see if we could do better + ) bank_id = bank.id - partner_bank = rpbo.create({ - 'partner_id': partner.id, - 'acc_number': iban, - 'bank_id': bank_id, - }) - chatter_msg.append(_( - "The bank account IBAN %s has been automatically " - "added on the supplier " - "%s") % ( - iban, partner.id, partner.display_name)) + partner_bank = rpbo.create( + {"partner_id": partner.id, "acc_number": iban, "bank_id": bank_id} + ) + chatter_msg.append( + _( + "The bank account IBAN %s has been automatically " + "added on the supplier " + "%s" + ) + % (iban, partner.id, partner.display_name) + ) return partner_bank else: - chatter_msg.append(_( - "The analysis of the business document returned " - "IBAN %s as bank account, but there is no such " - "bank account in Odoo linked to partner " - "%s and " - "the option to automatically create bank " - "accounts upon import is disabled.") - % (iban, partner.id, partner.display_name)) + chatter_msg.append( + _( + "The analysis of the business document returned " + "IBAN %s as bank account, but there is no such " + "bank account in Odoo linked to partner " + "%s and " + "the option to automatically create bank " + "accounts upon import is disabled." + ) + % (iban, partner.id, partner.display_name) + ) @api.model def _match_product(self, product_dict, chatter_msg, seller=False): @@ -343,51 +380,63 @@ def _match_product(self, product_dict, chatter_msg, seller=False): 'code': 'COCA1L', } """ - ppo = self.env['product.product'] + ppo = self.env["product.product"] self._strip_cleanup_dict(product_dict) - if product_dict.get('recordset'): - return product_dict['recordset'] - if product_dict.get('id'): - return ppo.browse(product_dict['id']) - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - cdomain = [ - '|', ('company_id', '=', False), ('company_id', '=', company_id)] - if product_dict.get('barcode'): - product = ppo.search(cdomain + [ - ('barcode', '=', product_dict['barcode'])], limit=1) + if product_dict.get("recordset"): + return product_dict["recordset"] + if product_dict.get("id"): + return ppo.browse(product_dict["id"]) + company_id = self._context.get("force_company") or self.env.user.company_id.id + cdomain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + if product_dict.get("barcode"): + product = ppo.search( + cdomain + [("barcode", "=", product_dict["barcode"])], limit=1 + ) if product: return product - if product_dict.get('code'): - product = ppo.search(cdomain + [ - '|', - ('barcode', '=', product_dict['code']), - ('default_code', '=', product_dict['code'])], limit=1) + if product_dict.get("code"): + product = ppo.search( + cdomain + + [ + "|", + ("barcode", "=", product_dict["code"]), + ("default_code", "=", product_dict["code"]), + ], + limit=1, + ) if product: return product # WARNING: Won't work for multi-variant products # because product.supplierinfo is attached to product template if seller: - sinfo = self.env['product.supplierinfo'].search(cdomain + [ - ('name', '=', seller.id), - ('product_code', '=', product_dict['code']), - ], limit=1) + sinfo = self.env["product.supplierinfo"].search( + cdomain + + [ + ("name", "=", seller.id), + ("product_code", "=", product_dict["code"]), + ], + limit=1, + ) if ( - sinfo and - sinfo.product_tmpl_id.product_variant_ids and - len( - sinfo.product_tmpl_id.product_variant_ids) == 1 + sinfo + and sinfo.product_tmpl_id.product_variant_ids + and len(sinfo.product_tmpl_id.product_variant_ids) == 1 ): return sinfo.product_tmpl_id.product_variant_ids[0] - raise self.user_error_wrap(_( - "Odoo couldn't find any product corresponding to the " - "following information extracted from the business document: " - "Barcode: %s\n" - "Product code: %s\n" - "Supplier: %s\n") % ( - product_dict.get('barcode'), - product_dict.get('code'), - seller and seller.name or 'None')) + raise self.user_error_wrap( + _( + "Odoo couldn't find any product corresponding to the " + "following information extracted from the business document: " + "Barcode: %s\n" + "Product code: %s\n" + "Supplier: %s\n" + ) + % ( + product_dict.get("barcode"), + product_dict.get("code"), + seller and seller.name or "None", + ) + ) @api.model def _match_currency(self, currency_dict, chatter_msg): @@ -400,76 +449,94 @@ def _match_currency(self, currency_dict, chatter_msg): """ if not currency_dict: currency_dict = {} - rco = self.env['res.currency'] + rco = self.env["res.currency"] self._strip_cleanup_dict(currency_dict) - if currency_dict.get('recordset'): - return currency_dict['recordset'] - if currency_dict.get('id'): - return rco.browse(currency_dict['id']) - if currency_dict.get('iso'): - currency_iso = currency_dict['iso'].upper() - currency = rco.search( - [('name', '=', currency_iso)], limit=1) + if currency_dict.get("recordset"): + return currency_dict["recordset"] + if currency_dict.get("id"): + return rco.browse(currency_dict["id"]) + if currency_dict.get("iso"): + currency_iso = currency_dict["iso"].upper() + currency = rco.search([("name", "=", currency_iso)], limit=1) if currency: return currency else: - raise self.user_error_wrap(_( - "The analysis of the business document returned '%s' as " - "the currency ISO code. But there are no currency " - "with that code in Odoo.") % currency_iso) - if currency_dict.get('symbol'): - currencies = rco.search( - [('symbol', '=', currency_dict['symbol'])]) + raise self.user_error_wrap( + _( + "The analysis of the business document returned '%s' as " + "the currency ISO code. But there are no currency " + "with that code in Odoo." + ) + % currency_iso + ) + if currency_dict.get("symbol"): + currencies = rco.search([("symbol", "=", currency_dict["symbol"])]) if len(currencies) == 1: return currencies[0] else: - chatter_msg.append(_( - "The analysis of the business document returned '%s' as " - "the currency symbol. But there are none or several " - "currencies with that symbol in Odoo.") - % currency_dict['symbol']) - if currency_dict.get('iso_or_symbol'): - currencies = rco.search([ - '|', - ('name', '=', currency_dict['iso_or_symbol'].upper()), - ('symbol', '=', currency_dict['iso_or_symbol'])]) + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "the currency symbol. But there are none or several " + "currencies with that symbol in Odoo." + ) + % currency_dict["symbol"] + ) + if currency_dict.get("iso_or_symbol"): + currencies = rco.search( + [ + "|", + ("name", "=", currency_dict["iso_or_symbol"].upper()), + ("symbol", "=", currency_dict["iso_or_symbol"]), + ] + ) if len(currencies) == 1: return currencies[0] else: - raise self.user_error_wrap(_( - "The analysis of the business document returned '%s' as " - "the currency symbol or ISO code. But there are none or " - "several currencies with the symbol/ISO code in Odoo.") - % currency_dict['iso_or_symbol']) - if currency_dict.get('country_code'): - country_code = currency_dict['country_code'] - country = self.env['res.country'].search([ - ('code', '=', country_code)], limit=1) + raise self.user_error_wrap( + _( + "The analysis of the business document returned '%s' as " + "the currency symbol or ISO code. But there are none or " + "several currencies with the symbol/ISO code in Odoo." + ) + % currency_dict["iso_or_symbol"] + ) + if currency_dict.get("country_code"): + country_code = currency_dict["country_code"] + country = self.env["res.country"].search( + [("code", "=", country_code)], limit=1 + ) if country: if country.currency_id: return country.currency_id else: - raise self.user_error_wrap(_( + raise self.user_error_wrap( + _( + "The analysis of the business document returned '%s' " + "as the country code to find the related currency. " + "But the country '%s' doesn't have any related " + "currency configured in Odoo." + ) + % (country_code, country.name) + ) + else: + raise self.user_error_wrap( + _( "The analysis of the business document returned '%s' " "as the country code to find the related currency. " - "But the country '%s' doesn't have any related " - "currency configured in Odoo.") - % (country_code, country.name)) - else: - raise self.user_error_wrap(_( - "The analysis of the business document returned '%s' " - "as the country code to find the related currency. " - "But there is no country with that code in Odoo.") - % country_code) - if self._context.get('force_company'): - company = self.env['res.company'].browse( - self._context['force_company']) + "But there is no country with that code in Odoo." + ) + % country_code + ) + if self._context.get("force_company"): + company = self.env["res.company"].browse(self._context["force_company"]) else: company = self.env.user.company_id company_cur = company.currency_id - chatter_msg.append(_( - 'No currency specified, so Odoo used the company currency (%s)') - % company_cur.name) + chatter_msg.append( + _("No currency specified, so Odoo used the company currency (%s)") + % company_cur.name + ) return company_cur @api.model @@ -480,62 +547,70 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): 'name': 'Liter', } """ - uuo = self.env['uom.uom'] + uuo = self.env["uom.uom"] if not uom_dict: uom_dict = {} self._strip_cleanup_dict(uom_dict) - if uom_dict.get('recordset'): - return uom_dict['recordset'] - if uom_dict.get('id'): - return uuo.browse(uom_dict['id']) - if uom_dict.get('unece_code'): + if uom_dict.get("recordset"): + return uom_dict["recordset"] + if uom_dict.get("id"): + return uuo.browse(uom_dict["id"]) + if uom_dict.get("unece_code"): # Map NIU to Unit - if uom_dict['unece_code'] == 'NIU': - uom_dict['unece_code'] = 'C62' - uom = uuo.search([ - ('unece_code', '=', uom_dict['unece_code'])], limit=1) + if uom_dict["unece_code"] == "NIU": + uom_dict["unece_code"] = "C62" + uom = uuo.search([("unece_code", "=", uom_dict["unece_code"])], limit=1) if uom: return uom else: - chatter_msg.append(_( - "The analysis of the business document returned '%s' " - "as the unit of measure UNECE code, but there is no " - "unit of measure with that UNECE code in Odoo. Please " - "check the configuration of the units of measures in " - "Odoo.") % uom_dict['unece_code']) - if uom_dict.get('name'): - uom = uuo.search([ - ('name', '=ilike', uom_dict['name'] + '%')], limit=1) + chatter_msg.append( + _( + "The analysis of the business document returned '%s' " + "as the unit of measure UNECE code, but there is no " + "unit of measure with that UNECE code in Odoo. Please " + "check the configuration of the units of measures in " + "Odoo." + ) + % uom_dict["unece_code"] + ) + if uom_dict.get("name"): + uom = uuo.search([("name", "=ilike", uom_dict["name"] + "%")], limit=1) if uom: return uom if product: return product.uom_id - chatter_msg.append(_( - "

Odoo couldn't find any unit of measure corresponding to the " - "following information extracted from the business document:

" - "
  • UNECE code: %s
  • " - "
  • Name of the unit of measure: %s
" - "

So the unit of measure 'Unit(s)' has been used. You may " - "have to change it manually.

") - % (uom_dict.get('unece_code'), uom_dict.get('name'))) - return self.env.ref('uom.product_uom_unit') + chatter_msg.append( + _( + "

Odoo couldn't find any unit of measure corresponding to the " + "following information extracted from the business document:

" + "
  • UNECE code: %s
  • " + "
  • Name of the unit of measure: %s
" + "

So the unit of measure 'Unit(s)' has been used. You may " + "have to change it manually.

" + ) + % (uom_dict.get("unece_code"), uom_dict.get("name")) + ) + return self.env.ref("uom.product_uom_unit") @api.model def _match_taxes( - self, taxes_list, chatter_msg, - type_tax_use='purchase', price_include=False): + self, taxes_list, chatter_msg, type_tax_use="purchase", price_include=False + ): """taxes_list must be a list of tax_dict""" - taxes_recordset = self.env['account.tax'].browse(False) + taxes_recordset = self.env["account.tax"].browse(False) for tax_dict in taxes_list: taxes_recordset += self._match_tax( - tax_dict, chatter_msg, type_tax_use=type_tax_use, - price_include=price_include) + tax_dict, + chatter_msg, + type_tax_use=type_tax_use, + price_include=price_include, + ) return taxes_recordset @api.model def _match_tax( - self, tax_dict, chatter_msg, - type_tax_use='purchase', price_include=False): + self, tax_dict, chatter_msg, type_tax_use="purchase", price_include=False + ): """Example: tax_dict = { 'amount_type': 'percent', # required param, 'fixed' or 'percent' @@ -545,63 +620,70 @@ def _match_tax( 'unece_due_date_code': '72', } """ - ato = self.env['account.tax'] + ato = self.env["account.tax"] self._strip_cleanup_dict(tax_dict) - if tax_dict.get('recordset'): - return tax_dict['recordset'] - if tax_dict.get('id'): - return ato.browse(tax_dict['id']) - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - domain = [('company_id', '=', company_id)] - if type_tax_use == 'purchase': - domain.append(('type_tax_use', '=', 'purchase')) - elif type_tax_use == 'sale': - domain.append(('type_tax_use', '=', 'sale')) + if tax_dict.get("recordset"): + return tax_dict["recordset"] + if tax_dict.get("id"): + return ato.browse(tax_dict["id"]) + company_id = self._context.get("force_company") or self.env.user.company_id.id + domain = [("company_id", "=", company_id)] + if type_tax_use == "purchase": + domain.append(("type_tax_use", "=", "purchase")) + elif type_tax_use == "sale": + domain.append(("type_tax_use", "=", "sale")) if price_include is False: - domain.append(('price_include', '=', False)) + domain.append(("price_include", "=", False)) elif price_include is True: - domain.append(('price_include', '=', True)) + domain.append(("price_include", "=", True)) # with the code above, if you set price_include=None, it will # won't depend on the value of the price_include parameter - assert tax_dict.get('amount_type') in ['fixed', 'percent'],\ - 'bad tax type' - assert 'amount' in tax_dict, 'Missing amount key in tax_dict' - domain.append(('amount_type', '=', tax_dict['amount_type'])) - if tax_dict.get('unece_type_code'): - domain.append( - ('unece_type_code', '=', tax_dict['unece_type_code'])) - if tax_dict.get('unece_categ_code'): - domain.append( - ('unece_categ_code', '=', tax_dict['unece_categ_code'])) - if tax_dict.get('unece_due_date_code'): + assert tax_dict.get("amount_type") in ["fixed", "percent"], "bad tax type" + assert "amount" in tax_dict, "Missing amount key in tax_dict" + domain.append(("amount_type", "=", tax_dict["amount_type"])) + if tax_dict.get("unece_type_code"): + domain.append(("unece_type_code", "=", tax_dict["unece_type_code"])) + if tax_dict.get("unece_categ_code"): + domain.append(("unece_categ_code", "=", tax_dict["unece_categ_code"])) + if tax_dict.get("unece_due_date_code"): domain += [ - '|', - ('unece_due_date_code', '=', tax_dict['unece_due_date_code']), - ('unece_due_date_code', '=', False)] - taxes = ato.search(domain, order='unece_due_date_code') + "|", + ("unece_due_date_code", "=", tax_dict["unece_due_date_code"]), + ("unece_due_date_code", "=", False), + ] + taxes = ato.search(domain, order="unece_due_date_code") for tax in taxes: tax_amount = tax.amount # 'amount' field : digits=(16, 4) - if not float_compare( - tax_dict['amount'], tax_amount, precision_digits=4): + if not float_compare(tax_dict["amount"], tax_amount, precision_digits=4): return tax - raise self.user_error_wrap(_( - "Odoo couldn't find any tax with 'Tax Application' = '%s' " - "and 'Tax Included in Price' = '%s' which correspond to the " - "following information extracted from the business document:\n" - "UNECE Tax Type code: %s\n" - "UNECE Tax Category code: %s\n" - "Tax amount: %s %s") % ( + raise self.user_error_wrap( + _( + "Odoo couldn't find any tax with 'Tax Application' = '%s' " + "and 'Tax Included in Price' = '%s' which correspond to the " + "following information extracted from the business document:\n" + "UNECE Tax Type code: %s\n" + "UNECE Tax Category code: %s\n" + "Tax amount: %s %s" + ) + % ( type_tax_use, price_include, - tax_dict.get('unece_type_code'), - tax_dict.get('unece_categ_code'), - tax_dict['amount'], - tax_dict['amount_type'] == 'percent' and '%' or _('(fixed)'))) + tax_dict.get("unece_type_code"), + tax_dict.get("unece_categ_code"), + tax_dict["amount"], + tax_dict["amount_type"] == "percent" and "%" or _("(fixed)"), + ) + ) def compare_lines( - self, existing_lines, import_lines, chatter_msg, - qty_precision=None, price_precision=None, seller=False): + self, + existing_lines, + import_lines, + chatter_msg, + qty_precision=None, + price_precision=None, + seller=False, + ): """ Example: existing_lines = [{ 'product': odoo_recordset, @@ -645,103 +727,117 @@ def compare_lines( The check existing_currency == import_currency must be done before the call to compare_lines() """ - dpo = self.env['decimal.precision'] + dpo = self.env["decimal.precision"] if qty_precision is None: - qty_precision = dpo.precision_get('Product Unit of Measure') + qty_precision = dpo.precision_get("Product Unit of Measure") if price_precision is None: - price_precision = dpo.precision_get('Product Price') + price_precision = dpo.precision_get("Product Price") existing_lines_dict = {} for eline in existing_lines: - if not eline.get('product'): - chatter_msg.append(_( - "The existing line '%s' doesn't have any product, " - "so the lines haven't been updated.") - % eline.get('name')) + if not eline.get("product"): + chatter_msg.append( + _( + "The existing line '%s' doesn't have any product, " + "so the lines haven't been updated." + ) + % eline.get("name") + ) return False - if eline['product'] in existing_lines_dict: - chatter_msg.append(_( - "The product '%s' is used on several existing " - "lines, so the lines haven't been updated.") - % eline['product'].display_name) + if eline["product"] in existing_lines_dict: + chatter_msg.append( + _( + "The product '%s' is used on several existing " + "lines, so the lines haven't been updated." + ) + % eline["product"].display_name + ) return False - existing_lines_dict[eline['product']] = eline + existing_lines_dict[eline["product"]] = eline unique_import_products = [] res = { - 'to_remove': False, - 'to_add': [], - 'to_update': {}, + "to_remove": False, + "to_add": [], + "to_update": {}, } for iline in import_lines: - if not iline.get('product'): - chatter_msg.append(_( - "One of the imported lines doesn't have any product, " - "so the lines haven't been updated.")) + if not iline.get("product"): + chatter_msg.append( + _( + "One of the imported lines doesn't have any product, " + "so the lines haven't been updated." + ) + ) return False - product = self._match_product( - iline['product'], chatter_msg, seller=seller) - uom = self._match_uom(iline.get('uom'), chatter_msg, product) + product = self._match_product(iline["product"], chatter_msg, seller=seller) + uom = self._match_uom(iline.get("uom"), chatter_msg, product) if product in unique_import_products: - chatter_msg.append(_( - "The product '%s' is used on several imported lines, " - "so the lines haven't been updated.") - % product.display_name) + chatter_msg.append( + _( + "The product '%s' is used on several imported lines, " + "so the lines haven't been updated." + ) + % product.display_name + ) return False unique_import_products.append(product) if product in existing_lines_dict: - if uom != existing_lines_dict[product]['uom']: - chatter_msg.append(_( - "For product '%s', the unit of measure is %s on the " - "existing line, but it is %s on the imported line. " - "We don't support this scenario for the moment, so " - "the lines haven't been updated.") % ( + if uom != existing_lines_dict[product]["uom"]: + chatter_msg.append( + _( + "For product '%s', the unit of measure is %s on the " + "existing line, but it is %s on the imported line. " + "We don't support this scenario for the moment, so " + "the lines haven't been updated." + ) + % ( product.display_name, - existing_lines_dict[product]['uom'].name, + existing_lines_dict[product]["uom"].name, uom.name, - )) + ) + ) return False # used for to_remove - existing_lines_dict[product]['import'] = True - oline = existing_lines_dict[product]['line'] - res['to_update'][oline] = {} + existing_lines_dict[product]["import"] = True + oline = existing_lines_dict[product]["line"] + res["to_update"][oline] = {} if float_compare( - iline['qty'], - existing_lines_dict[product]['qty'], - precision_digits=qty_precision): - res['to_update'][oline]['qty'] = [ - existing_lines_dict[product]['qty'], - iline['qty']] - if ( - 'price_unit' in iline and - float_compare( - iline['price_unit'], - existing_lines_dict[product]['price_unit'], - precision_digits=price_precision)): - res['to_update'][oline]['price_unit'] = [ - existing_lines_dict[product]['price_unit'], - iline['price_unit']] + iline["qty"], + existing_lines_dict[product]["qty"], + precision_digits=qty_precision, + ): + res["to_update"][oline]["qty"] = [ + existing_lines_dict[product]["qty"], + iline["qty"], + ] + if "price_unit" in iline and float_compare( + iline["price_unit"], + existing_lines_dict[product]["price_unit"], + precision_digits=price_precision, + ): + res["to_update"][oline]["price_unit"] = [ + existing_lines_dict[product]["price_unit"], + iline["price_unit"], + ] else: - res['to_add'].append({ - 'product': product, - 'uom': uom, - 'import_line': iline, - }) + res["to_add"].append( + {"product": product, "uom": uom, "import_line": iline} + ) for exiting_dict in existing_lines_dict.values(): - if not exiting_dict.get('import'): - if res['to_remove']: - res['to_remove'] += exiting_dict['line'] + if not exiting_dict.get("import"): + if res["to_remove"]: + res["to_remove"] += exiting_dict["line"] else: - res['to_remove'] = exiting_dict['line'] + res["to_remove"] = exiting_dict["line"] return res def _prepare_account_speed_dict(self): - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - res = self.env['account.account'].search_read([ - ('company_id', '=', company_id), - ('deprecated', '=', False)], ['code']) + company_id = self._context.get("force_company") or self.env.user.company_id.id + res = self.env["account.account"].search_read( + [("company_id", "=", company_id), ("deprecated", "=", False)], ["code"] + ) speed_dict = {} for l in res: - speed_dict[l['code'].upper()] = l['id'] + speed_dict[l["code"].upper()] = l["id"] return speed_dict @api.model @@ -755,23 +851,23 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): """ if not account_dict: account_dict = {} - aao = self.env['account.account'] + aao = self.env["account.account"] if speed_dict is None: speed_dict = self._prepare_account_speed_dict() self._strip_cleanup_dict(account_dict) - if account_dict.get('recordset'): - return account_dict['recordset'] - if account_dict.get('id'): - return aao.browse(account_dict['id']) - if account_dict.get('code'): - acc_code = account_dict['code'].upper() + if account_dict.get("recordset"): + return account_dict["recordset"] + if account_dict.get("id"): + return aao.browse(account_dict["id"]) + if account_dict.get("code"): + acc_code = account_dict["code"].upper() if acc_code in speed_dict: return aao.browse(speed_dict[acc_code]) # Match when account_dict['code'] is longer than Odoo's account # codes because of trailing '0' # I don't think we need a warning for this kind of match acc_code_tmp = acc_code - while acc_code_tmp and acc_code_tmp[-1] == '0': + while acc_code_tmp and acc_code_tmp[-1] == "0": acc_code_tmp = acc_code_tmp[:-1] if acc_code_tmp and acc_code_tmp in speed_dict: return aao.browse(speed_dict[acc_code_tmp]) @@ -779,30 +875,36 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): # -> warns the user about this for code, account_id in speed_dict.items(): if code.startswith(acc_code): - chatter_msg.append(_( - "Approximate match: account %s has been matched " - "with account %s") % (account_dict['code'], code)) + chatter_msg.append( + _( + "Approximate match: account %s has been matched " + "with account %s" + ) + % (account_dict["code"], code) + ) return aao.browse(account_id) - raise self.user_error_wrap(_( - "Odoo couldn't find any account corresponding to the " - "following information extracted from the business document: " - "Account code: %s") % account_dict.get('code')) + raise self.user_error_wrap( + _( + "Odoo couldn't find any account corresponding to the " + "following information extracted from the business document: " + "Account code: %s" + ) + % account_dict.get("code") + ) def _prepare_analytic_account_speed_dict(self): - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - res = self.env['account.analytic.account'].search_read( - [('company_id', '=', company_id)], - ['code']) + company_id = self._context.get("force_company") or self.env.user.company_id.id + res = self.env["account.analytic.account"].search_read( + [("company_id", "=", company_id)], ["code"] + ) speed_dict = {} for l in res: - if l['code']: - speed_dict[l['code'].upper()] = l['id'] + if l["code"]: + speed_dict[l["code"].upper()] = l["id"] return speed_dict @api.model - def _match_analytic_account( - self, aaccount_dict, chatter_msg, speed_dict=None): + def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): """Example: aaccount_dict = { 'code': '627', @@ -812,31 +914,35 @@ def _match_analytic_account( """ if not aaccount_dict: aaccount_dict = {} - aaao = self.env['account.analytic.account'] + aaao = self.env["account.analytic.account"] if speed_dict is None: speed_dict = self._prepare_analytic_account_speed_dict() self._strip_cleanup_dict(aaccount_dict) - if aaccount_dict.get('recordset'): - return aaccount_dict['recordset'] - if aaccount_dict.get('id'): - return aaao.browse(aaccount_dict['id']) - if aaccount_dict.get('code'): - aacode = aaccount_dict['code'].upper() + if aaccount_dict.get("recordset"): + return aaccount_dict["recordset"] + if aaccount_dict.get("id"): + return aaao.browse(aaccount_dict["id"]) + if aaccount_dict.get("code"): + aacode = aaccount_dict["code"].upper() if aacode in speed_dict: return aaao.browse(speed_dict[aacode]) - raise self.user_error_wrap(_( - "Odoo couldn't find any analytic account corresponding to the " - "following information extracted from the business document: " - "Analytic account code: %s") % aaccount_dict.get('code')) + raise self.user_error_wrap( + _( + "Odoo couldn't find any analytic account corresponding to the " + "following information extracted from the business document: " + "Analytic account code: %s" + ) + % aaccount_dict.get("code") + ) def _prepare_journal_speed_dict(self): - company_id = self._context.get('force_company') or\ - self.env.user.company_id.id - res = self.env['account.journal'].search_read([ - ('company_id', '=', company_id)], ['code']) + company_id = self._context.get("force_company") or self.env.user.company_id.id + res = self.env["account.journal"].search_read( + [("company_id", "=", company_id)], ["code"] + ) speed_dict = {} for l in res: - speed_dict[l['code'].upper()] = l['id'] + speed_dict[l["code"].upper()] = l["id"] return speed_dict @api.model @@ -850,131 +956,146 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): """ if not journal_dict: journal_dict = {} - ajo = self.env['account.journal'] + ajo = self.env["account.journal"] if speed_dict is None: speed_dict = self._prepare_journal_speed_dict() self._strip_cleanup_dict(journal_dict) - if journal_dict.get('recordset'): - return journal_dict['recordset'] - if journal_dict.get('id'): - return ajo.browse(journal_dict['id']) - if journal_dict.get('code'): - jcode = journal_dict['code'].upper() + if journal_dict.get("recordset"): + return journal_dict["recordset"] + if journal_dict.get("id"): + return ajo.browse(journal_dict["id"]) + if journal_dict.get("code"): + jcode = journal_dict["code"].upper() if jcode in speed_dict: return ajo.browse(speed_dict[jcode]) # case insensitive - raise self.user_error_wrap(_( - "Odoo couldn't find any journal corresponding to the " - "following information extracted from the business document: " - "Journal code: %s") % journal_dict.get('code')) + raise self.user_error_wrap( + _( + "Odoo couldn't find any journal corresponding to the " + "following information extracted from the business document: " + "Journal code: %s" + ) + % journal_dict.get("code") + ) # Code moved from base_business_document_import_stock # Now that the incoterm obj (account.incoterms) is defined in # the 'account' module (since Odoo v12) instead of 'stock' @api.model def _match_incoterm(self, incoterm_dict, chatter_msg): - aio = self.env['account.incoterms'] + aio = self.env["account.incoterms"] if not incoterm_dict: return False - if incoterm_dict.get('recordset'): - return incoterm_dict['recordset'] - if incoterm_dict.get('id'): - return aio.browse(incoterm_dict['id']) - if incoterm_dict.get('code'): - incoterm = aio.search([ - '|', - ('name', '=ilike', incoterm_dict['code']), - ('code', '=ilike', incoterm_dict['code'])], limit=1) + if incoterm_dict.get("recordset"): + return incoterm_dict["recordset"] + if incoterm_dict.get("id"): + return aio.browse(incoterm_dict["id"]) + if incoterm_dict.get("code"): + incoterm = aio.search( + [ + "|", + ("name", "=ilike", incoterm_dict["code"]), + ("code", "=ilike", incoterm_dict["code"]), + ], + limit=1, + ) if incoterm: return incoterm else: - self.user_error_wrap(_( - "Could not find any Incoterm in Odoo corresponding " - "to '%s'") % incoterm_dict['code']) + self.user_error_wrap( + _("Could not find any Incoterm in Odoo corresponding " "to '%s'") + % incoterm_dict["code"] + ) return False @api.model def _check_company(self, company_dict, chatter_msg): if not company_dict: company_dict = {} - rco = self.env['res.company'] - if self._context.get('force_company'): - company = rco.browse(self._context['force_company']) + rco = self.env["res.company"] + if self._context.get("force_company"): + company = rco.browse(self._context["force_company"]) else: company = self.env.user.company_id - if company_dict.get('vat'): - parsed_company_vat = company_dict['vat'].replace( - ' ', '').upper() + if company_dict.get("vat"): + parsed_company_vat = company_dict["vat"].replace(" ", "").upper() if company.partner_id.sanitized_vat: if company.partner_id.sanitized_vat != parsed_company_vat: - raise self.user_error_wrap(_( - "The VAT number of the customer written in the " - "business document (%s) doesn't match the VAT number " - "of the company '%s' (%s) in which you are trying to " - "import this document.") % ( + raise self.user_error_wrap( + _( + "The VAT number of the customer written in the " + "business document (%s) doesn't match the VAT number " + "of the company '%s' (%s) in which you are trying to " + "import this document." + ) + % ( parsed_company_vat, company.display_name, - company.partner_id.sanitized_vat)) + company.partner_id.sanitized_vat, + ) + ) else: - chatter_msg.append(_( - "Missing VAT number on company '%s'") - % company.display_name) + chatter_msg.append( + _("Missing VAT number on company '%s'") % company.display_name + ) def get_xml_files_from_pdf(self, pdf_file): """Returns a dict with key = filename, value = XML file obj""" - logger.info('Trying to find an embedded XML file inside PDF') + logger.info("Trying to find an embedded XML file inside PDF") res = {} try: fd = BytesIO(pdf_file) pdf = PyPDF2.PdfFileReader(fd) - logger.debug('pdf.trailer=%s', pdf.trailer) - pdf_root = pdf.trailer['/Root'] - logger.debug('pdf_root=%s', pdf_root) + logger.debug("pdf.trailer=%s", pdf.trailer) + pdf_root = pdf.trailer["/Root"] + logger.debug("pdf_root=%s", pdf_root) # TODO add support for /Kids - embeddedfiles = pdf_root['/Names']['/EmbeddedFiles']['/Names'] + embeddedfiles = pdf_root["/Names"]["/EmbeddedFiles"]["/Names"] i = 0 xmlfiles = {} # key = filename, value = PDF obj for embeddedfile in embeddedfiles[:-1]: mime_res = mimetypes.guess_type(embeddedfile) - if mime_res and mime_res[0] in ['application/xml', 'text/xml']: + if mime_res and mime_res[0] in ["application/xml", "text/xml"]: xmlfiles[embeddedfile] = embeddedfiles[i + 1] i += 1 - logger.debug('xmlfiles=%s', xmlfiles) + logger.debug("xmlfiles=%s", xmlfiles) for filename, xml_file_dict_obj in xmlfiles.items(): try: xml_file_dict = xml_file_dict_obj.getObject() - logger.debug('xml_file_dict=%s', xml_file_dict) - xml_string = xml_file_dict['/EF']['/F'].getData() + logger.debug("xml_file_dict=%s", xml_file_dict) + xml_string = xml_file_dict["/EF"]["/F"].getData() xml_root = etree.fromstring(xml_string) logger.debug( - 'A valid XML file %s has been found in the PDF file', - filename) + "A valid XML file %s has been found in the PDF file", filename + ) res[filename] = xml_root - except Exception as e: + except Exception: continue - except Exception as e: + except Exception: pass - logger.info('Valid XML files found in PDF: %s', list(res.keys())) + logger.info("Valid XML files found in PDF: %s", list(res.keys())) return res @api.model def post_create_or_update(self, parsed_dict, record, doc_filename=None): - if parsed_dict.get('attachments'): - for filename, data_base64 in\ - parsed_dict['attachments'].items(): - self.env['ir.attachment'].create({ - 'name': filename, - 'res_id': record.id, - 'res_model': str(record._name), - 'datas': data_base64, - 'datas_fname': filename, - }) - for msg in parsed_dict['chatter_msg']: + if parsed_dict.get("attachments"): + for filename, data_base64 in parsed_dict["attachments"].items(): + self.env["ir.attachment"].create( + { + "name": filename, + "res_id": record.id, + "res_model": str(record._name), + "datas": data_base64, + "datas_fname": filename, + } + ) + for msg in parsed_dict["chatter_msg"]: record.message_post(body=msg) - if parsed_dict.get('note'): + if parsed_dict.get("note"): if doc_filename: - msg = _('Notes in file %s:') % doc_filename + msg = _("Notes in file %s:") % doc_filename else: - msg = _('Notes in imported document:') + msg = _("Notes in imported document:") record.message_post( # pylint: disable=translation-required - body='%s %s' % (msg, parsed_dict['note'])) + body="{} {}".format(msg, parsed_dict["note"]) + ) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index a93a32bcc1..be924e8d79 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -2,244 +2,268 @@ # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -from odoo.tests.common import TransactionCase from odoo.exceptions import UserError +from odoo.tests.common import TransactionCase class TestBaseBusinessDocumentImport(TransactionCase): - def test_match_partner(self): - partner1 = self.env['res.partner'].create({ - 'name': 'Total SA', - 'supplier': False, - 'customer': False, - 'ref': 'TOTAL', - 'website': 'www.total.com', - }) - bdio = self.env['business.document.import'] + partner1 = self.env["res.partner"].create( + { + "name": "Total SA", + "supplier": False, + "customer": False, + "ref": "TOTAL", + "website": "www.total.com", + } + ) + bdio = self.env["business.document.import"] # match on domain extracted from email with warning - partner_dict = {'email': 'alexis.delattre@total.com'} + partner_dict = {"email": "alexis.delattre@total.com"} warn = [] res = bdio._match_partner(partner_dict, warn, partner_type=False) self.assertEqual(res, partner1) self.assertTrue(warn) - partner_dict = {'name': 'ready mat '} - res = bdio._match_partner( - partner_dict, [], partner_type='supplier') - self.assertEqual(res, self.env.ref('base.res_partner_4')) - partner_dict = {'ref': 'TOTAL'} + partner_dict = {"name": "ready mat "} + res = bdio._match_partner(partner_dict, [], partner_type="supplier") + self.assertEqual(res, self.env.ref("base.res_partner_4")) + partner_dict = {"ref": "TOTAL"} res = bdio._match_partner(partner_dict, [], partner_type=False) self.assertEqual(res, partner1) def test_match_shipping_partner(self): - rpo = self.env['res.partner'] - bdio = self.env['business.document.import'] - partner1 = rpo.create({ - 'name': 'Akretion France', - 'street': '27 rue Henri Rolland', - 'zip': '69100', - 'country_id': self.env.ref('base.fr').id, - 'email': 'contact@akretion.com', - }) - cpartner1 = rpo.create({ - 'parent_id': partner1.id, - 'name': 'Alexis de Lattre', - 'email': 'alexis.delattre@akretion.com', - 'type': 'delivery', - }) - rpo.create({ - 'parent_id': partner1.id, - 'name': 'Sébastien BEAU', - 'email': 'sebastien.beau@akretion.com', - 'type': 'contact', - }) - cpartner3 = rpo.create({ - 'parent_id': partner1.id, - 'name': 'Flo', - 'email': 'flo@akretion.com', - 'street': "42 rue des lilas d'Espagne", - 'zip': '92400', - 'city': 'Courbevoie', - 'country_id': self.env.ref('base.fr').id, - 'type': 'invoice', - }) + rpo = self.env["res.partner"] + bdio = self.env["business.document.import"] + partner1 = rpo.create( + { + "name": "Akretion France", + "street": "27 rue Henri Rolland", + "zip": "69100", + "country_id": self.env.ref("base.fr").id, + "email": "contact@akretion.com", + } + ) + cpartner1 = rpo.create( + { + "parent_id": partner1.id, + "name": "Alexis de Lattre", + "email": "alexis.delattre@akretion.com", + "type": "delivery", + } + ) + rpo.create( + { + "parent_id": partner1.id, + "name": "Sébastien BEAU", + "email": "sebastien.beau@akretion.com", + "type": "contact", + } + ) + cpartner3 = rpo.create( + { + "parent_id": partner1.id, + "name": "Flo", + "email": "flo@akretion.com", + "street": "42 rue des lilas d'Espagne", + "zip": "92400", + "city": "Courbevoie", + "country_id": self.env.ref("base.fr").id, + "type": "invoice", + } + ) shipping_dict = { - 'partner': {'email': 'contact@akretion.com'}, - 'address': {}, + "partner": {"email": "contact@akretion.com"}, + "address": {}, } res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner1) - shipping_dict['address'] = { - 'zip': '92400', - 'country_code': 'fr', + shipping_dict["address"] = { + "zip": "92400", + "country_code": "fr", } res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner3) - shipping_dict['address']['zip'] = '92500' + shipping_dict["address"]["zip"] = "92500" with self.assertRaises(UserError): bdio._match_shipping_partner(shipping_dict, None, []) - partner2 = rpo.create({ - 'name': 'Alex Corp', - 'zip': '69009', - 'country_id': self.env.ref('base.fr').id, - 'email': 'contact@alex.com', - }) - shipping_dict = { - 'partner': {'email': 'contact@alex.com'}, - 'address': {'country_code': 'FR', 'zip': '69009'}, + partner2 = rpo.create( + { + "name": "Alex Corp", + "zip": "69009", + "country_id": self.env.ref("base.fr").id, + "email": "contact@alex.com", } + ) + shipping_dict = { + "partner": {"email": "contact@alex.com"}, + "address": {"country_code": "FR", "zip": "69009"}, + } res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, partner2) shipping_dict = { - 'partner': {}, - 'address': {}, + "partner": {}, + "address": {}, } res = bdio._match_shipping_partner(shipping_dict, partner1, []) self.assertEqual(res, cpartner1) def test_match_currency(self): - bdio = self.env['business.document.import'] - currency_dict = {'iso': 'EUR'} + bdio = self.env["business.document.import"] + currency_dict = {"iso": "EUR"} res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref('base.EUR')) - currency_dict = {'symbol': '€'} + self.assertEqual(res, self.env.ref("base.EUR")) + currency_dict = {"symbol": "€"} res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref('base.EUR')) - currency_dict = {'country_code': 'fr '} + self.assertEqual(res, self.env.ref("base.EUR")) + currency_dict = {"country_code": "fr "} res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref('base.EUR')) - currency_dict = {'iso_or_symbol': '€'} + self.assertEqual(res, self.env.ref("base.EUR")) + currency_dict = {"iso_or_symbol": "€"} res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref('base.EUR')) - currency_id = self.env.ref('base.KRW').id - self.cr.execute("UPDATE res_company SET currency_id = %s WHERE id = 1", - (currency_id,)) + self.assertEqual(res, self.env.ref("base.EUR")) + currency_id = self.env.ref("base.KRW").id + self.cr.execute( + "UPDATE res_company SET currency_id = %s WHERE id = 1", (currency_id,) + ) currency_dict = {} res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref('base.KRW')) + self.assertEqual(res, self.env.ref("base.KRW")) def test_match_product(self): - bdio = self.env['business.document.import'] - ppo = self.env['product.product'] - product1 = ppo.create({ - 'name': 'Test Product', - 'barcode': '9782203121102', - 'seller_ids': [ - (0, 0, { - 'name': self.env.ref('base.res_partner_2').id, - 'product_code': 'TEST1242', - }), - ] - }) - product_dict = {'code': 'FURN_7777 '} + bdio = self.env["business.document.import"] + ppo = self.env["product.product"] + product1 = ppo.create( + { + "name": "Test Product", + "barcode": "9782203121102", + "seller_ids": [ + ( + 0, + 0, + { + "name": self.env.ref("base.res_partner_2").id, + "product_code": "TEST1242", + }, + ), + ], + } + ) + product_dict = {"code": "FURN_7777 "} res = bdio._match_product(product_dict, []) - self.assertEqual(res, self.env.ref('product.product_delivery_01')) - product_dict = {'barcode': '9782203121102'} + self.assertEqual(res, self.env.ref("product.product_delivery_01")) + product_dict = {"barcode": "9782203121102"} res = bdio._match_product(product_dict, []) self.assertEqual(res, product1) - product_dict = {'code': 'TEST1242'} + product_dict = {"code": "TEST1242"} res = bdio._match_product( - product_dict, [], seller=self.env.ref('base.res_partner_2')) + product_dict, [], seller=self.env.ref("base.res_partner_2") + ) self.assertEqual(res, product1) raise_test = True try: bdio._match_product(product_dict, [], seller=False) raise_test = False - except Exception as e: + except Exception: pass self.assertTrue(raise_test) def test_match_uom(self): - bdio = self.env['business.document.import'] - uom_dict = {'unece_code': 'KGM'} + bdio = self.env["business.document.import"] + uom_dict = {"unece_code": "KGM"} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('uom.product_uom_kgm')) - uom_dict = {'unece_code': 'NIU'} + self.assertEqual(res, self.env.ref("uom.product_uom_kgm")) + uom_dict = {"unece_code": "NIU"} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('uom.product_uom_unit')) - uom_dict = {'name': 'day'} + self.assertEqual(res, self.env.ref("uom.product_uom_unit")) + uom_dict = {"name": "day"} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('uom.product_uom_day')) - uom_dict = {'name': ' Liter '} + self.assertEqual(res, self.env.ref("uom.product_uom_day")) + uom_dict = {"name": " Liter "} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref('uom.product_uom_litre')) + self.assertEqual(res, self.env.ref("uom.product_uom_litre")) uom_dict = {} - product = self.env.ref('product.product_product_1') + product = self.env.ref("product.product_product_1") res = bdio._match_uom(uom_dict, [], product=product) self.assertEqual(res, product.uom_id) def test_match_tax(self): # on purpose, I use a rate that doesn't exist # so that this test works even if the l10n_de is installed - de_tax_21 = self.env['account.tax'].create({ - 'name': 'German VAT purchase 18.0%', - 'description': 'DE-VAT-buy-18.0', - 'type_tax_use': 'purchase', - 'price_include': False, - 'amount': 18, - 'amount_type': 'percent', - 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, - 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, - }) - de_tax_21_ttc = self.env['account.tax'].create({ - 'name': 'German VAT purchase 18.0% TTC', - 'description': 'DE-VAT-buy-18.0-TTC', - 'type_tax_use': 'purchase', - 'price_include': True, - 'amount': 18, - 'amount_type': 'percent', - 'unece_type_id': self.env.ref('account_tax_unece.tax_type_vat').id, - 'unece_categ_id': self.env.ref('account_tax_unece.tax_categ_s').id, - }) - bdio = self.env['business.document.import'] + de_tax_21 = self.env["account.tax"].create( + { + "name": "German VAT purchase 18.0%", + "description": "DE-VAT-buy-18.0", + "type_tax_use": "purchase", + "price_include": False, + "amount": 18, + "amount_type": "percent", + "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, + "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + } + ) + de_tax_21_ttc = self.env["account.tax"].create( + { + "name": "German VAT purchase 18.0% TTC", + "description": "DE-VAT-buy-18.0-TTC", + "type_tax_use": "purchase", + "price_include": True, + "amount": 18, + "amount_type": "percent", + "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, + "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + } + ) + bdio = self.env["business.document.import"] tax_dict = { - 'amount_type': 'percent', - 'amount': 18, - 'unece_type_code': 'VAT', - 'unece_categ_code': 'S', + "amount_type": "percent", + "amount": 18, + "unece_type_code": "VAT", + "unece_categ_code": "S", } - res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') + res = bdio._match_tax(tax_dict, [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) - tax_dict.pop('unece_categ_code') - res = bdio._match_tax(tax_dict, [], type_tax_use='purchase') + tax_dict.pop("unece_categ_code") + res = bdio._match_tax(tax_dict, [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) - res = bdio._match_tax( - tax_dict, [], type_tax_use='purchase', price_include=True) + res = bdio._match_tax(tax_dict, [], type_tax_use="purchase", price_include=True) self.assertEqual(res, de_tax_21_ttc) - res = bdio._match_taxes([tax_dict], [], type_tax_use='purchase') + res = bdio._match_taxes([tax_dict], [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) def test_match_account_exact(self): - bdio = self.env['business.document.import'] - acc = self.env['account.account'].create({ - 'name': 'Test 898999', - 'code': '898999', - 'user_type_id': - self.env.ref('account.data_account_type_expenses').id, - }) - res = bdio._match_account({'code': '898999'}, []) + bdio = self.env["business.document.import"] + acc = self.env["account.account"].create( + { + "name": "Test 898999", + "code": "898999", + "user_type_id": self.env.ref("account.data_account_type_expenses").id, + } + ) + res = bdio._match_account({"code": "898999"}, []) self.assertEqual(acc, res) def test_match_account_bigger_in(self): - bdio = self.env['business.document.import'] - acc = self.env['account.account'].create({ - 'name': 'Test 898999', - 'code': '898999', - 'user_type_id': - self.env.ref('account.data_account_type_expenses').id, - }) - res = bdio._match_account({'code': '89899900'}, []) + bdio = self.env["business.document.import"] + acc = self.env["account.account"].create( + { + "name": "Test 898999", + "code": "898999", + "user_type_id": self.env.ref("account.data_account_type_expenses").id, + } + ) + res = bdio._match_account({"code": "89899900"}, []) self.assertEqual(acc, res) def test_match_account_smaller_in(self): - bdio = self.env['business.document.import'] - acc = self.env['account.account'].create({ - 'name': 'Test 89899910', - 'code': '89899910', - 'user_type_id': - self.env.ref('account.data_account_type_expenses').id, - }) + bdio = self.env["business.document.import"] + acc = self.env["account.account"].create( + { + "name": "Test 89899910", + "code": "89899910", + "user_type_id": self.env.ref("account.data_account_type_expenses").id, + } + ) chatter = [] - res = bdio._match_account({'code': '898999'}, chatter) + res = bdio._match_account({"code": "898999"}, chatter) self.assertEqual(acc, res) self.assertEqual(len(chatter), 1) From 5808d0a8dda4fcbf9e646d32319573452f64906e Mon Sep 17 00:00:00 2001 From: sebalix Date: Wed, 13 May 2020 17:26:31 +0200 Subject: [PATCH 45/99] [MIG] base_business_document_import: Migration to 13.0 --- base_business_document_import/README.rst | 10 +- base_business_document_import/__manifest__.py | 10 +- .../i18n/base_business_document_import.pot | 190 +++++++++++------- .../models/business_document_import.py | 15 +- .../static/description/index.html | 6 +- .../tests/test_business_document_import.py | 16 +- 6 files changed, 149 insertions(+), 98 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index fb6cd91421..52549bf441 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -14,13 +14,13 @@ Base Business Document Import :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github - :target: https://github.com/OCA/edi/tree/12.0/base_business_document_import + :target: https://github.com/OCA/edi/tree/13.0/base_business_document_import :alt: OCA/edi .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/edi-12-0/edi-12-0-base_business_document_import + :target: https://translation.odoo-community.org/projects/edi-13-0/edi-13-0-base_business_document_import :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/226/12.0 + :target: https://runbot.odoo-community.org/runbot/226/13.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -42,7 +42,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -74,6 +74,6 @@ 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. -This module is part of the `OCA/edi `_ project on GitHub. +This module is part of the `OCA/edi `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index b26531d227..7c23a5a319 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,12 +4,18 @@ { "name": "Base Business Document Import", - "version": "12.0.1.0.0", + "version": "13.0.1.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", "author": "Akretion, Nicolas JEUDY, Odoo Community Association (OCA)", "website": "https://github.com/OCA/edi", - "depends": ["base_vat_sanitized", "account_tax_unece", "uom_unece"], + "depends": [ + # odoo + "account", + # OCA/community-data-files + "account_tax_unece", + "uom_unece", + ], "external_dependencies": {"python": ["PyPDF2"]}, } diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index b5a748a97d..4630c5ab49 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -1,12 +1,12 @@ # Translation of Odoo Server. # This file contains the translation of the following modules: -# * base_business_document_import +# * base_business_document_import # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 12.0\n" +"Project-Id-Version: Odoo Server 13.0\n" "Report-Msgid-Bugs-To: \n" -"Last-Translator: <>\n" +"Last-Translator: \n" "Language-Team: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -14,31 +14,36 @@ msgstr "" "Plural-Forms: \n" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:600 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:976 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:978 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:513 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "

Odoo couldn't find any unit of measure corresponding to the following information extracted from the business document:

  • UNECE code: %s
  • Name of the unit of measure: %s

So the unit of measure 'Unit(s)' has been used. You may have to change it manually.

" +msgid "" +"

Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

  • UNECE code: " +"%s
  • Name of the unit of measure: %s

So the unit of " +"measure 'Unit(s)' has been used. You may have to change it " +"manually.

" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:782 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "" @@ -49,7 +54,7 @@ msgid "Common methods to import business documents" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:891 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" @@ -60,13 +65,16 @@ msgid "Display Name" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:692 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "For product '%s', the unit of measure is %s on the existing line, but it is %s on the imported line. We don't support this scenario for the moment, so the lines haven't been updated." +msgid "" +"For product '%s', the unit of measure is %s on the existing line, but it is " +"%s on the imported line. We don't support this scenario for the moment, so " +"the lines haven't been updated." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:292 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "" @@ -82,21 +90,22 @@ msgid "Last Modified on" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:919 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:470 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:170 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +msgid "" +"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" "Name: %s\n" "VAT number: %s\n" "Reference: %s\n" @@ -104,168 +113,211 @@ msgid "Odoo couldn't find any %s corresponding to the following information extr "Website: %s\n" "State code: %s\n" "Country code: %s\n" -"" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:786 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any account corresponding to the following information extracted from the business document: Account code: %s" +msgid "" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document: Account code: %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:827 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any analytic account corresponding to the following information extracted from the business document: Analytic account code: %s" +msgid "" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document: Analytic account code: %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:866 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any journal corresponding to the following information extracted from the business document: Journal code: %s" +msgid "" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document: Journal code: %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:382 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" -"" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:266 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +msgid "" +"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" "Parent Partner: %s\n" "ZIP: %s\n" "State code: %s\n" "Country code: %s\n" -"" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:588 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" "Tax amount: %s %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:676 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "One of the imported lines doesn't have any product, so the lines haven't been updated." +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:153 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The %s has been identified by the domain name '%s' so please check carefully that the %s is correct." +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully" +" that the %s is correct." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:910 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The VAT number of the customer written in the business document (%s) doesn't match the VAT number of the company '%s' (%s) in which you are trying to import this document." +msgid "" +"The VAT number of the customer written in the business document (%s) doesn't" +" match the VAT number of the company '%s' (%s) in which you are trying to " +"import this document." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:114 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as %s VAT number. But there are no %s with this VAT number in Odoo." +msgid "" +"The analysis of the business document returned '%s' as %s VAT number. But " +"there are no %s with this VAT number in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:91 -#: code:addons/base_business_document_import/models/business_document_import.py:238 +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as country code. But there are no country with that code in Odoo." +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:452 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the country code to find the related currency. But the country '%s' doesn't have any related currency configured in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But the country '%s' doesn't have any related " +"currency configured in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:459 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the country code to find the related currency. But there is no country with that code in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:416 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the currency ISO code. But there are no currency with that code in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:439 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the currency symbol or ISO code. But there are none or several currencies with the symbol/ISO code in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the currency symbol " +"or ISO code. But there are none or several currencies with the symbol/ISO " +"code in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:426 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the currency symbol. But there are none or several currencies with that symbol in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:500 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned '%s' as the unit of measure UNECE code, but there is no unit of measure with that UNECE code in Odoo. Please check the configuration of the units of measures in Odoo." +msgid "" +"The analysis of the business document returned '%s' as the unit of measure " +"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " +"Please check the configuration of the units of measures in Odoo." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:329 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The analysis of the business document returned IBAN %s as bank account, but there is no such bank account in Odoo linked to partner %s and the option to automatically create bank accounts upon import is disabled." +msgid "" +"The analysis of the business document returned IBAN %s as bank " +"account, but there is no such bank account in Odoo linked to partner %s and the option to " +"automatically create bank accounts upon import is disabled." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:322 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The bank account IBAN %s has been automatically added on the supplier %s" +msgid "" +"The bank account IBAN %s has been automatically added on the supplier" +" %s" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:656 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The existing line '%s' doesn't have any product, so the lines haven't been updated." +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:662 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The product '%s' is used on several existing lines, so the lines haven't been updated." +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:684 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "The product '%s' is used on several imported lines, so the lines haven't been updated." +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:78 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:80 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:75 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "" - diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 4e7fbdcaf3..e68cdec208 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -71,10 +71,10 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): company_id = self._context.get("force_company") or self.env.user.company_id.id domain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] if partner_type == "supplier": - domain += [("supplier", "=", True)] + domain += [("supplier_rank", ">", 0)] partner_type_label = _("supplier") elif partner_type == "customer": - domain += [("customer", "=", True)] + domain += [("customer_rank", ">", 0)] partner_type_label = _("customer") else: partner_type_label = _("partner") @@ -110,10 +110,8 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] if partner_dict.get("vat"): vat = partner_dict["vat"].replace(" ", "").upper() - # use base_vat_sanitized partner = rpo.search( - domain + [("parent_id", "=", False), ("sanitized_vat", "=", vat)], - limit=1, + domain + [("parent_id", "=", False), ("vat", "=", vat)], limit=1, ) if partner: return partner @@ -1019,8 +1017,8 @@ def _check_company(self, company_dict, chatter_msg): company = self.env.user.company_id if company_dict.get("vat"): parsed_company_vat = company_dict["vat"].replace(" ", "").upper() - if company.partner_id.sanitized_vat: - if company.partner_id.sanitized_vat != parsed_company_vat: + if company.partner_id.vat: + if company.partner_id.vat != parsed_company_vat: raise self.user_error_wrap( _( "The VAT number of the customer written in the " @@ -1031,7 +1029,7 @@ def _check_company(self, company_dict, chatter_msg): % ( parsed_company_vat, company.display_name, - company.partner_id.sanitized_vat, + company.partner_id.vat, ) ) else: @@ -1086,7 +1084,6 @@ def post_create_or_update(self, parsed_dict, record, doc_filename=None): "res_id": record.id, "res_model": str(record._name), "datas": data_base64, - "datas_fname": filename, } ) for msg in parsed_dict["chatter_msg"]: diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 0abe539a72..9beb224caa 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -367,7 +367,7 @@

Base Business Document Import

!! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

  • account_invoice_import which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as account_invoice_import_invoice2data, account_invoice_import_ubl, etc… to support specific invoice formats),
  • @@ -390,7 +390,7 @@

    Bug Tracker

    Bugs are tracked on GitHub 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.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -416,7 +416,7 @@

    Maintainers

    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.

    -

    This module is part of the OCA/edi project on GitHub.

    +

    This module is part of the OCA/edi project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index be924e8d79..0012a45c0b 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -9,25 +9,21 @@ class TestBaseBusinessDocumentImport(TransactionCase): def test_match_partner(self): partner1 = self.env["res.partner"].create( - { - "name": "Total SA", - "supplier": False, - "customer": False, - "ref": "TOTAL", - "website": "www.total.com", - } + {"name": "COGIP", "ref": "COGIP", "website": "http://example.com/"} ) bdio = self.env["business.document.import"] # match on domain extracted from email with warning - partner_dict = {"email": "alexis.delattre@total.com"} + partner_dict = {"email": "alexis.delattre@example.com"} warn = [] res = bdio._match_partner(partner_dict, warn, partner_type=False) self.assertEqual(res, partner1) self.assertTrue(warn) partner_dict = {"name": "ready mat "} + partner_ready_mat = self.env.ref("base.res_partner_4") + partner_ready_mat.supplier_rank = 1 # to be considered as a supplier res = bdio._match_partner(partner_dict, [], partner_type="supplier") - self.assertEqual(res, self.env.ref("base.res_partner_4")) - partner_dict = {"ref": "TOTAL"} + self.assertEqual(res, partner_ready_mat) + partner_dict = {"ref": "COGIP"} res = bdio._match_partner(partner_dict, [], partner_type=False) self.assertEqual(res, partner1) From 7b7c460c2cab47bb82fdd32a9353bfe62cd2b4f0 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 10 Jun 2020 14:17:19 +0000 Subject: [PATCH 46/99] base_business_document_import 13.0.1.1.0 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 73 +++++++++---------- base_business_document_import/i18n/fr.po | 73 +++++++++---------- 3 files changed, 73 insertions(+), 75 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 7c23a5a319..5de1e395e1 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "13.0.1.0.0", + "version": "13.0.1.1.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index 01b940c517..7fe1572701 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -20,25 +20,25 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:600 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "(Úprávy)" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:976 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "Poznámky v souboru %s:" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:978 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "Poznámky v importovaném dokumentu:" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:513 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " @@ -51,7 +51,7 @@ msgstr "" "jednotka: %s Je použita měrná jednotka 'Jednotky)' Musíte ji ručně změnit." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:782 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "Přibližná shoda: účet %s byl přiřazen účtu %s" @@ -62,7 +62,7 @@ msgid "Common methods to import business documents" msgstr "Společné metody importu obchodních dokumentů" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:891 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" @@ -73,7 +73,7 @@ msgid "Display Name" msgstr "Zobrazovaný název" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:692 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "For product '%s', the unit of measure is %s on the existing line, but it is " @@ -85,7 +85,7 @@ msgstr "" "řádky nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:292 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s není platný, takže byl ignorován." @@ -101,19 +101,19 @@ msgid "Last Modified on" msgstr "Poslední změna dne" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:919 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:470 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "Není uvedena žádná měna, takže Odoo použil měnu společnosti (%s)" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:170 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any %s corresponding to the following information " @@ -128,7 +128,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:786 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " @@ -136,7 +136,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:827 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " @@ -144,7 +144,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:866 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " @@ -152,7 +152,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:382 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " @@ -162,7 +162,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:266 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " @@ -174,7 +174,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:588 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " @@ -186,7 +186,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:676 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " @@ -194,7 +194,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:153 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The %s has been identified by the domain name '%s' so please check carefully " @@ -202,7 +202,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:910 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The VAT number of the customer written in the business document (%s) doesn't " @@ -211,7 +211,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:114 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as %s VAT number. But " @@ -219,8 +219,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:91 -#: code:addons/base_business_document_import/models/business_document_import.py:238 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " @@ -228,7 +227,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:452 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -237,7 +236,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:459 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -245,7 +244,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:416 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " @@ -253,7 +252,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:439 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, fuzzy, python-format #| msgid "" #| "The analysis of the business document returned '%s' as the currency " @@ -268,7 +267,7 @@ msgstr "" "ISO. Neexistuje však žádná měna se symbolem ani kódem ISO v Odoo." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:426 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " @@ -278,7 +277,7 @@ msgstr "" "neexistuje žádný nebo několik měn s tímto symbolem." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:500 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the unit of measure " @@ -290,7 +289,7 @@ msgstr "" "prosím konfiguraci jednotek opatření v Odoo." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:329 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned IBAN %s as bank " @@ -300,7 +299,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:322 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, fuzzy, python-format #| msgid "" #| "The bank account IBAN %s has been automatically added on the " @@ -311,7 +310,7 @@ msgid "" msgstr "Bankovní účet 1IBAN %s byl automaticky přidán na dodavatele %s" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:656 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " @@ -320,7 +319,7 @@ msgstr "" "Existující řádek '%s' nemá žádný produkt, takže 1 řádky nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:662 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " @@ -330,7 +329,7 @@ msgstr "" "aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:684 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " @@ -340,19 +339,19 @@ msgstr "" "nebyly aktualizovány." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:78 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "zákazník" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:80 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "partner" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:75 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "dodavatele" diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 5f0d04a0bb..ad4718d7f5 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -19,25 +19,25 @@ msgstr "" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:600 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:976 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:978 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:513 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " @@ -47,7 +47,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:782 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "" @@ -58,7 +58,7 @@ msgid "Common methods to import business documents" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:891 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" @@ -69,7 +69,7 @@ msgid "Display Name" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:692 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "For product '%s', the unit of measure is %s on the existing line, but it is " @@ -78,7 +78,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:292 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "" @@ -94,19 +94,19 @@ msgid "Last Modified on" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:919 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:470 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:170 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any %s corresponding to the following information " @@ -121,7 +121,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:786 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " @@ -129,7 +129,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:827 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " @@ -137,7 +137,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:866 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " @@ -145,7 +145,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:382 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " @@ -155,7 +155,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:266 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " @@ -167,7 +167,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:588 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " @@ -179,7 +179,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:676 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " @@ -187,7 +187,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:153 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The %s has been identified by the domain name '%s' so please check carefully " @@ -195,7 +195,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:910 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The VAT number of the customer written in the business document (%s) doesn't " @@ -204,7 +204,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:114 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as %s VAT number. But " @@ -212,8 +212,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:91 -#: code:addons/base_business_document_import/models/business_document_import.py:238 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " @@ -221,7 +220,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:452 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -230,7 +229,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:459 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " @@ -238,7 +237,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:416 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " @@ -246,7 +245,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:439 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol " @@ -255,7 +254,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:426 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " @@ -263,7 +262,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:500 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned '%s' as the unit of measure " @@ -272,7 +271,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:329 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The analysis of the business document returned IBAN %s as bank " @@ -282,7 +281,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:322 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The bank account IBAN %s has been automatically added on the supplier " @@ -290,7 +289,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:656 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " @@ -298,7 +297,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:662 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " @@ -306,7 +305,7 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:684 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " @@ -314,19 +313,19 @@ msgid "" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:78 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:80 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "" #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:75 +#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "" From dee9654f0d4b8961fe8b012628bb240c8cb020a0 Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Mon, 3 Aug 2020 14:45:17 +0200 Subject: [PATCH 47/99] [13.0][IMP] base_business_document_import partner search As there is no longer a specific separation between customer and supplier with the `customer_rank` and `supplier_rank` fields on partner. It is less error prone to order the partner found by there rank type insteed of filtering. --- .../models/business_document_import.py | 29 ++++++++++++++----- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index e68cdec208..60e89377c3 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -71,12 +71,13 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): company_id = self._context.get("force_company") or self.env.user.company_id.id domain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] if partner_type == "supplier": - domain += [("supplier_rank", ">", 0)] + order = "supplier_rank desc" partner_type_label = _("supplier") elif partner_type == "customer": - domain += [("customer_rank", ">", 0)] + order = "customer_rank desc" partner_type_label = _("customer") else: + order = "" partner_type_label = _("partner") country = False if partner_dict.get("country_code"): @@ -111,7 +112,9 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): if partner_dict.get("vat"): vat = partner_dict["vat"].replace(" ", "").upper() partner = rpo.search( - domain + [("parent_id", "=", False), ("vat", "=", vat)], limit=1, + domain + [("parent_id", "=", False), ("vat", "=", vat)], + limit=1, + order=order, ) if partner: return partner @@ -134,7 +137,9 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): email_domain = False if partner_dict.get("email") and "@" in partner_dict["email"]: partner = rpo.search( - domain + [("email", "=ilike", partner_dict["email"])], limit=1 + domain + [("email", "=ilike", partner_dict["email"])], + limit=1, + order=order, ) if partner: return partner @@ -150,14 +155,18 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): if website_domain or email_domain: partner_domain = website_domain or email_domain partner = rpo.search( - domain + [("website", "=ilike", "%" + partner_domain + "%")], limit=1 + domain + [("website", "=ilike", "%" + partner_domain + "%")], + limit=1, + order=order, ) # I can't search on email addresses with # email_domain because of the emails such as # @gmail.com, @yahoo.com that may match random partners if not partner and website_domain: partner = rpo.search( - domain + [("email", "=ilike", "%@" + website_domain)], limit=1 + domain + [("email", "=ilike", "%@" + website_domain)], + limit=1, + order=order, ) if partner: chatter_msg.append( @@ -169,12 +178,16 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): ) return partner if partner_dict.get("ref"): - partner = rpo.search(domain + [("ref", "=", partner_dict["ref"])], limit=1) + partner = rpo.search( + domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order + ) if partner: return partner if partner_dict.get("name"): partner = rpo.search( - domain + [("name", "=ilike", partner_dict["name"])], limit=1 + domain + [("name", "=ilike", partner_dict["name"])], + limit=1, + order=order, ) if partner: return partner From 810548a27f98efddcbae25fb4fefe15e185e970f Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 10 Aug 2020 06:49:05 +0000 Subject: [PATCH 48/99] base_business_document_import 13.0.1.1.1 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 5de1e395e1..c2df5dedf9 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "13.0.1.1.0", + "version": "13.0.1.1.1", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index 7fe1572701..aa32d2be94 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -254,10 +254,6 @@ msgstr "" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, fuzzy, python-format -#| msgid "" -#| "The analysis of the business document returned '%s' as the currency " -#| "symbol or ISO code. But there are no currency with the symbol nor ISO " -#| "code in Odoo." msgid "" "The analysis of the business document returned '%s' as the currency symbol " "or ISO code. But there are none or several currencies with the symbol/ISO " @@ -301,9 +297,6 @@ msgstr "" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, fuzzy, python-format -#| msgid "" -#| "The bank account IBAN %s has been automatically added on the " -#| "supplier %s" msgid "" "The bank account IBAN %s has been automatically added on the supplier " "%s" From b967a592bd463e76326b69f2916fd4900ece1690 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Fri, 18 Sep 2020 12:10:29 +0200 Subject: [PATCH 49/99] Refactor partner matching 1/ First try to match on explicit partner ref 2/ If country and/or state is provided, make optional on search domain 3/ If vat is provided, make required on search domain 4/ Call search hook 5/ Try to match on email 6/ Try to match on name 7/ Try to match on website or email domain 8/ Try to match on vat Do not reformat VAT number as in Odoo v13 the VAT number is normalized and UBL provides a normalized VAT number. Moreover, some countries like Switzerland have spaces in the normalized VAT number that should not be removed. --- .../models/business_document_import.py | 69 +++++++++++-------- 1 file changed, 42 insertions(+), 27 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 60e89377c3..08f8bdccad 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -79,6 +79,16 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): else: order = "" partner_type_label = _("partner") + + # If a ref is explicitly given, we just want to match that partner + if partner_dict.get("ref"): + partner = rpo.search( + domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order + ) + if partner: + return partner + + # Append optional country and state to the domain country = False if partner_dict.get("country_code"): country = self.env["res.country"].search( @@ -109,31 +119,20 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): ) if state: domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] + + # Append required vat to the domain if partner_dict.get("vat"): - vat = partner_dict["vat"].replace(" ", "").upper() - partner = rpo.search( - domain + [("parent_id", "=", False), ("vat", "=", vat)], - limit=1, - order=order, - ) - if partner: - return partner - else: - chatter_msg.append( - _( - "The analysis of the business document returned '%s' as " - "%s VAT number. But there are no %s " - "with this VAT number in Odoo." - ) - % (vat, partner_type_label, partner_type_label) - ) + vat = partner_dict["vat"] + domain += [("vat", "=", vat)] + # Hook to plug alternative matching methods partner = self._hook_match_partner( partner_dict, chatter_msg, domain, partner_type_label ) if partner: return partner - website_domain = False + + # Search for partner email_domain = False if partner_dict.get("email") and "@" in partner_dict["email"]: partner = rpo.search( @@ -145,6 +144,17 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): return partner else: email_domain = partner_dict["email"].split("@")[1] + + if partner_dict.get("name"): + partner = rpo.search( + domain + [("name", "=ilike", partner_dict["name"])], + limit=1, + order=order, + ) + if partner: + return partner + + website_domain = False if partner_dict.get("website"): urlp = urlparse(partner_dict["website"]) netloc = urlp.netloc @@ -177,20 +187,25 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): % (partner_type_label, partner_domain, partner_type_label) ) return partner - if partner_dict.get("ref"): - partner = rpo.search( - domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order - ) - if partner: - return partner - if partner_dict.get("name"): + + if partner_dict.get("vat"): partner = rpo.search( - domain + [("name", "=ilike", partner_dict["name"])], + domain, limit=1, order=order, ) if partner: return partner + if not partner: + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "%s VAT number. But there are no %s " + "with this VAT number in Odoo." + ) + % (vat, partner_type_label, partner_type_label) + ) + raise self.user_error_wrap( _( "Odoo couldn't find any %s corresponding to the following " @@ -695,7 +710,7 @@ def compare_lines( price_precision=None, seller=False, ): - """ Example: + """Example: existing_lines = [{ 'product': odoo_recordset, 'name': 'USB Adapter', From ba408ef311075469e0cd2e7eaf3c3569703f9213 Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Fri, 18 Sep 2020 13:54:50 +0200 Subject: [PATCH 50/99] Allow to make parsing hook based on PartyIdentification/ID Some industries still identify party with a GLN and schemeID="GLN" or with a VAT number and schemeID=":VAT". This allow to process it with a parsing hook in the partner matching. Add module partner_identification_import to match partner by external identifier using the above hook. --- base_business_document_import/README.rst | 1 + .../models/business_document_import.py | 6 +----- base_business_document_import/readme/CONTRIBUTORS.rst | 1 + base_business_document_import/static/description/index.html | 1 + 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 52549bf441..1824195204 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -60,6 +60,7 @@ Contributors * Alexis de Lattre * Nicolas JEUDY +* Jacques-Etienne Baudoux Maintainers ~~~~~~~~~~~ diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 08f8bdccad..c4bb5b0fa4 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -189,11 +189,7 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): return partner if partner_dict.get("vat"): - partner = rpo.search( - domain, - limit=1, - order=order, - ) + partner = rpo.search(domain, limit=1, order=order) if partner: return partner if not partner: diff --git a/base_business_document_import/readme/CONTRIBUTORS.rst b/base_business_document_import/readme/CONTRIBUTORS.rst index 3382e3fd15..732e7af688 100644 --- a/base_business_document_import/readme/CONTRIBUTORS.rst +++ b/base_business_document_import/readme/CONTRIBUTORS.rst @@ -1,2 +1,3 @@ * Alexis de Lattre * Nicolas JEUDY +* Jacques-Etienne Baudoux diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 9beb224caa..d974812735 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -407,6 +407,7 @@

    Contributors

    From a0a40b50932d14bf0e60f869ca39ae3f576ec6eb Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Sun, 4 Oct 2020 11:41:19 +0200 Subject: [PATCH 51/99] Improve partner contact matching --- .../models/business_document_import.py | 61 +++++++++++++------ 1 file changed, 44 insertions(+), 17 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index c4bb5b0fa4..420968bf94 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -46,6 +46,39 @@ def _strip_cleanup_dict(self, match_dict): if match_dict.get("state_code"): match_dict["state_code"] = match_dict["state_code"].upper() + @api.model + def _match_partner_contact(self, partner_dict, domain, order): + rpo = self.env["res.partner"] + if partner_dict.get("email") and "@" in partner_dict["email"]: + partner = rpo.search( + domain + [("email", "=ilike", partner_dict["email"])], + limit=1, + order=order, + ) + if partner: + return partner + if partner_dict.get("contact"): + partner = rpo.search( + domain + [("name", "=ilike", partner_dict["contact"])], + limit=1, + order=order, + ) + if partner: + return partner + if partner_dict.get("phone"): + partner = rpo.search( + domain + + [ + "|", + ("mobile", "=", partner_dict["phone"]), + ("phone", "=", partner_dict["phone"]), + ], + limit=1, + order=order, + ) + if partner: + return partner + @api.model # noqa: C901 def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): """Example: @@ -59,8 +92,6 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): 'ref': 'C1242', 'phone': '01.41.98.12.42', } - The key 'phone' is used by the module - base_phone_business_document_import """ rpo = self.env["res.partner"] self._strip_cleanup_dict(partner_dict) @@ -126,25 +157,16 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): domain += [("vat", "=", vat)] # Hook to plug alternative matching methods - partner = self._hook_match_partner( - partner_dict, chatter_msg, domain, partner_type_label - ) + partner = self._hook_match_partner(partner_dict, chatter_msg, domain, order) if partner: return partner - # Search for partner - email_domain = False - if partner_dict.get("email") and "@" in partner_dict["email"]: - partner = rpo.search( - domain + [("email", "=ilike", partner_dict["email"])], - limit=1, - order=order, - ) - if partner: - return partner - else: - email_domain = partner_dict["email"].split("@")[1] + # Search for partner contact + partner = self._match_partner_contact(partner_dict, domain, order) + if partner: + return partner + # Search for partner if partner_dict.get("name"): partner = rpo.search( domain + [("name", "=ilike", partner_dict["name"])], @@ -155,6 +177,11 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): return partner website_domain = False + email_domain = ( + partner_dict.get("email") + and "@" in partner_dict["email"] + and partner_dict["email"].split("@")[1] + ) if partner_dict.get("website"): urlp = urlparse(partner_dict["website"]) netloc = urlp.netloc From a7ea7c32af4c9dd9e6a967e92a022619d1f13a4f Mon Sep 17 00:00:00 2001 From: Jacques-Etienne Baudoux Date: Mon, 5 Oct 2020 00:22:28 +0200 Subject: [PATCH 52/99] Parse and import Sales Order Invoicing Partner. Refactor shipping partner matching. A shipping partner is not especially related to the ordering party. It could be any partner. However, we want to ensure that the address is respected. Fix-up: PartyIdentification/ID is a 1..N relation. Parse each of them for a match --- .../i18n/base_business_document_import.pot | 18 +- .../models/business_document_import.py | 190 ++++++++++-------- .../tests/test_business_document_import.py | 30 +-- 3 files changed, 122 insertions(+), 116 deletions(-) diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index 4630c5ab49..60ac2dee50 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -153,7 +153,14 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" -"Parent Partner: %s\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Street: %s\n" +"Street2: %s\n" +"City: %s\n" "ZIP: %s\n" "State code: %s\n" "Country code: %s\n" @@ -198,15 +205,6 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as %s VAT number. But " -"there are no %s with this VAT number in Odoo." -msgstr "" - -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." msgstr "" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 420968bf94..47c0e0344c 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -80,7 +80,14 @@ def _match_partner_contact(self, partner_dict, domain, order): return partner @api.model # noqa: C901 - def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): + def _match_partner( + self, + partner_dict, + chatter_msg, + partner_type="supplier", + domain=None, + raise_exception=True, + ): """Example: partner_dict = { 'country_code': 'FR', @@ -100,7 +107,8 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): if partner_dict.get("id"): return rpo.browse(partner_dict["id"]) company_id = self._context.get("force_company") or self.env.user.company_id.id - domain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + domain = domain or [] + domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)] if partner_type == "supplier": order = "supplier_rank desc" partner_type_label = _("supplier") @@ -219,16 +227,9 @@ def _match_partner(self, partner_dict, chatter_msg, partner_type="supplier"): partner = rpo.search(domain, limit=1, order=order) if partner: return partner - if not partner: - chatter_msg.append( - _( - "The analysis of the business document returned '%s' as " - "%s VAT number. But there are no %s " - "with this VAT number in Odoo." - ) - % (vat, partner_type_label, partner_type_label) - ) + if not raise_exception: + return raise self.user_error_wrap( _( "Odoo couldn't find any %s corresponding to the following " @@ -260,97 +261,116 @@ def _hook_match_partner( return False @api.model - def _match_shipping_partner(self, shipping_dict, partner, chatter_msg): + def _match_shipping_partner( + self, partner_dict, partner, chatter_msg, domain=None, raise_exception=True + ): """Example: shipping_dict = { - 'partner': { - 'email': 'contact@akretion.com', - 'name': 'Akretion France', - }, - 'address': { - 'zip': '69100', - 'country_code': 'FR', - }, + 'email': 'contact@akretion.com', + 'name': 'Akretion France', + 'street': 'Long Avenue', + 'street2': 'Building 2A', + 'city': 'Paris', + 'zip': '69100', + 'country_code': 'FR', } - The partner argument is a bit special: it is a fallback in case - shipping_dict['partner'] = {} + The shipping partner can be any partner, not especially related to the + customer/supplier (partner argument) """ - rpo = self.env["res.partner"] - if shipping_dict.get("partner"): - partner = self._match_partner( - shipping_dict["partner"], chatter_msg, partner_type=False - ) - company_id = self._context.get("force_company") or self.env.user.company_id.id - domain = [ - "|", - ("company_id", "=", False), - ("company_id", "=", company_id), - ("parent_id", "=", partner.id), - ] - address_dict = shipping_dict["address"] - self._strip_cleanup_dict(address_dict) - country = False - parent_partner_matches = True - if address_dict.get("country_code"): - country = self.env["res.country"].search( - [("code", "=", address_dict["country_code"])], limit=1 - ) - if country: + domain = domain or [] + if partner_dict.get("street"): + if partner_dict.get("street_number"): domain += [ - "|", - ("country_id", "=", False), - ("country_id", "=", country.id), + ( + "street", + "in", + [ + "{} {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{} {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + "{}, {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{}, {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + ], + ) ] - if partner.country_id != country: - parent_partner_matches = False else: - chatter_msg.append( - _( - "The analysis of the business document returned '%s' as " - "country code. But there are no country with that code " - "in Odoo." - ) - % address_dict["country_code"] - ) - if country and address_dict.get("state_code"): - state = self.env["res.country.state"].search( - [ - ("code", "=", address_dict["state_code"]), - ("country_id", "=", country.id), - ], - limit=1, - ) - if state: - domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] - if partner.state_id and partner.state_id != state: - parent_partner_matches = False - if address_dict.get("zip"): - domain.append(("zip", "=", address_dict["zip"])) - # sanitize ZIP ? - if partner.zip != address_dict["zip"]: - parent_partner_matches = False - spartner = rpo.search(domain + [("type", "=", "delivery")], limit=1) - if spartner: - return spartner - spartner = rpo.search(domain, limit=1) - if spartner: - return spartner - if parent_partner_matches: + domain += [("street", "=", partner_dict.get("street"))] + if partner_dict.get("street2"): + domain += [("street2", "=", partner_dict.get("street2"))] + if partner_dict.get("city"): + domain += [("city", "=", partner_dict.get("city"))] + if partner_dict.get("zip"): + domain += [("zip", "=", partner_dict.get("zip"))] + + domain_delivery = domain + [("type", "=", "delivery")] + partner = self._match_partner( + partner_dict, + chatter_msg, + partner_type=False, + domain=domain_delivery, + raise_exception=False, + ) + if partner: + return partner + if not partner_dict.get("vat"): + partner = self.env["res.partner"].search(domain_delivery, limit=1) + if partner: + return partner + partner = self._match_partner( + partner_dict, + chatter_msg, + partner_type=False, + domain=domain, + raise_exception=False, + ) + if partner: return partner + if not partner_dict.get("vat"): + partner = self.env["res.partner"].search(domain, limit=1) + if partner: + return partner + + if not raise_exception: + return raise self.user_error_wrap( _( "Odoo couldn't find any shipping partner corresponding to the " "following information extracted from the business document:\n" - "Parent Partner: %s\n" + "Name: %s\n" + "VAT number: %s\n" + "Reference: %s\n" + "E-mail: %s\n" + "Website: %s\n" + "Street: %s\n" + "Street2: %s\n" + "City: %s\n" "ZIP: %s\n" "State code: %s\n" "Country code: %s\n" ) % ( - partner.display_name, - address_dict.get("zip"), - address_dict.get("state_code"), - address_dict.get("country_code"), + partner_dict.get("name"), + partner_dict.get("vat"), + partner_dict.get("ref"), + partner_dict.get("email"), + partner_dict.get("website"), + partner_dict.get("street"), + partner_dict.get("street2"), + partner_dict.get("city"), + partner_dict.get("zip"), + partner_dict.get("state_code"), + partner_dict.get("country_code"), ) ) diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 0012a45c0b..4e1d480b5e 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -1,4 +1,5 @@ # Copyright 2016-2019 Akretion France (http://www.akretion.com/) +# Copyright 2020 Jacques-Etienne Baudoux (BCIM) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -39,14 +40,6 @@ def test_match_shipping_partner(self): "email": "contact@akretion.com", } ) - cpartner1 = rpo.create( - { - "parent_id": partner1.id, - "name": "Alexis de Lattre", - "email": "alexis.delattre@akretion.com", - "type": "delivery", - } - ) rpo.create( { "parent_id": partner1.id, @@ -68,18 +61,18 @@ def test_match_shipping_partner(self): } ) shipping_dict = { - "partner": {"email": "contact@akretion.com"}, - "address": {}, + "email": "contact@akretion.com", } res = bdio._match_shipping_partner(shipping_dict, None, []) - self.assertEqual(res, cpartner1) - shipping_dict["address"] = { + self.assertEqual(res, partner1) + shipping_dict = { + "street": "42 rue des lilas d'Espagne", "zip": "92400", "country_code": "fr", } res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner3) - shipping_dict["address"]["zip"] = "92500" + shipping_dict["zip"] = "92500" with self.assertRaises(UserError): bdio._match_shipping_partner(shipping_dict, None, []) partner2 = rpo.create( @@ -91,17 +84,12 @@ def test_match_shipping_partner(self): } ) shipping_dict = { - "partner": {"email": "contact@alex.com"}, - "address": {"country_code": "FR", "zip": "69009"}, + "email": "contact@alex.com", + "zip": "69009", + "country_code": "FR", } res = bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, partner2) - shipping_dict = { - "partner": {}, - "address": {}, - } - res = bdio._match_shipping_partner(shipping_dict, partner1, []) - self.assertEqual(res, cpartner1) def test_match_currency(self): bdio = self.env["business.document.import"] From df772d86b336bb941bee407a68580d875c5f3728 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Wed, 4 Nov 2020 08:08:59 +0000 Subject: [PATCH 53/99] base_business_document_import 13.0.2.0.0 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 17 ++++++++--------- base_business_document_import/i18n/fr.po | 17 ++++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index c2df5dedf9..bfad9be623 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "13.0.1.1.1", + "version": "13.0.2.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index aa32d2be94..da1e231ac2 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -167,7 +167,14 @@ msgstr "" msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Parent Partner: %s\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Street: %s\n" +"Street2: %s\n" +"City: %s\n" "ZIP: %s\n" "State code: %s\n" "Country code: %s\n" @@ -210,14 +217,6 @@ msgid "" "import this document." msgstr "" -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%s' as %s VAT number. But " -"there are no %s with this VAT number in Odoo." -msgstr "" - #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index ad4718d7f5..32cafb58d3 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -160,7 +160,14 @@ msgstr "" msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Parent Partner: %s\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Street: %s\n" +"Street2: %s\n" +"City: %s\n" "ZIP: %s\n" "State code: %s\n" "Country code: %s\n" @@ -203,14 +210,6 @@ msgid "" "import this document." msgstr "" -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%s' as %s VAT number. But " -"there are no %s with this VAT number in Odoo." -msgstr "" - #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format From eaeda68126afd8609664384eaf79ec2b5ea73a81 Mon Sep 17 00:00:00 2001 From: Tran Thanh Phuc Date: Thu, 1 Apr 2021 09:51:01 +0700 Subject: [PATCH 54/99] [MIG] base_business_document_import: Migration to 14.0 --- base_business_document_import/README.rst | 18 +++++++++++----- base_business_document_import/__manifest__.py | 2 +- .../i18n/base_business_document_import.pot | 2 +- .../models/business_document_import.py | 21 ++++++++++--------- .../readme/CONTRIBUTORS.rst | 1 + .../readme/CREDITS.rst | 3 +++ .../static/description/index.html | 19 ++++++++++++----- .../tests/test_business_document_import.py | 2 +- 8 files changed, 45 insertions(+), 23 deletions(-) create mode 100644 base_business_document_import/readme/CREDITS.rst diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 1824195204..c0c3f642f5 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -14,13 +14,13 @@ Base Business Document Import :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github - :target: https://github.com/OCA/edi/tree/13.0/base_business_document_import + :target: https://github.com/OCA/edi/tree/14.0/base_business_document_import :alt: OCA/edi .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/edi-13-0/edi-13-0-base_business_document_import + :target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/226/13.0 + :target: https://runbot.odoo-community.org/runbot/226/14.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -42,7 +42,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -61,6 +61,14 @@ Contributors * Alexis de Lattre * Nicolas JEUDY * Jacques-Etienne Baudoux +* Phuc (Tran Thanh) + +Other credits +~~~~~~~~~~~~~ + +The development of this module has been financially supported by: + +* Camptocamp Maintainers ~~~~~~~~~~~ @@ -75,6 +83,6 @@ 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. -This module is part of the `OCA/edi `_ project on GitHub. +This module is part of the `OCA/edi `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index bfad9be623..95c32d973d 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "13.0.2.0.0", + "version": "14.0.1.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index 60ac2dee50..63796e2ea6 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 13.0\n" +"Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 47c0e0344c..50e2784012 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -79,8 +79,8 @@ def _match_partner_contact(self, partner_dict, domain, order): if partner: return partner - @api.model # noqa: C901 - def _match_partner( + @api.model + def _match_partner( # noqa: C901 self, partner_dict, chatter_msg, @@ -720,7 +720,8 @@ def _match_tax( ("unece_due_date_code", "=", tax_dict["unece_due_date_code"]), ("unece_due_date_code", "=", False), ] - taxes = ato.search(domain, order="unece_due_date_code") + taxes = ato.search(domain) + taxes = taxes.sorted(key=lambda t: t._get_unece_due_date_type_code()) for tax in taxes: tax_amount = tax.amount # 'amount' field : digits=(16, 4) if not float_compare(tax_dict["amount"], tax_amount, precision_digits=4): @@ -905,8 +906,8 @@ def _prepare_account_speed_dict(self): [("company_id", "=", company_id), ("deprecated", "=", False)], ["code"] ) speed_dict = {} - for l in res: - speed_dict[l["code"].upper()] = l["id"] + for line in res: + speed_dict[line["code"].upper()] = line["id"] return speed_dict @api.model @@ -967,9 +968,9 @@ def _prepare_analytic_account_speed_dict(self): [("company_id", "=", company_id)], ["code"] ) speed_dict = {} - for l in res: - if l["code"]: - speed_dict[l["code"].upper()] = l["id"] + for line in res: + if line["code"]: + speed_dict[line["code"].upper()] = line["id"] return speed_dict @api.model @@ -1010,8 +1011,8 @@ def _prepare_journal_speed_dict(self): [("company_id", "=", company_id)], ["code"] ) speed_dict = {} - for l in res: - speed_dict[l["code"].upper()] = l["id"] + for line in res: + speed_dict[line["code"].upper()] = line["id"] return speed_dict @api.model diff --git a/base_business_document_import/readme/CONTRIBUTORS.rst b/base_business_document_import/readme/CONTRIBUTORS.rst index 732e7af688..a223314d70 100644 --- a/base_business_document_import/readme/CONTRIBUTORS.rst +++ b/base_business_document_import/readme/CONTRIBUTORS.rst @@ -1,3 +1,4 @@ * Alexis de Lattre * Nicolas JEUDY * Jacques-Etienne Baudoux +* Phuc (Tran Thanh) diff --git a/base_business_document_import/readme/CREDITS.rst b/base_business_document_import/readme/CREDITS.rst new file mode 100644 index 0000000000..f5cc070c78 --- /dev/null +++ b/base_business_document_import/readme/CREDITS.rst @@ -0,0 +1,3 @@ +The development of this module has been financially supported by: + +* Camptocamp diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index d974812735..2d52bea282 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -367,7 +367,7 @@

    Base Business Document Import

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

    This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

    • account_invoice_import which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as account_invoice_import_invoice2data, account_invoice_import_ubl, etc… to support specific invoice formats),
    • @@ -380,7 +380,8 @@

      Base Business Document Import

    • Credits
    @@ -390,7 +391,7 @@

    Bug Tracker

    Bugs are tracked on GitHub 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.

    +feedback.

    Do not contact contributors directly about support or help with technical issues.

    @@ -408,16 +409,24 @@

    Contributors

  • Alexis de Lattre <alexis.delattre@akretion.com>
  • Nicolas JEUDY <https://github.com/njeudy>
  • Jacques-Etienne Baudoux <je@bcim.be>
  • +
  • Phuc (Tran Thanh) <phuc@trobz.com>
  • +
+ +
+

Other credits

+

The development of this module has been financially supported by:

+
    +
  • Camptocamp
-

Maintainers

+

Maintainers

This module is maintained by the OCA.

Odoo Community Association

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.

-

This module is part of the OCA/edi project on GitHub.

+

This module is part of the OCA/edi project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 4e1d480b5e..df3a2b3af9 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -162,7 +162,7 @@ def test_match_uom(self): uom_dict = {"name": "day"} res = bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_day")) - uom_dict = {"name": " Liter "} + uom_dict = {"name": "L"} res = bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_litre")) uom_dict = {} From 6d49257af05b4f71e4c8c4ed84ad27a22110c034 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 9 Apr 2021 10:10:39 +0200 Subject: [PATCH 55/99] base_business_document_import: Improve tests on taxes Improve error handling Code cleanup Remove CREDITS: either we list all the companies that financially supported the dev of the module or none, but we can't list just one. --- base_business_document_import/README.rst | 15 +- base_business_document_import/__manifest__.py | 5 +- .../i18n/base_business_document_import.pot | 16 +- .../models/business_document_import.py | 205 +++++++++++------- .../readme/CREDITS.rst | 3 - .../static/description/index.html | 14 +- .../tests/test_business_document_import.py | 26 ++- 7 files changed, 168 insertions(+), 116 deletions(-) delete mode 100644 base_business_document_import/readme/CREDITS.rst diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index c0c3f642f5..ae0e5a8e7f 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -63,13 +63,6 @@ Contributors * Jacques-Etienne Baudoux * Phuc (Tran Thanh) -Other credits -~~~~~~~~~~~~~ - -The development of this module has been financially supported by: - -* Camptocamp - Maintainers ~~~~~~~~~~~ @@ -83,6 +76,14 @@ 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. +.. |maintainer-alexis-via| image:: https://github.com/alexis-via.png?size=40px + :target: https://github.com/alexis-via + :alt: alexis-via + +Current `maintainer `__: + +|maintainer-alexis-via| + This module is part of the `OCA/edi `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 95c32d973d..75ffd52508 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -1,4 +1,4 @@ -# Copyright 2016-2019 Akretion France (http://www.akretion.com/) +# Copyright 2016-2021 Akretion France (http://www.akretion.com/) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -9,10 +9,9 @@ "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", "author": "Akretion, Nicolas JEUDY, Odoo Community Association (OCA)", + "maintainers": ["alexis-via"], "website": "https://github.com/OCA/edi", "depends": [ - # odoo - "account", # OCA/community-data-files "account_tax_unece", "uom_unece", diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index 63796e2ea6..4ebc605d91 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -119,31 +119,32 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any account corresponding to the following information " -"extracted from the business document: Account code: %s" +"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Account code: %s" msgstr "" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any analytic account corresponding to the following " -"information extracted from the business document: Analytic account code: %s" +"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Analytic account code: %s" msgstr "" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any journal corresponding to the following information " -"extracted from the business document: Journal code: %s" +"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Journal code: %s" msgstr "" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document: Barcode: %s\n" +"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" msgstr "" @@ -173,6 +174,7 @@ msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" "Tax amount: %s %s" msgstr "" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 50e2784012..ee8391e733 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -1,4 +1,4 @@ -# Copyright 2015-2019 Akretion France +# Copyright 2015-2021 Akretion France # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). @@ -28,11 +28,10 @@ class BusinessDocumentImport(models.AbstractModel): _description = "Common methods to import business documents" @api.model - def user_error_wrap(self, error_msg): + def user_error_wrap(self, method, data_dict, error_msg): + """The method and data_dict arguments are useful when you want to + inherit this method to update the error message""" assert error_msg - prefix = self._context.get("error_prefix") - if prefix and isinstance(prefix, str): - error_msg = "{}\n{}".format(prefix, error_msg) raise UserError(error_msg) @api.model @@ -106,7 +105,7 @@ def _match_partner( # noqa: C901 return partner_dict["recordset"] if partner_dict.get("id"): return rpo.browse(partner_dict["id"]) - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id domain = domain or [] domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)] if partner_type == "supplier": @@ -148,7 +147,7 @@ def _match_partner( # noqa: C901 ) % partner_dict["country_code"] ) - if country and partner_dict.get("state_code"): + if country and country.state_ids and partner_dict.get("state_code"): state = self.env["res.country.state"].search( [ ("code", "=", partner_dict["state_code"]), @@ -159,10 +158,12 @@ def _match_partner( # noqa: C901 if state: domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] - # Append required vat to the domain + # Search on VAT if partner_dict.get("vat"): vat = partner_dict["vat"] - domain += [("vat", "=", vat)] + partner = rpo.search(domain + [("vat", "=", vat)], limit=1, order=order) + if partner: + return partner # Hook to plug alternative matching methods partner = self._hook_match_partner(partner_dict, chatter_msg, domain, order) @@ -223,14 +224,11 @@ def _match_partner( # noqa: C901 ) return partner - if partner_dict.get("vat"): - partner = rpo.search(domain, limit=1, order=order) - if partner: - return partner - if not raise_exception: return raise self.user_error_wrap( + "_match_partner", + partner_dict, _( "Odoo couldn't find any %s corresponding to the following " "information extracted from the business document:\n" @@ -244,14 +242,14 @@ def _match_partner( # noqa: C901 ) % ( partner_type_label, - partner_dict.get("name"), - partner_dict.get("vat"), - partner_dict.get("ref"), - partner_dict.get("email"), - partner_dict.get("website"), - partner_dict.get("state_code"), - partner_dict.get("country_code"), - ) + partner_dict.get("name") or "", + partner_dict.get("vat") or "", + partner_dict.get("ref") or "", + partner_dict.get("email") or "", + partner_dict.get("website") or "", + partner_dict.get("state_code") or "", + partner_dict.get("country_code") or "", + ), ) @api.model @@ -344,6 +342,8 @@ def _match_shipping_partner( if not raise_exception: return raise self.user_error_wrap( + "_match_shipping_partner", + partner_dict, _( "Odoo couldn't find any shipping partner corresponding to the " "following information extracted from the business document:\n" @@ -360,18 +360,18 @@ def _match_shipping_partner( "Country code: %s\n" ) % ( - partner_dict.get("name"), - partner_dict.get("vat"), - partner_dict.get("ref"), - partner_dict.get("email"), - partner_dict.get("website"), - partner_dict.get("street"), - partner_dict.get("street2"), - partner_dict.get("city"), - partner_dict.get("zip"), - partner_dict.get("state_code"), - partner_dict.get("country_code"), - ) + partner_dict.get("name") or "", + partner_dict.get("vat") or "", + partner_dict.get("ref") or "", + partner_dict.get("email") or "", + partner_dict.get("website") or "", + partner_dict.get("street") or "", + partner_dict.get("street2") or "", + partner_dict.get("city") or "", + partner_dict.get("zip") or "", + partner_dict.get("state_code") or "", + partner_dict.get("country_code") or "", + ), ) @api.model @@ -391,7 +391,7 @@ def _match_partner_bank( _("IBAN %s is not valid, so it has been ignored.") % iban ) return False - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id bankaccount = rpbo.search( [ "|", @@ -455,7 +455,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): return product_dict["recordset"] if product_dict.get("id"): return ppo.browse(product_dict["id"]) - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id cdomain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] if product_dict.get("barcode"): product = ppo.search( @@ -493,18 +493,20 @@ def _match_product(self, product_dict, chatter_msg, seller=False): ): return sinfo.product_tmpl_id.product_variant_ids[0] raise self.user_error_wrap( + "_match_product", + product_dict, _( "Odoo couldn't find any product corresponding to the " - "following information extracted from the business document: " + "following information extracted from the business document:\n" "Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" ) % ( - product_dict.get("barcode"), - product_dict.get("code"), - seller and seller.name or "None", - ) + product_dict.get("barcode") or "", + product_dict.get("code") or "", + seller and seller.name or "", + ), ) @api.model @@ -531,12 +533,14 @@ def _match_currency(self, currency_dict, chatter_msg): return currency else: raise self.user_error_wrap( + "_match_currency", + currency_dict, _( "The analysis of the business document returned '%s' as " "the currency ISO code. But there are no currency " "with that code in Odoo." ) - % currency_iso + % currency_iso, ) if currency_dict.get("symbol"): currencies = rco.search([("symbol", "=", currency_dict["symbol"])]) @@ -563,12 +567,14 @@ def _match_currency(self, currency_dict, chatter_msg): return currencies[0] else: raise self.user_error_wrap( + "_match_currency", + currency_dict, _( "The analysis of the business document returned '%s' as " "the currency symbol or ISO code. But there are none or " "several currencies with the symbol/ISO code in Odoo." ) - % currency_dict["iso_or_symbol"] + % currency_dict["iso_or_symbol"], ) if currency_dict.get("country_code"): country_code = currency_dict["country_code"] @@ -580,27 +586,31 @@ def _match_currency(self, currency_dict, chatter_msg): return country.currency_id else: raise self.user_error_wrap( + "_match_currency", + currency_dict, _( "The analysis of the business document returned '%s' " "as the country code to find the related currency. " "But the country '%s' doesn't have any related " "currency configured in Odoo." ) - % (country_code, country.name) + % (country_code, country.name), ) else: raise self.user_error_wrap( + "_match_currency", + currency_dict, _( "The analysis of the business document returned '%s' " "as the country code to find the related currency. " "But there is no country with that code in Odoo." ) - % country_code + % country_code, ) if self._context.get("force_company"): company = self.env["res.company"].browse(self._context["force_company"]) else: - company = self.env.user.company_id + company = self.env.company company_cur = company.currency_id chatter_msg.append( _("No currency specified, so Odoo used the company currency (%s)") @@ -677,25 +687,11 @@ def _match_taxes( return taxes_recordset @api.model - def _match_tax( - self, tax_dict, chatter_msg, type_tax_use="purchase", price_include=False + def _prepare_match_tax_domain( + self, tax_dict, type_tax_use="purchase", price_include=False ): - """Example: - tax_dict = { - 'amount_type': 'percent', # required param, 'fixed' or 'percent' - 'amount': 20.0, # required - 'unece_type_code': 'VAT', - 'unece_categ_code': 'S', - 'unece_due_date_code': '72', - } - """ ato = self.env["account.tax"] - self._strip_cleanup_dict(tax_dict) - if tax_dict.get("recordset"): - return tax_dict["recordset"] - if tax_dict.get("id"): - return ato.browse(tax_dict["id"]) - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id domain = [("company_id", "=", company_id)] if type_tax_use == "purchase": domain.append(("type_tax_use", "=", "purchase")) @@ -715,34 +711,65 @@ def _match_tax( if tax_dict.get("unece_categ_code"): domain.append(("unece_categ_code", "=", tax_dict["unece_categ_code"])) if tax_dict.get("unece_due_date_code"): - domain += [ - "|", - ("unece_due_date_code", "=", tax_dict["unece_due_date_code"]), - ("unece_due_date_code", "=", False), - ] + tax_exigibility = ato._get_tax_exigibility_from_unece_code( + tax_dict["unece_due_date_code"] + ) + if tax_exigibility: + domain += [("tax_exigibility", "=", tax_exigibility)] + return domain + + @api.model + def _match_tax( + self, + tax_dict, + chatter_msg, + type_tax_use="purchase", + price_include=False, + ): + """Example: + tax_dict = { + 'amount_type': 'percent', # required param, 'fixed' or 'percent' + 'amount': 20.0, # required + 'unece_type_code': 'VAT', + 'unece_categ_code': 'S', + 'unece_due_date_code': '72', + } + """ + ato = self.env["account.tax"] + self._strip_cleanup_dict(tax_dict) + if tax_dict.get("recordset"): + return tax_dict["recordset"] + if tax_dict.get("id"): + return ato.browse(tax_dict["id"]) + domain = self._prepare_match_tax_domain( + tax_dict, type_tax_use=type_tax_use, price_include=price_include + ) taxes = ato.search(domain) - taxes = taxes.sorted(key=lambda t: t._get_unece_due_date_type_code()) for tax in taxes: tax_amount = tax.amount # 'amount' field : digits=(16, 4) if not float_compare(tax_dict["amount"], tax_amount, precision_digits=4): return tax raise self.user_error_wrap( + "_match_tax", + tax_dict, _( "Odoo couldn't find any tax with 'Tax Application' = '%s' " "and 'Tax Included in Price' = '%s' which correspond to the " "following information extracted from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" + "UNECE Due Date code: %s\n" "Tax amount: %s %s" ) % ( type_tax_use, price_include, - tax_dict.get("unece_type_code"), - tax_dict.get("unece_categ_code"), + tax_dict.get("unece_type_code") or "", + tax_dict.get("unece_categ_code") or "", + tax_dict.get("unece_due_date_code") or "", tax_dict["amount"], tax_dict["amount_type"] == "percent" and "%" or _("(fixed)"), - ) + ), ) def compare_lines( @@ -901,7 +928,7 @@ def compare_lines( return res def _prepare_account_speed_dict(self): - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id res = self.env["account.account"].search_read( [("company_id", "=", company_id), ("deprecated", "=", False)], ["code"] ) @@ -954,16 +981,18 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): ) return aao.browse(account_id) raise self.user_error_wrap( + "_match_account", + account_dict, _( "Odoo couldn't find any account corresponding to the " - "following information extracted from the business document: " + "following information extracted from the business document:\n" "Account code: %s" ) - % account_dict.get("code") + % (account_dict.get("code") or ""), ) def _prepare_analytic_account_speed_dict(self): - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id res = self.env["account.analytic.account"].search_read( [("company_id", "=", company_id)], ["code"] ) @@ -997,16 +1026,18 @@ def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): if aacode in speed_dict: return aaao.browse(speed_dict[aacode]) raise self.user_error_wrap( + "_match_analytic_account", + aaccount_dict, _( "Odoo couldn't find any analytic account corresponding to the " - "following information extracted from the business document: " + "following information extracted from the business document:\n" "Analytic account code: %s" ) - % aaccount_dict.get("code") + % (aaccount_dict.get("code") or ""), ) def _prepare_journal_speed_dict(self): - company_id = self._context.get("force_company") or self.env.user.company_id.id + company_id = self._context.get("force_company") or self.env.company.id res = self.env["account.journal"].search_read( [("company_id", "=", company_id)], ["code"] ) @@ -1040,12 +1071,14 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): return ajo.browse(speed_dict[jcode]) # case insensitive raise self.user_error_wrap( + "_match_journal", + journal_dict, _( "Odoo couldn't find any journal corresponding to the " - "following information extracted from the business document: " + "following information extracted from the business document:\n" "Journal code: %s" ) - % journal_dict.get("code") + % (journal_dict.get("code") or ""), ) # Code moved from base_business_document_import_stock @@ -1073,8 +1106,10 @@ def _match_incoterm(self, incoterm_dict, chatter_msg): return incoterm else: self.user_error_wrap( + "_match_incoterm", + incoterm_dict, _("Could not find any Incoterm in Odoo corresponding " "to '%s'") - % incoterm_dict["code"] + % incoterm_dict["code"], ) return False @@ -1086,12 +1121,14 @@ def _check_company(self, company_dict, chatter_msg): if self._context.get("force_company"): company = rco.browse(self._context["force_company"]) else: - company = self.env.user.company_id + company = self.env.company if company_dict.get("vat"): parsed_company_vat = company_dict["vat"].replace(" ", "").upper() if company.partner_id.vat: if company.partner_id.vat != parsed_company_vat: raise self.user_error_wrap( + "_check_company", + company_dict, _( "The VAT number of the customer written in the " "business document (%s) doesn't match the VAT number " @@ -1102,7 +1139,7 @@ def _check_company(self, company_dict, chatter_msg): parsed_company_vat, company.display_name, company.partner_id.vat, - ) + ), ) else: chatter_msg.append( diff --git a/base_business_document_import/readme/CREDITS.rst b/base_business_document_import/readme/CREDITS.rst deleted file mode 100644 index f5cc070c78..0000000000 --- a/base_business_document_import/readme/CREDITS.rst +++ /dev/null @@ -1,3 +0,0 @@ -The development of this module has been financially supported by: - -* Camptocamp diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 2d52bea282..436072ec67 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -380,8 +380,7 @@

Base Business Document Import

  • Credits
  • @@ -412,20 +411,15 @@

    Contributors

  • Phuc (Tran Thanh) <phuc@trobz.com>
  • -
    -

    Other credits

    -

    The development of this module has been financially supported by:

    -
      -
    • Camptocamp
    • -
    -
    -

    Maintainers

    +

    Maintainers

    This module is maintained by the OCA.

    Odoo Community Association

    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.

    +

    Current maintainer:

    +

    alexis-via

    This module is part of the OCA/edi project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index df3a2b3af9..ccb2965eb1 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -1,12 +1,14 @@ -# Copyright 2016-2019 Akretion France (http://www.akretion.com/) -# Copyright 2020 Jacques-Etienne Baudoux (BCIM) +# Copyright 2016-2021 Akretion France (http://www.akretion.com/) +# Copyright 2020-2021 Jacques-Etienne Baudoux (BCIM) # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). from odoo.exceptions import UserError +from odoo.tests import tagged from odoo.tests.common import TransactionCase +@tagged("post_install", "-at_install") class TestBaseBusinessDocumentImport(TransactionCase): def test_match_partner(self): partner1 = self.env["res.partner"].create( @@ -181,6 +183,20 @@ def test_match_tax(self): "price_include": False, "amount": 18, "amount_type": "percent", + "tax_exigibility": "on_invoice", + "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, + "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + } + ) + de_tax_21_onpayment = self.env["account.tax"].create( + { + "name": "German VAT purchase 18.0%", + "description": "DE-VAT-buy-18.0", + "type_tax_use": "purchase", + "price_include": False, + "amount": 18, + "amount_type": "percent", + "tax_exigibility": "on_payment", "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, } @@ -193,6 +209,7 @@ def test_match_tax(self): "price_include": True, "amount": 18, "amount_type": "percent", + "tax_exigibility": "on_invoice", "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, } @@ -203,6 +220,7 @@ def test_match_tax(self): "amount": 18, "unece_type_code": "VAT", "unece_categ_code": "S", + "unece_due_date_code": "5", } res = bdio._match_tax(tax_dict, [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) @@ -213,6 +231,10 @@ def test_match_tax(self): self.assertEqual(res, de_tax_21_ttc) res = bdio._match_taxes([tax_dict], [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) + res = bdio._match_taxes( + [dict(tax_dict, unece_due_date_code=72)], [], type_tax_use="purchase" + ) + self.assertEqual(res, de_tax_21_onpayment) def test_match_account_exact(self): bdio = self.env["business.document.import"] From 2706d1c3151bf67381140a1bb3c6dd1662104792 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 15 Apr 2021 08:33:30 +0000 Subject: [PATCH 56/99] base_business_document_import 14.0.2.0.0 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 13 +++++++++---- base_business_document_import/i18n/fr.po | 13 +++++++++---- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 75ffd52508..0d86e4c85d 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.1.0.0", + "version": "14.0.2.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index da1e231ac2..d36c9a8e05 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -132,7 +132,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " -"extracted from the business document: Account code: %s" +"extracted from the business document:\n" +"Account code: %s" msgstr "" #. module: base_business_document_import @@ -140,7 +141,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " -"information extracted from the business document: Analytic account code: %s" +"information extracted from the business document:\n" +"Analytic account code: %s" msgstr "" #. module: base_business_document_import @@ -148,7 +150,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " -"extracted from the business document: Journal code: %s" +"extracted from the business document:\n" +"Journal code: %s" msgstr "" #. module: base_business_document_import @@ -156,7 +159,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " -"extracted from the business document: Barcode: %s\n" +"extracted from the business document:\n" +"Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" msgstr "" @@ -189,6 +193,7 @@ msgid "" "from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" "Tax amount: %s %s" msgstr "" diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 32cafb58d3..b66bb7849a 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -125,7 +125,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " -"extracted from the business document: Account code: %s" +"extracted from the business document:\n" +"Account code: %s" msgstr "" #. module: base_business_document_import @@ -133,7 +134,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " -"information extracted from the business document: Analytic account code: %s" +"information extracted from the business document:\n" +"Analytic account code: %s" msgstr "" #. module: base_business_document_import @@ -141,7 +143,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " -"extracted from the business document: Journal code: %s" +"extracted from the business document:\n" +"Journal code: %s" msgstr "" #. module: base_business_document_import @@ -149,7 +152,8 @@ msgstr "" #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " -"extracted from the business document: Barcode: %s\n" +"extracted from the business document:\n" +"Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" msgstr "" @@ -182,6 +186,7 @@ msgid "" "from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" "Tax amount: %s %s" msgstr "" From 5cf93f21c9cbe8b0019b3eeec46bb222cca45f1b Mon Sep 17 00:00:00 2001 From: Yves Le Doeuff Date: Thu, 15 Apr 2021 14:55:07 +0000 Subject: [PATCH 57/99] Added translation using Weblate (French (France)) --- base_business_document_import/i18n/fr_FR.po | 418 ++++++++++++++++++++ 1 file changed, 418 insertions(+) create mode 100644 base_business_document_import/i18n/fr_FR.po diff --git a/base_business_document_import/i18n/fr_FR.po b/base_business_document_import/i18n/fr_FR.po new file mode 100644 index 0000000000..a7e7de15ba --- /dev/null +++ b/base_business_document_import/i18n/fr_FR.po @@ -0,0 +1,418 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-15 17:46+0000\n" +"Last-Translator: Yves Le Doeuff \n" +"Language-Team: none\n" +"Language: fr_FR\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "(fixed)" +msgstr "(fixe)" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in file %s:" +msgstr "Notes dans le fichier %s:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in imported document:" +msgstr "Notes dans le document importé:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"

    Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

    • UNECE code: " +"%s
    • Name of the unit of measure: %s

    So the unit of " +"measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " +msgstr "" +"

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " +"suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure 'Unité(s)" +"' a donc été utilisée. Vous devrez peut-être la modifier " +"manuellement.

    " + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Approximate match: account %s has been matched with account %s" +msgstr "" +"Correspondance approximative : le compte %s a été mis en correspondance avec " +"le compte %s" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "Méthodes courantes d'importation de documents commerciaux" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name +msgid "Display Name" +msgstr "Nom affiché" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"For product '%s', the unit of measure is %s on the existing line, but it is " +"%s on the imported line. We don't support this scenario for the moment, so " +"the lines haven't been updated." +msgstr "" +"Pour le produit '%s', l'unité de mesure est %s sur la ligne existante, mais " +"elle est %s sur la ligne importée. Nous ne supportons pas ce scénario pour " +"le moment, donc les lignes n'ont pas été mises à jour." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "L'IBAN %s n'est pas valide, il a donc été ignoré." + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id +msgid "ID" +msgstr "" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update +msgid "Last Modified on" +msgstr "Dernière modification" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "Numéro de TVA manquant pour la société '%s'" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "" +"Pas de devise précisée, donc Odoo a utilisé la devise (%s) de la société" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" +"Odoo n'a pas trouvé de %s correspondant aux informations suivantes extraites " +"du document commercial :\n" +"Nom : %s\n" +"Numéro de TVA : %s\n" +"Référence : %s\n" +"E-mail : %s\n" +"Site web : %s\n" +"Code de l'État : %s\n" +"Code du pays : %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Account code: %s" +msgstr "" +"Odoo n'a pas trouvé de compte correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Code du compte : %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Analytic account code: %s" +msgstr "" +"Odoo n'a pas trouvé de compte analytique correspondant aux informations " +"suivantes extraites du document commercial :\n" +"Code du compte analytique : %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Journal code: %s" +msgstr "" +"Odoo n'a pas trouvé de journal correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Code journal : %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Barcode: %s\n" +"Product code: %s\n" +"Supplier: %s\n" +msgstr "" +"Odoo n'a pas pu trouver de produit correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Code barres : %s\n" +"Code produit : %s\n" +"Fournisseur : %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Street: %s\n" +"Street2: %s\n" +"City: %s\n" +"ZIP: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" +"Odoo n'a pas pu trouver de partenaire d'expédition correspondant aux " +"informations suivantes extraites du document commercial :\n" +"Nom : %s\n" +"Numéro de TVA : %s\n" +"Référence : %s\n" +"E-mail : %s\n" +"Site web : %s\n" +"Rue : %s\n" +"Rue2 : %s\n" +"Ville : %s\n" +"Code postal : %s\n" +"Code d'état : %s\n" +"Code du pays : %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" +"Tax amount: %s %s" +msgstr "" +"Odoo n'a pas trouvé de taxe avec 'Application de taxe' = '%s' et 'Taxe " +"Incluse dans le prix' = '%s' qui correspondent aux informations suivantes " +"extraites du document commercial :\n" +"Code de type de taxe CEE-ONU : %s\n" +"Code de catégorie de taxe CEE-ONU : %s\n" +"Code de la date d'échéance CEE-ONU : %s\n" +"Montant de la taxe : %s %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"Une des lignes importées n'a pas de produit, donc les lignes n'ont pas " +"été mises à jour." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully" +" that the %s is correct." +msgstr "" +"Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " +"soigneusement que le %s est correct." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The VAT number of the customer written in the business document (%s) doesn't" +" match the VAT number of the company '%s' (%s) in which you are trying to " +"import this document." +msgstr "" +"Le numéro de TVA du client indiqué dans le document commercial (%s) ne " +"correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " +"essayez d'importer ce document." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" +"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " +"n'y a pas de pays avec ce code dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But the country '%s' doesn't have any related " +"currency configured in Odoo." +msgstr "" +"L'analyse du document commercial a retourné '%s' comme code de pays pour " +"trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " +"configurée dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." +msgstr "" +"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " +"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " +"dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" +"L'analyse du document commercial a donné '%s' comme code ISO de la devise. " +"Mais il n'y a pas de devise avec ce code dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol " +"or ISO code. But there are none or several currencies with the symbol/ISO " +"code in Odoo." +msgstr "" +"L'analyse du document commercial a donné '%s' comme symbole monétaire ou " +"code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +"dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." +msgstr "" +"L'analyse du document commercial a donné '%s' comme symbole de devise. Mais " +"il n'y a pas ou plusieurs devises avec ce symbole dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the unit of measure " +"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " +"Please check the configuration of the units of measures in Odoo." +msgstr "" +"L'analyse du document commercial a donné '%s' comme code d'unité de mesure " +"UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans Odoo. " +"Veuillez vérifier la configuration des unités de mesure dans Odoo." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned IBAN %s as bank " +"account, but there is no such bank account in Odoo linked to partner %s and the option to " +"automatically create bank accounts upon import is disabled." +msgstr "" +"L'analyse du document commercial a retourné IBAN %s comme compte " +"bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " +"partenaire %s et " +"l'option de création automatique de comptes bancaires lors de l'importation " +"est désactivée." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The bank account IBAN %s has been automatically added on the supplier" +" %s" +msgstr "" +"Le compte bancaire IBAN %s a été automatiquement ajouté sur le " +"fournisseur %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"La ligne existante '%s' n'a pas de produit, donc les lignes n'ont pas été " +"mises à jour." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." +msgstr "" +"Le produit '%s' est utilisé sur plusieurs lignes existantes, donc les " +"lignes n'ont pas été mises à jour." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." +msgstr "" +"Le produit '%s' est utilisé sur plusieurs lignes importées, donc les " +"lignes n'ont pas été mises à jour." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "customer" +msgstr "client" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "partner" +msgstr "partenaire" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "supplier" +msgstr "fournisseur" From da2d63903f428b4abd97dcd601293ab3f9190f1b Mon Sep 17 00:00:00 2001 From: Bosd Date: Sat, 17 Apr 2021 16:39:22 +0000 Subject: [PATCH 58/99] Added translation using Weblate (Dutch) --- base_business_document_import/i18n/nl.po | 416 +++++++++++++++++++++++ 1 file changed, 416 insertions(+) create mode 100644 base_business_document_import/i18n/nl.po diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po new file mode 100644 index 0000000000..d71f3570a9 --- /dev/null +++ b/base_business_document_import/i18n/nl.po @@ -0,0 +1,416 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 14.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2021-04-19 20:46+0000\n" +"Last-Translator: Bosd \n" +"Language-Team: none\n" +"Language: nl\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.3.2\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, fuzzy, python-format +msgid "(fixed)" +msgstr "(fixed)" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in file %s:" +msgstr "Notities in bestand %s:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in imported document:" +msgstr "Notities in geimporteerd document:" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"

    Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

    • UNECE code: " +"%s
    • Name of the unit of measure: %s

    So the unit of " +"measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " +msgstr "" +"

    Er kon geen eenheid gevonden worden welke overeenkomt met de volgende " +"informatie verkregen uit het bedrijfsdocument:

    • UNECE code: " +"%s
    • Eenheidsnaam: %s

    dus de 'Unit(s)' eenheid is " +"gebruikt. Wellicht wilt u dit handmatig wijzigen.

    " + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Approximate match: account %s has been matched with account %s" +msgstr "Geschatte overeenkomt: rekening %s is gematched met rekening %s" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "Algemene procedures voor het importeren van bedrijfsdocumenten" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "Er kong geen Incoterm gevonden worden overeenkomstig met '%s'" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name +msgid "Display Name" +msgstr "Weergavenaam" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"For product '%s', the unit of measure is %s on the existing line, but it is " +"%s on the imported line. We don't support this scenario for the moment, so " +"the lines haven't been updated." +msgstr "" +"voor product '%s', is de eenheid %s op de bestaande regel, maar is %s op de " +"geimporteerde regel. Dit wordt op dit moment niet ondersteund, de regels " +"zijnnietbijgewerkt." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "IBAN %s is ongeldig, dus genegeerd." + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id +#, fuzzy +msgid "ID" +msgstr "ID" + +#. module: base_business_document_import +#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update +msgid "Last Modified on" +msgstr "Laatst bijgewerkt op" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "Ontbrekent BTW nummer voor bedrijf '%s'" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "" +"Er is geen valuta gespicificeerd, dus de bedrijfsvaluta wordt gebruikt (%s)" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" +"kon geen %s vinden welke overeenkomt met de informatie verkregen uit dit " +"bedrijfsdocument:\n" +"Naam: %s\n" +"BTW nummer: %s\n" +"Referentie: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"State code: %s\n" +"Land code: %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Account code: %s" +msgstr "" +"kon geen rekening vinden welke overeenkomt met de verkregen informatie uit " +"dit bedrijfsdocument:\n" +"Rekening code: %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Analytic account code: %s" +msgstr "" +"kon geen analytisch account vinden welke overeenkomt met de verkregen " +"informatie uit dit bedrijfsdocument:\n" +"Analytisch account code: %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Journal code: %s" +msgstr "" +"kon geen dagboek vinden welke overeenkomt met de verkregen informatie uit " +"dit bedrijfsdocument:\n" +"Dagboek code: %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Barcode: %s\n" +"Product code: %s\n" +"Supplier: %s\n" +msgstr "" +"kon geen product vinden welke overeenkomt met de verkregen informatie uit " +"dit bedrijfsdocument:\n" +"Barcode: %s\n" +"Product code: %s\n" +"Leverancier: %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Name: %s\n" +"VAT number: %s\n" +"Reference: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Street: %s\n" +"Street2: %s\n" +"City: %s\n" +"ZIP: %s\n" +"State code: %s\n" +"Country code: %s\n" +msgstr "" +"kon geen verzendpartner vinden welke overeenkomt met de verkregen informatie " +"uit dit bedrijfsdocument:\n" +"Naam: %s\n" +"BTW nummer: %s\n" +"Referentie: %s\n" +"E-mail: %s\n" +"Website: %s\n" +"Straat: %s\n" +"Straat2: %s\n" +"Woonplaats: %s\n" +"Postcode: %s\n" +"State code: %s\n" +"Land code: %s\n" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" +"Tax amount: %s %s" +msgstr "" +"Er kon geen belastingsregel gevonden worden 'Tax Application' = '%s' en " +"'prijs inclusief btw' = '%s' whelke overeenkomt met de volgende informatie " +"verkregen uit dit bedrijfsdocument:\n" +"UNECE Tax Type code: %s\n" +"UNECE Tax Category code: %s\n" +"UNECE Due Date code: %s\n" +"Belast bedrag: %s %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"Een van de geimporteede regels bevat geen product, dus de regels zijn " +"niet bijgewerkt." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The %s has been identified by the domain name '%s' so please check carefully" +" that the %s is correct." +msgstr "" +"Het %s is geidentificeerd op de domeinnaam '%s' controleer zorgvuldig daat " +"de %s juist is." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The VAT number of the customer written in the business document (%s) doesn't" +" match the VAT number of the company '%s' (%s) in which you are trying to " +"import this document." +msgstr "" +"Het BTW nummer van de klant in het bedrijfsdocument (%s) komt niet overeen " +"met het BTW nummer van het bedrijf '%s' (%s) waarvoor je een document " +"probeert te importeren." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde landcode '%s' op. Deze landcode " +"is niet bekend in het systeem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But the country '%s' doesn't have any related " +"currency configured in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' op als de landcode om de " +"bijbehorende valuta te vinden. Maar voor het land '%s' zijn geen " +"bijbehorende valuta's geconfigureerd." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' op als de landcode om de " +"bijbehorende valuta te vinden. Maar deze landcode is niet bekend in het " +"systeem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' op als de valuta ISO code. " +"Er is geen valuta met deze code bekend in het systeem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol " +"or ISO code. But there are none or several currencies with the symbol/ISO " +"code in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' op als het valuta symbool " +"of ISO code. Er zijn geen of meerdere valuta met dit symbool/code bekend in " +"het systeem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' op als de valutateken. Er " +"zijn geen of meerdre valutas met dat valutateken in het systeem." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the unit of measure " +"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " +"Please check the configuration of the units of measures in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde '%s' als eenheids UNECE code, " +"maar er is geen eenheid met die UNECE code in het systeem. Controleer de " +"eenheidsinstellingen." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned IBAN %s as bank " +"account, but there is no such bank account in Odoo linked to partner %s and the option to " +"automatically create bank accounts upon import is disabled." +msgstr "" +"De analyse van het bedrijfsdocument leverde IBAN %s op als " +"bankrekening, maar het bankrekeningnummer is niet toegewezen aan relatie %s en de mogelijkheid om " +"automatisch bankrekeningen aan te maken tijdens de import van " +"bedrijfsdocumenten is uitgeschakeld." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The bank account IBAN %s has been automatically added on the supplier" +" %s" +msgstr "" +"Het bankrekeningnummerIBAN %s is automatisch toegevoegd aan de " +"leverancier %s" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"De bestaande regel '%s' heeft geen product, dus de regel is niet " +"bijgewerkt." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." +msgstr "" +"Het product '%s' is gebruikt op meerdere bestaande regels, dus de regels " +"zijn niet bijgewerkt." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." +msgstr "" +"Het product '%s' is gebruikt op meerdere geimporteerde regels, dus de " +"regels zijn niet bijgewerkt." + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "customer" +msgstr "klant" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "partner" +msgstr "relatie" + +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "supplier" +msgstr "leverancier" From d1dffb9d61582d133d6f5b8121a837b77dd4e595 Mon Sep 17 00:00:00 2001 From: Yves Le Doeuff Date: Thu, 17 Jun 2021 13:05:20 +0000 Subject: [PATCH 59/99] Translated using Weblate (French) Currently translated at 94.8% (37 of 39 strings) Translation: edi-14.0/edi-14.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import/fr/ --- base_business_document_import/i18n/fr.po | 103 +++++++++++++++++++---- 1 file changed, 88 insertions(+), 15 deletions(-) diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index b66bb7849a..0fe0a28c7a 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -9,32 +9,33 @@ msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-02-22 03:40+0000\n" -"PO-Revision-Date: 2018-02-22 03:40+0000\n" -"Last-Translator: OCA Transbot , 2018\n" +"PO-Revision-Date: 2021-06-17 15:48+0000\n" +"Last-Translator: Yves Le Doeuff \n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" -"Plural-Forms: nplurals=2; plural=(n > 1);\n" +"Plural-Forms: nplurals=2; plural=n > 1;\n" +"X-Generator: Weblate 4.3.2\n" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" -msgstr "" +msgstr "(fixe)" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" -msgstr "" +msgstr "Notes dans le fichier %s:" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" -msgstr "" +msgstr "Notes dans le document importé :" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -45,28 +46,35 @@ msgid "" "li>
  • Name of the unit of measure: %s
  • So the unit of measure " "'Unit(s)' has been used. You may have to change it manually.

    " msgstr "" +"

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " +"suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure 'Unité(s)" +"' a donc été utilisée. Vous devrez peut-être la modifier " +"manuellement.

    " #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Approximate match: account %s has been matched with account %s" msgstr "" +"Correspondance approximative : le compte %s a été mis en correspondance avec " +"le compte %s" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import msgid "Common methods to import business documents" -msgstr "" +msgstr "Méthodes courantes d'importation de documents commerciaux" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" -msgstr "" +msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'." #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name msgid "Display Name" -msgstr "" +msgstr "Afficher Nom" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -76,12 +84,15 @@ msgid "" "%s on the imported line. We don't support this scenario for the moment, so " "the lines haven't been updated." msgstr "" +"Pour le produit ' %s ', l’unité de mesure est %s sur la ligne existante, " +"mais elle est sur %s la ligne importée. Nous ne prenons pas en charge ce " +"scénario pour le moment, donc les lignes n’ont pas été mises à jour." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." -msgstr "" +msgstr "IBAN %s n’est pas valide, il a donc été ignoré." #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id @@ -91,19 +102,21 @@ msgstr "ID" #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" -msgstr "" +msgstr "Dernière modification le" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" -msgstr "" +msgstr "Numéro de TVA manquant pour la société \"%s\"." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" +"Aucune devise n'a été spécifiée, Odoo a donc utilisé la devise de la société " +"(%s)." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -128,6 +141,9 @@ msgid "" "extracted from the business document:\n" "Account code: %s" msgstr "" +"Odoo n'a pas trouvé de compte correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Code du compte : %s" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -137,6 +153,9 @@ msgid "" "information extracted from the business document:\n" "Analytic account code: %s" msgstr "" +"Odoo n'a pas trouvé de compte analytique correspondant aux informations " +"suivantes extraites du document commercial :\n" +"Code du compte analytique : %s" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -146,6 +165,9 @@ msgid "" "extracted from the business document:\n" "Journal code: %s" msgstr "" +"Odoo n'a pas trouvé de journal correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Code journal : %s" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -157,6 +179,11 @@ msgid "" "Product code: %s\n" "Supplier: %s\n" msgstr "" +"Odoo n'a pas pu trouver de produit correspondant aux informations suivantes " +"extraites du document commercial :\n" +"Barcode : %s\n" +"Code produit : %s\n" +"Fournisseur : %s\n" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -189,6 +216,13 @@ msgid "" "UNECE Due Date code: %s\n" "Tax amount: %s %s" msgstr "" +"Odoo n'a pas trouvé de taxe avec 'Tax Application' = '%s' et 'Tax Included " +"in Price' = '%s' qui correspondent aux informations suivantes extraites du " +"document commercial :\n" +"Code de type de taxe CEE-ONU : %s\n" +"Code de catégorie de taxe CEE-ONU : %s\n" +"Code de la date d'échéance CEE-ONU : %s\n" +"Montant de la taxe : %s %s" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -197,6 +231,8 @@ msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." msgstr "" +"Une des lignes importées n'a pas de produit, donc les lignes n'ont pas " +"été mises à jour." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -205,6 +241,8 @@ msgid "" "The %s has been identified by the domain name '%s' so please check carefully " "that the %s is correct." msgstr "" +"Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " +"soigneusement que le %s est correct." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -214,6 +252,9 @@ msgid "" "match the VAT number of the company '%s' (%s) in which you are trying to " "import this document." msgstr "" +"Le numéro de TVA du client indiqué dans le document commercial (%s) ne " +"correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " +"essayez d'importer ce document." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -222,6 +263,8 @@ msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." msgstr "" +"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " +"n'y a pas de pays avec ce code dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -231,6 +274,9 @@ msgid "" "find the related currency. But the country '%s' doesn't have any related " "currency configured in Odoo." msgstr "" +"L'analyse du document commercial a retourné '%s' comme code de pays pour " +"trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " +"configurée dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -239,6 +285,9 @@ msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." msgstr "" +"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " +"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " +"dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -247,6 +296,9 @@ msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." msgstr "" +"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " +"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " +"dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -256,6 +308,9 @@ msgid "" "or ISO code. But there are none or several currencies with the symbol/ISO " "code in Odoo." msgstr "" +"L'analyse du document commercial a donné '%s' comme symbole monétaire ou " +"code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +"dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -264,6 +319,8 @@ msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." msgstr "" +"L'analyse du document commercial a donné '%s' comme symbole de devise. Mais " +"il n'y a pas ou plusieurs devises avec ce symbole dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -273,6 +330,9 @@ msgid "" "UNECE code, but there is no unit of measure with that UNECE code in Odoo. " "Please check the configuration of the units of measures in Odoo." msgstr "" +"L'analyse du document commercial a donné '%s' comme code d'unité de mesure " +"UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans Odoo. " +"Veuillez vérifier la configuration des unités de mesure dans Odoo." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -283,6 +343,11 @@ msgid "" "href=# data-oe-model=res.partner data-oe-id=%d>%s and the option to " "automatically create bank accounts upon import is disabled." msgstr "" +"L'analyse du document commercial a renvoyé IBAN %s comme compte " +"bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " +"partenaire %s et " +"l'option de création automatique de comptes bancaires à l'importation est " +"désactivée." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -291,6 +356,8 @@ msgid "" "The bank account IBAN %s has been automatically added on the supplier " "%s" msgstr "" +"Le compte bancaire IBAN %s a été automatiquement ajouté sur le " +"fournisseur %s" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -299,6 +366,8 @@ msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." msgstr "" +"La ligne existante '%s' n'a pas de produit, donc les lignes n'ont pas été " +"mises à jour." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -307,6 +376,8 @@ msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." msgstr "" +"Le produit '%s' est utilisé sur plusieurs lignes existantes, donc les " +"lignes n'ont pas été mises à jour." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -315,21 +386,23 @@ msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." msgstr "" +"Le produit '%s' est utilisé sur plusieurs lignes importées, donc les " +"lignes n'ont pas été mises à jour." #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" -msgstr "" +msgstr "client" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" -msgstr "" +msgstr "partenaire" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" -msgstr "" +msgstr "sournisseur" From 20119e1ea0c30d24088375e5a137934064bc7fa3 Mon Sep 17 00:00:00 2001 From: Tran Thanh Phuc Date: Thu, 13 May 2021 21:14:57 +0700 Subject: [PATCH 60/99] [FIX] base_business_document_import: email should be taken into account when searching shipping partner --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index ee8391e733..e176d128ec 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -321,7 +321,7 @@ def _match_shipping_partner( ) if partner: return partner - if not partner_dict.get("vat"): + if not partner_dict.get("vat") and not partner_dict.get("email"): partner = self.env["res.partner"].search(domain_delivery, limit=1) if partner: return partner From a8c0858775c813d061ff79165bc0b3d134fa2b66 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 21 Apr 2021 14:43:33 +0200 Subject: [PATCH 61/99] base_business_document_import: FIX wrong arg name in _hook_match_partner() --- .../models/business_document_import.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index e176d128ec..da4a466151 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -253,9 +253,7 @@ def _match_partner( # noqa: C901 ) @api.model - def _hook_match_partner( - self, partner_dict, chatter_msg, domain, partner_type_label - ): + def _hook_match_partner(self, partner_dict, chatter_msg, domain, order): return False @api.model From d4e16e2144ead799964625c3cf09c209534fe31c Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Thu, 5 Aug 2021 10:19:14 +0000 Subject: [PATCH 62/99] base_business_document_import 14.0.2.1.0 --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 0d86e4c85d..4b87dcdf6d 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.0.0", + "version": "14.0.2.1.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", From b68f35f142a261af1885af1e55808d3864c8f147 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Wed, 3 Feb 2021 15:28:37 +0100 Subject: [PATCH 63/99] [REF] base_business_document_import: matching Reduce _match_partner complexity --- .../models/business_document_import.py | 263 +++++++++++------- 1 file changed, 167 insertions(+), 96 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index da4a466151..d63b53f265 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -46,7 +46,73 @@ def _strip_cleanup_dict(self, match_dict): match_dict["state_code"] = match_dict["state_code"].upper() @api.model - def _match_partner_contact(self, partner_dict, domain, order): + def _get_match_partner_order(self, partner_type): + if partner_type == "supplier": + return "supplier_rank desc" + if partner_type == "customer": + return "customer_rank desc" + return "" + + @api.model + def _get_match_partner_type_label(self, partner_type): + if partner_type == "supplier": + return _("supplier") + if partner_type == "customer": + return _("customer") + return _("partner") + + @api.model + def _get_country_filter(self, partner_dict, chatter_msg): + """Generate filter by country""" + country = False + if partner_dict.get("country_code"): + country = self.env["res.country"].search( + [("code", "=", partner_dict["country_code"])], limit=1 + ) + if country: + return [ + "|", + ("country_id", "=", False), + ("country_id", "=", country.id), + ] + chatter_msg.append( + _( + "The analysis of the business document returned '%s' as " + "country code. But there are no country with that code " + "in Odoo." + ) + % partner_dict["country_code"] + ) + return False + + @api.model + def _get_country_state_filter(self, partner_dict, chatter_msg): + if partner_dict.get("state_code"): + country = self.env["res.country"].search( + [("code", "=", partner_dict["country_code"])], limit=1 + ) + state = self.env["res.country.state"].search( + [ + ("code", "=", partner_dict["state_code"]), + ("country_id", "=", country.id), + ], + limit=1, + ) + if state: + return ["|", ("state_id", "=", False), ("state_id", "=", state.id)] + return False + + @api.model + def _match_partner_ref(self, partner_dict, chatter_msg, domain, order): + """If a ref is explicitly given, we just want to match that partner""" + if partner_dict.get("ref"): + return self.env["res.partner"].search( + domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order + ) + return False + + @api.model + def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): rpo = self.env["res.partner"] if partner_dict.get("email") and "@" in partner_dict["email"]: partner = rpo.search( @@ -77,6 +143,76 @@ def _match_partner_contact(self, partner_dict, domain, order): ) if partner: return partner + return False + + @api.model + def _match_partner_name(self, partner_dict, chatter_msg, domain, order): + if partner_dict.get("name"): + return self.env["res.partner"].search( + domain + [("name", "=ilike", partner_dict["name"])], + limit=1, + order=order, + ) + return False + + @api.model + def _get_partner_website_domain(self, partner_dict): + if partner_dict.get("website"): + urlp = urlparse(partner_dict["website"]) + netloc = urlp.netloc + if not urlp.scheme and not netloc: + netloc = urlp.path + if netloc and len(netloc.split(".")) >= 2: + return ".".join(netloc.split(".")[-2:]) + return False + + @api.model + def _match_partner_website(self, partner_dict, chatter_msg, domain, order): + website_domain = self._get_partner_website_domain(partner_dict) + if website_domain: + return self.env["res.partner"].search( + domain + [("website", "=ilike", "%" + website_domain + "%")], + limit=1, + order=order, + ) + return False + + @api.model + def _get_partner_email_domain(self, partner_dict): + return ( + partner_dict.get("email") + and "@" in partner_dict["email"] + and partner_dict["email"].split("@")[1] + ) + + @api.model + def _match_partner_email(self, partner_dict, chatter_msg, domain, order): + email_domain = self._get_partner_email_domain(partner_dict) + # I can't search on email addresses with + # email_domain because of the emails such as + # @gmail.com, @yahoo.com that may match random partners + if email_domain: + partner = self.env["res.partner"].search( + domain + [("website", "=ilike", "%" + email_domain + "%")], + limit=1, + order=order, + ) + if not partner: + partner = self.env["res.partner"].search( + domain + [("email", "=ilike", "%@" + email_domain)], + limit=1, + order=order, + ) + if partner: + partner_type_label = partner_dict["type_label"] + chatter_msg.append( + _( + "The %s has been identified by the domain name '%s' " + "so please check carefully that the %s is correct." + ) + % (partner_type_label, domain, partner_type_label) + ) + return partner @api.model def _match_partner( # noqa: C901 @@ -100,6 +236,7 @@ def _match_partner( # noqa: C901 } """ rpo = self.env["res.partner"] + partner_dict = partner_dict.copy() self._strip_cleanup_dict(partner_dict) if partner_dict.get("recordset"): return partner_dict["recordset"] @@ -108,55 +245,23 @@ def _match_partner( # noqa: C901 company_id = self._context.get("force_company") or self.env.company.id domain = domain or [] domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)] - if partner_type == "supplier": - order = "supplier_rank desc" - partner_type_label = _("supplier") - elif partner_type == "customer": - order = "customer_rank desc" - partner_type_label = _("customer") - else: - order = "" - partner_type_label = _("partner") + order = self._get_match_partner_order(partner_type) + partner_type_label = self._get_match_partner_type_label(partner_type) + partner_dict["type"] = partner_type + partner_dict["type_label"] = partner_type_label - # If a ref is explicitly given, we just want to match that partner - if partner_dict.get("ref"): - partner = rpo.search( - domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order - ) - if partner: - return partner + partner = self._match_partner_ref(partner_dict, chatter_msg, domain, order) + if partner: + return partner - # Append optional country and state to the domain - country = False - if partner_dict.get("country_code"): - country = self.env["res.country"].search( - [("code", "=", partner_dict["country_code"])], limit=1 - ) - if country: - domain += [ - "|", - ("country_id", "=", False), - ("country_id", "=", country.id), - ] - else: - chatter_msg.append( - _( - "The analysis of the business document returned '%s' as " - "country code. But there are no country with that code " - "in Odoo." - ) - % partner_dict["country_code"] - ) - if country and country.state_ids and partner_dict.get("state_code"): - state = self.env["res.country.state"].search( - [ - ("code", "=", partner_dict["state_code"]), - ("country_id", "=", country.id), - ], - limit=1, - ) - if state: - domain += ["|", ("state_id", "=", False), ("state_id", "=", state.id)] + country_domain = self._get_country_filter(partner_dict, chatter_msg) + + if country_domain: + domain += country_domain + + state_domain = self._get_country_state_filter(partner_dict, chatter_msg) + if state_domain: + domain += state_domain # Search on VAT if partner_dict.get("vat"): @@ -171,58 +276,24 @@ def _match_partner( # noqa: C901 return partner # Search for partner contact - partner = self._match_partner_contact(partner_dict, domain, order) + partner = self._match_partner_contact(partner_dict, chatter_msg, domain, order) if partner: return partner - # Search for partner - if partner_dict.get("name"): - partner = rpo.search( - domain + [("name", "=ilike", partner_dict["name"])], - limit=1, - order=order, - ) - if partner: - return partner + # Search for partner name + partner = self._match_partner_name(partner_dict, chatter_msg, domain, order) + if partner: + return partner - website_domain = False - email_domain = ( - partner_dict.get("email") - and "@" in partner_dict["email"] - and partner_dict["email"].split("@")[1] - ) - if partner_dict.get("website"): - urlp = urlparse(partner_dict["website"]) - netloc = urlp.netloc - if not urlp.scheme and not netloc: - netloc = urlp.path - if netloc and len(netloc.split(".")) >= 2: - website_domain = ".".join(netloc.split(".")[-2:]) - if website_domain or email_domain: - partner_domain = website_domain or email_domain - partner = rpo.search( - domain + [("website", "=ilike", "%" + partner_domain + "%")], - limit=1, - order=order, - ) - # I can't search on email addresses with - # email_domain because of the emails such as - # @gmail.com, @yahoo.com that may match random partners - if not partner and website_domain: - partner = rpo.search( - domain + [("email", "=ilike", "%@" + website_domain)], - limit=1, - order=order, - ) - if partner: - chatter_msg.append( - _( - "The %s has been identified by the domain name '%s' " - "so please check carefully that the %s is correct." - ) - % (partner_type_label, partner_domain, partner_type_label) - ) - return partner + # Search for partner website + partner = self._match_partner_website(partner_dict, chatter_msg, domain, order) + if partner: + return partner + + # Search for partner website + partner = self._match_partner_email(partner_dict, chatter_msg, domain, order) + if partner: + return partner if not raise_exception: return From 913d8855cb39edbf7eaafd7c79ecdf559ba7ee3f Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 5 Nov 2021 09:07:14 +0000 Subject: [PATCH 64/99] base_business_document_import 14.0.2.1.1 --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 4b87dcdf6d..4f5d30d9f9 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.1.0", + "version": "14.0.2.1.1", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", From 50d42657f98283ef168b3e1c5dd1eb35eeefb717 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 12 Jan 2022 15:58:48 +0100 Subject: [PATCH 65/99] business_document_import: split product search Ease override, simplify code. --- .../models/business_document_import.py | 74 ++++++++++--------- 1 file changed, 41 insertions(+), 33 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index d63b53f265..1a513d9f83 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -524,43 +524,26 @@ def _match_product(self, product_dict, chatter_msg, seller=False): return product_dict["recordset"] if product_dict.get("id"): return ppo.browse(product_dict["id"]) - company_id = self._context.get("force_company") or self.env.company.id - cdomain = ["|", ("company_id", "=", False), ("company_id", "=", company_id)] - if product_dict.get("barcode"): - product = ppo.search( - cdomain + [("barcode", "=", product_dict["barcode"])], limit=1 - ) - if product: - return product - if product_dict.get("code"): - product = ppo.search( - cdomain + product = self._match_product_search(product_dict) + if product: + return product + elif seller: + # WARNING: Won't work for multi-variant products + # because product.supplierinfo is attached to product template + sinfo = self.env["product.supplierinfo"].search( + self._match_company_domain() + [ - "|", - ("barcode", "=", product_dict["code"]), - ("default_code", "=", product_dict["code"]), + ("name", "=", seller.id), + ("product_code", "=", product_dict["code"]), ], limit=1, ) - if product: - return product - # WARNING: Won't work for multi-variant products - # because product.supplierinfo is attached to product template - if seller: - sinfo = self.env["product.supplierinfo"].search( - cdomain - + [ - ("name", "=", seller.id), - ("product_code", "=", product_dict["code"]), - ], - limit=1, - ) - if ( - sinfo - and sinfo.product_tmpl_id.product_variant_ids - and len(sinfo.product_tmpl_id.product_variant_ids) == 1 - ): - return sinfo.product_tmpl_id.product_variant_ids[0] + if ( + sinfo + and sinfo.product_tmpl_id.product_variant_ids + and len(sinfo.product_tmpl_id.product_variant_ids) == 1 + ): + return sinfo.product_tmpl_id.product_variant_ids[0] raise self.user_error_wrap( "_match_product", product_dict, @@ -578,6 +561,31 @@ def _match_product(self, product_dict, chatter_msg, seller=False): ), ) + @api.model + def _match_product_search(self, product_dict): + product = self.env["product.product"].browse() + cdomain = self._match_company_domain() + if product_dict.get("barcode"): + domain = cdomain + [ + "|", + ("barcode", "=", product_dict["barcode"]), + ] + product = product.search(domain, limit=1) + if not product and product_dict.get("code"): + # TODO: this domain could be probably included in the former one + domain = cdomain + [ + "|", + ("barcode", "=", product_dict["code"]), + ("default_code", "=", product_dict["code"]), + ] + product = product.search(domain, limit=1) + return product + + @api.model + def _match_company_domain(self): + company_id = self._context.get("force_company") or self.env.user.company_id.id + return ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + @api.model def _match_currency(self, currency_dict, chatter_msg): """Example: From 5c7a8ae607f42b72213c1aa22f8dba570af59d69 Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 12 Jan 2022 16:01:42 +0100 Subject: [PATCH 66/99] business_document_import: match product packaging fallback Products might be identified by packaging's barcode. This change adds a fallback domain leaf to look for matching packaging. --- .../models/business_document_import.py | 1 + .../tests/test_business_document_import.py | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 1a513d9f83..46ce8974a2 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -569,6 +569,7 @@ def _match_product_search(self, product_dict): domain = cdomain + [ "|", ("barcode", "=", product_dict["barcode"]), + ("packaging_ids.barcode", "=", product_dict["barcode"]), ] product = product.search(domain, limit=1) if not product and product_dict.get("code"): diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index ccb2965eb1..7143cd36ad 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -132,14 +132,22 @@ def test_match_product(self): }, ), ], + "packaging_ids": [(0, 0, {"name": "Big Pack", "barcode": "BIG-PACK"})], } ) + # Match by code product_dict = {"code": "FURN_7777 "} res = bdio._match_product(product_dict, []) self.assertEqual(res, self.env.ref("product.product_delivery_01")) + # Match by barcode product_dict = {"barcode": "9782203121102"} res = bdio._match_product(product_dict, []) self.assertEqual(res, product1) + # Match by packaging barcode + product_dict = {"barcode": "BIG-PACK"} + res = bdio._match_product(product_dict, []) + self.assertEqual(res, product1) + # Match by seller product_dict = {"code": "TEST1242"} res = bdio._match_product( product_dict, [], seller=self.env.ref("base.res_partner_2") From f141d343b61796671757bea21452fd1b2a73f15c Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Wed, 12 Jan 2022 16:38:41 +0100 Subject: [PATCH 67/99] business_document_import: imp _match_product docstring --- .../models/business_document_import.py | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 46ce8974a2..e73532f36d 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -512,11 +512,22 @@ def _match_partner_bank( @api.model def _match_product(self, product_dict, chatter_msg, seller=False): - """Example: - product_dict = { - 'barcode': '5449000054227', - 'code': 'COCA1L', - } + """Retrieve product. + + Matching sequence: + + 1. ID + 2. barcode + 3. packaging barcode + 4. default_code + 5. seller code + + :param product_dict: dictionary w/ product info. + + Example: {'barcode': '5449000054227', 'code': 'COCA1L'} + + :param chatter_msg: list of msgs to append to chatter (if any) + :param seller: optional product.supplierinfo record """ ppo = self.env["product.product"] self._strip_cleanup_dict(product_dict) From e044d15fe8da562582015b0d70b0c26f4626cd71 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 14 Jan 2022 15:11:39 +0000 Subject: [PATCH 68/99] base_business_document_import 14.0.2.2.0 --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 4f5d30d9f9..d3a8ff3b4e 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.1.1", + "version": "14.0.2.2.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", From f62e185aa285aa389c4f4625ca02d76188bd2ca2 Mon Sep 17 00:00:00 2001 From: Bosd Date: Sun, 15 May 2022 09:09:33 +0000 Subject: [PATCH 69/99] Translated using Weblate (Dutch) Currently translated at 94.8% (37 of 39 strings) Translation: edi-14.0/edi-14.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import/nl/ --- base_business_document_import/i18n/nl.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index d71f3570a9..23afc89a6b 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2021-04-19 20:46+0000\n" +"PO-Revision-Date: 2022-05-15 12:05+0000\n" "Last-Translator: Bosd \n" "Language-Team: none\n" "Language: nl\n" @@ -126,8 +126,8 @@ msgid "" "State code: %s\n" "Country code: %s\n" msgstr "" -"kon geen %s vinden welke overeenkomt met de informatie verkregen uit dit " -"bedrijfsdocument:\n" +"Er kon geen %s gevonden worden welke overeenkomt met de informatie verkregen " +"uit het document:\n" "Naam: %s\n" "BTW nummer: %s\n" "Referentie: %s\n" @@ -178,8 +178,8 @@ msgid "" "Product code: %s\n" "Supplier: %s\n" msgstr "" -"kon geen product vinden welke overeenkomt met de verkregen informatie uit " -"dit bedrijfsdocument:\n" +"Er kon geen product gevonden worden welke overeenkomt met de verkregen " +"informatie uit het document:\n" "Barcode: %s\n" "Product code: %s\n" "Leverancier: %s\n" @@ -201,8 +201,8 @@ msgid "" "State code: %s\n" "Country code: %s\n" msgstr "" -"kon geen verzendpartner vinden welke overeenkomt met de verkregen informatie " -"uit dit bedrijfsdocument:\n" +"Er kon geen geadresseerde relatie gevonden worden welke overeenkomt met de " +"verkregen informatie uit dit bedrijfsdocument:\n" "Naam: %s\n" "BTW nummer: %s\n" "Referentie: %s\n" From 4cef9341b024fa0de5fef85b5cfd3bd3aaacd18a Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Mon, 23 May 2022 14:09:58 +0200 Subject: [PATCH 70/99] base_business_document_import: use pdf_helper --- base_business_document_import/__manifest__.py | 2 +- .../models/business_document_import.py | 47 ++----------------- .../readme/CONTRIBUTORS.rst | 1 + 3 files changed, 6 insertions(+), 44 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index d3a8ff3b4e..ec6bc140fb 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -15,6 +15,6 @@ # OCA/community-data-files "account_tax_unece", "uom_unece", + "pdf_helper", ], - "external_dependencies": {"python": ["PyPDF2"]}, } diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index e73532f36d..91765426ae 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -3,12 +3,8 @@ # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). import logging -import mimetypes -from io import BytesIO from urllib.parse import urlparse -from lxml import etree - from odoo import _, api, models from odoo.exceptions import UserError from odoo.tools import float_compare @@ -17,11 +13,6 @@ logger = logging.getLogger(__name__) -try: - import PyPDF2 -except ImportError: - logger.debug("Cannot import PyPDF2") - class BusinessDocumentImport(models.AbstractModel): _name = "business.document.import" @@ -1237,40 +1228,10 @@ def _check_company(self, company_dict, chatter_msg): def get_xml_files_from_pdf(self, pdf_file): """Returns a dict with key = filename, value = XML file obj""" - logger.info("Trying to find an embedded XML file inside PDF") - res = {} - try: - fd = BytesIO(pdf_file) - pdf = PyPDF2.PdfFileReader(fd) - logger.debug("pdf.trailer=%s", pdf.trailer) - pdf_root = pdf.trailer["/Root"] - logger.debug("pdf_root=%s", pdf_root) - # TODO add support for /Kids - embeddedfiles = pdf_root["/Names"]["/EmbeddedFiles"]["/Names"] - i = 0 - xmlfiles = {} # key = filename, value = PDF obj - for embeddedfile in embeddedfiles[:-1]: - mime_res = mimetypes.guess_type(embeddedfile) - if mime_res and mime_res[0] in ["application/xml", "text/xml"]: - xmlfiles[embeddedfile] = embeddedfiles[i + 1] - i += 1 - logger.debug("xmlfiles=%s", xmlfiles) - for filename, xml_file_dict_obj in xmlfiles.items(): - try: - xml_file_dict = xml_file_dict_obj.getObject() - logger.debug("xml_file_dict=%s", xml_file_dict) - xml_string = xml_file_dict["/EF"]["/F"].getData() - xml_root = etree.fromstring(xml_string) - logger.debug( - "A valid XML file %s has been found in the PDF file", filename - ) - res[filename] = xml_root - except Exception: - continue - except Exception: - pass - logger.info("Valid XML files found in PDF: %s", list(res.keys())) - return res + logger.warning( + "`get_xml_files_from_pdf` deprecated: use `pdf.helper.pdf_get_xml_files`" + ) + return self.env["pdf.helper"].pdf_get_xml_files(pdf_file) @api.model def post_create_or_update(self, parsed_dict, record, doc_filename=None): diff --git a/base_business_document_import/readme/CONTRIBUTORS.rst b/base_business_document_import/readme/CONTRIBUTORS.rst index a223314d70..2aa685f8ae 100644 --- a/base_business_document_import/readme/CONTRIBUTORS.rst +++ b/base_business_document_import/readme/CONTRIBUTORS.rst @@ -2,3 +2,4 @@ * Nicolas JEUDY * Jacques-Etienne Baudoux * Phuc (Tran Thanh) +* Simone Orsi From 3e7bc04f138bbd417cf1b784eea9d7e3e2f6d7ab Mon Sep 17 00:00:00 2001 From: Thierry Ducrest Date: Wed, 16 Feb 2022 14:31:36 +0100 Subject: [PATCH 71/99] b_business_document_import: add order line update hook --- .../models/business_document_import.py | 43 +++++++++++-------- 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 91765426ae..0ed991858e 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -976,25 +976,9 @@ def compare_lines( # used for to_remove existing_lines_dict[product]["import"] = True oline = existing_lines_dict[product]["line"] - res["to_update"][oline] = {} - if float_compare( - iline["qty"], - existing_lines_dict[product]["qty"], - precision_digits=qty_precision, - ): - res["to_update"][oline]["qty"] = [ - existing_lines_dict[product]["qty"], - iline["qty"], - ] - if "price_unit" in iline and float_compare( - iline["price_unit"], - existing_lines_dict[product]["price_unit"], - precision_digits=price_precision, - ): - res["to_update"][oline]["price_unit"] = [ - existing_lines_dict[product]["price_unit"], - iline["price_unit"], - ] + res["to_update"][oline] = self._prepare_order_line_update_values( + existing_lines_dict[product], iline, qty_precision, price_precision + ) else: res["to_add"].append( {"product": product, "uom": uom, "import_line": iline} @@ -1007,6 +991,27 @@ def compare_lines( res["to_remove"] = exiting_dict["line"] return res + def _prepare_order_line_update_values( + self, existing_line, iline, qty_precision, price_precision + ): + values = {} + if float_compare( + iline["qty"], + existing_line["qty"], + precision_digits=qty_precision, + ): + values["qty"] = [existing_line["qty"], iline["qty"]] + if "price_unit" in iline and float_compare( + iline["price_unit"], + existing_line["price_unit"], + precision_digits=price_precision, + ): + values["price_unit"] = [ + existing_line["price_unit"], + iline["price_unit"], + ] + return values + def _prepare_account_speed_dict(self): company_id = self._context.get("force_company") or self.env.company.id res = self.env["account.account"].search_read( From 8ab549c91e16f4cf82da8e6b0974ce30f2c34a96 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 27 May 2022 07:33:24 +0000 Subject: [PATCH 72/99] base_business_document_import 14.0.2.3.0 --- base_business_document_import/README.rst | 1 + base_business_document_import/__manifest__.py | 2 +- base_business_document_import/static/description/index.html | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index ae0e5a8e7f..de31eba5ac 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -62,6 +62,7 @@ Contributors * Nicolas JEUDY * Jacques-Etienne Baudoux * Phuc (Tran Thanh) +* Simone Orsi Maintainers ~~~~~~~~~~~ diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index ec6bc140fb..5f47d4968d 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.2.0", + "version": "14.0.2.3.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 436072ec67..700fb907cf 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -409,6 +409,7 @@

    Contributors

  • Nicolas JEUDY <https://github.com/njeudy>
  • Jacques-Etienne Baudoux <je@bcim.be>
  • Phuc (Tran Thanh) <phuc@trobz.com>
  • +
  • Simone Orsi <simone.orsi@camptocamp.com>
  • From 77d675f323359a8e70e514e667d9ed81b3389eb5 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Mon, 30 May 2022 12:59:14 +0000 Subject: [PATCH 73/99] base_business_document_import 14.0.2.4.0 --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 5f47d4968d..c36b981a97 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.3.0", + "version": "14.0.2.4.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", From a16f5820ca3265884a9239bd1d03a4525a227a22 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 10 Jun 2022 12:36:41 +0200 Subject: [PATCH 74/99] base_business_document_import: add match on xmlid Factorize the match on ID, XMLID and recordset with a new method _direct_math() --- .../i18n/base_business_document_import.pot | 21 +++ .../models/business_document_import.py | 122 ++++++++++++------ .../tests/test_business_document_import.py | 10 ++ 3 files changed, 116 insertions(+), 37 deletions(-) diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index 4ebc605d91..a1a3a911ee 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -84,6 +84,12 @@ msgstr "" msgid "ID" msgstr "" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" @@ -203,6 +209,12 @@ msgid "" "import this document." msgstr "" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -304,6 +316,15 @@ msgid "" "been updated." msgstr "" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 0ed991858e..42fb426771 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -25,6 +25,62 @@ def user_error_wrap(self, method, data_dict, error_msg): assert error_msg raise UserError(error_msg) + def _direct_match(self, data_dict, model, raise_exception=True): + if data_dict.get("recordset"): + record = data_dict["recordset"] + if isinstance(record, type(model)): + return record + elif raise_exception: + raise UserError( + _( + "The record '{record}' is an instance of '{record_model}', " + "not of '{target_model}'." + ).format( + record=record.display_name, + record_model=record._name, + target_model=model._name, + ) + ) + if data_dict.get("id"): + record = False + try: + record = model.browse(data_dict["id"]) + # Browsing an unexisting ID doesn't make Odoo crash + # So I read create_date to make it crash + record.create_date # pylint: disable=pointless-statement + except Exception: + if raise_exception: + raise UserError( + _("ID {id} of '{model}' doesn't exist in Odoo.").format( + id=data_dict["id"], model=model._name + ) + ) + if record: + return record + if data_dict.get("xmlid"): + xmlid = data_dict["xmlid"] + record = False + try: + record = self.env.ref(xmlid, raise_if_not_found=True) + except Exception: + if raise_exception: + raise UserError(_("The XMLID '%s' doesn't exist in Odoo.") % xmlid) + if record: + if isinstance(record, type(model)): + return record + elif raise_exception: + raise UserError( + _( + "The record '{record}' is an instance of '{record_model}', " + "not of '{target_model}'." + ).format( + record=record.display_name, + record_model=record._name, + target_model=model._name, + ) + ) + return None + @api.model def _strip_cleanup_dict(self, match_dict): if match_dict: @@ -229,10 +285,9 @@ def _match_partner( # noqa: C901 rpo = self.env["res.partner"] partner_dict = partner_dict.copy() self._strip_cleanup_dict(partner_dict) - if partner_dict.get("recordset"): - return partner_dict["recordset"] - if partner_dict.get("id"): - return rpo.browse(partner_dict["id"]) + partner = self._direct_match(partner_dict, rpo, raise_exception=raise_exception) + if partner: + return partner company_id = self._context.get("force_company") or self.env.company.id domain = domain or [] domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)] @@ -522,10 +577,9 @@ def _match_product(self, product_dict, chatter_msg, seller=False): """ ppo = self.env["product.product"] self._strip_cleanup_dict(product_dict) - if product_dict.get("recordset"): - return product_dict["recordset"] - if product_dict.get("id"): - return ppo.browse(product_dict["id"]) + product = self._direct_match(product_dict, ppo) + if product: + return product product = self._match_product_search(product_dict) if product: return product @@ -602,10 +656,9 @@ def _match_currency(self, currency_dict, chatter_msg): currency_dict = {} rco = self.env["res.currency"] self._strip_cleanup_dict(currency_dict) - if currency_dict.get("recordset"): - return currency_dict["recordset"] - if currency_dict.get("id"): - return rco.browse(currency_dict["id"]) + currency = self._direct_match(currency_dict, rco) + if currency: + return currency if currency_dict.get("iso"): currency_iso = currency_dict["iso"].upper() currency = rco.search([("name", "=", currency_iso)], limit=1) @@ -710,10 +763,9 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): if not uom_dict: uom_dict = {} self._strip_cleanup_dict(uom_dict) - if uom_dict.get("recordset"): - return uom_dict["recordset"] - if uom_dict.get("id"): - return uuo.browse(uom_dict["id"]) + uom = self._direct_match(uom_dict, uuo) + if uom: + return uom if uom_dict.get("unece_code"): # Map NIU to Unit if uom_dict["unece_code"] == "NIU": @@ -817,10 +869,9 @@ def _match_tax( """ ato = self.env["account.tax"] self._strip_cleanup_dict(tax_dict) - if tax_dict.get("recordset"): - return tax_dict["recordset"] - if tax_dict.get("id"): - return ato.browse(tax_dict["id"]) + tax = self._direct_match(tax_dict, ato) + if tax: + return tax domain = self._prepare_match_tax_domain( tax_dict, type_tax_use=type_tax_use, price_include=price_include ) @@ -1037,10 +1088,9 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): if speed_dict is None: speed_dict = self._prepare_account_speed_dict() self._strip_cleanup_dict(account_dict) - if account_dict.get("recordset"): - return account_dict["recordset"] - if account_dict.get("id"): - return aao.browse(account_dict["id"]) + account = self._direct_match(account_dict, aao) + if account: + return account if account_dict.get("code"): acc_code = account_dict["code"].upper() if acc_code in speed_dict: @@ -1102,10 +1152,9 @@ def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): if speed_dict is None: speed_dict = self._prepare_analytic_account_speed_dict() self._strip_cleanup_dict(aaccount_dict) - if aaccount_dict.get("recordset"): - return aaccount_dict["recordset"] - if aaccount_dict.get("id"): - return aaao.browse(aaccount_dict["id"]) + aaccount = self._direct_match(aaccount_dict, aaao) + if aaccount: + return aaccount if aaccount_dict.get("code"): aacode = aaccount_dict["code"].upper() if aacode in speed_dict: @@ -1146,10 +1195,9 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): if speed_dict is None: speed_dict = self._prepare_journal_speed_dict() self._strip_cleanup_dict(journal_dict) - if journal_dict.get("recordset"): - return journal_dict["recordset"] - if journal_dict.get("id"): - return ajo.browse(journal_dict["id"]) + journal = self._direct_match(journal_dict, ajo) + if journal: + return journal if journal_dict.get("code"): jcode = journal_dict["code"].upper() if jcode in speed_dict: @@ -1173,11 +1221,11 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): def _match_incoterm(self, incoterm_dict, chatter_msg): aio = self.env["account.incoterms"] if not incoterm_dict: - return False - if incoterm_dict.get("recordset"): - return incoterm_dict["recordset"] - if incoterm_dict.get("id"): - return aio.browse(incoterm_dict["id"]) + incoterm_dict = {} + self._strip_cleanup_dict(incoterm_dict) + incoterm = self._direct_match(incoterm_dict, aio) + if incoterm: + return incoterm if incoterm_dict.get("code"): incoterm = aio.search( [ diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 7143cd36ad..57c3292c7f 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -95,6 +95,16 @@ def test_match_shipping_partner(self): def test_match_currency(self): bdio = self.env["business.document.import"] + currency_dict = {"xmlid": "base.USD"} + res = bdio._match_currency(currency_dict, []) + self.assertEqual(res, self.env.ref("base.USD")) + first_cur = self.env["res.currency"].search([], limit=1) + currency_dict = {"id": first_cur.id} + res = bdio._match_currency(currency_dict, []) + self.assertEqual(res, first_cur) + currency_dict = {"recordset": first_cur} + res = bdio._match_currency(currency_dict, []) + self.assertEqual(res, first_cur) currency_dict = {"iso": "EUR"} res = bdio._match_currency(currency_dict, []) self.assertEqual(res, self.env.ref("base.EUR")) From 5ba970ceecd297edcce5bbcd5b81bf3dc657ed17 Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Fri, 8 Jul 2022 08:19:19 +0000 Subject: [PATCH 75/99] base_business_document_import 14.0.2.5.0 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 20 ++++++ base_business_document_import/i18n/fr.po | 24 ++++++- base_business_document_import/i18n/fr_FR.po | 65 ++++++++++++------ base_business_document_import/i18n/nl.po | 67 +++++++++++++------ 5 files changed, 136 insertions(+), 42 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index c36b981a97..9c9ffb8cb1 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.4.0", + "version": "14.0.2.5.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index d36c9a8e05..cc938c9e9d 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -95,6 +95,12 @@ msgstr "IBAN %s není platný, takže byl ignorován." msgid "ID" msgstr "ID" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" @@ -222,6 +228,12 @@ msgid "" "import this document." msgstr "" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -335,6 +347,14 @@ msgstr "" "Produkt '%s' se používá na několika importovaných řádcích, takže 1 řádky " "nebyly aktualizovány." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 0fe0a28c7a..a261099ed4 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -48,8 +48,8 @@ msgid "" msgstr "" "

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " "suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure 'Unité(s)" -"' a donc été utilisée. Vous devrez peut-être la modifier " +"li>

  • Nom de l'unité de mesure : %s
  • L'unité de mesure " +"'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " "manuellement.

    " #. module: base_business_document_import @@ -99,6 +99,12 @@ msgstr "IBAN %s n’est pas valide, il a donc été ignoré." msgid "ID" msgstr "ID" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" @@ -256,6 +262,12 @@ msgstr "" "correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " "essayez d'importer ce document." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -389,6 +401,14 @@ msgstr "" "Le produit '%s' est utilisé sur plusieurs lignes importées, donc les " "lignes n'ont pas été mises à jour." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/i18n/fr_FR.po b/base_business_document_import/i18n/fr_FR.po index a7e7de15ba..eb303f902c 100644 --- a/base_business_document_import/i18n/fr_FR.po +++ b/base_business_document_import/i18n/fr_FR.po @@ -39,15 +39,14 @@ msgstr "Notes dans le document importé:" #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: " -"%s
    • Name of the unit of measure: %s

    So the unit of " -"measure 'Unit(s)' has been used. You may have to change it " -"manually.

    " +"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " +"'Unit(s)' has been used. You may have to change it manually.

    " msgstr "" "

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " "suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure 'Unité(s)" -"' a donc été utilisée. Vous devrez peut-être la modifier " +"li>

  • Nom de l'unité de mesure : %s
  • L'unité de mesure " +"'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " "manuellement.

    " #. module: base_business_document_import @@ -97,6 +96,12 @@ msgstr "L'IBAN %s n'est pas valide, il a donc été ignoré." msgid "ID" msgstr "" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" @@ -119,7 +124,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any %s corresponding to the following information " +"extracted from the business document:\n" "Name: %s\n" "VAT number: %s\n" "Reference: %s\n" @@ -142,7 +148,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document:\n" "Account code: %s" msgstr "" "Odoo n'a pas trouvé de compte correspondant aux informations suivantes " @@ -153,7 +160,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document:\n" "Analytic account code: %s" msgstr "" "Odoo n'a pas trouvé de compte analytique correspondant aux informations " @@ -164,7 +172,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document:\n" "Journal code: %s" msgstr "" "Odoo n'a pas trouvé de journal correspondant aux informations suivantes " @@ -175,7 +184,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document:\n" "Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" @@ -190,7 +200,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" "Name: %s\n" "VAT number: %s\n" "Reference: %s\n" @@ -221,7 +232,9 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " +"in Price' = '%s' which correspond to the following information extracted " +"from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" "UNECE Due Date code: %s\n" @@ -249,8 +262,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully" -" that the %s is correct." +"The %s has been identified by the domain name '%s' so please check carefully " +"that the %s is correct." msgstr "" "Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " "soigneusement que le %s est correct." @@ -259,14 +272,20 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't" -" match the VAT number of the company '%s' (%s) in which you are trying to " +"The VAT number of the customer written in the business document (%s) doesn't " +"match the VAT number of the company '%s' (%s) in which you are trying to " "import this document." msgstr "" "Le numéro de TVA du client indiqué dans le document commercial (%s) ne " "correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " "essayez d'importer ce document." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -363,8 +382,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier" -" %s" +"The bank account IBAN %s has been automatically added on the supplier " +"%s" msgstr "" "Le compte bancaire IBAN %s a été automatiquement ajouté sur le " "fournisseur %s" @@ -399,6 +418,14 @@ msgstr "" "Le produit '%s' est utilisé sur plusieurs lignes importées, donc les " "lignes n'ont pas été mises à jour." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index 23afc89a6b..2f30a3b967 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -39,15 +39,14 @@ msgstr "Notities in geimporteerd document:" #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: " -"%s
    • Name of the unit of measure: %s

    So the unit of " -"measure 'Unit(s)' has been used. You may have to change it " -"manually.

    " +"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " +"'Unit(s)' has been used. You may have to change it manually.

    " msgstr "" "

    Er kon geen eenheid gevonden worden welke overeenkomt met de volgende " -"informatie verkregen uit het bedrijfsdocument:

    • UNECE code: " -"%s
    • Eenheidsnaam: %s

    dus de 'Unit(s)' eenheid is " -"gebruikt. Wellicht wilt u dit handmatig wijzigen.

    " +"informatie verkregen uit het bedrijfsdocument:

    • UNECE code: %s
    • Eenheidsnaam: %s

    dus de 'Unit(s)' eenheid is gebruikt. " +"Wellicht wilt u dit handmatig wijzigen.

    " #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -95,6 +94,12 @@ msgstr "IBAN %s is ongeldig, dus genegeerd." msgid "ID" msgstr "ID" +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update msgid "Last Modified on" @@ -117,7 +122,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any %s corresponding to the following information " +"extracted from the business document:\n" "Name: %s\n" "VAT number: %s\n" "Reference: %s\n" @@ -140,7 +146,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document:\n" "Account code: %s" msgstr "" "kon geen rekening vinden welke overeenkomt met de verkregen informatie uit " @@ -151,7 +158,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document:\n" "Analytic account code: %s" msgstr "" "kon geen analytisch account vinden welke overeenkomt met de verkregen " @@ -162,7 +170,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document:\n" "Journal code: %s" msgstr "" "kon geen dagboek vinden welke overeenkomt met de verkregen informatie uit " @@ -173,7 +182,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document:\n" "Barcode: %s\n" "Product code: %s\n" "Supplier: %s\n" @@ -188,7 +198,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" "Name: %s\n" "VAT number: %s\n" "Reference: %s\n" @@ -219,7 +230,9 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " +"in Price' = '%s' which correspond to the following information extracted " +"from the business document:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" "UNECE Due Date code: %s\n" @@ -247,8 +260,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully" -" that the %s is correct." +"The %s has been identified by the domain name '%s' so please check carefully " +"that the %s is correct." msgstr "" "Het %s is geidentificeerd op de domeinnaam '%s' controleer zorgvuldig daat " "de %s juist is." @@ -257,14 +270,20 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't" -" match the VAT number of the company '%s' (%s) in which you are trying to " +"The VAT number of the customer written in the business document (%s) doesn't " +"match the VAT number of the company '%s' (%s) in which you are trying to " "import this document." msgstr "" "Het BTW nummer van de klant in het bedrijfsdocument (%s) komt niet overeen " "met het BTW nummer van het bedrijf '%s' (%s) waarvoor je een document " "probeert te importeren." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -361,8 +380,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier" -" %s" +"The bank account IBAN %s has been automatically added on the supplier " +"%s" msgstr "" "Het bankrekeningnummerIBAN %s is automatisch toegevoegd aan de " "leverancier %s" @@ -397,6 +416,14 @@ msgstr "" "Het product '%s' is gebruikt op meerdere geimporteerde regels, dus de " "regels zijn niet bijgewerkt." +#. module: base_business_document_import +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" + #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format From 1dc19e1cb20a2f215a2e3d0a808d6f1c02d90575 Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Fri, 15 Jul 2022 00:38:02 +0200 Subject: [PATCH 76/99] account_invoice_import: improve handling of simple PDF invoices Implement what is described in issue #610: - account_invoice_import_simple_pdf and account_invoice_import_invoice2data can now be use d together - when importing an invoice for an unknown partner, it creates an empty invoice with PDF a s attachment - when importing an invoice via mail gateway and the from email is set on a partner that doesn't have any import config, create a supplier invoice with PDF as attachment and with that partner - when importing an invoice via mail gateway and the from email is set on a partner that has a single-line import config, create a supplier invoice with PDF as attachment, that partner and 1 invoice line with price_unit=0. --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 42fb426771..1132fdcb1e 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -342,7 +342,7 @@ def _match_partner( # noqa: C901 return partner if not raise_exception: - return + return None raise self.user_error_wrap( "_match_partner", partner_dict, From 443ae2714f22d3287211a95b2d0b5205b11c2bba Mon Sep 17 00:00:00 2001 From: Bosd Date: Sat, 16 Jul 2022 20:32:59 +0000 Subject: [PATCH 77/99] Translated using Weblate (Dutch) Currently translated at 88.0% (37 of 42 strings) Translation: edi-14.0/edi-14.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import/nl/ --- base_business_document_import/i18n/nl.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index 2f30a3b967..5c5e9c8341 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-05-15 12:05+0000\n" +"PO-Revision-Date: 2022-07-16 23:06+0000\n" "Last-Translator: Bosd \n" "Language-Team: none\n" "Language: nl\n" @@ -239,7 +239,7 @@ msgid "" "Tax amount: %s %s" msgstr "" "Er kon geen belastingsregel gevonden worden 'Tax Application' = '%s' en " -"'prijs inclusief btw' = '%s' whelke overeenkomt met de volgende informatie " +"'prijs inclusief btw' = '%s' welke overeenkomt met de volgende informatie " "verkregen uit dit bedrijfsdocument:\n" "UNECE Tax Type code: %s\n" "UNECE Tax Category code: %s\n" From ade790fd67571c16a5ec2f0ceb0d704bf50c3511 Mon Sep 17 00:00:00 2001 From: Claude R Perrin Date: Sun, 7 Aug 2022 05:59:58 +0000 Subject: [PATCH 78/99] Translated using Weblate (French) Currently translated at 88.0% (37 of 42 strings) Translation: edi-14.0/edi-14.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import/fr/ --- base_business_document_import/i18n/fr.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index a261099ed4..20539d212d 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -9,8 +9,8 @@ msgstr "" "Project-Id-Version: Odoo Server 11.0\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-02-22 03:40+0000\n" -"PO-Revision-Date: 2021-06-17 15:48+0000\n" -"Last-Translator: Yves Le Doeuff \n" +"PO-Revision-Date: 2022-08-07 07:06+0000\n" +"Last-Translator: Claude R Perrin \n" "Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n" "Language: fr\n" "MIME-Version: 1.0\n" @@ -69,7 +69,7 @@ msgstr "Méthodes courantes d'importation de documents commerciaux" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" -msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'." +msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name @@ -114,7 +114,7 @@ msgstr "Dernière modification le" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" -msgstr "Numéro de TVA manquant pour la société \"%s\"." +msgstr "Numéro de TVA manquant pour la société \"%s\"" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -122,7 +122,7 @@ msgstr "Numéro de TVA manquant pour la société \"%s\"." msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" "Aucune devise n'a été spécifiée, Odoo a donc utilisé la devise de la société " -"(%s)." +"(%s)" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 From 4596caa5f05c9f5199d683128475f87c9c69b4be Mon Sep 17 00:00:00 2001 From: OCA-git-bot Date: Tue, 27 Sep 2022 21:17:26 +0000 Subject: [PATCH 79/99] base_business_document_import 14.0.3.0.0 --- base_business_document_import/__manifest__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 9c9ffb8cb1..92b8f0d9e7 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.2.5.0", + "version": "14.0.3.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", From f4371c8c3aca59e9ee880c30f8f268632614b371 Mon Sep 17 00:00:00 2001 From: Bosd Date: Tue, 7 Feb 2023 10:08:45 +0000 Subject: [PATCH 80/99] Translated using Weblate (Dutch) Currently translated at 90.4% (38 of 42 strings) Translation: edi-14.0/edi-14.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import/nl/ --- base_business_document_import/i18n/nl.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index 5c5e9c8341..daee123fb3 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 14.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2022-07-16 23:06+0000\n" +"PO-Revision-Date: 2023-02-07 12:22+0000\n" "Last-Translator: Bosd \n" "Language-Team: none\n" "Language: nl\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.3.2\n" +"X-Generator: Weblate 4.14.1\n" #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -52,7 +52,7 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Approximate match: account %s has been matched with account %s" -msgstr "Geschatte overeenkomt: rekening %s is gematched met rekening %s" +msgstr "Geschatte overeenkomst: rekening %s is gematched met rekening %s" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import @@ -98,7 +98,7 @@ msgstr "ID" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." -msgstr "" +msgstr "ID {id} van '{model}' bestaat niet." #. module: base_business_document_import #: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update From c59305f6486c02f90c7629e3fd44185c0cc91cf5 Mon Sep 17 00:00:00 2001 From: Goncalo Brito Date: Mon, 13 Feb 2023 15:45:13 +0100 Subject: [PATCH 81/99] [MIG] base_business_document_import: Migration to 16.0 --- base_business_document_import/__manifest__.py | 2 +- base_business_document_import/i18n/cs_CZ.po | 8 - .../models/business_document_import.py | 280 +++++++++--------- .../tests/test_business_document_import.py | 203 ++++++++++++- 4 files changed, 342 insertions(+), 151 deletions(-) diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 92b8f0d9e7..3ec495a9f4 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "14.0.3.0.0", + "version": "16.0.1.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index cc938c9e9d..aac52b4500 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -310,14 +310,6 @@ msgid "" "automatically create bank accounts upon import is disabled." msgstr "" -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, fuzzy, python-format -msgid "" -"The bank account IBAN %s has been automatically added on the supplier " -"%s" -msgstr "Bankovní účet 1IBAN %s byl automaticky přidán na dodavatele %s" - #. module: base_business_document_import #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 1132fdcb1e..9ee925dc63 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -21,7 +21,7 @@ class BusinessDocumentImport(models.AbstractModel): @api.model def user_error_wrap(self, method, data_dict, error_msg): """The method and data_dict arguments are useful when you want to - inherit this method to update the error message""" + inherit this method to update the error messag_match_currencye""" assert error_msg raise UserError(error_msg) @@ -48,13 +48,13 @@ def _direct_match(self, data_dict, model, raise_exception=True): # Browsing an unexisting ID doesn't make Odoo crash # So I read create_date to make it crash record.create_date # pylint: disable=pointless-statement - except Exception: + except Exception as e: if raise_exception: raise UserError( _("ID {id} of '{model}' doesn't exist in Odoo.").format( id=data_dict["id"], model=model._name ) - ) + ) from e if record: return record if data_dict.get("xmlid"): @@ -62,9 +62,11 @@ def _direct_match(self, data_dict, model, raise_exception=True): record = False try: record = self.env.ref(xmlid, raise_if_not_found=True) - except Exception: + except Exception as e: if raise_exception: - raise UserError(_("The XMLID '%s' doesn't exist in Odoo.") % xmlid) + raise UserError( + _("The XMLID '%s' doesn't exist in Odoo.") % xmlid + ) from e if record: if isinstance(record, type(model)): return record @@ -83,14 +85,16 @@ def _direct_match(self, data_dict, model, raise_exception=True): @api.model def _strip_cleanup_dict(self, match_dict): - if match_dict: - for key, value in match_dict.items(): - if value and isinstance(value, str): - match_dict[key] = value.strip() - if match_dict.get("country_code"): - match_dict["country_code"] = match_dict["country_code"].upper() - if match_dict.get("state_code"): - match_dict["state_code"] = match_dict["state_code"].upper() + if not match_dict: + return + + for key, value in match_dict.items(): + if value and isinstance(value, str): + match_dict[key] = value.strip() + if match_dict.get("country_code"): + match_dict["country_code"] = match_dict["country_code"].upper() + if match_dict.get("state_code"): + match_dict["state_code"] = match_dict["state_code"].upper() @api.model def _get_match_partner_order(self, partner_type): @@ -111,7 +115,6 @@ def _get_match_partner_type_label(self, partner_type): @api.model def _get_country_filter(self, partner_dict, chatter_msg): """Generate filter by country""" - country = False if partner_dict.get("country_code"): country = self.env["res.country"].search( [("code", "=", partner_dict["country_code"])], limit=1 @@ -204,14 +207,15 @@ def _match_partner_name(self, partner_dict, chatter_msg, domain, order): @api.model def _get_partner_website_domain(self, partner_dict): - if partner_dict.get("website"): - urlp = urlparse(partner_dict["website"]) - netloc = urlp.netloc - if not urlp.scheme and not netloc: - netloc = urlp.path - if netloc and len(netloc.split(".")) >= 2: - return ".".join(netloc.split(".")[-2:]) - return False + if not partner_dict.get("website"): + return False + + urlp = urlparse(partner_dict["website"]) + netloc = urlp.netloc + if not urlp.scheme and not netloc: + netloc = urlp.path + if netloc and len(netloc.split(".")) >= 2: + return ".".join(netloc.split(".")[-2:]) @api.model def _match_partner_website(self, partner_dict, chatter_msg, domain, order): @@ -254,10 +258,12 @@ def _match_partner_email(self, partner_dict, chatter_msg, domain, order): partner_type_label = partner_dict["type_label"] chatter_msg.append( _( - "The %s has been identified by the domain name '%s' " - "so please check carefully that the %s is correct." + "The %(label)s has been identified by the domain name " + "'%(domain)s' so please check carefully that the " + "%(label)s is correct.", + label=partner_type_label, + domain=domain, ) - % (partner_type_label, domain, partner_type_label) ) return partner @@ -311,7 +317,7 @@ def _match_partner( # noqa: C901 # Search on VAT if partner_dict.get("vat"): - vat = partner_dict["vat"] + vat = partner_dict["vat"].replace(" ", "").upper() partner = rpo.search(domain + [("vat", "=", vat)], limit=1, order=order) if partner: return partner @@ -347,25 +353,23 @@ def _match_partner( # noqa: C901 "_match_partner", partner_dict, _( - "Odoo couldn't find any %s corresponding to the following " + "Odoo couldn't find any %(label)s corresponding to the following " "information extracted from the business document:\n" - "Name: %s\n" - "VAT number: %s\n" - "Reference: %s\n" - "E-mail: %s\n" - "Website: %s\n" - "State code: %s\n" - "Country code: %s\n" - ) - % ( - partner_type_label, - partner_dict.get("name") or "", - partner_dict.get("vat") or "", - partner_dict.get("ref") or "", - partner_dict.get("email") or "", - partner_dict.get("website") or "", - partner_dict.get("state_code") or "", - partner_dict.get("country_code") or "", + "Name: %(name)s \n" + "VAT number: %(vat)s \n" + "Reference: %(ref)s \n" + "E-mail: %(email)s \n" + "Website: %(website)s \n" + "State code: %(state)s \n" + "Country code: %(country)s \n", + label=partner_type_label, + name=partner_dict.get("name") or "", + vat=partner_dict.get("vat") or "", + ref=partner_dict.get("ref") or "", + email=partner_dict.get("email") or "", + website=partner_dict.get("website") or "", + state=partner_dict.get("state_code") or "", + country=partner_dict.get("country_code") or "", ), ) @@ -462,30 +466,28 @@ def _match_shipping_partner( _( "Odoo couldn't find any shipping partner corresponding to the " "following information extracted from the business document:\n" - "Name: %s\n" - "VAT number: %s\n" - "Reference: %s\n" - "E-mail: %s\n" - "Website: %s\n" - "Street: %s\n" - "Street2: %s\n" - "City: %s\n" - "ZIP: %s\n" - "State code: %s\n" - "Country code: %s\n" - ) - % ( - partner_dict.get("name") or "", - partner_dict.get("vat") or "", - partner_dict.get("ref") or "", - partner_dict.get("email") or "", - partner_dict.get("website") or "", - partner_dict.get("street") or "", - partner_dict.get("street2") or "", - partner_dict.get("city") or "", - partner_dict.get("zip") or "", - partner_dict.get("state_code") or "", - partner_dict.get("country_code") or "", + "Name: %(name)s\n" + "VAT number: %(vat)s\n" + "Reference: %(ref)s\n" + "E-mail: %(email)s\n" + "Website: %(website)s\n" + "Street: %(street)s\n" + "Street2: %(street2)s\n" + "City: %(city)s\n" + "ZIP: %(zip)s\n" + "State code: %(state)s\n" + "Country code: %(country)s\n", + name=partner_dict.get("name") or "", + vat=partner_dict.get("vat") or "", + ref=partner_dict.get("ref") or "", + email=partner_dict.get("email") or "", + website=partner_dict.get("website") or "", + street=partner_dict.get("street") or "", + street2=partner_dict.get("street2") or "", + city=partner_dict.get("city") or "", + zip=partner_dict.get("zip") or "", + state=partner_dict.get("state_code") or "", + country=partner_dict.get("country_code") or "", ), ) @@ -536,24 +538,30 @@ def _match_partner_bank( ) chatter_msg.append( _( - "The bank account IBAN %s has been automatically " + "The bank account IBAN %(iban)s has been automatically " "added on the supplier " - "%s" + "%(partner)s", + iban=iban, + partner_id=partner.id, + partner=partner.display_name, ) - % (iban, partner.id, partner.display_name) ) return partner_bank else: chatter_msg.append( _( "The analysis of the business document returned " - "IBAN %s as bank account, but there is no such " + "IBAN %(iban)s as bank account, but there is no such " "bank account in Odoo linked to partner " - "%s and " + "%(partner)s and " "the option to automatically create bank " - "accounts upon import is disabled." + "accounts upon import is disabled.", + iban=iban, + partner_id=partner.id, + partner=partner.display_name, ) - % (iban, partner.id, partner.display_name) ) @api.model @@ -589,7 +597,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): sinfo = self.env["product.supplierinfo"].search( self._match_company_domain() + [ - ("name", "=", seller.id), + ("partner_id", "=", seller.id), ("product_code", "=", product_dict["code"]), ], limit=1, @@ -606,14 +614,12 @@ def _match_product(self, product_dict, chatter_msg, seller=False): _( "Odoo couldn't find any product corresponding to the " "following information extracted from the business document:\n" - "Barcode: %s\n" - "Product code: %s\n" - "Supplier: %s\n" - ) - % ( - product_dict.get("barcode") or "", - product_dict.get("code") or "", - seller and seller.name or "", + "Barcode: %(barcode)s\n" + "Product code: %(product_code)s\n" + "Supplier: %(supplier)s\n", + barcode=product_dict.get("barcode") or "", + product_code=product_dict.get("code") or "", + supplier=seller and seller.name or "", ), ) @@ -650,6 +656,7 @@ def _match_currency(self, currency_dict, chatter_msg): 'iso': 'USD', # If we have ISO, no need to have more keys 'symbol': '$', 'country_code': 'US', + 'iso_or_symbol': '$', } """ if not currency_dict: @@ -703,11 +710,11 @@ def _match_currency(self, currency_dict, chatter_msg): "_match_currency", currency_dict, _( - "The analysis of the business document returned '%s' as " + "The analysis of the business document returned '%(code)s' as " "the currency symbol or ISO code. But there are none or " - "several currencies with the symbol/ISO code in Odoo." - ) - % currency_dict["iso_or_symbol"], + "several currencies with the symbol/ISO code in Odoo.", + code=currency_dict["iso_or_symbol"], + ), ) if currency_dict.get("country_code"): country_code = currency_dict["country_code"] @@ -722,12 +729,13 @@ def _match_currency(self, currency_dict, chatter_msg): "_match_currency", currency_dict, _( - "The analysis of the business document returned '%s' " + "The analysis of the business document returned '%(code)s' " "as the country code to find the related currency. " - "But the country '%s' doesn't have any related " - "currency configured in Odoo." - ) - % (country_code, country.name), + "But the country '%(name)s' doesn't have any related " + "currency configured in Odoo.", + code=country_code, + name=country.name, + ), ) else: raise self.user_error_wrap( @@ -776,13 +784,13 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): else: chatter_msg.append( _( - "The analysis of the business document returned '%s' " + "The analysis of the business document returned '%(code)s' " "as the unit of measure UNECE code, but there is no " "unit of measure with that UNECE code in Odoo. Please " "check the configuration of the units of measures in " - "Odoo." + "Odoo.", + code=uom_dict["unece_code"], ) - % uom_dict["unece_code"] ) if uom_dict.get("name"): uom = uuo.search([("name", "=ilike", uom_dict["name"] + "%")], limit=1) @@ -794,12 +802,13 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): _( "

    Odoo couldn't find any unit of measure corresponding to the " "following information extracted from the business document:

    " - "
    • UNECE code: %s
    • " - "
    • Name of the unit of measure: %s
    " + "
    • UNECE code: %(code)s
    • " + "
    • Name of the unit of measure: %(name)s
    " "

    So the unit of measure 'Unit(s)' has been used. You may " - "have to change it manually.

    " + "have to change it manually.

    ", + code=uom_dict.get("unece_code"), + name=uom_dict.get("name"), ) - % (uom_dict.get("unece_code"), uom_dict.get("name")) ) return self.env.ref("uom.product_uom_unit") @@ -835,7 +844,10 @@ def _prepare_match_tax_domain( domain.append(("price_include", "=", True)) # with the code above, if you set price_include=None, it will # won't depend on the value of the price_include parameter - assert tax_dict.get("amount_type") in ["fixed", "percent"], "bad tax type" + assert tax_dict.get("amount_type") in [ + "fixed", + "percent", + ], "bad tax type, has to be fixed or percent" assert "amount" in tax_dict, "Missing amount key in tax_dict" domain.append(("amount_type", "=", tax_dict["amount_type"])) if tax_dict.get("unece_type_code"): @@ -884,22 +896,22 @@ def _match_tax( "_match_tax", tax_dict, _( - "Odoo couldn't find any tax with 'Tax Application' = '%s' " - "and 'Tax Included in Price' = '%s' which correspond to the " + "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' " + "and 'Tax Included in Price' = '%(price)s' which correspond to the " "following information extracted from the business document:\n" - "UNECE Tax Type code: %s\n" - "UNECE Tax Category code: %s\n" - "UNECE Due Date code: %s\n" - "Tax amount: %s %s" - ) - % ( - type_tax_use, - price_include, - tax_dict.get("unece_type_code") or "", - tax_dict.get("unece_categ_code") or "", - tax_dict.get("unece_due_date_code") or "", - tax_dict["amount"], - tax_dict["amount_type"] == "percent" and "%" or _("(fixed)"), + "UNECE Tax Type code: %(tax_type)s\n" + "UNECE Tax Category code: %(tax_cat)s\n" + "UNECE Due Date code: %s(tax_due_date)\n" + "Tax amount: %(amount)s %(amount_type)s", + tax=type_tax_use, + price=price_include, + tax_type=tax_dict.get("unece_type_code") or "", + tax_cat=tax_dict.get("unece_categ_code") or "", + tax_due_date=tax_dict.get("unece_due_date_code") or "", + amount=tax_dict["amount"], + amount_type=tax_dict["amount_type"] == "percent" + and "%" + or _("(fixed)"), ), ) @@ -1012,15 +1024,14 @@ def compare_lines( if uom != existing_lines_dict[product]["uom"]: chatter_msg.append( _( - "For product '%s', the unit of measure is %s on the " - "existing line, but it is %s on the imported line. " + "For product '%(product)s', the unit of measure is " + "%(uom_product)s on the existing line, but it is " + "%(uom_imported)s on the imported line." "We don't support this scenario for the moment, so " - "the lines haven't been updated." - ) - % ( - product.display_name, - existing_lines_dict[product]["uom"].name, - uom.name, + "the lines haven't been updated.", + product=product.display_name, + uom_product=existing_lines_dict[product]["uom"].name, + uom_imported=uom.name, ) ) return False @@ -1109,10 +1120,11 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): if code.startswith(acc_code): chatter_msg.append( _( - "Approximate match: account %s has been matched " - "with account %s" + "Approximate match: account %(account)s has been matched " + "with account %(matched_account)s", + account=account_dict["code"], + matched_account=code, ) - % (account_dict["code"], code) ) return aao.browse(account_id) raise self.user_error_wrap( @@ -1264,14 +1276,12 @@ def _check_company(self, company_dict, chatter_msg): company_dict, _( "The VAT number of the customer written in the " - "business document (%s) doesn't match the VAT number " - "of the company '%s' (%s) in which you are trying to " - "import this document." - ) - % ( - parsed_company_vat, - company.display_name, - company.partner_id.vat, + "business document (%(parsed_vat)s) doesn't match " + "the VAT number of the company '%(company)s' (%(vat)s) " + "in which you are trying to import this document.", + parsed_vat=parsed_company_vat, + company=company.display_name, + vat=company.partner_id.vat, ), ) else: diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 57c3292c7f..90ddbedcf6 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -3,10 +3,14 @@ # @author: Alexis de Lattre # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). +import logging + from odoo.exceptions import UserError from odoo.tests import tagged from odoo.tests.common import TransactionCase +logger = logging.getLogger(__name__) + @tagged("post_install", "-at_install") class TestBaseBusinessDocumentImport(TransactionCase): @@ -30,6 +34,184 @@ def test_match_partner(self): res = bdio._match_partner(partner_dict, [], partner_type=False) self.assertEqual(res, partner1) + def test_direct_match_recordset(self): + partner = self.env["res.partner"].create( + { + "name": "Alexis Delattre", + "email": "alexis.delattre@example.com", + "ref": "C1242", + } + ) + partner_dict = { + "recordset": partner, + } + bdio = self.env["business.document.import"] + partner_match = bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.assertEqual(partner, partner_match) + + with self.assertRaises(UserError): + bdio._direct_match(partner_dict, self.env["res.partner.bank"], True) + + partner_match = bdio._direct_match( + partner_dict, self.env["res.partner.bank"], False + ) + self.assertEqual(None, partner_match) + + def test_direct_match_id(self): + partner = self.env["res.partner"].create( + { + "name": "Alexis Delattre", + "email": "alexis.delattre@example.com", + "ref": "C1242", + } + ) + partner_dict = { + "id": partner.id, + } + bdio = self.env["business.document.import"] + partner_match = bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.assertEqual(partner, partner_match) + + partner_dict = { + "id": 234234234234231, + } + with self.assertRaises(UserError): + bdio._direct_match(partner_dict, self.env["res.partner"], True) + + def test_direct_match_xmlid(self): + partner_dict = { + "xmlid": "i.dont.exist.odoo", + } + bdio = self.env["business.document.import"] + with self.assertRaises(UserError): + bdio._direct_match(partner_dict, self.env["res.partner"], True) + + partner_dict = { + "xmlid": "base.fr", + } + with self.assertRaises(UserError): + bdio._direct_match(partner_dict, self.env["res.partner"], True) + + partner_dict = { + "xmlid": "base.main_partner", + } + partner = bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.assertEqual(partner.name, "YourCompany") + + def test_match_partner_ref(self): + partner1 = self.env["res.partner"].create( + { + "name": "Alexis Delattre", + "email": "alexis.delattre@example.com", + "ref": "C1242", + } + ) + bdio = self.env["business.document.import"] + partner_dict = { + "name": "Alexis Delattre", + "email": "alexis.delattre@example.com", + "ref": "C1242", + } + chatter_msg = [] + domain = [] + order = "" + partner = bdio._match_partner_ref(partner_dict, chatter_msg, domain, order) + self.assertEqual(partner, partner1) + + def test_match_partner_contact(self): + partner_email = self.env["res.partner"].create( + { + "email": "alexis.email@example.com", + "name": "Alexis email", + } + ) + partner_contact = self.env["res.partner"].create( + { + "email": "alexis.name@example.com", + "name": "Alexis name", + } + ) + partner_phone = self.env["res.partner"].create( + { + "email": "alexis.phone@example.com", + "phone": "01.41.98.12.42", + "name": "Alexis phone", + } + ) + bdio = self.env["business.document.import"] + chatter_msg = [] + domain = [] + order = "" + + partner_dict = { + "name": "Alexis email", + "email": "alexis.email@example.com", + } + partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + self.assertEqual(partner, partner_email) + + partner_dict = { + "contact": "Alexis name", + "email": "alexis.name@example.com", + } + partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + self.assertEqual(partner, partner_contact) + + partner_dict = { + "name": "Alexis phone", + "email": "alexis.phone@example.com", + "phone": "01.41.98.12.42", + } + partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + self.assertEqual(partner, partner_phone) + + def test_match_partner_name(self): + partner_name = self.env["res.partner"].create( + { + "email": "alexis.name@example.com", + "name": "Alexis name", + } + ) + bdio = self.env["business.document.import"] + chatter_msg = [] + domain = [] + order = "" + + partner_dict = { + "name": "Alexis name", + "email": "alexis.name@example.com", + } + partner = bdio._match_partner_name(partner_dict, chatter_msg, domain, order) + self.assertEqual(partner, partner_name) + + def test_get_partner_website_domain(self): + bdio = self.env["business.document.import"] + + www_website = {"website": "www.example.com"} + website_domain = bdio._get_partner_website_domain(www_website) + self.assertEqual(website_domain, "example.com") + + no_website = bdio._get_partner_website_domain({}) + self.assertEqual(False, no_website) + + https_www_website = {"website": "https://www.example.com"} + website_domain = bdio._get_partner_website_domain(https_www_website) + self.assertEqual(website_domain, "example.com") + + https_website = {"website": "https://example.com"} + website_domain = bdio._get_partner_website_domain(https_website) + self.assertEqual(website_domain, "example.com") + + https_path_website = {"website": "https://subdomain.example.com/bla/bla"} + website_domain = bdio._get_partner_website_domain(https_path_website) + self.assertEqual(website_domain, "example.com") + + https_big_subdomain_website = { + "website": "https://just.a.big.subdomain.example.com" + } + website_domain = bdio._get_partner_website_domain(https_big_subdomain_website) + self.assertEqual(website_domain, "example.com") + def test_match_shipping_partner(self): rpo = self.env["res.partner"] bdio = self.env["business.document.import"] @@ -77,6 +259,12 @@ def test_match_shipping_partner(self): shipping_dict["zip"] = "92500" with self.assertRaises(UserError): bdio._match_shipping_partner(shipping_dict, None, []) + + no_error = bdio._match_shipping_partner( + shipping_dict, None, [], raise_exception=False + ) + self.assertEqual(no_error, None) + partner2 = rpo.create( { "name": "Alex Corp", @@ -137,7 +325,7 @@ def test_match_product(self): 0, 0, { - "name": self.env.ref("base.res_partner_2").id, + "partner_id": self.env.ref("base.res_partner_2").id, "product_code": "TEST1242", }, ), @@ -168,7 +356,8 @@ def test_match_product(self): bdio._match_product(product_dict, [], seller=False) raise_test = False except Exception: - pass + logger.info("Exception catched.") + self.assertTrue(raise_test) def test_match_uom(self): @@ -182,9 +371,9 @@ def test_match_uom(self): uom_dict = {"name": "day"} res = bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_day")) - uom_dict = {"name": "L"} + uom_dict = {"name": "lb"} res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref("uom.product_uom_litre")) + self.assertEqual(res, self.env.ref("uom.product_uom_lb")) uom_dict = {} product = self.env.ref("product.product_product_1") res = bdio._match_uom(uom_dict, [], product=product) @@ -260,7 +449,7 @@ def test_match_account_exact(self): { "name": "Test 898999", "code": "898999", - "user_type_id": self.env.ref("account.data_account_type_expenses").id, + "account_type": "expense", } ) res = bdio._match_account({"code": "898999"}, []) @@ -272,7 +461,7 @@ def test_match_account_bigger_in(self): { "name": "Test 898999", "code": "898999", - "user_type_id": self.env.ref("account.data_account_type_expenses").id, + "account_type": "expense", } ) res = bdio._match_account({"code": "89899900"}, []) @@ -284,7 +473,7 @@ def test_match_account_smaller_in(self): { "name": "Test 89899910", "code": "89899910", - "user_type_id": self.env.ref("account.data_account_type_expenses").id, + "account_type": "expense", } ) chatter = [] From 205661a6498bebecad78c32b7814a3a9080a5358 Mon Sep 17 00:00:00 2001 From: Goncalo Brito Date: Thu, 4 May 2023 16:12:10 +0200 Subject: [PATCH 82/99] [REF] Change domain with expression method --- base_business_document_import/README.rst | 10 +- .../i18n/base_business_document_import.pot | 180 ++++--- base_business_document_import/i18n/cs_CZ.po | 255 ++++++---- base_business_document_import/i18n/fr.po | 384 ++++++++++----- base_business_document_import/i18n/fr_FR.po | 455 ++++++++++++------ base_business_document_import/i18n/nl.po | 455 ++++++++++++------ .../models/business_document_import.py | 268 +++++++---- .../static/description/index.html | 6 +- 8 files changed, 1316 insertions(+), 697 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index de31eba5ac..c76d117f95 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -14,13 +14,13 @@ Base Business Document Import :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github - :target: https://github.com/OCA/edi/tree/14.0/base_business_document_import + :target: https://github.com/OCA/edi/tree/16.0/base_business_document_import :alt: OCA/edi .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/edi-14-0/edi-14-0-base_business_document_import + :target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-base_business_document_import :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/226/14.0 + :target: https://runbot.odoo-community.org/runbot/226/16.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -42,7 +42,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -85,6 +85,6 @@ Current `maintainer `__: |maintainer-alexis-via| -This module is part of the `OCA/edi `_ project on GitHub. +This module is part of the `OCA/edi `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index a1a3a911ee..27a5fd2ad9 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -4,7 +4,7 @@ # msgid "" msgstr "" -"Project-Id-Version: Odoo Server 14.0\n" +"Project-Id-Version: Odoo Server 16.0\n" "Report-Msgid-Bugs-To: \n" "Last-Translator: \n" "Language-Team: \n" @@ -14,38 +14,45 @@ msgstr "" "Plural-Forms: \n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

    • UNECE code: " -"%s
    • Name of the unit of measure: %s

    So the unit of " -"measure 'Unit(s)' has been used. You may have to change it " +"%(code)s

  • Name of the unit of measure: %(name)s
  • So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " "manually.

    " msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Approximate match: account %s has been matched with account %s" +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" msgstr "" #. module: base_business_document_import @@ -54,74 +61,68 @@ msgid "Common methods to import business documents" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name -msgid "Display Name" -msgstr "" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"For product '%s', the unit of measure is %s on the existing line, but it is " -"%s on the imported line. We don't support this scenario for the moment, so " -"the lines haven't been updated." +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been " +"updated." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id -msgid "ID" -msgstr "" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update -msgid "Last Modified on" -msgstr "" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Odoo couldn't find any %(label)s corresponding to the following information extracted from the business document:\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -130,6 +131,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -138,6 +140,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -146,45 +149,49 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Supplier: %s\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Street: %s\n" -"Street2: %s\n" -"City: %s\n" -"ZIP: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included in Price' = '%s' which correspond to the following information extracted from the business document:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Tax amount: %s %s" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax Included in Price' = '%(price)s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -193,106 +200,121 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully" -" that the %s is correct." +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't" -" match the VAT number of the company '%s' (%s) in which you are trying to " -"import this document." +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company '%(company)s' " +"(%(vat)s) in which you are trying to import this document." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as country code. But " -"there are no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But the country '%s' doesn't have any related " -"currency configured in Odoo." +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the " +"symbol/ISO code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But there is no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency ISO " -"code. But there are no currency with that code in Odoo." +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are none or several currencies with the symbol/ISO " -"code in Odoo." +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol. " -"But there are none or several currencies with that symbol in Odoo." +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the unit of measure " -"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " -"Please check the configuration of the units of measures in Odoo." +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned IBAN %s as bank " +"The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %s and the option to " -"automatically create bank accounts upon import is disabled." +"href=# data-oe-model=res.partner data-oe-id=%(partner_id)d>%(partner)s " +"and the option to automatically create bank accounts upon import is " +"disabled." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier" -" %s" +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier %(partner)s" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -301,6 +323,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -309,6 +332,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -317,6 +341,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format @@ -326,18 +351,21 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index aac52b4500..c9f936c924 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -20,41 +20,46 @@ msgstr "" "Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "(Úprávy)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "Poznámky v souboru %s:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "Poznámky v importovaném dokumentu:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " -"'Unit(s)' has been used. You may have to change it manually.

    " +"information extracted from the business document:

    • UNECE code: " +"%(code)s
    • Name of the unit of measure: %(name)s

    So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " msgstr "" -"Společnost Odoo nemohla najít žádnou měrnou jednotku, která by odpovídala " -"těmto informacím získaným z obchodního dokladu: Kód UNECE %s Náměrová " -"jednotka: %s Je použita měrná jednotka 'Jednotky)' Musíte ji ručně změnit." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Approximate match: account %s has been matched with account %s" -msgstr "Přibližná shoda: účet %s byl přiřazen účtu %s" +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" +msgstr "" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import @@ -62,78 +67,69 @@ msgid "Common methods to import business documents" msgstr "Společné metody importu obchodních dokumentů" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name -msgid "Display Name" -msgstr "Zobrazovaný název" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"For product '%s', the unit of measure is %s on the existing line, but it is " -"%s on the imported line. We don't support this scenario for the moment, so " -"the lines haven't been updated." +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been updated." msgstr "" -"U produktu '%s' je měrnou jednotkou %s na existujícím řádku, ale na " -"importované řádce je %s. Momentálně nepodporujeme tento scénář, takže 1 " -"řádky nebyly aktualizovány." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s není platný, takže byl ignorován." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id -msgid "ID" -msgstr "ID" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update -msgid "Last Modified on" -msgstr "Poslední změna dne" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "Není uvedena žádná měna, takže Odoo použil měnu společnosti (%s)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information " +"Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -143,6 +139,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -152,6 +149,7 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -161,49 +159,53 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Supplier: %s\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Street: %s\n" -"Street2: %s\n" -"City: %s\n" -"ZIP: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " -"in Price' = '%s' which correspond to the following information extracted " -"from the business document:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Tax amount: %s %s" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -212,73 +214,90 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully " -"that the %s is correct." +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't " -"match the VAT number of the company '%s' (%s) in which you are trying to " -"import this document." +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as country code. But " -"there are no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But the country '%s' doesn't have any related " -"currency configured in Odoo." +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But there is no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency ISO " -"code. But there are no currency with that code in Odoo." +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, fuzzy, python-format +#, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are none or several currencies with the symbol/ISO " -"code in Odoo." +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." msgstr "" -"Analýza obchodního dokladu vrátila hodnotu \"%s\" jako symbol měny nebo kód " -"ISO. Neexistuje však žádná měna se symbolem ani kódem ISO v Odoo." #. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" + +#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -289,28 +308,28 @@ msgstr "" "neexistuje žádný nebo několik měn s tímto symbolem." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the unit of measure " -"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " -"Please check the configuration of the units of measures in Odoo." +"The analysis of the business document returned IBAN %(iban)s as bank " +"account, but there is no such bank account in Odoo linked to partner %(partner)s " +"and the option to automatically create bank accounts upon import is disabled." msgstr "" -"Analýza obchodního dokladu vrátila \"%s\" jako měrnou jednotku UNECE, avšak " -"s tímto kódem UNECE v Odoo neexistuje žádná měrná jednotka. Zkontrolujte " -"prosím konfiguraci jednotek opatření v Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned IBAN %s as bank " -"account, but there is no such bank account in Odoo linked to partner %s and the option to " -"automatically create bank accounts upon import is disabled." +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier " +"%(partner)s" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -320,6 +339,7 @@ msgstr "" "Existující řádek '%s' nemá žádný produkt, takže 1 řádky nebyly aktualizovány." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -330,6 +350,7 @@ msgstr "" "aktualizovány." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -340,6 +361,7 @@ msgstr "" "nebyly aktualizovány." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -348,19 +370,76 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "zákazník" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "partner" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "dodavatele" + +#, python-format +#~ msgid "" +#~ "

    Odoo couldn't find any unit of measure corresponding to the following " +#~ "information extracted from the business document:

    • UNECE code: " +#~ "%s
    • Name of the unit of measure: %s

    So the unit of " +#~ "measure 'Unit(s)' has been used. You may have to change it manually.

    " +#~ msgstr "" +#~ "Společnost Odoo nemohla najít žádnou měrnou jednotku, která by odpovídala " +#~ "těmto informacím získaným z obchodního dokladu: Kód UNECE %s Náměrová " +#~ "jednotka: %s Je použita měrná jednotka 'Jednotky)' Musíte ji ručně změnit." + +#, python-format +#~ msgid "Approximate match: account %s has been matched with account %s" +#~ msgstr "Přibližná shoda: účet %s byl přiřazen účtu %s" + +#~ msgid "Display Name" +#~ msgstr "Zobrazovaný název" + +#, python-format +#~ msgid "" +#~ "For product '%s', the unit of measure is %s on the existing line, but it " +#~ "is %s on the imported line. We don't support this scenario for the " +#~ "moment, so the lines haven't been updated." +#~ msgstr "" +#~ "U produktu '%s' je měrnou jednotkou %s na existujícím řádku, ale na " +#~ "importované řádce je %s. Momentálně nepodporujeme tento scénář, takže 1 " +#~ "řádky nebyly aktualizovány." + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Poslední změna dne" + +#, fuzzy, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the currency " +#~ "symbol or ISO code. But there are none or several currencies with the " +#~ "symbol/ISO code in Odoo." +#~ msgstr "" +#~ "Analýza obchodního dokladu vrátila hodnotu \"%s\" jako symbol měny nebo " +#~ "kód ISO. Neexistuje však žádná měna se symbolem ani kódem ISO v Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "Analýza obchodního dokladu vrátila \"%s\" jako měrnou jednotku UNECE, " +#~ "avšak s tímto kódem UNECE v Odoo neexistuje žádná měrná jednotka. " +#~ "Zkontrolujte prosím konfiguraci jednotek opatření v Odoo." diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 20539d212d..641b8ef9a0 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -20,45 +20,46 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "(fixe)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "Notes dans le fichier %s:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "Notes dans le document importé :" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " -"'Unit(s)' has been used. You may have to change it manually.

    " +"information extracted from the business document:

    • UNECE code: " +"%(code)s
    • Name of the unit of measure: %(name)s

    So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " msgstr "" -"

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " -"suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure " -"'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " -"manuellement.

    " #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Approximate match: account %s has been matched with account %s" +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" msgstr "" -"Correspondance approximative : le compte %s a été mis en correspondance avec " -"le compte %s" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import @@ -66,57 +67,46 @@ msgid "Common methods to import business documents" msgstr "Méthodes courantes d'importation de documents commerciaux" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name -msgid "Display Name" -msgstr "Afficher Nom" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"For product '%s', the unit of measure is %s on the existing line, but it is " -"%s on the imported line. We don't support this scenario for the moment, so " -"the lines haven't been updated." +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been updated." msgstr "" -"Pour le produit ' %s ', l’unité de mesure est %s sur la ligne existante, " -"mais elle est sur %s la ligne importée. Nous ne prenons pas en charge ce " -"scénario pour le moment, donc les lignes n’ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s n’est pas valide, il a donc été ignoré." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id -msgid "ID" -msgstr "ID" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update -msgid "Last Modified on" -msgstr "Dernière modification le" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "Numéro de TVA manquant pour la société \"%s\"" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" @@ -125,21 +115,23 @@ msgstr "" "(%s)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information " +"Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -152,6 +144,7 @@ msgstr "" "Code du compte : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -164,6 +157,7 @@ msgstr "" "Code du compte analytique : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -176,61 +170,53 @@ msgstr "" "Code journal : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Supplier: %s\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" msgstr "" -"Odoo n'a pas pu trouver de produit correspondant aux informations suivantes " -"extraites du document commercial :\n" -"Barcode : %s\n" -"Code produit : %s\n" -"Fournisseur : %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Street: %s\n" -"Street2: %s\n" -"City: %s\n" -"ZIP: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " -"in Price' = '%s' which correspond to the following information extracted " -"from the business document:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Tax amount: %s %s" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" msgstr "" -"Odoo n'a pas trouvé de taxe avec 'Tax Application' = '%s' et 'Tax Included " -"in Price' = '%s' qui correspondent aux informations suivantes extraites du " -"document commercial :\n" -"Code de type de taxe CEE-ONU : %s\n" -"Code de catégorie de taxe CEE-ONU : %s\n" -"Code de la date d'échéance CEE-ONU : %s\n" -"Montant de la taxe : %s %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -241,90 +227,98 @@ msgstr "" "été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully " -"that the %s is correct." +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." msgstr "" -"Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " -"soigneusement que le %s est correct." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't " -"match the VAT number of the company '%s' (%s) in which you are trying to " -"import this document." +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" -"Le numéro de TVA du client indiqué dans le document commercial (%s) ne " -"correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " -"essayez d'importer ce document." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as country code. But " -"there are no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." msgstr "" -"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " -"n'y a pas de pays avec ce code dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But the country '%s' doesn't have any related " -"currency configured in Odoo." +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" -"L'analyse du document commercial a retourné '%s' comme code de pays pour " -"trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " -"configurée dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But there is no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." msgstr "" -"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " -"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " -"dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency ISO " -"code. But there are no currency with that code in Odoo." +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" +"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " +"n'y a pas de pays avec ce code dans Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." msgstr "" "L'analyse du document commercial a renvoyé '%s' comme code de pays pour " "trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " "dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are none or several currencies with the symbol/ISO " -"code in Odoo." +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." msgstr "" -"L'analyse du document commercial a donné '%s' comme symbole monétaire ou " -"code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " +"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " "dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -335,43 +329,28 @@ msgstr "" "il n'y a pas ou plusieurs devises avec ce symbole dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the unit of measure " -"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " -"Please check the configuration of the units of measures in Odoo." -msgstr "" -"L'analyse du document commercial a donné '%s' comme code d'unité de mesure " -"UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans Odoo. " -"Veuillez vérifier la configuration des unités de mesure dans Odoo." - -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned IBAN %s as bank " +"The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %s and the option to " -"automatically create bank accounts upon import is disabled." +"href=# data-oe-model=res.partner data-oe-id=%(partner_id)d>%(partner)s " +"and the option to automatically create bank accounts upon import is disabled." msgstr "" -"L'analyse du document commercial a renvoyé IBAN %s comme compte " -"bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " -"partenaire %s et " -"l'option de création automatique de comptes bancaires à l'importation est " -"désactivée." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier " -"%s" +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier " +"%(partner)s" msgstr "" -"Le compte bancaire IBAN %s a été automatiquement ajouté sur le " -"fournisseur %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -382,6 +361,7 @@ msgstr "" "mises à jour
    ." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -392,6 +372,7 @@ msgstr "" "lignes n'ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -402,6 +383,7 @@ msgstr "" "lignes n'ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -410,19 +392,163 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "client" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "partenaire" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "sournisseur" + +#, python-format +#~ msgid "" +#~ "

    Odoo couldn't find any unit of measure corresponding to the following " +#~ "information extracted from the business document:

    • UNECE code: " +#~ "%s
    • Name of the unit of measure: %s

    So the unit of " +#~ "measure 'Unit(s)' has been used. You may have to change it manually.

    " +#~ msgstr "" +#~ "

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " +#~ "suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure " +#~ "'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " +#~ "manuellement.

    " + +#, python-format +#~ msgid "Approximate match: account %s has been matched with account %s" +#~ msgstr "" +#~ "Correspondance approximative : le compte %s a été mis en correspondance " +#~ "avec le compte %s" + +#~ msgid "Display Name" +#~ msgstr "Afficher Nom" + +#, python-format +#~ msgid "" +#~ "For product '%s', the unit of measure is %s on the existing line, but it " +#~ "is %s on the imported line. We don't support this scenario for the " +#~ "moment, so the lines haven't been updated." +#~ msgstr "" +#~ "Pour le produit ' %s ', l’unité de mesure est %s sur la ligne existante, " +#~ "mais elle est sur %s la ligne importée. Nous ne prenons pas en charge ce " +#~ "scénario pour le moment, donc les lignes n’ont pas été mises à jour." + +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modification le" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any product corresponding to the following information " +#~ "extracted from the business document:\n" +#~ "Barcode: %s\n" +#~ "Product code: %s\n" +#~ "Supplier: %s\n" +#~ msgstr "" +#~ "Odoo n'a pas pu trouver de produit correspondant aux informations " +#~ "suivantes extraites du document commercial :\n" +#~ "Barcode : %s\n" +#~ "Code produit : %s\n" +#~ "Fournisseur : %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax " +#~ "Included in Price' = '%s' which correspond to the following information " +#~ "extracted from the business document:\n" +#~ "UNECE Tax Type code: %s\n" +#~ "UNECE Tax Category code: %s\n" +#~ "UNECE Due Date code: %s\n" +#~ "Tax amount: %s %s" +#~ msgstr "" +#~ "Odoo n'a pas trouvé de taxe avec 'Tax Application' = '%s' et 'Tax " +#~ "Included in Price' = '%s' qui correspondent aux informations suivantes " +#~ "extraites du document commercial :\n" +#~ "Code de type de taxe CEE-ONU : %s\n" +#~ "Code de catégorie de taxe CEE-ONU : %s\n" +#~ "Code de la date d'échéance CEE-ONU : %s\n" +#~ "Montant de la taxe : %s %s" + +#, python-format +#~ msgid "" +#~ "The %s has been identified by the domain name '%s' so please check " +#~ "carefully that the %s is correct." +#~ msgstr "" +#~ "Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " +#~ "soigneusement que le %s est correct." + +#, python-format +#~ msgid "" +#~ "The VAT number of the customer written in the business document (%s) " +#~ "doesn't match the VAT number of the company '%s' (%s) in which you are " +#~ "trying to import this document." +#~ msgstr "" +#~ "Le numéro de TVA du client indiqué dans le document commercial (%s) ne " +#~ "correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle " +#~ "vous essayez d'importer ce document." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the country code " +#~ "to find the related currency. But the country '%s' doesn't have any " +#~ "related currency configured in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a retourné '%s' comme code de pays pour " +#~ "trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " +#~ "configurée dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the currency " +#~ "symbol or ISO code. But there are none or several currencies with the " +#~ "symbol/ISO code in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a donné '%s' comme symbole monétaire ou " +#~ "code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +#~ "dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a donné '%s' comme code d'unité de " +#~ "mesure UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans " +#~ "Odoo. Veuillez vérifier la configuration des unités de mesure dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned IBAN %s as bank " +#~ "account, but there is no such bank account in Odoo linked to partner %s and the option to " +#~ "automatically create bank accounts upon import is disabled." +#~ msgstr "" +#~ "L'analyse du document commercial a renvoyé IBAN %s comme compte " +#~ "bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " +#~ "partenaire %s et " +#~ "l'option de création automatique de comptes bancaires à l'importation est " +#~ "désactivée." + +#, python-format +#~ msgid "" +#~ "The bank account IBAN %s has been automatically added on the " +#~ "supplier %s" +#~ msgstr "" +#~ "Le compte bancaire IBAN %s a été automatiquement ajouté sur le " +#~ "fournisseur %s" diff --git a/base_business_document_import/i18n/fr_FR.po b/base_business_document_import/i18n/fr_FR.po index eb303f902c..1c5b54cfb7 100644 --- a/base_business_document_import/i18n/fr_FR.po +++ b/base_business_document_import/i18n/fr_FR.po @@ -17,45 +17,46 @@ msgstr "" "X-Generator: Weblate 4.3.2\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "(fixed)" msgstr "(fixe)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "Notes dans le fichier %s:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "Notes dans le document importé:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " -"'Unit(s)' has been used. You may have to change it manually.

    " +"information extracted from the business document:

    • UNECE code: " +"%(code)s
    • Name of the unit of measure: %(name)s

    So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " msgstr "" -"

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " -"suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure " -"'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " -"manuellement.

    " #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Approximate match: account %s has been matched with account %s" +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" msgstr "" -"Correspondance approximative : le compte %s a été mis en correspondance avec " -"le compte %s" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import @@ -63,57 +64,46 @@ msgid "Common methods to import business documents" msgstr "Méthodes courantes d'importation de documents commerciaux" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name -msgid "Display Name" -msgstr "Nom affiché" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"For product '%s', the unit of measure is %s on the existing line, but it is " -"%s on the imported line. We don't support this scenario for the moment, so " -"the lines haven't been updated." +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been updated." msgstr "" -"Pour le produit '%s', l'unité de mesure est %s sur la ligne existante, mais " -"elle est %s sur la ligne importée. Nous ne supportons pas ce scénario pour " -"le moment, donc les lignes n'ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "L'IBAN %s n'est pas valide, il a donc été ignoré." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id -msgid "ID" -msgstr "" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update -msgid "Last Modified on" -msgstr "Dernière modification" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "Numéro de TVA manquant pour la société '%s'" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" @@ -121,30 +111,23 @@ msgstr "" "Pas de devise précisée, donc Odoo a utilisé la devise (%s) de la société" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information " +"Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" msgstr "" -"Odoo n'a pas trouvé de %s correspondant aux informations suivantes extraites " -"du document commercial :\n" -"Nom : %s\n" -"Numéro de TVA : %s\n" -"Référence : %s\n" -"E-mail : %s\n" -"Site web : %s\n" -"Code de l'État : %s\n" -"Code du pays : %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -157,6 +140,7 @@ msgstr "" "Code du compte : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -169,6 +153,7 @@ msgstr "" "Code du compte analytique : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -181,74 +166,53 @@ msgstr "" "Code journal : %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Supplier: %s\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" msgstr "" -"Odoo n'a pas pu trouver de produit correspondant aux informations suivantes " -"extraites du document commercial :\n" -"Code barres : %s\n" -"Code produit : %s\n" -"Fournisseur : %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Street: %s\n" -"Street2: %s\n" -"City: %s\n" -"ZIP: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" msgstr "" -"Odoo n'a pas pu trouver de partenaire d'expédition correspondant aux " -"informations suivantes extraites du document commercial :\n" -"Nom : %s\n" -"Numéro de TVA : %s\n" -"Référence : %s\n" -"E-mail : %s\n" -"Site web : %s\n" -"Rue : %s\n" -"Rue2 : %s\n" -"Ville : %s\n" -"Code postal : %s\n" -"Code d'état : %s\n" -"Code du pays : %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " -"in Price' = '%s' which correspond to the following information extracted " -"from the business document:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Tax amount: %s %s" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" msgstr "" -"Odoo n'a pas trouvé de taxe avec 'Application de taxe' = '%s' et 'Taxe " -"Incluse dans le prix' = '%s' qui correspondent aux informations suivantes " -"extraites du document commercial :\n" -"Code de type de taxe CEE-ONU : %s\n" -"Code de catégorie de taxe CEE-ONU : %s\n" -"Code de la date d'échéance CEE-ONU : %s\n" -"Montant de la taxe : %s %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -259,136 +223,129 @@ msgstr "" "été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully " -"that the %s is correct." +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." msgstr "" -"Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " -"soigneusement que le %s est correct." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't " -"match the VAT number of the company '%s' (%s) in which you are trying to " -"import this document." +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" -"Le numéro de TVA du client indiqué dans le document commercial (%s) ne " -"correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle vous " -"essayez d'importer ce document." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as country code. But " -"there are no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." msgstr "" -"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " -"n'y a pas de pays avec ce code dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But the country '%s' doesn't have any related " -"currency configured in Odoo." +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" -"L'analyse du document commercial a retourné '%s' comme code de pays pour " -"trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " -"configurée dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But there is no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." msgstr "" -"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " -"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " -"dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency ISO " -"code. But there are no currency with that code in Odoo." +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." msgstr "" -"L'analyse du document commercial a donné '%s' comme code ISO de la devise. " -"Mais il n'y a pas de devise avec ce code dans Odoo." +"L'analyse du document commercial a retourné '%s' comme code de pays. Mais il " +"n'y a pas de pays avec ce code dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are none or several currencies with the symbol/ISO " -"code in Odoo." +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." msgstr "" -"L'analyse du document commercial a donné '%s' comme symbole monétaire ou " -"code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +"L'analyse du document commercial a renvoyé '%s' comme code de pays pour " +"trouver la devise correspondante. Mais il n'y a pas de pays avec ce code " "dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the currency symbol. " -"But there are none or several currencies with that symbol in Odoo." +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." msgstr "" -"L'analyse du document commercial a donné '%s' comme symbole de devise. Mais " -"il n'y a pas ou plusieurs devises avec ce symbole dans Odoo." +"L'analyse du document commercial a donné '%s' comme code ISO de la devise. " +"Mais il n'y a pas de devise avec ce code dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the unit of measure " -"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " -"Please check the configuration of the units of measures in Odoo." +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." msgstr "" -"L'analyse du document commercial a donné '%s' comme code d'unité de mesure " -"UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans Odoo. " -"Veuillez vérifier la configuration des unités de mesure dans Odoo." +"L'analyse du document commercial a donné '%s' comme symbole de devise. Mais " +"il n'y a pas ou plusieurs devises avec ce symbole dans Odoo." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned IBAN %s as bank " +"The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %s and the option to " -"automatically create bank accounts upon import is disabled." +"href=# data-oe-model=res.partner data-oe-id=%(partner_id)d>%(partner)s " +"and the option to automatically create bank accounts upon import is disabled." msgstr "" -"L'analyse du document commercial a retourné IBAN %s comme compte " -"bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " -"partenaire %s et " -"l'option de création automatique de comptes bancaires lors de l'importation " -"est désactivée." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier " -"%s" +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier " +"%(partner)s" msgstr "" -"Le compte bancaire IBAN %s a été automatiquement ajouté sur le " -"fournisseur %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -399,6 +356,7 @@ msgstr "" "mises à jour
    ." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -409,6 +367,7 @@ msgstr "" "lignes n'ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -419,6 +378,7 @@ msgstr "" "lignes n'ont pas été mises à jour." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -427,19 +387,212 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "client" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "partenaire" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "fournisseur" + +#, python-format +#~ msgid "" +#~ "

    Odoo couldn't find any unit of measure corresponding to the following " +#~ "information extracted from the business document:

    • UNECE code: " +#~ "%s
    • Name of the unit of measure: %s

    So the unit of " +#~ "measure 'Unit(s)' has been used. You may have to change it manually.

    " +#~ msgstr "" +#~ "

    Odoo n'a pas trouvé d'unité de mesure correspondant aux informations " +#~ "suivantes extraites du document métier :

    • Code UNECE : %s
    • Nom de l'unité de mesure : %s

    L'unité de mesure " +#~ "'Unité(s)' a donc été utilisée. Vous devrez peut-être la modifier " +#~ "manuellement.

    " + +#, python-format +#~ msgid "Approximate match: account %s has been matched with account %s" +#~ msgstr "" +#~ "Correspondance approximative : le compte %s a été mis en correspondance " +#~ "avec le compte %s" + +#~ msgid "Display Name" +#~ msgstr "Nom affiché" + +#, python-format +#~ msgid "" +#~ "For product '%s', the unit of measure is %s on the existing line, but it " +#~ "is %s on the imported line. We don't support this scenario for the " +#~ "moment, so the lines haven't been updated." +#~ msgstr "" +#~ "Pour le produit '%s', l'unité de mesure est %s sur la ligne existante, " +#~ "mais elle est %s sur la ligne importée. Nous ne supportons pas ce " +#~ "scénario pour le moment, donc les lignes n'ont pas été mises à jour." + +#~ msgid "Last Modified on" +#~ msgstr "Dernière modification" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any %s corresponding to the following information " +#~ "extracted from the business document:\n" +#~ "Name: %s\n" +#~ "VAT number: %s\n" +#~ "Reference: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "State code: %s\n" +#~ "Country code: %s\n" +#~ msgstr "" +#~ "Odoo n'a pas trouvé de %s correspondant aux informations suivantes " +#~ "extraites du document commercial :\n" +#~ "Nom : %s\n" +#~ "Numéro de TVA : %s\n" +#~ "Référence : %s\n" +#~ "E-mail : %s\n" +#~ "Site web : %s\n" +#~ "Code de l'État : %s\n" +#~ "Code du pays : %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any product corresponding to the following information " +#~ "extracted from the business document:\n" +#~ "Barcode: %s\n" +#~ "Product code: %s\n" +#~ "Supplier: %s\n" +#~ msgstr "" +#~ "Odoo n'a pas pu trouver de produit correspondant aux informations " +#~ "suivantes extraites du document commercial :\n" +#~ "Code barres : %s\n" +#~ "Code produit : %s\n" +#~ "Fournisseur : %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any shipping partner corresponding to the following " +#~ "information extracted from the business document:\n" +#~ "Name: %s\n" +#~ "VAT number: %s\n" +#~ "Reference: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "Street: %s\n" +#~ "Street2: %s\n" +#~ "City: %s\n" +#~ "ZIP: %s\n" +#~ "State code: %s\n" +#~ "Country code: %s\n" +#~ msgstr "" +#~ "Odoo n'a pas pu trouver de partenaire d'expédition correspondant aux " +#~ "informations suivantes extraites du document commercial :\n" +#~ "Nom : %s\n" +#~ "Numéro de TVA : %s\n" +#~ "Référence : %s\n" +#~ "E-mail : %s\n" +#~ "Site web : %s\n" +#~ "Rue : %s\n" +#~ "Rue2 : %s\n" +#~ "Ville : %s\n" +#~ "Code postal : %s\n" +#~ "Code d'état : %s\n" +#~ "Code du pays : %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax " +#~ "Included in Price' = '%s' which correspond to the following information " +#~ "extracted from the business document:\n" +#~ "UNECE Tax Type code: %s\n" +#~ "UNECE Tax Category code: %s\n" +#~ "UNECE Due Date code: %s\n" +#~ "Tax amount: %s %s" +#~ msgstr "" +#~ "Odoo n'a pas trouvé de taxe avec 'Application de taxe' = '%s' et 'Taxe " +#~ "Incluse dans le prix' = '%s' qui correspondent aux informations suivantes " +#~ "extraites du document commercial :\n" +#~ "Code de type de taxe CEE-ONU : %s\n" +#~ "Code de catégorie de taxe CEE-ONU : %s\n" +#~ "Code de la date d'échéance CEE-ONU : %s\n" +#~ "Montant de la taxe : %s %s" + +#, python-format +#~ msgid "" +#~ "The %s has been identified by the domain name '%s' so please check " +#~ "carefully that the %s is correct." +#~ msgstr "" +#~ "Le %s a été identifié par le nom de domaine '%s'. Veuillez vérifier " +#~ "soigneusement que le %s est correct." + +#, python-format +#~ msgid "" +#~ "The VAT number of the customer written in the business document (%s) " +#~ "doesn't match the VAT number of the company '%s' (%s) in which you are " +#~ "trying to import this document." +#~ msgstr "" +#~ "Le numéro de TVA du client indiqué dans le document commercial (%s) ne " +#~ "correspond pas au numéro de TVA de la société '%s' (%s) dans laquelle " +#~ "vous essayez d'importer ce document." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the country code " +#~ "to find the related currency. But the country '%s' doesn't have any " +#~ "related currency configured in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a retourné '%s' comme code de pays pour " +#~ "trouver la devise associée. Mais le pays '%s' n'a pas de devise associée " +#~ "configurée dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the currency " +#~ "symbol or ISO code. But there are none or several currencies with the " +#~ "symbol/ISO code in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a donné '%s' comme symbole monétaire ou " +#~ "code ISO. Mais il n'y a pas ou plusieurs devises avec ce symbole/code ISO " +#~ "dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "L'analyse du document commercial a donné '%s' comme code d'unité de " +#~ "mesure UNECE, mais il n'y a pas d'unité de mesure avec ce code UNECE dans " +#~ "Odoo. Veuillez vérifier la configuration des unités de mesure dans Odoo." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned IBAN %s as bank " +#~ "account, but there is no such bank account in Odoo linked to partner %s and the option to " +#~ "automatically create bank accounts upon import is disabled." +#~ msgstr "" +#~ "L'analyse du document commercial a retourné IBAN %s comme compte " +#~ "bancaire, mais il n'y a pas de tel compte bancaire dans Odoo lié au " +#~ "partenaire %s et " +#~ "l'option de création automatique de comptes bancaires lors de " +#~ "l'importation est désactivée." + +#, python-format +#~ msgid "" +#~ "The bank account IBAN %s has been automatically added on the " +#~ "supplier %s" +#~ msgstr "" +#~ "Le compte bancaire IBAN %s a été automatiquement ajouté sur le " +#~ "fournisseur %s" diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index daee123fb3..3c74a3e0b5 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -17,42 +17,46 @@ msgstr "" "X-Generator: Weblate 4.14.1\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, fuzzy, python-format msgid "(fixed)" msgstr "(fixed)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in file %s:" msgstr "Notities in bestand %s:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Notes in imported document:" msgstr "Notities in geimporteerd document:" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "

    Odoo couldn't find any unit of measure corresponding to the following " -"information extracted from the business document:

    • UNECE code: %s
    • Name of the unit of measure: %s

    So the unit of measure " -"'Unit(s)' has been used. You may have to change it manually.

    " +"information extracted from the business document:

    • UNECE code: " +"%(code)s
    • Name of the unit of measure: %(name)s

    So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " msgstr "" -"

    Er kon geen eenheid gevonden worden welke overeenkomt met de volgende " -"informatie verkregen uit het bedrijfsdocument:

    • UNECE code: %s
    • Eenheidsnaam: %s

    dus de 'Unit(s)' eenheid is gebruikt. " -"Wellicht wilt u dit handmatig wijzigen.

    " #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format -msgid "Approximate match: account %s has been matched with account %s" -msgstr "Geschatte overeenkomst: rekening %s is gematched met rekening %s" +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" +msgstr "" #. module: base_business_document_import #: model:ir.model,name:base_business_document_import.model_business_document_import @@ -60,58 +64,46 @@ msgid "Common methods to import business documents" msgstr "Algemene procedures voor het importeren van bedrijfsdocumenten" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Er kong geen Incoterm gevonden worden overeenkomstig met '%s'" #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__display_name -msgid "Display Name" -msgstr "Weergavenaam" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"For product '%s', the unit of measure is %s on the existing line, but it is " -"%s on the imported line. We don't support this scenario for the moment, so " -"the lines haven't been updated." +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been updated." msgstr "" -"voor product '%s', is de eenheid %s op de bestaande regel, maar is %s op de " -"geimporteerde regel. Dit wordt op dit moment niet ondersteund, de regels " -"zijnnietbijgewerkt." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s is ongeldig, dus genegeerd." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import__id -#, fuzzy -msgid "ID" -msgstr "ID" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "ID {id} van '{model}' bestaat niet." #. module: base_business_document_import -#: model:ir.model.fields,field_description:base_business_document_import.field_business_document_import____last_update -msgid "Last Modified on" -msgstr "Laatst bijgewerkt op" - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "Missing VAT number on company '%s'" msgstr "Ontbrekent BTW nummer voor bedrijf '%s'" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "No currency specified, so Odoo used the company currency (%s)" @@ -119,30 +111,23 @@ msgstr "" "Er is geen valuta gespicificeerd, dus de bedrijfsvaluta wordt gebruikt (%s)" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %s corresponding to the following information " +"Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" msgstr "" -"Er kon geen %s gevonden worden welke overeenkomt met de informatie verkregen " -"uit het document:\n" -"Naam: %s\n" -"BTW nummer: %s\n" -"Referentie: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"State code: %s\n" -"Land code: %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -155,6 +140,7 @@ msgstr "" "Rekening code: %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -167,6 +153,7 @@ msgstr "" "Analytisch account code: %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -179,74 +166,53 @@ msgstr "" "Dagboek code: %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Supplier: %s\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" msgstr "" -"Er kon geen product gevonden worden welke overeenkomt met de verkregen " -"informatie uit het document:\n" -"Barcode: %s\n" -"Product code: %s\n" -"Leverancier: %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" -"Name: %s\n" -"VAT number: %s\n" -"Reference: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Street: %s\n" -"Street2: %s\n" -"City: %s\n" -"ZIP: %s\n" -"State code: %s\n" -"Country code: %s\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" msgstr "" -"Er kon geen geadresseerde relatie gevonden worden welke overeenkomt met de " -"verkregen informatie uit dit bedrijfsdocument:\n" -"Naam: %s\n" -"BTW nummer: %s\n" -"Referentie: %s\n" -"E-mail: %s\n" -"Website: %s\n" -"Straat: %s\n" -"Straat2: %s\n" -"Woonplaats: %s\n" -"Postcode: %s\n" -"State code: %s\n" -"Land code: %s\n" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax Included " -"in Price' = '%s' which correspond to the following information extracted " -"from the business document:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Tax amount: %s %s" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" msgstr "" -"Er kon geen belastingsregel gevonden worden 'Tax Application' = '%s' en " -"'prijs inclusief btw' = '%s' welke overeenkomt met de volgende informatie " -"verkregen uit dit bedrijfsdocument:\n" -"UNECE Tax Type code: %s\n" -"UNECE Tax Category code: %s\n" -"UNECE Due Date code: %s\n" -"Belast bedrag: %s %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -257,56 +223,74 @@ msgstr "" "niet bijgewerkt." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The %s has been identified by the domain name '%s' so please check carefully " -"that the %s is correct." +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." msgstr "" -"Het %s is geidentificeerd op de domeinnaam '%s' controleer zorgvuldig daat " -"de %s juist is." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The VAT number of the customer written in the business document (%s) doesn't " -"match the VAT number of the company '%s' (%s) in which you are trying to " -"import this document." +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" -"Het BTW nummer van de klant in het bedrijfsdocument (%s) komt niet overeen " -"met het BTW nummer van het bedrijf '%s' (%s) waarvoor je een document " -"probeert te importeren." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as country code. But " -"there are no country with that code in Odoo." +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." msgstr "" -"De analyse van het bedrijfsdocument leverde landcode '%s' op. Deze landcode " -"is niet bekend in het systeem." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the country code to " -"find the related currency. But the country '%s' doesn't have any related " -"currency configured in Odoo." +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" -"De analyse van het bedrijfsdocument leverde '%s' op als de landcode om de " -"bijbehorende valuta te vinden. Maar voor het land '%s' zijn geen " -"bijbehorende valuta's geconfigureerd." #. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" +"De analyse van het bedrijfsdocument leverde landcode '%s' op. Deze landcode " +"is niet bekend in het systeem." + +#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -318,6 +302,7 @@ msgstr "" "systeem." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -328,18 +313,7 @@ msgstr "" "Er is geen valuta met deze code bekend in het systeem." #. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%s' as the currency symbol " -"or ISO code. But there are none or several currencies with the symbol/ISO " -"code in Odoo." -msgstr "" -"De analyse van het bedrijfsdocument leverde '%s' op als het valuta symbool " -"of ISO code. Er zijn geen of meerdere valuta met dit symbool/code bekend in " -"het systeem." - -#. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -350,43 +324,28 @@ msgstr "" "zijn geen of meerdre valutas met dat valutateken in het systeem." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The analysis of the business document returned '%s' as the unit of measure " -"UNECE code, but there is no unit of measure with that UNECE code in Odoo. " -"Please check the configuration of the units of measures in Odoo." -msgstr "" -"De analyse van het bedrijfsdocument leverde '%s' als eenheids UNECE code, " -"maar er is geen eenheid met die UNECE code in het systeem. Controleer de " -"eenheidsinstellingen." - -#. module: base_business_document_import -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned IBAN %s as bank " +"The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %s and the option to " -"automatically create bank accounts upon import is disabled." +"href=# data-oe-model=res.partner data-oe-id=%(partner_id)d>%(partner)s " +"and the option to automatically create bank accounts upon import is disabled." msgstr "" -"De analyse van het bedrijfsdocument leverde IBAN %s op als " -"bankrekening, maar het bankrekeningnummer is niet toegewezen aan relatie %s en de mogelijkheid om " -"automatisch bankrekeningen aan te maken tijdens de import van " -"bedrijfsdocumenten is uitgeschakeld." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"The bank account IBAN %s has been automatically added on the supplier " -"%s" +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier " +"%(partner)s" msgstr "" -"Het bankrekeningnummerIBAN %s is automatisch toegevoegd aan de " -"leverancier %s" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -397,6 +356,7 @@ msgstr "" "bijgewerkt
    ." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -407,6 +367,7 @@ msgstr "" "zijn niet bijgewerkt." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -417,6 +378,7 @@ msgstr "" "regels zijn niet bijgewerkt." #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" @@ -425,19 +387,212 @@ msgid "" msgstr "" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "customer" msgstr "klant" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "partner" msgstr "relatie" #. module: base_business_document_import +#. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "supplier" msgstr "leverancier" + +#, python-format +#~ msgid "" +#~ "

    Odoo couldn't find any unit of measure corresponding to the following " +#~ "information extracted from the business document:

    • UNECE code: " +#~ "%s
    • Name of the unit of measure: %s

    So the unit of " +#~ "measure 'Unit(s)' has been used. You may have to change it manually.

    " +#~ msgstr "" +#~ "

    Er kon geen eenheid gevonden worden welke overeenkomt met de volgende " +#~ "informatie verkregen uit het bedrijfsdocument:

    • UNECE code: %s
    • Eenheidsnaam: %s

    dus de 'Unit(s)' eenheid is gebruikt. " +#~ "Wellicht wilt u dit handmatig wijzigen.

    " + +#, python-format +#~ msgid "Approximate match: account %s has been matched with account %s" +#~ msgstr "Geschatte overeenkomst: rekening %s is gematched met rekening %s" + +#~ msgid "Display Name" +#~ msgstr "Weergavenaam" + +#, python-format +#~ msgid "" +#~ "For product '%s', the unit of measure is %s on the existing line, but it " +#~ "is %s on the imported line. We don't support this scenario for the " +#~ "moment, so the lines haven't been updated." +#~ msgstr "" +#~ "voor product '%s', is de eenheid %s op de bestaande regel, maar is %s op " +#~ "de geimporteerde regel. Dit wordt op dit moment niet ondersteund, de " +#~ "regels zijnnietbijgewerkt." + +#, fuzzy +#~ msgid "ID" +#~ msgstr "ID" + +#~ msgid "Last Modified on" +#~ msgstr "Laatst bijgewerkt op" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any %s corresponding to the following information " +#~ "extracted from the business document:\n" +#~ "Name: %s\n" +#~ "VAT number: %s\n" +#~ "Reference: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "State code: %s\n" +#~ "Country code: %s\n" +#~ msgstr "" +#~ "Er kon geen %s gevonden worden welke overeenkomt met de informatie " +#~ "verkregen uit het document:\n" +#~ "Naam: %s\n" +#~ "BTW nummer: %s\n" +#~ "Referentie: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "State code: %s\n" +#~ "Land code: %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any product corresponding to the following information " +#~ "extracted from the business document:\n" +#~ "Barcode: %s\n" +#~ "Product code: %s\n" +#~ "Supplier: %s\n" +#~ msgstr "" +#~ "Er kon geen product gevonden worden welke overeenkomt met de verkregen " +#~ "informatie uit het document:\n" +#~ "Barcode: %s\n" +#~ "Product code: %s\n" +#~ "Leverancier: %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any shipping partner corresponding to the following " +#~ "information extracted from the business document:\n" +#~ "Name: %s\n" +#~ "VAT number: %s\n" +#~ "Reference: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "Street: %s\n" +#~ "Street2: %s\n" +#~ "City: %s\n" +#~ "ZIP: %s\n" +#~ "State code: %s\n" +#~ "Country code: %s\n" +#~ msgstr "" +#~ "Er kon geen geadresseerde relatie gevonden worden welke overeenkomt met " +#~ "de verkregen informatie uit dit bedrijfsdocument:\n" +#~ "Naam: %s\n" +#~ "BTW nummer: %s\n" +#~ "Referentie: %s\n" +#~ "E-mail: %s\n" +#~ "Website: %s\n" +#~ "Straat: %s\n" +#~ "Straat2: %s\n" +#~ "Woonplaats: %s\n" +#~ "Postcode: %s\n" +#~ "State code: %s\n" +#~ "Land code: %s\n" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any tax with 'Tax Application' = '%s' and 'Tax " +#~ "Included in Price' = '%s' which correspond to the following information " +#~ "extracted from the business document:\n" +#~ "UNECE Tax Type code: %s\n" +#~ "UNECE Tax Category code: %s\n" +#~ "UNECE Due Date code: %s\n" +#~ "Tax amount: %s %s" +#~ msgstr "" +#~ "Er kon geen belastingsregel gevonden worden 'Tax Application' = '%s' en " +#~ "'prijs inclusief btw' = '%s' welke overeenkomt met de volgende informatie " +#~ "verkregen uit dit bedrijfsdocument:\n" +#~ "UNECE Tax Type code: %s\n" +#~ "UNECE Tax Category code: %s\n" +#~ "UNECE Due Date code: %s\n" +#~ "Belast bedrag: %s %s" + +#, python-format +#~ msgid "" +#~ "The %s has been identified by the domain name '%s' so please check " +#~ "carefully that the %s is correct." +#~ msgstr "" +#~ "Het %s is geidentificeerd op de domeinnaam '%s' controleer zorgvuldig " +#~ "daat de %s juist is." + +#, python-format +#~ msgid "" +#~ "The VAT number of the customer written in the business document (%s) " +#~ "doesn't match the VAT number of the company '%s' (%s) in which you are " +#~ "trying to import this document." +#~ msgstr "" +#~ "Het BTW nummer van de klant in het bedrijfsdocument (%s) komt niet " +#~ "overeen met het BTW nummer van het bedrijf '%s' (%s) waarvoor je een " +#~ "document probeert te importeren." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the country code " +#~ "to find the related currency. But the country '%s' doesn't have any " +#~ "related currency configured in Odoo." +#~ msgstr "" +#~ "De analyse van het bedrijfsdocument leverde '%s' op als de landcode om de " +#~ "bijbehorende valuta te vinden. Maar voor het land '%s' zijn geen " +#~ "bijbehorende valuta's geconfigureerd." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the currency " +#~ "symbol or ISO code. But there are none or several currencies with the " +#~ "symbol/ISO code in Odoo." +#~ msgstr "" +#~ "De analyse van het bedrijfsdocument leverde '%s' op als het valuta " +#~ "symbool of ISO code. Er zijn geen of meerdere valuta met dit symbool/code " +#~ "bekend in het systeem." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "De analyse van het bedrijfsdocument leverde '%s' als eenheids UNECE code, " +#~ "maar er is geen eenheid met die UNECE code in het systeem. Controleer de " +#~ "eenheidsinstellingen." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned IBAN %s as bank " +#~ "account, but there is no such bank account in Odoo linked to partner %s and the option to " +#~ "automatically create bank accounts upon import is disabled." +#~ msgstr "" +#~ "De analyse van het bedrijfsdocument leverde IBAN %s op als " +#~ "bankrekening, maar het bankrekeningnummer is niet toegewezen aan relatie " +#~ "%s en de " +#~ "mogelijkheid om automatisch bankrekeningen aan te maken tijdens de import " +#~ "van bedrijfsdocumenten is uitgeschakeld." + +#, python-format +#~ msgid "" +#~ "The bank account IBAN %s has been automatically added on the " +#~ "supplier %s" +#~ msgstr "" +#~ "Het bankrekeningnummerIBAN %s is automatisch toegevoegd aan de " +#~ "leverancier %s" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 9ee925dc63..074596f28b 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -7,6 +7,7 @@ from odoo import _, api, models from odoo.exceptions import UserError +from odoo.osv import expression from odoo.tools import float_compare from odoo.addons.base_iban.models.res_partner_bank import validate_iban @@ -42,19 +43,13 @@ def _direct_match(self, data_dict, model, raise_exception=True): ) ) if data_dict.get("id"): - record = False - try: - record = model.browse(data_dict["id"]) - # Browsing an unexisting ID doesn't make Odoo crash - # So I read create_date to make it crash - record.create_date # pylint: disable=pointless-statement - except Exception as e: - if raise_exception: - raise UserError( - _("ID {id} of '{model}' doesn't exist in Odoo.").format( - id=data_dict["id"], model=model._name - ) - ) from e + record = model.browse(data_dict["id"]).exists() + if not record and raise_exception: + raise UserError( + _("ID {id} of '{model}' doesn't exist in Odoo.").format( + id=data_dict["id"], model=model._name + ) + ) if record: return record if data_dict.get("xmlid"): @@ -141,14 +136,13 @@ def _get_country_state_filter(self, partner_dict, chatter_msg): country = self.env["res.country"].search( [("code", "=", partner_dict["country_code"])], limit=1 ) - state = self.env["res.country.state"].search( + if state := self.env["res.country.state"].search( [ ("code", "=", partner_dict["state_code"]), ("country_id", "=", country.id), ], limit=1, - ) - if state: + ): return ["|", ("state_id", "=", False), ("state_id", "=", state.id)] return False @@ -156,53 +150,72 @@ def _get_country_state_filter(self, partner_dict, chatter_msg): def _match_partner_ref(self, partner_dict, chatter_msg, domain, order): """If a ref is explicitly given, we just want to match that partner""" if partner_dict.get("ref"): - return self.env["res.partner"].search( - domain + [("ref", "=", partner_dict["ref"])], limit=1, order=order + domain = expression.AND( + [ + domain, + [("ref", "=", partner_dict["ref"])], + ] ) + return self.env["res.partner"].search(domain, limit=1, order=order) return False @api.model def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): rpo = self.env["res.partner"] if partner_dict.get("email") and "@" in partner_dict["email"]: - partner = rpo.search( - domain + [("email", "=ilike", partner_dict["email"])], + if partner := rpo.search( + expression.AND( + [ + domain, + [("email", "=ilike", partner_dict["email"])], + ] + ), limit=1, order=order, - ) - if partner: + ): return partner if partner_dict.get("contact"): - partner = rpo.search( - domain + [("name", "=ilike", partner_dict["contact"])], + if partner := rpo.search( + expression.AND( + [ + domain, + [("name", "=ilike", partner_dict["contact"])], + ] + ), limit=1, order=order, - ) - if partner: + ): return partner if partner_dict.get("phone"): - partner = rpo.search( - domain - + [ - "|", - ("mobile", "=", partner_dict["phone"]), - ("phone", "=", partner_dict["phone"]), - ], + if partner := rpo.search( + expression.AND( + [ + domain, + [ + "|", + ("mobile", "=", partner_dict["phone"]), + ("phone", "=", partner_dict["phone"]), + ], + ] + ), limit=1, order=order, - ) - if partner: + ): return partner return False @api.model def _match_partner_name(self, partner_dict, chatter_msg, domain, order): if partner_dict.get("name"): - return self.env["res.partner"].search( - domain + [("name", "=ilike", partner_dict["name"])], - limit=1, - order=order, + domain = expression.AND( + [ + domain, + [ + ("name", "=ilike", partner_dict["name"]), + ], + ] ) + return self.env["res.partner"].search(domain, limit=1, order=order) return False @api.model @@ -219,13 +232,16 @@ def _get_partner_website_domain(self, partner_dict): @api.model def _match_partner_website(self, partner_dict, chatter_msg, domain, order): - website_domain = self._get_partner_website_domain(partner_dict) - if website_domain: - return self.env["res.partner"].search( - domain + [("website", "=ilike", "%" + website_domain + "%")], - limit=1, - order=order, + if website_domain := self._get_partner_website_domain(partner_dict): + domain = expression.AND( + [ + domain, + [ + ("website", "=ilike", "%" + website_domain + "%"), + ], + ] ) + return self.env["res.partner"].search(domain, limit=1, order=order) return False @api.model @@ -244,13 +260,17 @@ def _match_partner_email(self, partner_dict, chatter_msg, domain, order): # @gmail.com, @yahoo.com that may match random partners if email_domain: partner = self.env["res.partner"].search( - domain + [("website", "=ilike", "%" + email_domain + "%")], + expression.AND( + [domain, [("website", "=ilike", "%" + email_domain + "%")]] + ), limit=1, order=order, ) if not partner: partner = self.env["res.partner"].search( - domain + [("email", "=ilike", "%@" + email_domain)], + expression.AND( + [domain, [("email", "=ilike", "%@" + email_domain)]] + ), limit=1, order=order, ) @@ -296,7 +316,16 @@ def _match_partner( # noqa: C901 return partner company_id = self._context.get("force_company") or self.env.company.id domain = domain or [] - domain += ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + domain = expression.AND( + [ + domain, + [ + "|", + ("company_id", "=", False), + ("company_id", "=", company_id), + ], + ] + ) order = self._get_match_partner_order(partner_type) partner_type_label = self._get_match_partner_type_label(partner_type) partner_dict["type"] = partner_type @@ -306,19 +335,22 @@ def _match_partner( # noqa: C901 if partner: return partner - country_domain = self._get_country_filter(partner_dict, chatter_msg) - - if country_domain: - domain += country_domain + if country_domain := self._get_country_filter(partner_dict, chatter_msg): + domain = expression.AND([domain, country_domain]) - state_domain = self._get_country_state_filter(partner_dict, chatter_msg) - if state_domain: - domain += state_domain + if state_domain := self._get_country_state_filter( + partner_dict, chatter_msg + ): + domain = expression.AND([domain, state_domain]) # Search on VAT if partner_dict.get("vat"): vat = partner_dict["vat"].replace(" ", "").upper() - partner = rpo.search(domain + [("vat", "=", vat)], limit=1, order=order) + partner = rpo.search( + expression.AND([domain, [("vat", "=", vat)]]), + limit=1, + order=order, + ) if partner: return partner @@ -397,40 +429,74 @@ def _match_shipping_partner( domain = domain or [] if partner_dict.get("street"): if partner_dict.get("street_number"): - domain += [ - ( - "street", - "in", + domain = expression.AND( + [ + domain, [ - "{} {}".format( - partner_dict.get("street"), - partner_dict.get("street_number"), - ), - "{} {}".format( - partner_dict.get("street_number"), - partner_dict.get("street"), - ), - "{}, {}".format( - partner_dict.get("street"), - partner_dict.get("street_number"), - ), - "{}, {}".format( - partner_dict.get("street_number"), - partner_dict.get("street"), - ), + ( + "street", + "in", + [ + "{} {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{} {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + "{}, {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{}, {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + ], + ) ], - ) - ] + ] + ) else: - domain += [("street", "=", partner_dict.get("street"))] + domain = expression.AND( + [ + domain, + [ + ("street", "=", partner_dict.get("street")), + ], + ] + ) + if partner_dict.get("street2"): - domain += [("street2", "=", partner_dict.get("street2"))] + domain = expression.AND( + [ + domain, + [ + ("street2", "=", partner_dict.get("street2")), + ], + ] + ) if partner_dict.get("city"): - domain += [("city", "=", partner_dict.get("city"))] + domain = expression.AND( + [ + domain, + [ + ("city", "=", partner_dict.get("city")), + ], + ] + ) if partner_dict.get("zip"): - domain += [("zip", "=", partner_dict.get("zip"))] + domain = expression.AND( + [ + domain, + [ + ("zip", "=", partner_dict.get("zip")), + ], + ] + ) - domain_delivery = domain + [("type", "=", "delivery")] + domain_delivery = expression.AND([domain, [("type", "=", "delivery")]]) partner = self._match_partner( partner_dict, chatter_msg, @@ -628,19 +694,29 @@ def _match_product_search(self, product_dict): product = self.env["product.product"].browse() cdomain = self._match_company_domain() if product_dict.get("barcode"): - domain = cdomain + [ - "|", - ("barcode", "=", product_dict["barcode"]), - ("packaging_ids.barcode", "=", product_dict["barcode"]), - ] + domain = expression.AND( + [ + cdomain, + [ + "|", + ("barcode", "=", product_dict["barcode"]), + ("packaging_ids.barcode", "=", product_dict["barcode"]), + ], + ] + ) product = product.search(domain, limit=1) if not product and product_dict.get("code"): # TODO: this domain could be probably included in the former one - domain = cdomain + [ - "|", - ("barcode", "=", product_dict["code"]), - ("default_code", "=", product_dict["code"]), - ] + domain = expression.AND( + [ + cdomain, + [ + "|", + ("barcode", "=", product_dict["code"]), + ("default_code", "=", product_dict["code"]), + ], + ] + ) product = product.search(domain, limit=1) return product @@ -685,7 +761,7 @@ def _match_currency(self, currency_dict, chatter_msg): if currency_dict.get("symbol"): currencies = rco.search([("symbol", "=", currency_dict["symbol"])]) if len(currencies) == 1: - return currencies[0] + return currencies else: chatter_msg.append( _( @@ -859,7 +935,9 @@ def _prepare_match_tax_domain( tax_dict["unece_due_date_code"] ) if tax_exigibility: - domain += [("tax_exigibility", "=", tax_exigibility)] + domain = expression.AND( + [domain, [("tax_exigibility", "=", tax_exigibility)]] + ) return domain @api.model diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 700fb907cf..b869007942 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -367,7 +367,7 @@

    Base Business Document Import

    !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

    Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

    +

    Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runbot

    This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

    • account_invoice_import which imports supplier invoices as PDF or XML files (this module also requires some additional modules such as account_invoice_import_invoice2data, account_invoice_import_ubl, etc… to support specific invoice formats),
    • @@ -390,7 +390,7 @@

      Bug Tracker

      Bugs are tracked on GitHub 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.

      +feedback.

      Do not contact contributors directly about support or help with technical issues.

    @@ -421,7 +421,7 @@

    Maintainers

    promote its widespread use.

    Current maintainer:

    alexis-via

    -

    This module is part of the OCA/edi project on GitHub.

    +

    This module is part of the OCA/edi project on GitHub.

    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

    From fd7293728431b2e8fb7f75459e44574d74f501d9 Mon Sep 17 00:00:00 2001 From: Ivorra78 Date: Mon, 7 Aug 2023 08:22:50 +0000 Subject: [PATCH 83/99] Added translation using Weblate (Spanish) --- base_business_document_import/i18n/es.po | 473 +++++++++++++++++++++++ 1 file changed, 473 insertions(+) create mode 100644 base_business_document_import/i18n/es.po diff --git a/base_business_document_import/i18n/es.po b/base_business_document_import/i18n/es.po new file mode 100644 index 0000000000..306086aeb8 --- /dev/null +++ b/base_business_document_import/i18n/es.po @@ -0,0 +1,473 @@ +# Translation of Odoo Server. +# This file contains the translation of the following modules: +# * base_business_document_import +# +msgid "" +msgstr "" +"Project-Id-Version: Odoo Server 16.0\n" +"Report-Msgid-Bugs-To: \n" +"PO-Revision-Date: 2023-08-07 11:09+0000\n" +"Last-Translator: Ivorra78 \n" +"Language-Team: none\n" +"Language: es\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: \n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 4.17\n" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "(fixed)" +msgstr "(fijado)" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in file %s:" +msgstr "Notas en el archivo %s:" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Notes in imported document:" +msgstr "Notas en el documento importado:" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"

    Odoo couldn't find any unit of measure corresponding to the following " +"information extracted from the business document:

    • UNECE code: " +"%(code)s
    • Name of the unit of measure: %(name)s

    So the " +"unit of measure 'Unit(s)' has been used. You may have to change it " +"manually.

    " +msgstr "" +"

    Odoo no pudo encontrar ninguna unidad de medida correspondiente a la " +"siguiente información extraída del documento comercial:

    • Código " +"UNECE: %(code)s
    • Nombre de la unidad de medida: %(name)s
    • Entonces se ha utilizado la unidad de medida 'Unidad(es)'. Puede " +"que tenga que cambiarlo manualmente.

      " + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Approximate match: account %(account)s has been matched with account " +"%(matched_account)s" +msgstr "" +"Coincidencia aproximada: la cuenta %(account)s ha coincidido con la cuenta " +"%(matched_account)s" + +#. module: base_business_document_import +#: model:ir.model,name:base_business_document_import.model_business_document_import +msgid "Common methods to import business documents" +msgstr "Métodos habituales para importar documentos comerciales" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Could not find any Incoterm in Odoo corresponding to '%s'" +msgstr "No se pudo encontrar ningún Incotérmino en Odoo que corresponda a '%s'" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"For product '%(product)s', the unit of measure is %(uom_product)s on the " +"existing line, but it is %(uom_imported)s on the imported line.We don't " +"support this scenario for the moment, so the lines haven't been " +"updated." +msgstr "" +"Para el producto '%(product)s', la unidad de medida es %(uom_product)s en la " +"línea existente, pero es %(uom_imported)s en la línea importada. No " +"admitimos este escenario por el momento, por lo que las líneas no se han " +"actualizado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "IBAN %s is not valid, so it has been ignored." +msgstr "El IBAN %s no es válido, por lo que se ha ignorado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "ID {id} of '{model}' doesn't exist in Odoo." +msgstr "La ID {id} de '{model}' no existe en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "Missing VAT number on company '%s'" +msgstr "Falta el número de IVA de la compañía \"%s\"" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "No currency specified, so Odoo used the company currency (%s)" +msgstr "" +"No se especificó la moneda, por lo que Odoo utilizó la moneda de la compañía " +"(%s)" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any %(label)s corresponding to the following information extracted from the business document:\n" +"Name: %(name)s \n" +"VAT number: %(vat)s \n" +"Reference: %(ref)s \n" +"E-mail: %(email)s \n" +"Website: %(website)s \n" +"State code: %(state)s \n" +"Country code: %(country)s \n" +msgstr "" +"Odoo no pudo encontrar ningún %(label)s correspondiente a la siguiente " +"información extraída del documento comercial:\n" +"Nombre: %(name)s\n" +"Número de IVA: %(vat)s\n" +"Referencia: %(ref)s\n" +"Correo electrónico: %(email)s\n" +"Sitio web: %(website)s\n" +"Código de estado: %(state)s\n" +"Código de país: %(country)s \n" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Account code: %s" +msgstr "" +"Odoo no pudo encontrar ninguna cuenta correspondiente a la siguiente " +"información extraída del documento comercial:\n" +"Código de cuenta: %s" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Analytic account code: %s" +msgstr "" +"Odoo no pudo encontrar ninguna cuenta analítica correspondiente a la " +"siguiente información extraída del documento comercial:\n" +"Código de cuenta analítica: %s" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Journal code: %s" +msgstr "" +"Odoo no pudo encontrar ningún diario correspondiente a la siguiente " +"información extraída del documento comercial:\n" +"Código de diario: %s" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Barcode: %(barcode)s\n" +"Product code: %(product_code)s\n" +"Supplier: %(supplier)s\n" +msgstr "" +"Odoo no pudo encontrar ningún producto correspondiente a la siguiente " +"información extraída del documento comercial:\n" +"Código de barras: %(barcode)s\n" +"Código de producto: %(product_code)s\n" +"Proveedor: %(supplier)s\n" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Name: %(name)s\n" +"VAT number: %(vat)s\n" +"Reference: %(ref)s\n" +"E-mail: %(email)s\n" +"Website: %(website)s\n" +"Street: %(street)s\n" +"Street2: %(street2)s\n" +"City: %(city)s\n" +"ZIP: %(zip)s\n" +"State code: %(state)s\n" +"Country code: %(country)s\n" +msgstr "" +"Odoo no pudo encontrar ningún socio de envío correspondiente a la siguiente " +"información extraída del documento comercial:\n" +"Nombre: %(name)s\n" +"Número de IVA: %(vat)s\n" +"Referencia: %(ref)s\n" +"Correo electrónico: %(email)s\n" +"Sitio web: %(website)s\n" +"Calle: %(street)s\n" +"Calle2: %(street2)s\n" +"Ciudad: %(city)s\n" +"Código postal: %(zip)s\n" +"Código de estado: %(state)s\n" +"Código de país: %(country)s\n" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax Included in Price' = '%(price)s' which correspond to the following information extracted from the business document:\n" +"UNECE Tax Type code: %(tax_type)s\n" +"UNECE Tax Category code: %(tax_cat)s\n" +"UNECE Due Date code: %s(tax_due_date)\n" +"Tax amount: %(amount)s %(amount_type)s" +msgstr "" +"Odoo no pudo encontrar ningún impuesto con 'Aplicación de impuestos' = " +"'%(tax)s' e 'Impuestos incluidos en el precio' = '%(price)s' que " +"corresponden a la siguiente información extraída del documento comercial:\n" +"Código de tipo de impuesto de la UNECE (CEPE): %(tax_type)s\n" +"Código de categoría fiscal de la UNECE (CEPE): %(tax_cat)s\n" +"Código de fecha de vencimiento de la UNECE (CEPE): %s(tax_due_date)\n" +"Monto del impuesto: %(amount)s %(amount_type)s" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"One of the imported lines doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"Una de las líneas importadas no tiene ningún producto, por lo que las " +"líneas no se han actualizado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The %(label)s has been identified by the domain name '%(domain)s' so please " +"check carefully that the %(label)s is correct." +msgstr "" +"El %(label)s ha sido identificado por el nombre de dominio '%(domain)s' así " +"que por favor compruebe cuidadosamente que el %(label)s es correcto." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The VAT number of the customer written in the business document " +"(%(parsed_vat)s) doesn't match the VAT number of the company '%(company)s' " +"(%(vat)s) in which you are trying to import this document." +msgstr "" +"El número de IVA del cliente escrito en el documento comercial " +"(%(parsed_vat)s) no coincide con el número de IVA de la empresa '%(company)" +"s' (%(vat)s) en la que intenta importar esto documento." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "The XMLID '%s' doesn't exist in Odoo." +msgstr "El XMLID '%s' no existe en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%(code)s' as the country " +"code to find the related currency. But the country '%(name)s' doesn't have " +"any related currency configured in Odoo." +msgstr "" +"El análisis del documento comercial arrojó '%(code)s' como el código de país " +"para encontrar la moneda relacionada. Pero el país '%(name)s' no tiene " +"ninguna moneda relacionada configurada en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%(code)s' as the currency " +"symbol or ISO code. But there are none or several currencies with the " +"symbol/ISO code in Odoo." +msgstr "" +"El análisis del documento comercial arrojó '%(code)s' como símbolo de moneda " +"o código ISO. Pero no hay ninguna o varias monedas con el símbolo/código ISO " +"en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%(code)s' as the unit of " +"measure UNECE code, but there is no unit of measure with that UNECE code in " +"Odoo. Please check the configuration of the units of measures in Odoo." +msgstr "" +"El análisis del documento comercial arrojó '%(code)s' como la unidad de " +"medida del código UNECE, pero no hay ninguna unidad de medida con ese código " +"UNECE en Odoo. Por favor revise la configuración de las unidades de medidas " +"en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as country code. But " +"there are no country with that code in Odoo." +msgstr "" +"El análisis del documento de negocio devolvió '%s' como código de país. Pero " +"no hay ningún país con ese código en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the country code to " +"find the related currency. But there is no country with that code in Odoo." +msgstr "" +"El análisis del documento comercial arrojó '%s' como código de país para " +"encontrar la moneda relacionada. Pero no hay ningún país con ese código en " +"Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency ISO " +"code. But there are no currency with that code in Odoo." +msgstr "" +"El análisis del documento comercial devolvió '%s' como el código ISO de " +"divisa. Pero no hay divisa con ese código en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned '%s' as the currency symbol. " +"But there are none or several currencies with that symbol in Odoo." +msgstr "" +"El análisis del documento comercial arrojó '%s' como símbolo de divisa. Pero " +"no hay ninguna o varias divisas con ese símbolo en Odoo." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The analysis of the business document returned IBAN %(iban)s as bank " +"account, but there is no such bank account in Odoo linked to partner %(partner)s " +"and the option to automatically create bank accounts upon import is " +"disabled." +msgstr "" +"El análisis del documento comercial deolvió IBAN %(iban)s como cuenta " +"bancaria, pero no existe tal cuenta bancaria en Odoo vinculada al socio %(partner)s y " +"la opción de crear automáticamente cuentas bancarias al importar está " +"deshabilitada." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The bank account IBAN %(iban)s has been automatically added on the " +"supplier %(partner)s" +msgstr "" +"La cuenta bancaria IBAN %(iban)s se ha añadido automáticamente al " +"proveedor %(partner)s" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The existing line '%s' doesn't have any product, so the lines haven't " +"been updated." +msgstr "" +"La línea existente '%s' no tiene ningún producto, por lo que las líneas " +"no se han actualizado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several existing lines, so the lines haven't " +"been updated." +msgstr "" +"El producto '%s' se utiliza en varias líneas existentes, por lo que las " +"líneas no se han actualizado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The product '%s' is used on several imported lines, so the lines haven't " +"been updated." +msgstr "" +"El producto '%s' se utiliza en varias líneas importadas, por lo que las " +"líneas no se han actualizado." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "" +"The record '{record}' is an instance of '{record_model}', not of " +"'{target_model}'." +msgstr "" +"El registro '{record}' es una instancia de '{record_model}', no de " +"'{target_model}'." + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "customer" +msgstr "Cliente" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "partner" +msgstr "socio" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +#, python-format +msgid "supplier" +msgstr "proveedor" From 8c25ed949eb51c965b41a7c9835359eb5cf20836 Mon Sep 17 00:00:00 2001 From: Gediminas Venclova Date: Tue, 29 Aug 2023 10:14:20 +0300 Subject: [PATCH 84/99] [FIX] base_business_document_import: fixed typo in _match_tax method --- base_business_document_import/README.rst | 15 ++-- base_business_document_import/__manifest__.py | 2 +- .../i18n/base_business_document_import.pot | 2 +- base_business_document_import/i18n/cs_CZ.po | 2 +- base_business_document_import/i18n/es.po | 78 ++++++++++++------- base_business_document_import/i18n/fr.po | 2 +- base_business_document_import/i18n/fr_FR.po | 2 +- base_business_document_import/i18n/nl.po | 2 +- .../models/business_document_import.py | 2 +- .../static/description/index.html | 36 +++++---- 10 files changed, 83 insertions(+), 60 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index c76d117f95..a0dbd9e366 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -2,10 +2,13 @@ Base Business Document Import ============================= -.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +.. + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + !! source digest: sha256:e0687319afa4e196bd4d8087afd6a7f63b64265200a8e5837fb7658d8ef8dd95 + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png :target: https://odoo-community.org/page/development-status @@ -19,11 +22,11 @@ Base Business Document Import .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png :target: https://translation.odoo-community.org/projects/edi-16-0/edi-16-0-base_business_document_import :alt: Translate me on Weblate -.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/226/16.0 - :alt: Try me on Runbot +.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png + :target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=16.0 + :alt: Try me on Runboat -|badge1| |badge2| |badge3| |badge4| |badge5| +|badge1| |badge2| |badge3| |badge4| |badge5| This is a technical module ; it doesn't bring any useful feature by itself. This module is the base modules for 2 other modules : @@ -41,7 +44,7 @@ Bug Tracker Bugs are tracked on `GitHub 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 +If you spotted it first, help us to smash it by providing a detailed and welcomed `feedback `_. Do not contact contributors directly about support or help with technical issues. diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 3ec495a9f4..e0bab6d2ec 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "16.0.1.0.0", + "version": "16.0.1.0.1", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index 27a5fd2ad9..7faebfefee 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -186,7 +186,7 @@ msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax Included in Price' = '%(price)s' which correspond to the following information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index c9f936c924..a7795f89cf 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -200,7 +200,7 @@ msgid "" "information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" diff --git a/base_business_document_import/i18n/es.po b/base_business_document_import/i18n/es.po index 306086aeb8..7cfc8961fd 100644 --- a/base_business_document_import/i18n/es.po +++ b/base_business_document_import/i18n/es.po @@ -84,8 +84,8 @@ msgstr "No se pudo encontrar ningún Incotérmino en Odoo que corresponda a '%s' msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " -"support this scenario for the moment, so the lines haven't been " -"updated." +"support this scenario for the moment, so the lines haven't been updated." msgstr "" "Para el producto '%(product)s', la unidad de medida es %(uom_product)s en la " "línea existente, pero es %(uom_imported)s en la línea importada. No " @@ -127,7 +127,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any %(label)s corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any %(label)s corresponding to the following information " +"extracted from the business document:\n" "Name: %(name)s \n" "VAT number: %(vat)s \n" "Reference: %(ref)s \n" @@ -151,7 +152,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document:\n" "Account code: %s" msgstr "" "Odoo no pudo encontrar ninguna cuenta correspondiente a la siguiente " @@ -163,7 +165,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document:\n" "Analytic account code: %s" msgstr "" "Odoo no pudo encontrar ninguna cuenta analítica correspondiente a la " @@ -175,7 +178,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document:\n" "Journal code: %s" msgstr "" "Odoo no pudo encontrar ningún diario correspondiente a la siguiente " @@ -187,7 +191,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document:\n" "Barcode: %(barcode)s\n" "Product code: %(product_code)s\n" "Supplier: %(supplier)s\n" @@ -203,7 +208,8 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" "Name: %(name)s\n" "VAT number: %(vat)s\n" "Reference: %(ref)s\n" @@ -235,19 +241,14 @@ msgstr "" #: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax Included in Price' = '%(price)s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" -"Odoo no pudo encontrar ningún impuesto con 'Aplicación de impuestos' = " -"'%(tax)s' e 'Impuestos incluidos en el precio' = '%(price)s' que " -"corresponden a la siguiente información extraída del documento comercial:\n" -"Código de tipo de impuesto de la UNECE (CEPE): %(tax_type)s\n" -"Código de categoría fiscal de la UNECE (CEPE): %(tax_cat)s\n" -"Código de fecha de vencimiento de la UNECE (CEPE): %s(tax_due_date)\n" -"Monto del impuesto: %(amount)s %(amount_type)s" #. module: base_business_document_import #. odoo-python @@ -277,12 +278,12 @@ msgstr "" #, python-format msgid "" "The VAT number of the customer written in the business document " -"(%(parsed_vat)s) doesn't match the VAT number of the company '%(company)s' " -"(%(vat)s) in which you are trying to import this document." +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" "El número de IVA del cliente escrito en el documento comercial " -"(%(parsed_vat)s) no coincide con el número de IVA de la empresa '%(company)" -"s' (%(vat)s) en la que intenta importar esto documento." +"(%(parsed_vat)s) no coincide con el número de IVA de la empresa " +"'%(company)s' (%(vat)s) en la que intenta importar esto documento." #. module: base_business_document_import #. odoo-python @@ -310,8 +311,8 @@ msgstr "" #, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " -"symbol or ISO code. But there are none or several currencies with the " -"symbol/ISO code in Odoo." +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" "El análisis del documento comercial arrojó '%(code)s' como símbolo de moneda " "o código ISO. Pero no hay ninguna o varias monedas con el símbolo/código ISO " @@ -384,8 +385,7 @@ msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %(partner)s " -"and the option to automatically create bank accounts upon import is " -"disabled." +"and the option to automatically create bank accounts upon import is disabled." msgstr "" "El análisis del documento comercial deolvió IBAN %(iban)s como cuenta " "bancaria, pero no existe tal cuenta bancaria en Odoo vinculada al socio IBAN %(iban)s has been automatically added on the " -"supplier %(partner)s" +"supplier " +"%(partner)s" msgstr "" "La cuenta bancaria IBAN %(iban)s se ha añadido automáticamente al " -"proveedor %(partner)s" +"proveedor " +"%(partner)s" #. module: base_business_document_import #. odoo-python @@ -442,7 +442,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#: code:addons/base_business_document_import/models/business_document_import.py:0 #, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " @@ -471,3 +470,22 @@ msgstr "socio" #, python-format msgid "supplier" msgstr "proveedor" + +#, python-format +#~ msgid "" +#~ "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +#~ "Included in Price' = '%(price)s' which correspond to the following " +#~ "information extracted from the business document:\n" +#~ "UNECE Tax Type code: %(tax_type)s\n" +#~ "UNECE Tax Category code: %(tax_cat)s\n" +#~ "UNECE Due Date code: %s(tax_due_date)\n" +#~ "Tax amount: %(amount)s %(amount_type)s" +#~ msgstr "" +#~ "Odoo no pudo encontrar ningún impuesto con 'Aplicación de impuestos' = " +#~ "'%(tax)s' e 'Impuestos incluidos en el precio' = '%(price)s' que " +#~ "corresponden a la siguiente información extraída del documento " +#~ "comercial:\n" +#~ "Código de tipo de impuesto de la UNECE (CEPE): %(tax_type)s\n" +#~ "Código de categoría fiscal de la UNECE (CEPE): %(tax_cat)s\n" +#~ "Código de fecha de vencimiento de la UNECE (CEPE): %s(tax_due_date)\n" +#~ "Monto del impuesto: %(amount)s %(amount_type)s" diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index 641b8ef9a0..b0e5f8deba 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -211,7 +211,7 @@ msgid "" "information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" diff --git a/base_business_document_import/i18n/fr_FR.po b/base_business_document_import/i18n/fr_FR.po index 1c5b54cfb7..9f10c2c1c6 100644 --- a/base_business_document_import/i18n/fr_FR.po +++ b/base_business_document_import/i18n/fr_FR.po @@ -207,7 +207,7 @@ msgid "" "information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index 3c74a3e0b5..15d0d8aa2f 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -207,7 +207,7 @@ msgid "" "information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" -"UNECE Due Date code: %s(tax_due_date)\n" +"UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s" msgstr "" diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 074596f28b..75932a0d48 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -979,7 +979,7 @@ def _match_tax( "following information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" - "UNECE Due Date code: %s(tax_due_date)\n" + "UNECE Due Date code: %(tax_due_date)s\n" "Tax amount: %(amount)s %(amount_type)s", tax=type_tax_use, price=price_include, diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index b869007942..8cf028bdc3 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -1,20 +1,20 @@ - + - + Base Business Document Import -
      -

      Base Business Document Import

      +
      + + +Odoo Community Association + +
      +

      Base Business Document Import

      -

      Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

      +

      Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

      This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

        -
      • account_invoice_import which imports supplier invoices as PDF or -XML files (this module also requires some additional modules such as +
      • account_invoice_import which imports supplier invoices as PDF or XML +files (this module also requires some additional modules such as account_invoice_import_invoice2data, account_invoice_import_ubl, etc… to support specific invoice formats),
      • sale_invoice_import which imports sale orders as CSV, XML or PDF @@ -394,24 +400,24 @@

        Base Business Document Import

      -

      Bug Tracker

      +

      Bug Tracker

      Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

      +feedback.

      Do not contact contributors directly about support or help with technical issues.

      -

      Credits

      +

      Credits

      -

      Authors

      +

      Authors

      • Akretion
      • Nicolas JEUDY
      -

      Contributors

      +

      Contributors

      -

      Maintainers

      +

      Maintainers

      This module is maintained by the OCA.

      -Odoo Community Association + +Odoo Community Association +

      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.

      Current maintainer:

      alexis-via

      -

      This module is part of the OCA/edi project on GitHub.

      +

      This module is part of the OCA/edi project on GitHub.

      You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

      +
      From ec1f9916c9ea23fe7c0df2990750119e8fa7cdab Mon Sep 17 00:00:00 2001 From: Simone Orsi Date: Thu, 24 Jul 2025 08:41:28 +0200 Subject: [PATCH 95/99] base_business_document_import: fix supplier product match When wrapping the error was still using the seller.name relation which does not exists anymore. --- base_business_document_import/README.rst | 2 +- base_business_document_import/__manifest__.py | 2 +- .../models/business_document_import.py | 3 ++- base_business_document_import/static/description/index.html | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 73407ee663..be769f44c1 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -11,7 +11,7 @@ Base Business Document Import !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:add7228da0785a97773337f3ae9214045b74e71d2f0efed8dfd63ea063cdfde8 + !! source digest: sha256:0165e85f7621164f57f7b61ae8714aa379047cecfd2ff6572ed3356949ac53c2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 70e2d81c13..111bc4a59e 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "18.0.1.0.0", + "version": "18.0.1.0.1", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 904376989b..f953423538 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -670,6 +670,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): ) if sinfo and len(sinfo.product_tmpl_id.product_variant_ids) == 1: return sinfo.product_tmpl_id.product_variant_id + # TODO: add test raise self.user_error_wrap( "_match_product", product_dict, @@ -681,7 +682,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): "Supplier: %(supplier)s\n", barcode=product_dict.get("barcode") or "", product_code=product_dict.get("code") or "", - supplier=seller and seller.name or "", + supplier=seller and seller.display_name or "", ), ) diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index e926d91c25..4871c05e03 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -372,7 +372,7 @@

      Base Business Document Import

      !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:add7228da0785a97773337f3ae9214045b74e71d2f0efed8dfd63ea063cdfde8 +!! source digest: sha256:0165e85f7621164f57f7b61ae8714aa379047cecfd2ff6572ed3356949ac53c2 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

      Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

      This is a technical module ; it doesn’t bring any useful feature by From 7d240847e37f25d3940d2a5efa546d2e2fe9e1ba Mon Sep 17 00:00:00 2001 From: Alexis de Lattre Date: Wed, 26 Nov 2025 20:07:33 +0100 Subject: [PATCH 96/99] [IMP] base_business_document_import: Full re-write of multi-company handling Add raise_exception argument in several methods Avoid double entries in chatter --- base_business_document_import/README.rst | 2 +- base_business_document_import/__manifest__.py | 2 +- .../i18n/base_business_document_import.pot | 31 +- base_business_document_import/i18n/cs_CZ.po | 73 ++-- base_business_document_import/i18n/es.po | 108 +++--- base_business_document_import/i18n/fr.po | 79 ++--- base_business_document_import/i18n/fr_FR.po | 79 ++--- base_business_document_import/i18n/it.po | 137 ++++---- base_business_document_import/i18n/nl.po | 80 ++--- .../models/business_document_import.py | 325 +++++++++++++----- .../static/description/index.html | 2 +- 11 files changed, 470 insertions(+), 448 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index be769f44c1..3bae8d11ee 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -11,7 +11,7 @@ Base Business Document Import !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - !! source digest: sha256:0165e85f7621164f57f7b61ae8714aa379047cecfd2ff6572ed3356949ac53c2 + !! source digest: sha256:1655613e930925e97993fa33290eed4b1d146afff0ed7e59edb9854edf0ed2d6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! .. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 111bc4a59e..89d920198e 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "18.0.1.0.1", + "version": "18.0.2.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/i18n/base_business_document_import.pot b/base_business_document_import/i18n/base_business_document_import.pot index b99d5e515c..1484dd4996 100644 --- a/base_business_document_import/i18n/base_business_document_import.pot +++ b/base_business_document_import/i18n/base_business_document_import.pot @@ -42,6 +42,16 @@ msgid "" "manually.

      " msgstr "" +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "" +"

      The UNECE code %(code)s was used to describe the unit of measure but this" +" UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

      " +msgstr "" + #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 @@ -86,7 +96,13 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -msgid "Missing VAT number on company '%s'" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." msgstr "" #. module: base_business_document_import @@ -184,8 +200,8 @@ msgstr "" #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import @@ -221,15 +237,6 @@ msgid "" "symbol/ISO code in Odoo." msgstr "" -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" - #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 diff --git a/base_business_document_import/i18n/cs_CZ.po b/base_business_document_import/i18n/cs_CZ.po index a7795f89cf..97057aa6d0 100644 --- a/base_business_document_import/i18n/cs_CZ.po +++ b/base_business_document_import/i18n/cs_CZ.po @@ -22,28 +22,24 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "(fixed)" msgstr "(Úprávy)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Poznámky v souboru %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Poznámky v importovaném dokumentu:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

      Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

      • UNECE code: " @@ -55,7 +51,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

        The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

        " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -69,14 +74,12 @@ msgstr "Společné metody importu obchodních dokumentů" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " @@ -87,35 +90,36 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s není platný, takže byl ignorován." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "Není uvedena žádná měna, takže Odoo použil měnu společnosti (%s)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" @@ -131,7 +135,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " "extracted from the business document:\n" @@ -141,7 +144,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " "information extracted from the business document:\n" @@ -151,7 +153,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " "extracted from the business document:\n" @@ -161,7 +162,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" @@ -173,7 +173,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" @@ -193,7 +192,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " "Included in Price' = '%(price)s' which correspond to the following " @@ -207,7 +205,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -216,16 +213,14 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " "(%(parsed_vat)s) doesn't match the VAT number of the company " @@ -235,14 +230,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -252,7 +245,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " "symbol or ISO code. But there are none or several currencies with the symbol/" @@ -262,17 +254,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -281,7 +262,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -290,7 +270,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -299,7 +278,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -310,7 +288,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner IBAN %(iban)s has been automatically added on the " -"supplier " -"%(partner)s" +"supplier %(partner)s" msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." @@ -341,7 +316,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -352,7 +326,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -363,7 +336,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -372,21 +344,18 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "zákazník" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "partner" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "dodavatele" diff --git a/base_business_document_import/i18n/es.po b/base_business_document_import/i18n/es.po index 121da667fb..0d0e66b518 100644 --- a/base_business_document_import/i18n/es.po +++ b/base_business_document_import/i18n/es.po @@ -19,28 +19,24 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "(fixed)" msgstr "(fijado)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Notas en el archivo %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Notas en el documento importado:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

        Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

        • UNECE code: " @@ -57,7 +53,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

          The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

          " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -73,14 +78,12 @@ msgstr "Métodos habituales para importar documentos comerciales" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "No se pudo encontrar ningún Incotérmino en Odoo que corresponda a '%s'" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " @@ -95,28 +98,30 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "El IBAN %s no es válido, por lo que se ha ignorado." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "La ID {id} de '{model}' no existe en Odoo." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" -msgstr "Falta el número de IVA de la compañía \"%s\"" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." +msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" "No se especificó la moneda, por lo que Odoo utilizó la moneda de la compañía " @@ -125,7 +130,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" @@ -150,7 +154,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " "extracted from the business document:\n" @@ -163,7 +166,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " "information extracted from the business document:\n" @@ -176,7 +178,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " "extracted from the business document:\n" @@ -189,7 +190,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" @@ -206,7 +206,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" @@ -239,7 +238,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " "Included in Price' = '%(price)s' which correspond to the following " @@ -260,7 +258,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -271,18 +268,14 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" -"El %(label)s ha sido identificado por el nombre de dominio '%(domain)s' así " -"que por favor compruebe cuidadosamente que el %(label)s es correcto." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " "(%(parsed_vat)s) doesn't match the VAT number of the company " @@ -295,14 +288,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "El XMLID '%s' no existe en Odoo." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -315,7 +306,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " "symbol or ISO code. But there are none or several currencies with the symbol/" @@ -328,21 +318,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" -"El análisis del documento comercial arrojó '%(code)s' como la unidad de " -"medida del código UNECE, pero no hay ninguna unidad de medida con ese código " -"UNECE en Odoo. Por favor revise la configuración de las unidades de medidas " -"en Odoo." - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -353,7 +328,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -365,7 +339,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -376,7 +349,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -387,7 +359,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner IBAN %(iban)s has been automatically added on the " -"supplier " -"%(partner)s" +"supplier %(partner)s" msgstr "" "La cuenta bancaria IBAN %(iban)s se ha añadido automáticamente al " -"proveedor " -"%(partner)s" +"proveedor %(partner)s" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." @@ -427,7 +396,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -438,7 +406,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -449,7 +416,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -460,24 +426,44 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "Cliente" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "socio" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "proveedor" +#, python-format +#~ msgid "Missing VAT number on company '%s'" +#~ msgstr "Falta el número de IVA de la compañía \"%s\"" + +#, python-format +#~ msgid "" +#~ "The %(label)s has been identified by the domain name '%(domain)s' so " +#~ "please check carefully that the %(label)s is correct." +#~ msgstr "" +#~ "El %(label)s ha sido identificado por el nombre de dominio '%(domain)s' " +#~ "así que por favor compruebe cuidadosamente que el %(label)s es correcto." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%(code)s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "El análisis del documento comercial arrojó '%(code)s' como la unidad de " +#~ "medida del código UNECE, pero no hay ninguna unidad de medida con ese " +#~ "código UNECE en Odoo. Por favor revise la configuración de las unidades " +#~ "de medidas en Odoo." + #, python-format #~ msgid "" #~ "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " diff --git a/base_business_document_import/i18n/fr.po b/base_business_document_import/i18n/fr.po index b0e5f8deba..31615ce1f8 100644 --- a/base_business_document_import/i18n/fr.po +++ b/base_business_document_import/i18n/fr.po @@ -22,28 +22,24 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "(fixed)" msgstr "(fixe)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Notes dans le fichier %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Notes dans le document importé :" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

          Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

          • UNECE code: " @@ -55,7 +51,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

            The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

            " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -69,14 +74,12 @@ msgstr "Méthodes courantes d'importation de documents commerciaux" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " @@ -87,28 +90,30 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s n’est pas valide, il a donc été ignoré." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" -msgstr "Numéro de TVA manquant pour la société \"%s\"" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." +msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" "Aucune devise n'a été spécifiée, Odoo a donc utilisé la devise de la société " @@ -117,7 +122,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" @@ -133,7 +137,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " "extracted from the business document:\n" @@ -146,7 +149,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " "information extracted from the business document:\n" @@ -159,7 +161,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " "extracted from the business document:\n" @@ -172,7 +173,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" @@ -184,7 +184,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" @@ -204,7 +203,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " "Included in Price' = '%(price)s' which correspond to the following " @@ -218,7 +216,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -229,16 +226,14 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " "(%(parsed_vat)s) doesn't match the VAT number of the company " @@ -248,14 +243,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -265,7 +258,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " "symbol or ISO code. But there are none or several currencies with the symbol/" @@ -275,17 +267,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -296,7 +277,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -308,7 +288,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -320,7 +299,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -331,7 +309,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner IBAN %(iban)s has been automatically added on the " -"supplier " -"%(partner)s" +"supplier %(partner)s" msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." @@ -363,7 +338,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -374,7 +348,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -385,7 +358,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -394,24 +366,25 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "client" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "partenaire" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "sournisseur" +#, python-format +#~ msgid "Missing VAT number on company '%s'" +#~ msgstr "Numéro de TVA manquant pour la société \"%s\"" + #, python-format #~ msgid "" #~ "

            Odoo couldn't find any unit of measure corresponding to the following " diff --git a/base_business_document_import/i18n/fr_FR.po b/base_business_document_import/i18n/fr_FR.po index 9f10c2c1c6..5aa62f6f20 100644 --- a/base_business_document_import/i18n/fr_FR.po +++ b/base_business_document_import/i18n/fr_FR.po @@ -19,28 +19,24 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "(fixed)" msgstr "(fixe)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Notes dans le fichier %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Notes dans le document importé:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

            Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

            • UNECE code: " @@ -52,7 +48,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

              The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

              " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -66,14 +71,12 @@ msgstr "Méthodes courantes d'importation de documents commerciaux" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Impossible de trouver un Incoterm dans Odoo correspondant à '%s'" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " @@ -84,28 +87,30 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "L'IBAN %s n'est pas valide, il a donc été ignoré." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" -msgstr "Numéro de TVA manquant pour la société '%s'" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." +msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" "Pas de devise précisée, donc Odoo a utilisé la devise (%s) de la société" @@ -113,7 +118,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" @@ -129,7 +133,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " "extracted from the business document:\n" @@ -142,7 +145,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " "information extracted from the business document:\n" @@ -155,7 +157,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " "extracted from the business document:\n" @@ -168,7 +169,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" @@ -180,7 +180,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" @@ -200,7 +199,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " "Included in Price' = '%(price)s' which correspond to the following " @@ -214,7 +212,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -225,16 +222,14 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " "(%(parsed_vat)s) doesn't match the VAT number of the company " @@ -244,14 +239,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -261,7 +254,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " "symbol or ISO code. But there are none or several currencies with the symbol/" @@ -271,17 +263,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -292,7 +273,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -304,7 +284,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -315,7 +294,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -326,7 +304,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner IBAN %(iban)s has been automatically added on the " -"supplier " -"%(partner)s" +"supplier %(partner)s" msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." @@ -358,7 +333,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -369,7 +343,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -380,7 +353,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -389,24 +361,25 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "client" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "partenaire" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "fournisseur" +#, python-format +#~ msgid "Missing VAT number on company '%s'" +#~ msgstr "Numéro de TVA manquant pour la société '%s'" + #, python-format #~ msgid "" #~ "

              Odoo couldn't find any unit of measure corresponding to the following " diff --git a/base_business_document_import/i18n/it.po b/base_business_document_import/i18n/it.po index 0783eada11..722a8883d3 100644 --- a/base_business_document_import/i18n/it.po +++ b/base_business_document_import/i18n/it.po @@ -19,28 +19,24 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "(fixed)" msgstr "(fisso)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Note nel file %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Note nel documento importato:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

              Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

              • UNECE code: " @@ -56,7 +52,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

                The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

                " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -72,19 +77,17 @@ msgstr "Metodi comuni per l'importazione di documenti di lavoro" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "In Odoo non è presente nessun Incoterm corrispondente a '%s'" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " -"support this scenario for the moment, so the lines haven't been " -"updated." +"support this scenario for the moment, so the lines haven't been updated." msgstr "" "Per il prodotto '%(product)s', sulla riga esistente l'unità di misura è " "%(uom_product)s, ma è %(uom_imported)s nella riga importata. Al momento " @@ -94,37 +97,39 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "L'IBAN %s non è valido, quindi è stato ignorato." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "ID {id} di '{model}' non esiste in Odoo." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" -msgstr "Partita IVA mancante per l'azienda '%s'" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." +msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "Valuta non indicata, quindi Odoo utilizza la valuta dell'azienda (%s)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any %(label)s corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any %(label)s corresponding to the following information " +"extracted from the business document:\n" "Name: %(name)s \n" "VAT number: %(vat)s \n" "Reference: %(ref)s \n" @@ -146,9 +151,9 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any account corresponding to the following information " +"extracted from the business document:\n" "Account code: %s" msgstr "" "Odoo non trova nessun conto corrispondente alla seguente informazione " @@ -158,9 +163,9 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any analytic account corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any analytic account corresponding to the following " +"information extracted from the business document:\n" "Analytic account code: %s" msgstr "" "Odoo non trova nessun conto analitico corrispondente alla seguente " @@ -170,9 +175,9 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any journal corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any journal corresponding to the following information " +"extracted from the business document:\n" "Journal code: %s" msgstr "" "Odoo non trova nessun registro corrispondente alla seguente informazione " @@ -182,9 +187,9 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any product corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any product corresponding to the following information " +"extracted from the business document:\n" "Barcode: %(barcode)s\n" "Product code: %(product_code)s\n" "Supplier: %(supplier)s\n" @@ -198,9 +203,9 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any shipping partner corresponding to the following information extracted from the business document:\n" +"Odoo couldn't find any shipping partner corresponding to the following " +"information extracted from the business document:\n" "Name: %(name)s\n" "VAT number: %(vat)s\n" "Reference: %(ref)s\n" @@ -230,9 +235,10 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax Included in Price' = '%(price)s' which correspond to the following information extracted from the business document:\n" +"Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " +"Included in Price' = '%(price)s' which correspond to the following " +"information extracted from the business document:\n" "UNECE Tax Type code: %(tax_type)s\n" "UNECE Tax Category code: %(tax_cat)s\n" "UNECE Due Date code: %(tax_due_date)s\n" @@ -249,7 +255,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -260,22 +265,18 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" -"%(label)s è stato identificato dal nome dominio '%(domain)s' qundi " -"controllare con attenzione che %(label)s sia corretto." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " -"(%(parsed_vat)s) doesn't match the VAT number of the company '%(company)s' " -"(%(vat)s) in which you are trying to import this document." +"(%(parsed_vat)s) doesn't match the VAT number of the company " +"'%(company)s' (%(vat)s) in which you are trying to import this document." msgstr "" "La partita IVA del cliente scritta nel documento di lavoro(%(parsed_vat)s) " "non corrisponde alla prtita IVA dell'azienda '%(company)s' (%(vat)s) dove si " @@ -284,14 +285,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "L'ID XML '%s' non esiste in Odoo." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -304,11 +303,10 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " -"symbol or ISO code. But there are none or several currencies with the " -"symbol/ISO code in Odoo." +"symbol or ISO code. But there are none or several currencies with the symbol/" +"ISO code in Odoo." msgstr "" "L'analisi del documento di lavoro ha restituito '%(code)s' come simbolo " "valuta o codice ISO. Ma non ci sono o ce ne sono diverse valute con il " @@ -317,20 +315,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" -"La'nalisi del documento di lavoro ha restituito '%(code)s' come docie unità " -"di misura UNECE, ma non c'è una unità di misura con questo codice UNECE in " -"Odoo. Controllare la confiugrazione delle unità di misura in Odoo." - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -341,7 +325,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -352,7 +335,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -363,7 +345,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -374,13 +355,11 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner %(partner)s " -"and the option to automatically create bank accounts upon import is " -"disabled." +"and the option to automatically create bank accounts upon import is disabled." msgstr "" "L'analisi del documento di lavoro ha restituito IBAN %(iban)s come " "conto bancario, ma non esiste tale conto bancario in Odoo collegato ad un " @@ -391,7 +370,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The bank account IBAN %(iban)s has been automatically added on the " "supplier the lines haven't " "been updated." @@ -415,7 +392,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -426,7 +402,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -437,8 +412,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -449,20 +422,40 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "cliente" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "partner" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "fornitore" + +#, python-format +#~ msgid "Missing VAT number on company '%s'" +#~ msgstr "Partita IVA mancante per l'azienda '%s'" + +#, python-format +#~ msgid "" +#~ "The %(label)s has been identified by the domain name '%(domain)s' so " +#~ "please check carefully that the %(label)s is correct." +#~ msgstr "" +#~ "%(label)s è stato identificato dal nome dominio '%(domain)s' qundi " +#~ "controllare con attenzione che %(label)s sia corretto." + +#, python-format +#~ msgid "" +#~ "The analysis of the business document returned '%(code)s' as the unit of " +#~ "measure UNECE code, but there is no unit of measure with that UNECE code " +#~ "in Odoo. Please check the configuration of the units of measures in Odoo." +#~ msgstr "" +#~ "La'nalisi del documento di lavoro ha restituito '%(code)s' come docie " +#~ "unità di misura UNECE, ma non c'è una unità di misura con questo codice " +#~ "UNECE in Odoo. Controllare la confiugrazione delle unità di misura in " +#~ "Odoo." diff --git a/base_business_document_import/i18n/nl.po b/base_business_document_import/i18n/nl.po index 15d0d8aa2f..09c660946b 100644 --- a/base_business_document_import/i18n/nl.po +++ b/base_business_document_import/i18n/nl.po @@ -19,28 +19,25 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, fuzzy, python-format +#, fuzzy msgid "(fixed)" msgstr "(fixed)" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in file %s:" msgstr "Notities in bestand %s:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Notes in imported document:" msgstr "Notities in geimporteerd document:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "

                Odoo couldn't find any unit of measure corresponding to the following " "information extracted from the business document:

                • UNECE code: " @@ -52,7 +49,16 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format +msgid "" +"

                  The UNECE code %(code)s was used to describe the unit of measure but this " +"UNECE code was not found on an existing unit of measure: you should check " +"the UNECE codes on the existing unit of measure and, if necessary, create " +"the missing unit of measure and set the UNECE code on it.

                  " +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "" "Approximate match: account %(account)s has been matched with account " "%(matched_account)s" @@ -66,14 +72,12 @@ msgstr "Algemene procedures voor het importeren van bedrijfsdocumenten" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "Could not find any Incoterm in Odoo corresponding to '%s'" msgstr "Er kong geen Incoterm gevonden worden overeenkomstig met '%s'" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "For product '%(product)s', the unit of measure is %(uom_product)s on the " "existing line, but it is %(uom_imported)s on the imported line.We don't " @@ -84,28 +88,30 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "IBAN %s is not valid, so it has been ignored." msgstr "IBAN %s is ongeldig, dus genegeerd." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "ID {id} of '{model}' doesn't exist in Odoo." msgstr "ID {id} van '{model}' bestaat niet." #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "Missing VAT number on company '%s'" -msgstr "Ontbrekent BTW nummer voor bedrijf '%s'" +msgid "Import Warnings:" +msgstr "" + +#. module: base_business_document_import +#. odoo-python +#: code:addons/base_business_document_import/models/business_document_import.py:0 +msgid "Missing VAT number on company '%s'." +msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "No currency specified, so Odoo used the company currency (%s)" msgstr "" "Er is geen valuta gespicificeerd, dus de bedrijfsvaluta wordt gebruikt (%s)" @@ -113,7 +119,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any %(label)s corresponding to the following information " "extracted from the business document:\n" @@ -129,7 +134,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any account corresponding to the following information " "extracted from the business document:\n" @@ -142,7 +146,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any analytic account corresponding to the following " "information extracted from the business document:\n" @@ -155,7 +158,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any journal corresponding to the following information " "extracted from the business document:\n" @@ -168,7 +170,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any product corresponding to the following information " "extracted from the business document:\n" @@ -180,7 +181,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any shipping partner corresponding to the following " "information extracted from the business document:\n" @@ -200,7 +200,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "Odoo couldn't find any tax with 'Tax Application' = '%(tax)s' and 'Tax " "Included in Price' = '%(price)s' which correspond to the following " @@ -214,7 +213,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "One of the imported lines doesn't have any product, so the lines haven't " "been updated." @@ -225,16 +223,14 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" -"The %(label)s has been identified by the domain name '%(domain)s' so please " -"check carefully that the %(label)s is correct." +"The %(label)s has been identified by the domain name '%(email_domain)s' so " +"please check carefully that the %(label)s is correct." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The VAT number of the customer written in the business document " "(%(parsed_vat)s) doesn't match the VAT number of the company " @@ -244,14 +240,12 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "The XMLID '%s' doesn't exist in Odoo." msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the country " "code to find the related currency. But the country '%(name)s' doesn't have " @@ -261,7 +255,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%(code)s' as the currency " "symbol or ISO code. But there are none or several currencies with the symbol/" @@ -271,17 +264,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format -msgid "" -"The analysis of the business document returned '%(code)s' as the unit of " -"measure UNECE code, but there is no unit of measure with that UNECE code in " -"Odoo. Please check the configuration of the units of measures in Odoo." -msgstr "" - -#. module: base_business_document_import -#. odoo-python -#: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as country code. But " "there are no country with that code in Odoo." @@ -292,7 +274,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the country code to " "find the related currency. But there is no country with that code in Odoo." @@ -304,7 +285,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency ISO " "code. But there are no currency with that code in Odoo." @@ -315,7 +295,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned '%s' as the currency symbol. " "But there are none or several currencies with that symbol in Odoo." @@ -326,7 +305,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The analysis of the business document returned IBAN %(iban)s as bank " "account, but there is no such bank account in Odoo linked to partner
                  IBAN %(iban)s has been automatically added on the " -"supplier " -"%(partner)s" +"supplier %(partner)s" msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The existing line '%s' doesn't have any product, so the lines haven't " "been updated." @@ -358,7 +334,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several existing lines, so the lines haven't " "been updated." @@ -369,7 +344,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The product '%s' is used on several imported lines, so the lines haven't " "been updated." @@ -380,7 +354,6 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "" "The record '{record}' is an instance of '{record_model}', not of " "'{target_model}'." @@ -389,24 +362,25 @@ msgstr "" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "customer" msgstr "klant" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "partner" msgstr "relatie" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 -#, python-format msgid "supplier" msgstr "leverancier" +#, python-format +#~ msgid "Missing VAT number on company '%s'" +#~ msgstr "Ontbrekent BTW nummer voor bedrijf '%s'" + #, python-format #~ msgid "" #~ "

                  Odoo couldn't find any unit of measure corresponding to the following " diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index f953423538..9b139d1859 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -5,6 +5,8 @@ import logging from urllib.parse import urlparse +from markupsafe import Markup + from odoo import api, models from odoo.exceptions import UserError from odoo.osv import expression @@ -20,11 +22,16 @@ class BusinessDocumentImport(models.AbstractModel): _description = "Common methods to import business documents" @api.model - def user_error_wrap(self, method, data_dict, error_msg): + def user_error_wrap( + self, method, data_dict, error_msg, chatter_msg, raise_exception + ): """The method and data_dict arguments are useful when you want to inherit this method to update the error messag_match_currencye""" assert error_msg - raise UserError(error_msg) + if raise_exception: + raise UserError(error_msg) + elif error_msg not in chatter_msg: + chatter_msg.append(error_msg) def _direct_match(self, data_dict, model, raise_exception=True): if data_dict.get("recordset"): @@ -279,14 +286,16 @@ def _match_partner_email(self, partner_dict, chatter_msg, domain, order): chatter_msg.append( self.env._( "The %(label)s has been identified by the domain name " - "'%(domain)s' so please check carefully that the " + "'%(email_domain)s' so please check carefully that the " "%(label)s is correct.", label=partner_type_label, - domain=domain, + email_domain=email_domain, ) ) return partner + # TODO: maybe we should remove partner_type in future versions + # and add a company= arg @api.model def _match_partner( # noqa: C901 self, @@ -373,9 +382,7 @@ def _match_partner( # noqa: C901 if partner: return partner - if not raise_exception: - return None - raise self.user_error_wrap( + self.user_error_wrap( "_match_partner", partner_dict, self.env._( @@ -397,7 +404,10 @@ def _match_partner( # noqa: C901 state=partner_dict.get("state_code") or "", country=partner_dict.get("country_code") or "", ), + chatter_msg, + raise_exception, ) + return None @api.model def _hook_match_partner(self, partner_dict, chatter_msg, domain, order): @@ -518,9 +528,7 @@ def _match_shipping_partner( if partner: return partner - if not raise_exception: - return - raise self.user_error_wrap( + self.user_error_wrap( "_match_shipping_partner", partner_dict, self.env._( @@ -549,7 +557,10 @@ def _match_shipping_partner( state=partner_dict.get("state_code") or "", country=partner_dict.get("country_code") or "", ), + chatter_msg, + raise_exception, ) + return None @api.model def _match_partner_bank( @@ -627,7 +638,9 @@ def _match_partner_bank( ) @api.model - def _match_product(self, product_dict, chatter_msg, seller=False): + def _match_product( + self, product_dict, chatter_msg, seller=False, raise_exception=True + ): """Retrieve product. Matching sequence: @@ -671,7 +684,7 @@ def _match_product(self, product_dict, chatter_msg, seller=False): if sinfo and len(sinfo.product_tmpl_id.product_variant_ids) == 1: return sinfo.product_tmpl_id.product_variant_id # TODO: add test - raise self.user_error_wrap( + self.user_error_wrap( "_match_product", product_dict, self.env._( @@ -684,7 +697,10 @@ def _match_product(self, product_dict, chatter_msg, seller=False): product_code=product_dict.get("code") or "", supplier=seller and seller.display_name or "", ), + chatter_msg, + raise_exception, ) + return None @api.model def _match_product_search(self, product_dict): @@ -719,11 +735,13 @@ def _match_product_search(self, product_dict): @api.model def _match_company_domain(self): - company_id = self.env.company.id or self.env.user.company_id.id - return ["|", ("company_id", "=", False), ("company_id", "=", company_id)] + company_ids = self._context.get("allowed_company_ids") or [self.env.company.id] + return [("company_id", "in", company_ids + [False])] @api.model - def _match_currency(self, currency_dict, chatter_msg): + def _match_currency( + self, currency_dict, chatter_msg, company=None, raise_exception=True + ): """Example: currency_dict = { 'iso': 'USD', # If we have ISO, no need to have more keys @@ -745,7 +763,7 @@ def _match_currency(self, currency_dict, chatter_msg): if currency: return currency else: - raise self.user_error_wrap( + self.user_error_wrap( "_match_currency", currency_dict, self.env._( @@ -754,6 +772,8 @@ def _match_currency(self, currency_dict, chatter_msg): "with that code in Odoo." ) % currency_iso, + chatter_msg, + raise_exception, ) if currency_dict.get("symbol"): currencies = rco.search([("symbol", "=", currency_dict["symbol"])]) @@ -779,7 +799,7 @@ def _match_currency(self, currency_dict, chatter_msg): if len(currencies) == 1: return currencies[0] else: - raise self.user_error_wrap( + self.user_error_wrap( "_match_currency", currency_dict, self.env._( @@ -788,6 +808,8 @@ def _match_currency(self, currency_dict, chatter_msg): "several currencies with the symbol/ISO code in Odoo.", code=currency_dict["iso_or_symbol"], ), + chatter_msg, + raise_exception, ) if currency_dict.get("country_code"): country_code = currency_dict["country_code"] @@ -798,7 +820,7 @@ def _match_currency(self, currency_dict, chatter_msg): if country.currency_id: return country.currency_id else: - raise self.user_error_wrap( + self.user_error_wrap( "_match_currency", currency_dict, self.env._( @@ -809,9 +831,11 @@ def _match_currency(self, currency_dict, chatter_msg): code=country_code, name=country.name, ), + chatter_msg, + raise_exception, ) else: - raise self.user_error_wrap( + self.user_error_wrap( "_match_currency", currency_dict, self.env._( @@ -820,8 +844,19 @@ def _match_currency(self, currency_dict, chatter_msg): "But there is no country with that code in Odoo." ) % country_code, + chatter_msg, + raise_exception, ) - company = self.env.company + if company is None: + if ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + ): + company = self.env["res.company"].browse( + self._context["allowed_company_ids"][0] + ) + else: + company = self.env.company company_cur = company.currency_id chatter_msg.append( self.env._("No currency specified, so Odoo used the company currency (%s)") @@ -830,7 +865,7 @@ def _match_currency(self, currency_dict, chatter_msg): return company_cur @api.model - def _match_uom(self, uom_dict, chatter_msg, product=False): + def _match_uom(self, uom_dict, chatter_msg, product=False, raise_exception=False): """Example: uom_dict = { 'unece_code': 'LTR', @@ -851,58 +886,80 @@ def _match_uom(self, uom_dict, chatter_msg, product=False): uom = uuo.search([("unece_code", "=", uom_dict["unece_code"])], limit=1) if uom: return uom - else: - chatter_msg.append( - self.env._( - "The analysis of the business document returned '%(code)s' " - "as the unit of measure UNECE code, but there is no " - "unit of measure with that UNECE code in Odoo. Please " - "check the configuration of the units of measures in " - "Odoo.", - code=uom_dict["unece_code"], - ) - ) if uom_dict.get("name"): uom = uuo.search([("name", "=ilike", uom_dict["name"] + "%")], limit=1) if uom: return uom if product: return product.uom_id - chatter_msg.append( - self.env._( - "

                  Odoo couldn't find any unit of measure corresponding to the " - "following information extracted from the business document:

                  " - "
                  • UNECE code: %(code)s
                  • " - "
                  • Name of the unit of measure: %(name)s
                  " - "

                  So the unit of measure 'Unit(s)' has been used. You may " - "have to change it manually.

                  ", - code=uom_dict.get("unece_code"), - name=uom_dict.get("name"), + msg = self.env._( + "

                  Odoo couldn't find any unit of measure corresponding to the " + "following information extracted from the business document:

                  " + "
                  • UNECE code: %(code)s
                  • " + "
                  • Name of the unit of measure: %(name)s
                  " + "

                  So the unit of measure 'Unit(s)' has been used. You may " + "have to change it manually.

                  ", + code=uom_dict.get("unece_code"), + name=uom_dict.get("name"), + ) + if uom_dict.get("unece_code"): + msg += self.env._( + "

                  The UNECE code %(code)s was used to describe the unit of measure " + "but this UNECE code was not found on an existing unit of measure: " + "you should check the UNECE codes on the existing unit of measure and, " + "if necessary, create the missing unit of measure and set the UNECE " + "code on it.

                  ", + code=uom_dict["unece_code"], ) + self.user_error_wrap( + "_match_uom", + uom_dict, + msg, + chatter_msg, + raise_exception, ) return self.env.ref("uom.product_uom_unit") @api.model def _match_taxes( - self, taxes_list, chatter_msg, type_tax_use="purchase", price_include=False + self, + taxes_list, + chatter_msg, + company=None, + type_tax_use="purchase", + price_include=False, + raise_exception=True, ): """taxes_list must be a list of tax_dict""" taxes_recordset = self.env["account.tax"].browse() for tax_dict in taxes_list: - taxes_recordset += self._match_tax( + tax = self._match_tax( tax_dict, chatter_msg, type_tax_use=type_tax_use, - price_include=price_include, + company=company, + price_include=tax_dict.get("price_include", price_include), + raise_exception=raise_exception, ) + if tax: + taxes_recordset += tax return taxes_recordset @api.model def _prepare_match_tax_domain( - self, tax_dict, type_tax_use="purchase", price_include=False + self, tax_dict, company=None, type_tax_use="purchase", price_include=False ): ato = self.env["account.tax"] - domain = [("company_id", "=", self.env.company.id)] + if company is None: + company_id = ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + and self._context["allowed_company_ids"][0] + or self.env.company.id + ) + else: + company_id = company.id + domain = [("company_id", "=", company_id)] if type_tax_use == "purchase": domain.append(("type_tax_use", "=", "purchase")) elif type_tax_use == "sale": @@ -940,6 +997,8 @@ def _match_tax( chatter_msg, type_tax_use="purchase", price_include=False, + company=None, + raise_exception=True, ): """Example: tax_dict = { @@ -956,14 +1015,17 @@ def _match_tax( if tax: return tax domain = self._prepare_match_tax_domain( - tax_dict, type_tax_use=type_tax_use, price_include=price_include + tax_dict, + company=company, + type_tax_use=type_tax_use, + price_include=price_include, ) taxes = ato.search(domain) for tax in taxes: tax_amount = tax.amount # 'amount' field : digits=(16, 4) if not float_compare(tax_dict["amount"], tax_amount, precision_digits=4): return tax - raise self.user_error_wrap( + self.user_error_wrap( "_match_tax", tax_dict, self.env._( @@ -984,8 +1046,12 @@ def _match_tax( and "%" or self.env._("(fixed)"), ), + chatter_msg, + raise_exception, ) + return None + # WARNING: This code will probably be removed in the next version ! def compare_lines( self, existing_lines, @@ -1145,9 +1211,18 @@ def _prepare_order_line_update_values( ] return values - def _prepare_account_speed_dict(self): + def _prepare_account_speed_dict(self, company=None): + if company is None: + company_id = ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + and self._context["allowed_company_ids"][0] + or self.env.company.id + ) + else: + company_id = company.id res = self.env["account.account"].search_read( - [("company_ids", "=", self.env.company.id), ("deprecated", "=", False)], + [("company_ids", "=", company_id), ("deprecated", "=", False)], ["code"], ) speed_dict = {} @@ -1156,7 +1231,14 @@ def _prepare_account_speed_dict(self): return speed_dict @api.model - def _match_account(self, account_dict, chatter_msg, speed_dict=None): + def _match_account( + self, + account_dict, + chatter_msg, + company=None, + speed_dict=None, + raise_exception=True, + ): """Example: account_dict = { 'code': '411100', @@ -1168,7 +1250,7 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): account_dict = {} aao = self.env["account.account"] if speed_dict is None: - speed_dict = self._prepare_account_speed_dict() + speed_dict = self._prepare_account_speed_dict(company=company) self._strip_cleanup_dict(account_dict) account = self._direct_match(account_dict, aao) if account: @@ -1198,7 +1280,7 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): ) ) return aao.browse(account_id) - raise self.user_error_wrap( + self.user_error_wrap( "_match_account", account_dict, self.env._( @@ -1207,11 +1289,22 @@ def _match_account(self, account_dict, chatter_msg, speed_dict=None): "Account code: %s" ) % (account_dict.get("code") or ""), + chatter_msg, + raise_exception, ) - def _prepare_analytic_account_speed_dict(self): + def _prepare_analytic_account_speed_dict(self, company=None): + if company is None: + company_id = ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + and self._context["allowed_company_ids"][0] + or self.env.company.id + ) + else: + company_id = company.id res = self.env["account.analytic.account"].search_read( - [("company_id", "=", self.env.company.id)], ["code"] + [("company_id", "in", [company_id, False])], ["code"] ) speed_dict = {} for line in res: @@ -1220,7 +1313,14 @@ def _prepare_analytic_account_speed_dict(self): return speed_dict @api.model - def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): + def _match_analytic_account( + self, + aaccount_dict, + chatter_msg, + company=None, + speed_dict=None, + raise_exception=True, + ): """Example: aaccount_dict = { 'code': '627', @@ -1232,7 +1332,7 @@ def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): aaccount_dict = {} aaao = self.env["account.analytic.account"] if speed_dict is None: - speed_dict = self._prepare_analytic_account_speed_dict() + speed_dict = self._prepare_analytic_account_speed_dict(company=company) self._strip_cleanup_dict(aaccount_dict) aaccount = self._direct_match(aaccount_dict, aaao) if aaccount: @@ -1241,7 +1341,7 @@ def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): aacode = aaccount_dict["code"].upper() if aacode in speed_dict: return aaao.browse(speed_dict[aacode]) - raise self.user_error_wrap( + self.user_error_wrap( "_match_analytic_account", aaccount_dict, self.env._( @@ -1250,11 +1350,22 @@ def _match_analytic_account(self, aaccount_dict, chatter_msg, speed_dict=None): "Analytic account code: %s" ) % (aaccount_dict.get("code") or ""), + chatter_msg, + raise_exception, ) - def _prepare_journal_speed_dict(self): + def _prepare_journal_speed_dict(self, company=None): + if company is None: + company_id = ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + and self._context["allowed_company_ids"][0] + or self.env.company.id + ) + else: + company_id = company.id res = self.env["account.journal"].search_read( - [("company_id", "=", self.env.company.id)], ["code"] + [("company_id", "=", company_id)], ["code"] ) speed_dict = {} for line in res: @@ -1262,7 +1373,14 @@ def _prepare_journal_speed_dict(self): return speed_dict @api.model - def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): + def _match_journal( + self, + journal_dict, + chatter_msg, + speed_dict=None, + company=None, + raise_exception=True, + ): """Example: journal_dict = { 'code': 'MISC', @@ -1274,7 +1392,7 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): journal_dict = {} ajo = self.env["account.journal"] if speed_dict is None: - speed_dict = self._prepare_journal_speed_dict() + speed_dict = self._prepare_journal_speed_dict(company=company) self._strip_cleanup_dict(journal_dict) journal = self._direct_match(journal_dict, ajo) if journal: @@ -1284,7 +1402,7 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): if jcode in speed_dict: return ajo.browse(speed_dict[jcode]) # case insensitive - raise self.user_error_wrap( + self.user_error_wrap( "_match_journal", journal_dict, self.env._( @@ -1293,13 +1411,15 @@ def _match_journal(self, journal_dict, chatter_msg, speed_dict=None): "Journal code: %s" ) % (journal_dict.get("code") or ""), + chatter_msg, + raise_exception, ) # Code moved from base_business_document_import_stock # Now that the incoterm obj (account.incoterms) is defined in # the 'account' module (since Odoo v12) instead of 'stock' @api.model - def _match_incoterm(self, incoterm_dict, chatter_msg): + def _match_incoterm(self, incoterm_dict, chatter_msg, raise_exception=True): aio = self.env["account.incoterms"] if not incoterm_dict: incoterm_dict = {} @@ -1326,35 +1446,52 @@ def _match_incoterm(self, incoterm_dict, chatter_msg): "Could not find any Incoterm in Odoo corresponding " "to '%s'" ) % incoterm_dict["code"], + chatter_msg, + raise_exception, ) return False @api.model - def _check_company(self, company_dict, chatter_msg): + def _check_company( + self, company_dict, chatter_msg, company=None, raise_exception=True + ): if not company_dict: company_dict = {} - company = self.env.company - if not company_dict.get("vat"): - return - parsed_company_vat = company_dict["vat"].replace(" ", "").upper() - if company.partner_id.vat and company.partner_id.vat != parsed_company_vat: - raise self.user_error_wrap( - "_check_company", - company_dict, - self.env._( - "The VAT number of the customer written in the " - "business document (%(parsed_vat)s) doesn't match " - "the VAT number of the company '%(company)s' (%(vat)s) " - "in which you are trying to import this document.", - parsed_vat=parsed_company_vat, - company=company.display_name, - vat=company.partner_id.vat, - ), - ) - else: - chatter_msg.append( - self.env._("Missing VAT number on company '%s'") % company.display_name - ) + if company is None: + if ( + self._context.get("allowed_company_ids") + and len(self._context["allowed_company_ids"]) == 1 + ): + company = self.env["res.company"].browse( + self._context["allowed_company_ids"][0] + ) + else: + company = self.env.company + if company_dict.get("vat"): + parsed_company_vat = company_dict["vat"].replace(" ", "").upper() + if company.partner_id.vat: + if company.partner_id.vat != parsed_company_vat: + self.user_error_wrap( + "_check_company", + company_dict, + self.env._( + "The VAT number of the customer written in the " + "business document (%(parsed_vat)s) doesn't match " + "the VAT number of the company '%(company)s' (%(vat)s) " + "in which you are trying to import this document.", + parsed_vat=parsed_company_vat, + company=company.display_name, + vat=company.partner_id.vat, + ), + chatter_msg, + raise_exception, + ) + else: + msg = self.env._( + "Missing VAT number on company '%s'.", company.display_name + ) + if msg not in chatter_msg: + chatter_msg.append(msg) @api.model def post_create_or_update(self, parsed_dict, record, doc_filename=None): @@ -1368,8 +1505,18 @@ def post_create_or_update(self, parsed_dict, record, doc_filename=None): "datas": data_base64, } ) + chatter_msg_html = [] for msg in parsed_dict["chatter_msg"]: - record.message_post(body=msg) + chatter_msg_html.append(msg.replace("\n", "
                  ")) + for msg in chatter_msg_html: + record.message_post(body=Markup(msg)) + if hasattr(record, "import_warnings") and chatter_msg_html: + import_warn = self.env._("Import Warnings:") + list_msg = "\n".join([f"
                • {msg}
                • " for msg in chatter_msg_html]) + import_warnings = Markup( + f"{import_warn}
                    {list_msg}
                  " + ) + record.write({"import_warnings": import_warnings}) if parsed_dict.get("note"): if doc_filename: msg = self.env._("Notes in file %s:") % doc_filename diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index 4871c05e03..c013152498 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -372,7 +372,7 @@

                  Base Business Document Import

                  !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! source digest: sha256:0165e85f7621164f57f7b61ae8714aa379047cecfd2ff6572ed3356949ac53c2 +!! source digest: sha256:1655613e930925e97993fa33290eed4b1d146afff0ed7e59edb9854edf0ed2d6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->

                  Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

                  This is a technical module ; it doesn’t bring any useful feature by From 7367c5f3c92c25b070e5684024f6dddd3f2ed9d9 Mon Sep 17 00:00:00 2001 From: mymage Date: Tue, 9 Dec 2025 10:43:26 +0000 Subject: [PATCH 97/99] Translated using Weblate (Italian) Currently translated at 100.0% (40 of 40 strings) Translation: edi-18.0/edi-18.0-base_business_document_import Translate-URL: https://translation.odoo-community.org/projects/edi-18-0/edi-18-0-base_business_document_import/it/ --- base_business_document_import/i18n/it.po | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/base_business_document_import/i18n/it.po b/base_business_document_import/i18n/it.po index 722a8883d3..e63a428a2f 100644 --- a/base_business_document_import/i18n/it.po +++ b/base_business_document_import/i18n/it.po @@ -6,7 +6,7 @@ msgid "" msgstr "" "Project-Id-Version: Odoo Server 17.0\n" "Report-Msgid-Bugs-To: \n" -"PO-Revision-Date: 2024-04-10 09:34+0000\n" +"PO-Revision-Date: 2025-12-09 13:43+0000\n" "Last-Translator: mymage \n" "Language-Team: none\n" "Language: it\n" @@ -14,7 +14,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: \n" "Plural-Forms: nplurals=2; plural=n != 1;\n" -"X-Generator: Weblate 4.17\n" +"X-Generator: Weblate 5.10.4\n" #. module: base_business_document_import #. odoo-python @@ -58,6 +58,11 @@ msgid "" "the UNECE codes on the existing unit of measure and, if necessary, create " "the missing unit of measure and set the UNECE code on it.

                  " msgstr "" +"

                  Il codice UNECE %(code)s è stato utilizzato per descrivere l'unità di " +"misura, ma questo codice UNECE non è stato trovato su un'unità di misura " +"esistente: si dovrebbe controllare i codici UNECE sull'unità di misura " +"esistente e, se necessario, creare l'unità di misura mancante e impostarvi " +"il codice UNECE.

                  " #. module: base_business_document_import #. odoo-python @@ -110,13 +115,13 @@ msgstr "ID {id} di '{model}' non esiste in Odoo." #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "Import Warnings:" -msgstr "" +msgstr "Avvisi di importazione:" #. module: base_business_document_import #. odoo-python #: code:addons/base_business_document_import/models/business_document_import.py:0 msgid "Missing VAT number on company '%s'." -msgstr "" +msgstr "Partita IVA mancante per l'azienda '%s'." #. module: base_business_document_import #. odoo-python @@ -269,6 +274,9 @@ msgid "" "The %(label)s has been identified by the domain name '%(email_domain)s' so " "please check carefully that the %(label)s is correct." msgstr "" +"L'etichetta %(label)s è stata identificata dal nome di dominio " +"'%(email_domain)s', quindi verificare attentamente che %(label)s sia " +"corretto." #. module: base_business_document_import #. odoo-python From 912e2201a8f42759e0343788c983b661cd709381 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Thu, 2 Apr 2026 17:18:53 +0300 Subject: [PATCH 98/99] [IMP] base_business_document_import: pre-commit auto fixes --- .../models/business_document_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 9b139d1859..8149456807 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -1443,7 +1443,7 @@ def _match_incoterm(self, incoterm_dict, chatter_msg, raise_exception=True): "_match_incoterm", incoterm_dict, self.env._( - "Could not find any Incoterm in Odoo corresponding " "to '%s'" + "Could not find any Incoterm in Odoo corresponding to '%s'" ) % incoterm_dict["code"], chatter_msg, From 59428b0dc61e1cc5acea681758345b46f4710152 Mon Sep 17 00:00:00 2001 From: Maksym Yankin Date: Thu, 2 Apr 2026 18:03:22 +0300 Subject: [PATCH 99/99] [MIG] base_business_document_import: Migration to 19.0 --- base_business_document_import/README.rst | 10 +- base_business_document_import/__manifest__.py | 2 +- .../models/business_document_import.py | 421 ++++++++++-------- .../static/description/index.html | 6 +- .../tests/test_business_document_import.py | 303 +++++++------ 5 files changed, 412 insertions(+), 330 deletions(-) diff --git a/base_business_document_import/README.rst b/base_business_document_import/README.rst index 3bae8d11ee..1c97297d35 100644 --- a/base_business_document_import/README.rst +++ b/base_business_document_import/README.rst @@ -21,13 +21,13 @@ Base Business Document Import :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fedi-lightgray.png?logo=github - :target: https://github.com/OCA/edi/tree/18.0/base_business_document_import + :target: https://github.com/OCA/edi/tree/19.0/base_business_document_import :alt: OCA/edi .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/edi-18-0/edi-18-0-base_business_document_import + :target: https://translation.odoo-community.org/projects/edi-19-0/edi-19-0-base_business_document_import :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png - :target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=18.0 + :target: https://runboat.odoo-community.org/builds?repo=OCA/edi&target_branch=19.0 :alt: Try me on Runboat |badge1| |badge2| |badge3| |badge4| |badge5| @@ -55,7 +55,7 @@ Bug Tracker Bugs are tracked on `GitHub Issues `_. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -`feedback `_. +`feedback `_. Do not contact contributors directly about support or help with technical issues. @@ -98,6 +98,6 @@ Current `maintainer `__: |maintainer-alexis-via| -This module is part of the `OCA/edi `_ project on GitHub. +This module is part of the `OCA/edi `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/base_business_document_import/__manifest__.py b/base_business_document_import/__manifest__.py index 89d920198e..8c68c9223b 100644 --- a/base_business_document_import/__manifest__.py +++ b/base_business_document_import/__manifest__.py @@ -4,7 +4,7 @@ { "name": "Base Business Document Import", - "version": "18.0.2.0.0", + "version": "19.0.1.0.0", "category": "Tools", "license": "AGPL-3", "summary": "Provides technical tools to import sale orders or supplier invoices", diff --git a/base_business_document_import/models/business_document_import.py b/base_business_document_import/models/business_document_import.py index 8149456807..50cdad127f 100644 --- a/base_business_document_import/models/business_document_import.py +++ b/base_business_document_import/models/business_document_import.py @@ -9,7 +9,7 @@ from odoo import api, models from odoo.exceptions import UserError -from odoo.osv import expression +from odoo.fields import Domain from odoo.tools import float_compare from odoo.addons.base_iban.models.res_partner_bank import validate_iban @@ -41,9 +41,8 @@ def _direct_match(self, data_dict, model, raise_exception=True): elif raise_exception: raise UserError( self.env._( - "The record '{record}' is an instance of '{record_model}', " - "not of '{target_model}'." - ).format( + "The record '%(record)s' is an instance of '%(record_model)s', " + "not of '%(target_model)s'.", record=record.display_name, record_model=record._name, target_model=model._name, @@ -53,8 +52,10 @@ def _direct_match(self, data_dict, model, raise_exception=True): record = model.browse(data_dict["id"]).exists() if not record and raise_exception: raise UserError( - self.env._("ID {id} of '{model}' doesn't exist in Odoo.").format( - id=data_dict["id"], model=model._name + self.env._( + "ID %(id)s of '%(model)s' doesn't exist in Odoo.", + id=data_dict["id"], + model=model._name, ) ) if record: @@ -67,7 +68,9 @@ def _direct_match(self, data_dict, model, raise_exception=True): except ValueError as e: if raise_exception: raise UserError( - self.env._("The XMLID '%s' doesn't exist in Odoo.") % xmlid + self.env._( + "The XMLID '%(xmlid)s' doesn't exist in Odoo.", xmlid=xmlid + ) ) from e if record: if isinstance(record, type(model)): @@ -75,9 +78,8 @@ def _direct_match(self, data_dict, model, raise_exception=True): elif raise_exception: raise UserError( self.env._( - "The record '{record}' is an instance of '{record_model}', " - "not of '{target_model}'." - ).format( + "The record '%(record)s' is an instance of " + "'%(record_model)s', not of '%(target_model)s'.", record=record.display_name, record_model=record._name, target_model=model._name, @@ -119,21 +121,22 @@ def _get_country_filter(self, partner_dict, chatter_msg): """Generate filter by country""" if partner_dict.get("country_code"): country = self.env["res.country"].search( - [("code", "=", partner_dict["country_code"])], limit=1 + Domain("code", "=", partner_dict["country_code"]), limit=1 ) if country: - return [ - "|", - ("country_id", "=", False), - ("country_id", "=", country.id), - ] + return Domain.OR( + [ + Domain("country_id", "=", False), + Domain("country_id", "=", country.id), + ] + ) chatter_msg.append( self.env._( - "The analysis of the business document returned '%s' as " - "country code. But there are no country with that code " - "in Odoo." + "The analysis of the business document returned " + "'%(country_code)s' as country code. " + "But there are no country with that code in Odoo.", + country_code=partner_dict["country_code"], ) - % partner_dict["country_code"] ) return False @@ -141,26 +144,33 @@ def _get_country_filter(self, partner_dict, chatter_msg): def _get_country_state_filter(self, partner_dict, chatter_msg): if partner_dict.get("state_code"): country = self.env["res.country"].search( - [("code", "=", partner_dict["country_code"])], limit=1 + Domain("code", "=", partner_dict["country_code"]), limit=1 ) if state := self.env["res.country.state"].search( - [ - ("code", "=", partner_dict["state_code"]), - ("country_id", "=", country.id), - ], + Domain.AND( + [ + Domain("code", "=", partner_dict["state_code"]), + Domain("country_id", "=", country.id), + ] + ), limit=1, ): - return ["|", ("state_id", "=", False), ("state_id", "=", state.id)] + return Domain.OR( + [ + Domain("state_id", "=", False), + Domain("state_id", "=", state.id), + ] + ) return False @api.model def _match_partner_ref(self, partner_dict, chatter_msg, domain, order): """If a ref is explicitly given, we just want to match that partner""" if partner_dict.get("ref"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [("ref", "=", partner_dict["ref"])], + Domain("ref", "=", partner_dict["ref"]), ] ) return self.env["res.partner"].search(domain, limit=1, order=order) @@ -171,10 +181,10 @@ def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): rpo = self.env["res.partner"] if partner_dict.get("email") and "@" in partner_dict["email"]: if partner := rpo.search( - expression.AND( + Domain.AND( [ domain, - [("email", "=ilike", partner_dict["email"])], + Domain("email", "=ilike", partner_dict["email"]), ] ), limit=1, @@ -183,10 +193,10 @@ def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): return partner if partner_dict.get("contact"): if partner := rpo.search( - expression.AND( + Domain.AND( [ domain, - [("name", "=ilike", partner_dict["contact"])], + Domain("name", "=ilike", partner_dict["contact"]), ] ), limit=1, @@ -195,14 +205,15 @@ def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): return partner if partner_dict.get("phone"): if partner := rpo.search( - expression.AND( + Domain.AND( [ domain, - [ - "|", - ("mobile", "=", partner_dict["phone"]), - ("phone", "=", partner_dict["phone"]), - ], + Domain.OR( + [ + Domain("mobile", "=", partner_dict["phone"]), + Domain("phone", "=", partner_dict["phone"]), + ] + ), ] ), limit=1, @@ -214,12 +225,10 @@ def _match_partner_contact(self, partner_dict, chatter_msg, domain, order): @api.model def _match_partner_name(self, partner_dict, chatter_msg, domain, order): if partner_dict.get("name"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("name", "=ilike", partner_dict["name"]), - ], + Domain("name", "=ilike", partner_dict["name"]), ] ) return self.env["res.partner"].search(domain, limit=1, order=order) @@ -240,12 +249,10 @@ def _get_partner_website_domain(self, partner_dict): @api.model def _match_partner_website(self, partner_dict, chatter_msg, domain, order): if website_domain := self._get_partner_website_domain(partner_dict): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("website", "=ilike", "%" + website_domain + "%"), - ], + Domain("website", "=ilike", "%" + website_domain + "%"), ] ) return self.env["res.partner"].search(domain, limit=1, order=order) @@ -267,16 +274,16 @@ def _match_partner_email(self, partner_dict, chatter_msg, domain, order): # @gmail.com, @yahoo.com that may match random partners if email_domain: partner = self.env["res.partner"].search( - expression.AND( - [domain, [("website", "=ilike", "%" + email_domain + "%")]] + Domain.AND( + [domain, Domain("website", "=ilike", "%" + email_domain + "%")] ), limit=1, order=order, ) if not partner: partner = self.env["res.partner"].search( - expression.AND( - [domain, [("email", "=ilike", "%@" + email_domain)]] + Domain.AND( + [domain, Domain("email", "=ilike", "%@" + email_domain)] ), limit=1, order=order, @@ -323,9 +330,9 @@ def _match_partner( # noqa: C901 partner = self._direct_match(partner_dict, rpo, raise_exception=raise_exception) if partner: return partner - domain = expression.AND( + domain = Domain.AND( [ - domain or [], + domain or Domain.TRUE, self._match_company_domain(), ] ) @@ -339,18 +346,18 @@ def _match_partner( # noqa: C901 return partner if country_domain := self._get_country_filter(partner_dict, chatter_msg): - domain = expression.AND([domain, country_domain]) + domain = Domain.AND([domain, country_domain]) if state_domain := self._get_country_state_filter( partner_dict, chatter_msg ): - domain = expression.AND([domain, state_domain]) + domain = Domain.AND([domain, state_domain]) # Search on VAT if partner_dict.get("vat"): vat = partner_dict["vat"].replace(" ", "").upper() partner = rpo.search( - expression.AND([domain, [("vat", "=", vat)]]), + Domain.AND([domain, Domain("vat", "=", vat)]), limit=1, order=order, ) @@ -430,77 +437,83 @@ def _match_shipping_partner( The shipping partner can be any partner, not especially related to the customer/supplier (partner argument) """ - domain = domain or [] + domain = domain or Domain.TRUE if partner_dict.get("street"): if partner_dict.get("street_number"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ( - "street", - "in", - [ - "{} {}".format( - partner_dict.get("street"), - partner_dict.get("street_number"), - ), - "{} {}".format( - partner_dict.get("street_number"), - partner_dict.get("street"), - ), - "{}, {}".format( - partner_dict.get("street"), - partner_dict.get("street_number"), - ), - "{}, {}".format( - partner_dict.get("street_number"), - partner_dict.get("street"), - ), - ], - ) - ], + Domain( + "street", + "in", + [ + "{} {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{} {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + "{}, {}".format( + partner_dict.get("street"), + partner_dict.get("street_number"), + ), + "{}, {}".format( + partner_dict.get("street_number"), + partner_dict.get("street"), + ), + ], + ), ] ) else: - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("street", "=", partner_dict.get("street")), - ], + Domain( + "street", + "=", + partner_dict.get("street"), + ), ] ) if partner_dict.get("street2"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("street2", "=", partner_dict.get("street2")), - ], + Domain( + "street2", + "=", + partner_dict.get("street2"), + ), ] ) if partner_dict.get("city"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("city", "=", partner_dict.get("city")), - ], + Domain( + "city", + "=", + partner_dict.get("city"), + ), ] ) if partner_dict.get("zip"): - domain = expression.AND( + domain = Domain.AND( [ domain, - [ - ("zip", "=", partner_dict.get("zip")), - ], + Domain( + "zip", + "=", + partner_dict.get("zip"), + ), ] ) - domain_delivery = expression.AND([domain, [("type", "=", "delivery")]]) + domain_delivery = Domain.AND([domain, Domain("type", "=", "delivery")]) partner = self._match_partner( partner_dict, chatter_msg, @@ -576,18 +589,22 @@ def _match_partner_bank( validate_iban(iban) except Exception: chatter_msg.append( - self.env._("IBAN %s is not valid, so it has been ignored.") - % iban + self.env._( + "IBAN %(iban)s is not valid, so it has been ignored.", + iban=iban, + ) ) return False bankaccount = rpbo.search( - expression.AND( + Domain.AND( [ self._match_company_domain(), - [ - ("acc_number", "=", iban), - ("partner_id", "=", partner.id), - ], + Domain.AND( + [ + Domain("acc_number", "=", iban), + Domain("partner_id", "=", partner.id), + ] + ), ] ), limit=1, @@ -598,7 +615,7 @@ def _match_partner_bank( bank_id = False if bic: bic = bic.replace(" ", "").upper() - bank = rbo.search([("bic", "=", bic)], limit=1) + bank = rbo.search(Domain("bic", "=", bic), limit=1) if bank: bank_id = bank.id else: @@ -670,13 +687,15 @@ def _match_product( # WARNING: Won't work for multi-variant products # because product.supplierinfo is attached to product template sinfo = self.env["product.supplierinfo"].search( - expression.AND( + Domain.AND( [ self._match_company_domain(), - [ - ("partner_id", "=", seller.id), - ("product_code", "=", product_dict["code"]), - ], + Domain.AND( + [ + Domain("partner_id", "=", seller), + Domain("product_code", "=", product_dict["code"]), + ] + ), ] ), limit=1, @@ -707,27 +726,23 @@ def _match_product_search(self, product_dict): product = self.env["product.product"].browse() cdomain = self._match_company_domain() if product_dict.get("barcode"): - domain = expression.AND( + domain = Domain.AND( [ cdomain, - [ - "|", - ("barcode", "=", product_dict["barcode"]), - ("packaging_ids.barcode", "=", product_dict["barcode"]), - ], + Domain("barcode", "=", product_dict["barcode"]), ] ) product = product.search(domain, limit=1) if not product and product_dict.get("code"): - # TODO: this domain could be probably included in the former one - domain = expression.AND( + domain = Domain.AND( [ cdomain, - [ - "|", - ("barcode", "=", product_dict["code"]), - ("default_code", "=", product_dict["code"]), - ], + Domain.OR( + [ + Domain("barcode", "=", product_dict["code"]), + Domain("default_code", "=", product_dict["code"]), + ] + ), ] ) product = product.search(domain, limit=1) @@ -735,7 +750,9 @@ def _match_product_search(self, product_dict): @api.model def _match_company_domain(self): - company_ids = self._context.get("allowed_company_ids") or [self.env.company.id] + company_ids = self.env.context.get("allowed_company_ids") or [ + self.env.company.id + ] return [("company_id", "in", company_ids + [False])] @api.model @@ -759,7 +776,7 @@ def _match_currency( return currency if currency_dict.get("iso"): currency_iso = currency_dict["iso"].upper() - currency = rco.search([("name", "=", currency_iso)], limit=1) + currency = rco.search(Domain("name", "=", currency_iso), limit=1) if currency: return currency else: @@ -767,34 +784,36 @@ def _match_currency( "_match_currency", currency_dict, self.env._( - "The analysis of the business document returned '%s' as " + "The analysis of the business document returned '%(code)s' as " "the currency ISO code. But there are no currency " - "with that code in Odoo." - ) - % currency_iso, + "with that code in Odoo.", + code=currency_iso, + ), chatter_msg, raise_exception, ) if currency_dict.get("symbol"): - currencies = rco.search([("symbol", "=", currency_dict["symbol"])]) + currencies = rco.search(Domain("symbol", "=", currency_dict["symbol"])) if len(currencies) == 1: return currencies else: chatter_msg.append( self.env._( - "The analysis of the business document returned '%s' as " - "the currency symbol. But there are none or several " - "currencies with that symbol in Odoo." + "The analysis of the business document returned " + "'%(symbol)s' as the currency symbol. " + "But there are none or several " + "currencies with that symbol in Odoo.", + symbol=currency_dict["symbol"], ) - % currency_dict["symbol"] ) if currency_dict.get("iso_or_symbol"): currencies = rco.search( - [ - "|", - ("name", "=", currency_dict["iso_or_symbol"].upper()), - ("symbol", "=", currency_dict["iso_or_symbol"]), - ] + Domain.OR( + [ + Domain("name", "=", currency_dict["iso_or_symbol"].upper()), + Domain("symbol", "=", currency_dict["iso_or_symbol"]), + ] + ) ) if len(currencies) == 1: return currencies[0] @@ -803,9 +822,10 @@ def _match_currency( "_match_currency", currency_dict, self.env._( - "The analysis of the business document returned '%(code)s' as " - "the currency symbol or ISO code. But there are none or " - "several currencies with the symbol/ISO code in Odoo.", + "The analysis of the business document " + "returned '%(code)s' as the currency symbol or ISO code. " + "But there are none or several currencies " + "with the symbol/ISO code in Odoo.", code=currency_dict["iso_or_symbol"], ), chatter_msg, @@ -814,7 +834,7 @@ def _match_currency( if currency_dict.get("country_code"): country_code = currency_dict["country_code"] country = self.env["res.country"].search( - [("code", "=", country_code)], limit=1 + Domain("code", "=", country_code), limit=1 ) if country: if country.currency_id: @@ -824,10 +844,10 @@ def _match_currency( "_match_currency", currency_dict, self.env._( - "The analysis of the business document returned '%(code)s' " - "as the country code to find the related currency. " - "But the country '%(name)s' doesn't have any related " - "currency configured in Odoo.", + "The analysis of the business document " + "returned '%(code)s' as the country code to find " + "the related currency. But the country '%(name)s'" + "doesn't have any related currency configured in Odoo.", code=country_code, name=country.name, ), @@ -839,28 +859,31 @@ def _match_currency( "_match_currency", currency_dict, self.env._( - "The analysis of the business document returned '%s' " + "The analysis of the business document returned '%(code)s' " "as the country code to find the related currency. " - "But there is no country with that code in Odoo." - ) - % country_code, + "But there is no country with that code in Odoo.", + code=country_code, + ), chatter_msg, raise_exception, ) if company is None: if ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 ): company = self.env["res.company"].browse( - self._context["allowed_company_ids"][0] + self.env.context["allowed_company_ids"][0] ) else: company = self.env.company company_cur = company.currency_id chatter_msg.append( - self.env._("No currency specified, so Odoo used the company currency (%s)") - % company_cur.name + self.env._( + "No currency specified, so Odoo used " + "the company currency (%(currency)s)", + currency=company_cur.name, + ) ) return company_cur @@ -883,11 +906,11 @@ def _match_uom(self, uom_dict, chatter_msg, product=False, raise_exception=False # Map NIU to Unit if uom_dict["unece_code"] == "NIU": uom_dict["unece_code"] = "C62" - uom = uuo.search([("unece_code", "=", uom_dict["unece_code"])], limit=1) + uom = uuo.search(Domain("unece_code", "=", uom_dict["unece_code"]), limit=1) if uom: return uom if uom_dict.get("name"): - uom = uuo.search([("name", "=ilike", uom_dict["name"] + "%")], limit=1) + uom = uuo.search(Domain("name", "=ilike", uom_dict["name"] + "%"), limit=1) if uom: return uom if product: @@ -952,9 +975,9 @@ def _prepare_match_tax_domain( ato = self.env["account.tax"] if company is None: company_id = ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 - and self._context["allowed_company_ids"][0] + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 + and self.env.context["allowed_company_ids"][0] or self.env.company.id ) else: @@ -985,8 +1008,8 @@ def _prepare_match_tax_domain( tax_dict["unece_due_date_code"] ) if tax_exigibility: - domain = expression.AND( - [domain, [("tax_exigibility", "=", tax_exigibility)]] + domain = Domain.AND( + [domain, Domain("tax_exigibility", "=", tax_exigibility)] ) return domain @@ -1114,19 +1137,19 @@ def compare_lines( if not eline.get("product"): chatter_msg.append( self.env._( - "The existing line '%s' doesn't have any product, " - "so the lines haven't been updated." + "The existing line '%(name)s' doesn't have any product, " + "so the lines haven't been updated.", + name=eline.get("name"), ) - % eline.get("name") ) return False if eline["product"] in existing_lines_dict: chatter_msg.append( self.env._( - "The product '%s' is used on several existing " - "lines, so the lines haven't been updated." + "The product '%(product)s' is used on several existing " + "lines, so the lines haven't been updated.", + product=eline["product"].display_name, ) - % eline["product"].display_name ) return False existing_lines_dict[eline["product"]] = eline @@ -1150,10 +1173,10 @@ def compare_lines( if product in unique_import_products: chatter_msg.append( self.env._( - "The product '%s' is used on several imported lines, " - "so the lines haven't been updated." + "The product '%(product)s' is used on several imported lines, " + "so the lines haven't been updated.", + product=product.display_name, ) - % product.display_name ) return False unique_import_products.append(product) @@ -1214,15 +1237,15 @@ def _prepare_order_line_update_values( def _prepare_account_speed_dict(self, company=None): if company is None: company_id = ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 - and self._context["allowed_company_ids"][0] + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 + and self.env.context["allowed_company_ids"][0] or self.env.company.id ) else: company_id = company.id res = self.env["account.account"].search_read( - [("company_ids", "=", company_id), ("deprecated", "=", False)], + Domain("company_ids", "=", company_id), ["code"], ) speed_dict = {} @@ -1296,15 +1319,15 @@ def _match_account( def _prepare_analytic_account_speed_dict(self, company=None): if company is None: company_id = ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 - and self._context["allowed_company_ids"][0] + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 + and self.env.context["allowed_company_ids"][0] or self.env.company.id ) else: company_id = company.id res = self.env["account.analytic.account"].search_read( - [("company_id", "in", [company_id, False])], ["code"] + Domain("company_id", "in", [company_id, False]), ["code"] ) speed_dict = {} for line in res: @@ -1357,15 +1380,15 @@ def _match_analytic_account( def _prepare_journal_speed_dict(self, company=None): if company is None: company_id = ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 - and self._context["allowed_company_ids"][0] + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 + and self.env.context["allowed_company_ids"][0] or self.env.company.id ) else: company_id = company.id res = self.env["account.journal"].search_read( - [("company_id", "=", company_id)], ["code"] + Domain("company_id", "=", company_id), ["code"] ) speed_dict = {} for line in res: @@ -1429,11 +1452,12 @@ def _match_incoterm(self, incoterm_dict, chatter_msg, raise_exception=True): return incoterm if incoterm_dict.get("code"): incoterm = aio.search( - [ - "|", - ("name", "=ilike", incoterm_dict["code"]), - ("code", "=ilike", incoterm_dict["code"]), - ], + Domain.OR( + [ + Domain("name", "=ilike", incoterm_dict["code"]), + Domain("code", "=ilike", incoterm_dict["code"]), + ] + ), limit=1, ) if incoterm: @@ -1443,9 +1467,10 @@ def _match_incoterm(self, incoterm_dict, chatter_msg, raise_exception=True): "_match_incoterm", incoterm_dict, self.env._( - "Could not find any Incoterm in Odoo corresponding to '%s'" - ) - % incoterm_dict["code"], + "Could not find any Incoterm in Odoo " + "corresponding to '%(code)s'", + code=incoterm_dict["code"], + ), chatter_msg, raise_exception, ) @@ -1459,11 +1484,11 @@ def _check_company( company_dict = {} if company is None: if ( - self._context.get("allowed_company_ids") - and len(self._context["allowed_company_ids"]) == 1 + self.env.context.get("allowed_company_ids") + and len(self.env.context["allowed_company_ids"]) == 1 ): company = self.env["res.company"].browse( - self._context["allowed_company_ids"][0] + self.env.context["allowed_company_ids"][0] ) else: company = self.env.company @@ -1519,7 +1544,9 @@ def post_create_or_update(self, parsed_dict, record, doc_filename=None): record.write({"import_warnings": import_warnings}) if parsed_dict.get("note"): if doc_filename: - msg = self.env._("Notes in file %s:") % doc_filename + msg = self.env._( + "Notes in file %(filename)s:", filename=doc_filename + ) else: msg = self.env._("Notes in imported document:") record.message_post( # pylint: disable=translation-required diff --git a/base_business_document_import/static/description/index.html b/base_business_document_import/static/description/index.html index c013152498..3f074f7591 100644 --- a/base_business_document_import/static/description/index.html +++ b/base_business_document_import/static/description/index.html @@ -374,7 +374,7 @@

                  Base Business Document Import

                  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! source digest: sha256:1655613e930925e97993fa33290eed4b1d146afff0ed7e59edb9854edf0ed2d6 !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

                  Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

                  +

                  Beta License: AGPL-3 OCA/edi Translate me on Weblate Try me on Runboat

                  This is a technical module ; it doesn’t bring any useful feature by itself. This module is the base modules for 2 other modules :

                    @@ -404,7 +404,7 @@

                    Bug Tracker

                    Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed -feedback.

                    +feedback.

                    Do not contact contributors directly about support or help with technical issues.

                    @@ -437,7 +437,7 @@

                    Maintainers

                    promote its widespread use.

                    Current maintainer:

                    alexis-via

                    -

                    This module is part of the OCA/edi project on GitHub.

                    +

                    This module is part of the OCA/edi project on GitHub.

                    You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

                    diff --git a/base_business_document_import/tests/test_business_document_import.py b/base_business_document_import/tests/test_business_document_import.py index 8b452b1e4d..d4881bc88f 100644 --- a/base_business_document_import/tests/test_business_document_import.py +++ b/base_business_document_import/tests/test_business_document_import.py @@ -5,6 +5,7 @@ import logging +from odoo import Command from odoo.exceptions import UserError from odoo.tests import tagged from odoo.tests.common import TransactionCase @@ -14,28 +15,87 @@ @tagged("post_install", "-at_install") class TestBaseBusinessDocumentImport(TransactionCase): + @classmethod + def setUpClass(cls): + super().setUpClass() + cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True)) + cls.Account = cls.env["account.account"] + cls.AccountTax = cls.env["account.tax"] + cls.bdio = cls.env["business.document.import"] + cls.Partner = cls.env["res.partner"] + cls.PartnerBank = cls.env["res.partner.bank"] + cls.Product = cls.env["product.product"] + cls.France = cls.env.ref("base.fr") + cls.usd = cls.env.ref("base.USD") + cls.eur = cls.env.ref("base.EUR") + cls.krw = cls.env.ref("base.KRW") + cls.vat_tax_type = cls.env.ref("account_tax_unece.tax_type_vat") + cls.s_tax_categ = cls.env.ref("account_tax_unece.tax_categ_s") + cls.service_product = cls.Product.create( + { + "name": "Virtual Interior Design", + "type": "service", + "uom_id": cls.env.ref("uom.product_uom_hour").id, + } + ) + cls.consu_product = cls.Product.create( + { + "name": "Office Chair", + "type": "consu", + "uom_id": cls.env.ref("uom.product_uom_unit").id, + "default_code": "FURN_77779", + } + ) + cls.partner_acme_corp = cls.Partner.create( + { + "name": "Acme Corporation", + "email": "acme_corp@yourcompany.example.com", + "is_company": True, + } + ) + cls.cash_basis_transfer_account = cls.Account.create( + { + "code": "cash.basis.transfer.account", + "name": "cash_basis_transfer_account", + "account_type": "income", + "reconcile": True, + } + ) + cls.pound = cls.env["uom.uom"].create( + { + "name": "pnd", + "relative_factor": 454, + "relative_uom_id": cls.env.ref("uom.product_uom_gram").id, + } + ) + def test_match_partner(self): - partner1 = self.env["res.partner"].create( + partner1 = self.Partner.create( {"name": "COGIP", "ref": "COGIP", "website": "http://example.com/"} ) - bdio = self.env["business.document.import"] + partner_ready_mat = self.Partner.create( + { + "name": "Ready Match", + "is_company": True, + "email": "ready.mat28@example.com", + } + ) # match on domain extracted from email with warning partner_dict = {"email": "alexis.delattre@example.com"} warn = [] - res = bdio._match_partner(partner_dict, warn, partner_type=False) + res = self.bdio._match_partner(partner_dict, warn, partner_type=False) self.assertEqual(res, partner1) self.assertTrue(warn) - partner_dict = {"name": "ready mat "} - partner_ready_mat = self.env.ref("base.res_partner_4") + partner_dict = {"name": "ready match "} partner_ready_mat.supplier_rank = 1 # to be considered as a supplier - res = bdio._match_partner(partner_dict, [], partner_type="supplier") + res = self.bdio._match_partner(partner_dict, [], partner_type="supplier") self.assertEqual(res, partner_ready_mat) partner_dict = {"ref": "COGIP"} - res = bdio._match_partner(partner_dict, [], partner_type=False) + res = self.bdio._match_partner(partner_dict, [], partner_type=False) self.assertEqual(res, partner1) def test_direct_match_recordset(self): - partner = self.env["res.partner"].create( + partner = self.Partner.create( { "name": "Alexis Delattre", "email": "alexis.delattre@example.com", @@ -45,20 +105,17 @@ def test_direct_match_recordset(self): partner_dict = { "recordset": partner, } - bdio = self.env["business.document.import"] - partner_match = bdio._direct_match(partner_dict, self.env["res.partner"], True) + partner_match = self.bdio._direct_match(partner_dict, self.Partner, True) self.assertEqual(partner, partner_match) with self.assertRaises(UserError): - bdio._direct_match(partner_dict, self.env["res.partner.bank"], True) + self.bdio._direct_match(partner_dict, self.PartnerBank, True) - partner_match = bdio._direct_match( - partner_dict, self.env["res.partner.bank"], False - ) + partner_match = self.bdio._direct_match(partner_dict, self.PartnerBank, False) self.assertEqual(None, partner_match) def test_direct_match_id(self): - partner = self.env["res.partner"].create( + partner = self.Partner.create( { "name": "Alexis Delattre", "email": "alexis.delattre@example.com", @@ -68,45 +125,42 @@ def test_direct_match_id(self): partner_dict = { "id": partner.id, } - bdio = self.env["business.document.import"] - partner_match = bdio._direct_match(partner_dict, self.env["res.partner"], True) + partner_match = self.bdio._direct_match(partner_dict, self.Partner, True) self.assertEqual(partner, partner_match) partner_dict = { "id": 234234234234231, } with self.assertRaises(UserError): - bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.bdio._direct_match(partner_dict, self.Partner, True) def test_direct_match_xmlid(self): partner_dict = { "xmlid": "i.dont.exist.odoo", } - bdio = self.env["business.document.import"] with self.assertRaises(UserError): - bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.bdio._direct_match(partner_dict, self.Partner, True) partner_dict = { "xmlid": "base.fr", } with self.assertRaises(UserError): - bdio._direct_match(partner_dict, self.env["res.partner"], True) + self.bdio._direct_match(partner_dict, self.Partner, True) partner_dict = { "xmlid": "base.main_partner", } - partner = bdio._direct_match(partner_dict, self.env["res.partner"], True) + partner = self.bdio._direct_match(partner_dict, self.Partner, True) self.assertEqual(partner.id, self.env.ref("base.main_partner").id) def test_match_partner_ref(self): - partner1 = self.env["res.partner"].create( + partner1 = self.Partner.create( { "name": "Alexis Delattre", "email": "alexis.delattre@example.com", "ref": "C1242", } ) - bdio = self.env["business.document.import"] partner_dict = { "name": "Alexis Delattre", "email": "alexis.delattre@example.com", @@ -115,30 +169,29 @@ def test_match_partner_ref(self): chatter_msg = [] domain = [] order = "" - partner = bdio._match_partner_ref(partner_dict, chatter_msg, domain, order) + partner = self.bdio._match_partner_ref(partner_dict, chatter_msg, domain, order) self.assertEqual(partner, partner1) def test_match_partner_contact(self): - partner_email = self.env["res.partner"].create( + partner_email = self.Partner.create( { "email": "alexis.email@example.com", "name": "Alexis email", } ) - partner_contact = self.env["res.partner"].create( + partner_contact = self.Partner.create( { "email": "alexis.name@example.com", "name": "Alexis name", } ) - partner_phone = self.env["res.partner"].create( + partner_phone = self.Partner.create( { "email": "alexis.phone@example.com", "phone": "01.41.98.12.42", "name": "Alexis phone", } ) - bdio = self.env["business.document.import"] chatter_msg = [] domain = [] order = "" @@ -147,14 +200,18 @@ def test_match_partner_contact(self): "name": "Alexis email", "email": "alexis.email@example.com", } - partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + partner = self.bdio._match_partner_contact( + partner_dict, chatter_msg, domain, order + ) self.assertEqual(partner, partner_email) partner_dict = { "contact": "Alexis name", "email": "alexis.name@example.com", } - partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + partner = self.bdio._match_partner_contact( + partner_dict, chatter_msg, domain, order + ) self.assertEqual(partner, partner_contact) partner_dict = { @@ -162,17 +219,18 @@ def test_match_partner_contact(self): "email": "alexis.phone@example.com", "phone": "01.41.98.12.42", } - partner = bdio._match_partner_contact(partner_dict, chatter_msg, domain, order) + partner = self.bdio._match_partner_contact( + partner_dict, chatter_msg, domain, order + ) self.assertEqual(partner, partner_phone) def test_match_partner_name(self): - partner_name = self.env["res.partner"].create( + partner_name = self.Partner.create( { "email": "alexis.name@example.com", "name": "Alexis name", } ) - bdio = self.env["business.document.import"] chatter_msg = [] domain = [] order = "" @@ -181,50 +239,50 @@ def test_match_partner_name(self): "name": "Alexis name", "email": "alexis.name@example.com", } - partner = bdio._match_partner_name(partner_dict, chatter_msg, domain, order) + partner = self.bdio._match_partner_name( + partner_dict, chatter_msg, domain, order + ) self.assertEqual(partner, partner_name) def test_get_partner_website_domain(self): - bdio = self.env["business.document.import"] - www_website = {"website": "www.example.com"} - website_domain = bdio._get_partner_website_domain(www_website) + website_domain = self.bdio._get_partner_website_domain(www_website) self.assertEqual(website_domain, "example.com") - no_website = bdio._get_partner_website_domain({}) + no_website = self.bdio._get_partner_website_domain({}) self.assertEqual(False, no_website) https_www_website = {"website": "https://www.example.com"} - website_domain = bdio._get_partner_website_domain(https_www_website) + website_domain = self.bdio._get_partner_website_domain(https_www_website) self.assertEqual(website_domain, "example.com") https_website = {"website": "https://example.com"} - website_domain = bdio._get_partner_website_domain(https_website) + website_domain = self.bdio._get_partner_website_domain(https_website) self.assertEqual(website_domain, "example.com") https_path_website = {"website": "https://subdomain.example.com/bla/bla"} - website_domain = bdio._get_partner_website_domain(https_path_website) + website_domain = self.bdio._get_partner_website_domain(https_path_website) self.assertEqual(website_domain, "example.com") https_big_subdomain_website = { "website": "https://just.a.big.subdomain.example.com" } - website_domain = bdio._get_partner_website_domain(https_big_subdomain_website) + website_domain = self.bdio._get_partner_website_domain( + https_big_subdomain_website + ) self.assertEqual(website_domain, "example.com") def test_match_shipping_partner(self): - rpo = self.env["res.partner"] - bdio = self.env["business.document.import"] - partner1 = rpo.create( + partner1 = self.Partner.create( { "name": "Akretion France", "street": "27 rue Henri Rolland", "zip": "69100", - "country_id": self.env.ref("base.fr").id, + "country_id": self.France.id, "email": "contact@akretion.com", } ) - rpo.create( + self.Partner.create( { "parent_id": partner1.id, "name": "Sébastien BEAU", @@ -232,7 +290,7 @@ def test_match_shipping_partner(self): "type": "contact", } ) - cpartner3 = rpo.create( + cpartner3 = self.Partner.create( { "parent_id": partner1.id, "name": "Flo", @@ -240,36 +298,36 @@ def test_match_shipping_partner(self): "street": "42 rue des lilas d'Espagne", "zip": "92400", "city": "Courbevoie", - "country_id": self.env.ref("base.fr").id, + "country_id": self.France.id, "type": "invoice", } ) shipping_dict = { "email": "contact@akretion.com", } - res = bdio._match_shipping_partner(shipping_dict, None, []) + res = self.bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, partner1) shipping_dict = { "street": "42 rue des lilas d'Espagne", "zip": "92400", "country_code": "fr", } - res = bdio._match_shipping_partner(shipping_dict, None, []) + res = self.bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, cpartner3) shipping_dict["zip"] = "92500" with self.assertRaises(UserError): - bdio._match_shipping_partner(shipping_dict, None, []) + self.bdio._match_shipping_partner(shipping_dict, None, []) - no_error = bdio._match_shipping_partner( + no_error = self.bdio._match_shipping_partner( shipping_dict, None, [], raise_exception=False ) self.assertEqual(no_error, None) - partner2 = rpo.create( + partner2 = self.Partner.create( { "name": "Alex Corp", "zip": "69009", - "country_id": self.env.ref("base.fr").id, + "country_id": self.France.id, "email": "contact@alex.com", } ) @@ -278,82 +336,81 @@ def test_match_shipping_partner(self): "zip": "69009", "country_code": "FR", } - res = bdio._match_shipping_partner(shipping_dict, None, []) + res = self.bdio._match_shipping_partner(shipping_dict, None, []) self.assertEqual(res, partner2) def test_match_currency(self): - bdio = self.env["business.document.import"] currency_dict = {"xmlid": "base.USD"} - res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.USD")) + res = self.bdio._match_currency(currency_dict, []) + self.assertEqual(res, self.usd) first_cur = self.env["res.currency"].search([], limit=1) currency_dict = {"id": first_cur.id} - res = bdio._match_currency(currency_dict, []) + res = self.bdio._match_currency(currency_dict, []) self.assertEqual(res, first_cur) currency_dict = {"recordset": first_cur} - res = bdio._match_currency(currency_dict, []) + res = self.bdio._match_currency(currency_dict, []) self.assertEqual(res, first_cur) currency_dict = {"iso": "EUR"} - res = bdio.with_context(active_test=False)._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.EUR")) + res = self.bdio.with_context(active_test=False)._match_currency( + currency_dict, [] + ) + self.assertEqual(res, self.eur) currency_dict = {"symbol": "€"} - res = bdio.with_context(active_test=False)._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.EUR")) + res = self.bdio.with_context(active_test=False)._match_currency( + currency_dict, [] + ) + self.assertEqual(res, self.eur) currency_dict = {"country_code": "fr "} - res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.EUR")) + res = self.bdio._match_currency(currency_dict, []) + self.assertEqual(res, self.eur) currency_dict = {"iso_or_symbol": "€"} - res = bdio.with_context(active_test=False)._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.EUR")) - currency_id = self.env.ref("base.KRW").id + res = self.bdio.with_context(active_test=False)._match_currency( + currency_dict, [] + ) + self.assertEqual(res, self.eur) + currency_id = self.krw.id self.cr.execute( "UPDATE res_company SET currency_id = %s WHERE id = 1", (currency_id,) ) currency_dict = {} - res = bdio._match_currency(currency_dict, []) - self.assertEqual(res, self.env.ref("base.KRW")) + res = self.bdio._match_currency(currency_dict, []) + self.assertEqual(res, self.krw) def test_match_product(self): - bdio = self.env["business.document.import"] - ppo = self.env["product.product"] + ppo = self.Product product1 = ppo.create( { "name": "Test Product", "barcode": "9782203121102", "seller_ids": [ - ( - 0, - 0, + Command.create( { - "partner_id": self.env.ref("base.res_partner_2").id, + "partner_id": self.partner_acme_corp.id, "product_code": "TEST1242", }, ), ], - "packaging_ids": [(0, 0, {"name": "Big Pack", "barcode": "BIG-PACK"})], } ) # Match by code - product_dict = {"code": "FURN_7777 "} - res = bdio._match_product(product_dict, []) - self.assertEqual(res, self.env.ref("product.product_delivery_01")) + product_dict = {"code": "FURN_77779 "} + res = self.bdio._match_product(product_dict, []) + self.assertEqual(res, self.consu_product) # Match by barcode product_dict = {"barcode": "9782203121102"} - res = bdio._match_product(product_dict, []) - self.assertEqual(res, product1) - # Match by packaging barcode - product_dict = {"barcode": "BIG-PACK"} - res = bdio._match_product(product_dict, []) + res = self.bdio._match_product(product_dict, []) self.assertEqual(res, product1) + # Match by seller product_dict = {"code": "TEST1242"} - res = bdio._match_product( - product_dict, [], seller=self.env.ref("base.res_partner_2") + res = self.bdio._match_product( + product_dict, [], seller=self.partner_acme_corp.id ) self.assertEqual(res, product1) + raise_test = True try: - bdio._match_product(product_dict, [], seller=False) + self.bdio._match_product(product_dict, [], seller=False) raise_test = False except Exception: logger.info("Exception catched.") @@ -361,28 +418,27 @@ def test_match_product(self): self.assertTrue(raise_test) def test_match_uom(self): - bdio = self.env["business.document.import"] uom_dict = {"unece_code": "KGM"} - res = bdio._match_uom(uom_dict, []) + res = self.bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_kgm")) uom_dict = {"unece_code": "NIU"} - res = bdio._match_uom(uom_dict, []) + res = self.bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_unit")) uom_dict = {"name": "day"} - res = bdio._match_uom(uom_dict, []) + res = self.bdio._match_uom(uom_dict, []) self.assertEqual(res, self.env.ref("uom.product_uom_day")) - uom_dict = {"name": "lb"} - res = bdio._match_uom(uom_dict, []) - self.assertEqual(res, self.env.ref("uom.product_uom_lb")) + uom_dict = {"name": "pnd"} + res = self.bdio._match_uom(uom_dict, []) + self.assertEqual(res, self.pound) uom_dict = {} - product = self.env.ref("product.product_product_1") - res = bdio._match_uom(uom_dict, [], product=product) + product = self.service_product + res = self.bdio._match_uom(uom_dict, [], product=product) self.assertEqual(res, product.uom_id) def test_match_tax(self): # on purpose, I use a rate that doesn't exist # so that this test works even if the l10n_de is installed - de_tax_21 = self.env["account.tax"].create( + de_tax_21 = self.AccountTax.create( { "name": "German VAT purchase 18.0%", "description": "DE-VAT-buy-18.0", @@ -390,11 +446,11 @@ def test_match_tax(self): "amount": 18, "amount_type": "percent", "tax_exigibility": "on_invoice", - "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, - "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + "unece_type_id": self.vat_tax_type.id, + "unece_categ_id": self.s_tax_categ.id, } ) - de_tax_21_onpayment = self.env["account.tax"].create( + de_tax_21_onpayment = self.AccountTax.create( { "name": "German VAT purchase 18.0% (On Payment)", "description": "DE-VAT-buy-18.0", @@ -402,11 +458,12 @@ def test_match_tax(self): "amount": 18, "amount_type": "percent", "tax_exigibility": "on_payment", - "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, - "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + "unece_type_id": self.vat_tax_type.id, + "unece_categ_id": self.s_tax_categ.id, + "cash_basis_transition_account_id": self.cash_basis_transfer_account.id, } ) - de_tax_21_ttc = self.env["account.tax"].create( + de_tax_21_ttc = self.AccountTax.create( { "name": "German VAT purchase 18.0% TTC", "description": "DE-VAT-buy-18.0-TTC", @@ -415,11 +472,10 @@ def test_match_tax(self): "amount": 18, "amount_type": "percent", "tax_exigibility": "on_invoice", - "unece_type_id": self.env.ref("account_tax_unece.tax_type_vat").id, - "unece_categ_id": self.env.ref("account_tax_unece.tax_categ_s").id, + "unece_type_id": self.vat_tax_type.id, + "unece_categ_id": self.s_tax_categ.id, } ) - bdio = self.env["business.document.import"] tax_dict = { "amount_type": "percent", "amount": 18, @@ -427,47 +483,46 @@ def test_match_tax(self): "unece_categ_code": "S", "unece_due_date_code": "5", } - res = bdio._match_tax(tax_dict, [], type_tax_use="purchase") + res = self.bdio._match_tax(tax_dict, [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) tax_dict.pop("unece_categ_code") - res = bdio._match_tax(tax_dict, [], type_tax_use="purchase") + res = self.bdio._match_tax(tax_dict, [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) - res = bdio._match_tax(tax_dict, [], type_tax_use="purchase", price_include=True) + res = self.bdio._match_tax( + tax_dict, [], type_tax_use="purchase", price_include=True + ) self.assertEqual(res, de_tax_21_ttc) - res = bdio._match_taxes([tax_dict], [], type_tax_use="purchase") + res = self.bdio._match_taxes([tax_dict], [], type_tax_use="purchase") self.assertEqual(res, de_tax_21) - res = bdio._match_taxes( + res = self.bdio._match_taxes( [dict(tax_dict, unece_due_date_code=72)], [], type_tax_use="purchase" ) self.assertEqual(res, de_tax_21_onpayment) def test_match_account_exact(self): - bdio = self.env["business.document.import"] - acc = self.env["account.account"].create( + acc = self.Account.create( { "name": "Test 898999", "code": "898999", "account_type": "expense", } ) - res = bdio._match_account({"code": "898999"}, []) + res = self.bdio._match_account({"code": "898999"}, []) self.assertEqual(acc, res) def test_match_account_bigger_in(self): - bdio = self.env["business.document.import"] - acc = self.env["account.account"].create( + acc = self.Account.create( { "name": "Test 898999", "code": "898999", "account_type": "expense", } ) - res = bdio._match_account({"code": "89899900"}, []) + res = self.bdio._match_account({"code": "89899900"}, []) self.assertEqual(acc, res) def test_match_account_smaller_in(self): - bdio = self.env["business.document.import"] - acc = self.env["account.account"].create( + acc = self.Account.create( { "name": "Test 89899910", "code": "89899910", @@ -475,6 +530,6 @@ def test_match_account_smaller_in(self): } ) chatter = [] - res = bdio._match_account({"code": "898999"}, chatter) + res = self.bdio._match_account({"code": "898999"}, chatter) self.assertEqual(acc, res) self.assertEqual(len(chatter), 1)