OCA / edi

GNU Affero General Public License v3.0
116 stars 299 forks source link

[15.0][ADD] account_edi_simple_pdf #959

Open hbrunn opened 3 months ago

hbrunn commented 3 months ago

this is account_invoice_import_simple_pdf but then plugged into Odoo's existing invoice import mechanism.

Missing:

I've started this as a spiritual successor of account_invoice_import_simple_pdf, that's why I preserved the commits, and prepared for possibly having both - we'd have to move the configuration and the mixin to its own module on which both depend and just apply the mixin. But now I'm unsure, as those functionalities conflict, so coexistence doesn't really seem an option to me.

What do reviewers think?

  1. keep history, this will cause problems for a migration of account_invoice_import_simple_pdf
  2. remove history, don't try to be compatible with a future account_invoice_import_simple_pdf migration
pedrobaeza commented 3 months ago

@hbrunn check this that we are cooking that is very generic for any possible document: https://github.com/Tecnativa/edi/tree/15.0-add-base_import_pdf_simple/base_import_pdf_simple

We have started it for importing sales orders, but it can serve for anything

We'll propose it to OCA soon.

hbrunn commented 3 months ago

oh that looks interesting, thanks. The readme is hard to read for me though ;-)

Thing is, @alexis-via's code is time proven and my customer is used to it, they just want to have that in their v15 instance too. And rather now than soon. I don't see a problem having account_edi_simple_pdf now and a possible import_pdf_simple_account_move (what will this depend on? account_edi or account_invoice_import?) next to each other here. Maybe a word or two about the differences between them might be helpful when we've come so far.

We do already keep the account_import* stack and the parallel facturx import here, so more choice, the merrier I'd say. Actually for facturx a comparison in the repo's/module's readme would be very helpful too, I can't tell a customer from the top off my head why they should use the OCA version instead of the core one.

@alexis-via what's your take on keeping the history here? And would you prefer me to disentangle this completely from account_invoice_import_simple_pdf whenever this lands in v15, or prepare for sharing most of the code?

pedrobaeza commented 3 months ago

The problem with existing *_simple_import* module is that it doesn't handle properly multi-lines import with all the needed fields. We have already tackled this in a generic way to serve to import sales order, purchase orders, invoices...

jans23 commented 2 months ago

Is this used by the ordinary Upload button?

grafik

hbrunn commented 2 months ago

yes, watch your logs for messages about recognizing a partner, and further messages

pedrobaeza commented 2 months ago

Another approach to try is #964

The fetchmail/import gateway is very simple to be added.

jans23 commented 2 months ago

When trying the test upload within Contact's tab "Vendor Bill Import" I get the following error while when trying to import the same invoice within Invoicing -> Vendors -> Bills, Upload button I get useful messages such as "Missing invoice number format configuration on partner". For me this makes the test upload functionality useless.

RPC_ERROR
Odoo Server Error
Traceback (most recent call last):
  File "/srv/odoo/odoo/parts/odoo/odoo/addons/base/models/ir_http.py", line 242, in _dispatch
    result = request.dispatch()
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 702, in dispatch
    result = self._call_function(**self.params)
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 368, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/srv/odoo/odoo/parts/odoo/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 357, in checked_call
    result = self.endpoint(*a, **kw)
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 925, in __call__
    return self.method(*args, **kw)
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 546, in response_wrap
    response = f(*args, **kw)
  File "/tmp/addons/web/controllers/main.py", line 1328, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/tmp/addons/web/controllers/main.py", line 1316, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/srv/odoo/odoo/parts/odoo/odoo/api.py", line 471, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/srv/odoo/odoo/parts/odoo/odoo/api.py", line 456, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/tmp/addons/account_edi_simple_pdf/models/res_partner.py", line 194, in pdf_simple_test_run
    aiio = self.env["account.invoice.import"]
  File "/srv/odoo/odoo/parts/odoo/odoo/api.py", line 553, in __getitem__
    return self.registry[model_name]._browse(self, (), ())
  File "/srv/odoo/odoo/parts/odoo/odoo/modules/registry.py", line 182, in __getitem__
    return self.models[model_name]
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 658, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/srv/odoo/odoo/parts/odoo/odoo/http.py", line 301, in _handle_exception
    raise exception.with_traceback(None) from new_cause
KeyError: 'account.invoice.import'
jans23 commented 1 month ago

account_invoice_import_simple_pdf allows to define Invoice Import Configurations. I don't find such option with this module. Where can I find it or is it obsolete? I want to define the vendor's account.

grafik

hbrunn commented 1 month ago

@jans23 thanks for your input. Note however that this is a draft and not really ready for review, even though it (mostly) works for my customer already the way they need it to. I mainly wanted to start a discussion about the future of invoice import in Odoo/OCA.

Regarding your question about import configurations: That's part of the account_invoice_import framework which is migrated in https://github.com/OCA/edi/pull/668 but stalled for quite a while. So won't happen here. I can however imagine adding a product to use for the one imported line per invoice on the partner form, to allow custom accounts/taxes per partner.