-
-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[MIG] 11.0: base_business_document_import #42
[MIG] 11.0: base_business_document_import #42
Conversation
…voice 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
Adapt module account_invoice_import_ubl to use the new base_ubl module Small fixes
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)
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
Add unitests in base_business_document_import Small code enhancements/simplifications
Code cleanup/minor changes
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
Add support for partner bank matching on invoice update (before, it was only supported on invoice creation)
[FIX] LINT Use try/except when importing external libs Remove self.ensure_one() that has nothing to do in an api.model method
Rename __openerp__.py to __manifest__.py and set installable to False
Add match for accounts and journals
Improve match for journals and accounts
Also port all the modules that generate the XML documents: account_invoice_ubl, account_invoice_zugferd, purchase_order_ubl and sale_order_ubl
Note: it requires this fix on odoo 10: odoo/odoo#15649
… module Fix spelling mistake and other remarks on README by Tarteo
…o v10.0 base_business_document_import: Add support for the creation of res.bank
Add support for insertion of title in error messages
Add method to create SO in sale.order.import accessible via JSON-RPC
@alexis-via @hbrunn I don't know what to do for this lint error .. it seems to be ok like this ?
|
@njeudy The lint `C8107(translation-required)' is a beta one (don't affect the travis build result) and have a issue related OCA/pylint-odoo#187 The real lint red is because flake8 lints: base_business_document_import/models/business_document_import.py:262:16: F821 undefined name 'e'
base_business_document_import/models/business_document_import.py:844:24: F821 undefined name 'e'
base_business_document_import/models/business_document_import.py:846:16: F821 undefined name 'e'
base_business_document_import/tests/test_business_document_import.py:137:16: F821 undefined name 'e' |
9e7703f
to
162d69d
Compare
Coverage remained the same at 53.604% when pulling 162d69dbdc4b66045600cb97872d401a51b7fceb on njeudy:11-mig-base_business_document_import into b13c8e9 on OCA:11.0. |
netloc = urlp.netloc | ||
if not urlp.scheme and not netloc: | ||
netloc = urlp.path | ||
if netloc and netloc.split('.') >= 2: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should be:
if netloc and len(netloc.split('.')) >= 2:
otherwise I get this error:
Error:
Odoo Server Error
Traceback (most recent call last):
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 646, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 307, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 339, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 332, in checked_call
result = self.endpoint(*a, **kw)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 927, in __call__
return self.method(*args, **kw)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/http.py", line 512, in response_wrap
response = f(*args, **kw)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/addons/web/controllers/main.py", line 934, in call_button
action = self._call_kw(model, method, args, {})
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/addons/web/controllers/main.py", line 922, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/odoo-11.0/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/oca/account_invoice_import/wizard/account_invoice_import.py", line 401, in import_invoice
parsed_inv['partner'], parsed_inv['chatter_msg'])
File "/home/onestein/Pycharm/Gitlab/odoo-11.0/src/oca/base_business_document_import/models/business_document_import.py", line 134, in _match_partner
if netloc and netloc.split('.') >= 2:
TypeError: unorderable types: list() >= int()
885a709
to
fbeec83
Compare
logger.info('Trying to find an embedded XML file inside PDF') | ||
res = {} | ||
try: | ||
fd = StringIO(pdf_file) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you need BytesIO
here. I get an error otherwise, could you also check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@astirpe can you past error ? import test file are working ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I remember now...
There is a try
that prevents you to see any error.
So just place your debugger breakpoint on that line and notice that it always fails: it always enters the except
block, which simply says pass
. That's why you don't see any error.
BytesIO
seems fixing that behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok thanks. it's done
else: | ||
msg = _('<b>Notes in imported document:</b>') | ||
record.message_post( | ||
'%s %s' % (msg, parsed_dict['note'])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check this pylint:
base_business_document_import/models/business_document_import.py:870: [C8107(translation-required), BusinessDocumentImport.post_create_or_update] String parameter on "message_post" requires translation. Use _(('%s %s') % ((msg, parsed_dict['note'])))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
msg is already translated:
msg = _('Notes in imported document:') so, it's ok for me ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a case for # pylint: ignore=$errorname
I think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it's translated. Just making the pylint silent would be fine, as @hbrunn says. Is not a blocking issue anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hbrunn where i should add #pylint line ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 870
should be:
record.message_post( # pylint: disable=translation-required
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done :)
oca_dependencies.txt
Outdated
@@ -0,0 +1,3 @@ | |||
base_vat_sanitized https://github.com/OCA/partner-contact.git | |||
account_tax_unece https://github.com/onesteinbv/community-data-files 11_mig_account_tax_unece | |||
product_uom_unece https://github.com/OCA/community-data-files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All the modules in the dependencies are merged. You can rewrite the oca_dependencies.txt
using the definitive list of repositories.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok done, thanks @astirpe
53bd9e9
to
36eb65c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Only two minor comments, not blocking of course.
For me this module is ok to be merged.
'name': 'Akretion France', | ||
'ref': 'C1242', | ||
'phone': '01.41.98.12.42', | ||
'fax': '01.41.98.12.43', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The "Fax" field was removed, please remove this line as well.
'phone': '01.41.98.12.42', | ||
'fax': '01.41.98.12.43', | ||
} | ||
The keys 'phone' and 'fax' are used by the module |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please removed the 'fax' also here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you re right !!! done !
36eb65c
to
0810ed0
Compare
@moylop260 @hbrunn ready to merge this one ? |
FYI #54 |
No description provided.