contract icon indicating copy to clipboard operation
contract copied to clipboard

Automatic payment on generated invoices

Open valasule opened this issue 2 years ago • 6 comments

Is your feature request related to a problem? When invoices are automatically generated from a contract there does not appear to be a way for them to be paid automatically using payment information that is saved for the customer.

Describe the solution you'd like Allow payment information to be set on the backend or by the customer through the portal that can be saved and used for paying invoices generated by the contract system.

Additional context Really just looking for a simple recurring billing and payment solution and the OCA Contracts are almost there

valasule avatar Aug 31 '22 22:08 valasule

See module contract_payment_auto, present in 10.0 and in PR 798 for 12.0.

fcayre avatar Sep 01 '22 18:09 fcayre

See module contract_payment_auto, present in 10.0 and in PR 798 for 12.0.

I wasn't sure if that module would work on 14 as there wasn't much comment about it but I will toss it on my sandbox and see what happens.

valasule avatar Sep 01 '22 18:09 valasule

On version 14 I get the following error when I try to install that addon: Error: Odoo Server Error

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch result = self._call_function(**self.params) File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/http.py", line 347, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 912, in call return self.method(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 531, in response_wrap response = f(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1398, in call_button action = self._call_kw(model, method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1386, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 399, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 386, in _call_kw_multi result = method(recs, *args, **kwargs) File "", line 2, in button_immediate_install File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log return method(self, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 475, in button_immediate_install return self._button_immediate_function(type(self).button_install) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 593, in _button_immediate_function modules.registry.Registry.new(self._cr.dbname, update_module=True) File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 89, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 459, in load_modules processed_modules += load_marked_modules(cr, graph, File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 347, in load_marked_modules loaded, processed = load_module_graph( File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 179, in load_module_graph load_openerp_module(package.name) File "/usr/lib/python3/dist-packages/odoo/modules/module.py", line 385, in load_openerp_module import('odoo.addons.' + module_name) File "/opt/odoo/addons/contract_payment_auto/init.py", line 5, in from . import models File "/opt/odoo/addons/contract_payment_auto/models/init.py", line 5, in from . import account_analytic_account File "/opt/odoo/addons/contract_payment_auto/models/account_analytic_account.py", line 15, in class AccountAnalyticAccount(models.Model): File "/opt/odoo/addons/contract_payment_auto/models/account_analytic_account.py", line 28, in AccountAnalyticAccount @api.multi Exception

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

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception raise exception.with_traceback(None) from new_cause AttributeError: module 'odoo.api' has no attribute 'multi'

valasule avatar Sep 01 '22 18:09 valasule

I did a little search and it looks like specifying api.multi is no longer required as of version 13: https://github.com/odoo/odoo/commit/4b38cc6590abcb58a0ca102a06063eb3db7ac1f4#diff-2c418cb78b7c562a79e7032645a537d2

After removing the @api.multi as referenced in the link I get the following error:

Error: Odoo Server Error

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch result = request.dispatch() File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch result = self._call_function(**self.params) File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/http.py", line 347, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 912, in call return self.method(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 531, in response_wrap response = f(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1398, in call_button action = self._call_kw(model, method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1386, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 399, in call_kw result = _call_kw_multi(method, model, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 386, in _call_kw_multi result = method(recs, *args, **kwargs) File "", line 2, in button_immediate_install File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 74, in check_and_log return method(self, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 475, in button_immediate_install return self._button_immediate_function(type(self).button_install) File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_module.py", line 593, in _button_immediate_function modules.registry.Registry.new(self._cr.dbname, update_module=True) File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 89, in new odoo.modules.load_modules(registry._db, force_demo, status, update_module) File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 459, in load_modules processed_modules += load_marked_modules(cr, graph, File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 347, in load_marked_modules loaded, processed = load_module_graph( File "/usr/lib/python3/dist-packages/odoo/modules/loading.py", line 188, in load_module_graph model_names = registry.load(cr, package) File "/usr/lib/python3/dist-packages/odoo/modules/registry.py", line 232, in load model = cls._build_model(self, cr) File "/usr/lib/python3/dist-packages/odoo/models.py", line 554, in _build_model raise TypeError("Model %r does not exist in registry." % name) Exception

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

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception raise exception.with_traceback(None) from new_cause TypeError: Model 'account.analytic.contract' does not exist in registry.

Gonna try to track that one down after lunch

valasule avatar Sep 01 '22 18:09 valasule

@valasule modules have to be ported from one odoo version to another. See https://github.com/OCA/maintainer-tools/wiki/Migration-to-version-13.0 for instance. But this is another matter, I think you can close this ticket, and if you feel like porting the module to upper odoo versions, feel free to propose a PR.

fcayre avatar Sep 01 '22 19:09 fcayre

@fcayre sadly I am not a coder so I would probably write some pretty awful stuff in trying to do so. I am very good at test design, QA, and documentation so maybe there are some that would like to help out on this?

valasule avatar Sep 01 '22 20:09 valasule

@valasule Hi there. I've been working on this for a while but struggling to find time to complete. I have a working version on 15.0 and 16.0 but need some help from another OCA member to complete unit tests and do a code review with testing.

chrisandrewmann avatar Jan 23 '23 09:01 chrisandrewmann

@chrisandrewmann I would love to help where I can. I will fire up a fresh v15 Odoo instance for testing shortly!

valasule avatar Jan 23 '23 16:01 valasule

Just dropped in here. Interested in having this move from 10 to at least 14 as well. Ideally it should support various ways to do recurring payments - ie Credit Card, Bank, Open Receivable etc.

Will study a bit about what is involved in porting to new branches.

I expect there are other practical modules in the Repo also needing to port forward.

l-arnold avatar Jan 27 '23 17:01 l-arnold

@l-arnold if you are more familiar with OCA practices and coding requirements, i'd be happy to pass you the work i've done so far on 15.0 and 16.0 for you to complete and submit?

chrisandrewmann avatar Jan 27 '23 21:01 chrisandrewmann

There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days. If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.

github-actions[bot] avatar Jul 30 '23 12:07 github-actions[bot]