Skip to Content
Menu
This question has been flagged
1 Reply
1427 Views

Hi;

In the Enterprise module of Odoo 15 account.journal, when assigning a journal I get an error that account.journal does not have the _is_payment_method_available attribute.

def _default_inbound_payment_methods(self):
res = super()._default_inbound_payment_methods()
if self._is_payment_method_available('batch_payment'):
res |= self.env.ref ('account_batch_payment.account_payment_method_batch_deposit')
return res


Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
    result = request.dispatch()
  File "/odoo/odoo-server/odoo/http.py", line 688, in dispatch
    result = self._call_function(**self.params)
  File "/odoo/odoo-server/odoo/http.py", line 360, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper
    return f(dbname, *args, **kwargs)
  File "/odoo/odoo-server/odoo/http.py", line 349, in checked_call
    result = self.endpoint(*a, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 917, in __call__
    return self.method(*args, **kw)
  File "/odoo/odoo-server/odoo/http.py", line 536, in response_wrap
    response = f(*args, **kw)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 1352, in call_button
    action = self._call_kw(model, method, args, kwargs)
  File "/odoo/odoo-server/addons/web/controllers/main.py", line 1340, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 464, in call_kw
    result = _call_kw_multi(method, model, args, kwargs)
  File "/odoo/odoo-server/odoo/api.py", line 451, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/odoo/odoo-server/odoo/addons/base/models/res_config.py", line 622, in execute
    self.set_values()
  File "/odoo/odoo-server/addons/website_sale_stock/models/res_config_settings.py", line 17, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/sale_management/models/res_config_settings.py", line 28, in set_values
    return super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/sale/models/res_config_settings.py", line 75, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/crm_iap_enrich/models/res_config_settings.py", line 18, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/purchase/models/res_config_settings.py", line 42, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/hr_expense/models/res_config_settings.py", line 27, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/website/models/res_config_settings.py", line 144, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/stock/models/res_config_settings.py", line 90, in set_values
    res = super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/mass_mailing/models/res_config_settings.py", line 24, in set_values
    super().set_values()
  File "/odoo/odoo-server/addons/crm/models/res_config_settings.py", line 134, in set_values
    super(ResConfigSettings, self).set_values()
  File "/odoo/odoo-server/addons/account/models/res_config_settings.py", line 150, in set_values
    self.chart_template_id._load(15.0, 15.0, self.env.company)
  File "/odoo/odoo-server/enterprise/account_followup/models/chart_template.py", line 10, in _load
    res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
  File "/odoo/odoo-server/enterprise/account_reports/models/chart_template.py", line 9, in _load
    res = super(AccountChartTemplate, self)._load(sale_tax_rate, purchase_tax_rate, company)
  File "/odoo/odoo-server/addons/account/models/chart_template.py", line 331, in _load
    self._create_bank_journals(company, acc_template_ref)
  File "/odoo/odoo-server/addons/account/models/chart_template.py", line 408, in _create_bank_journals
    bank_journals += self.env['account.journal'].create({
  File "/usr/local/lib/python3.8/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/odoo/odoo-server/odoo/api.py", line 391, in _model_create_single
    return create(self, arg)
  File "/odoo/odoo-server/addons/account/models/account_journal.py", line 661, in create
    journal = super(AccountJournal, self.with_context(mail_create_nolog=True)).create(vals)
  File "/usr/local/lib/python3.8/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/odoo/odoo-server/odoo/api.py", line 412, in _model_create_multi
    return create(self, [arg])
  File "/odoo/odoo-server/addons/mail/models/mail_thread.py", line 265, in create
    threads = super(MailThread, self).create(vals_list)
  File "/usr/local/lib/python3.8/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/odoo/odoo-server/odoo/api.py", line 413, in _model_create_multi
    return create(self, arg)
  File "/odoo/odoo-server/odoo/addons/base/models/ir_fields.py", line 613, in create
    recs = super().create(vals_list)
  File "/usr/local/lib/python3.8/dist-packages/decorator.py", line 232, in fun
    return caller(func, *(extras + args), **kw)
  File "/odoo/odoo-server/odoo/api.py", line 413, in _model_create_multi
    return create(self, arg)
  File "/odoo/odoo-server/odoo/models.py", line 4110, in create
    records._check_company()
  File "/odoo/odoo-server/odoo/models.py", line 3493, in _check_company
    corecord = record.sudo()[name]
  File "/odoo/odoo-server/odoo/models.py", line 5885, in __getitem__
    return self._fields[key].__get__(self, type(self))
  File "/odoo/odoo-server/odoo/fields.py", line 3389, in __get__
    return super().__get__(records, owner)
  File "/odoo/odoo-server/odoo/fields.py", line 2603, in __get__
    return super().__get__(records, owner)
  File "/odoo/odoo-server/odoo/fields.py", line 1054, in __get__
    self.recompute(record)
  File "/odoo/odoo-server/odoo/fields.py", line 1243, in recompute
    self.compute_value(recs)
  File "/odoo/odoo-server/odoo/fields.py", line 1265, in compute_value
    records._compute_field_value(self)
  File "/odoo/odoo-server/addons/mail/models/mail_thread.py", line 411, in _compute_field_value
    return super()._compute_field_value(field)
  File "/odoo/odoo-server/odoo/models.py", line 4255, in _compute_field_value
    getattr(self, field.compute)()
  File "/odoo/odoo-server/addons/account/models/account_journal.py", line 287, in _compute_inbound_payment_method_line_ids
    default_methods = journal._default_inbound_payment_methods()
  File "/odoo/odoo-server/enterprise/account_sepa_direct_debit/models/account_journal.py", line 12, in _default_inbound_payment_methods
    res = super()._default_inbound_payment_methods()
  File "/odoo/odoo-server/enterprise/account_batch_payment/models/account_journal.py", line 12, in _default_inbound_payment_methods
    if self._is_payment_method_available('batch_payment'):
Exception

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

Traceback (most recent call last):
  File "/odoo/odoo-server/odoo/http.py", line 644, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/odoo/odoo-server/odoo/http.py", line 302, in _handle_exception
    raise exception.with_traceback(None) from new_cause
AttributeError: 'account.journal' object has no attribute '_is_payment_method_available'

Reviewing I have seen that this method is not defined anywhere. The question is; Does anyone have it defined or has encountered this problem before?

Thank you anyway

Avatar
Discard
Author Best Answer

Solucionado con la creación de un modulo donde añade la parte de la definición de la función.


https://github.com/odoo/odoo/blob/89ecb17f56b34b7e3875fa36cde70a2666dca4d8/addons/account/models/account_journal.py

Avatar
Discard
Related Posts Replies Views Activity
0
Jun 21
2228
0
Apr 17
3510
0
Feb 16
2805
2
Jul 15
4083
1
Mar 23
1788