Issue 10983

Title
error in account_rule when processing the sale
Priority
bug
Status
resolved
Nosy list
booraa0a, ced, reviewbot, roundup-bot
Assigned to
ced
Keywords
review

Created on 2021-11-26.03:07:34 by booraa0a, last changed 2 months ago by roundup-bot.

Messages

New changeset 2aacacb4efdb by Cédric Krier in branch '6.2':
Use today when context date is empty
https://hg.tryton.org/modules/account_rule/rev/2aacacb4efdb
New changeset bd08999d93f4 by Cédric Krier in branch 'default':
Use today when context date is empty
https://hg.tryton.org/tryton-env/rev/bd08999d93f4

New changeset 3667468925d7 by Cédric Krier in branch 'default':
Set date only on search context of product
https://hg.tryton.org/tryton-env/rev/3667468925d7
New changeset ffafef445ee9 by Cédric Krier in branch 'default':
Set date only on search context of product
https://hg.tryton.org/modules/product_price_list_dates/rev/ffafef445ee9
New changeset 0b70dbf22543 by Cédric Krier in branch 'default':
Use today when context date is empty
https://hg.tryton.org/modules/account_rule/rev/0b70dbf22543
Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2022-02-05.22:03:13

Here are review389951002 which should fix the problem and review378261002 which prevents to set empty string in the product context.

Author: [hidden] (booraa0a)
Date: 2021-12-06.20:52:53

The error will only show when you activate all modules but if you activate only account_rule, the error will not show.

Author: [hidden] (booraa0a)
Date: 2021-12-06.20:50:00

Thank you Cédric

I am using only standard modules. I tried to debug the issue but could not. However, I replicated the same issue in the demo server 6.2 version. Please check sales id 123, the error will show up when you click process.

Author: [hidden] (ced) Tryton committer Tryton translator
Date: 2021-12-01.00:14:13

You seem to have a date key in the context that is not a date but just a string.
Have you any custom module activated?

Author: [hidden] (booraa0a)
Date: 2021-11-26.03:07:34

I am using the Tryton 6.2. I receive the following traceback when clicking on process (Sale).

Thank you.


Traceback (most recent call last):
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 117, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 47, in rpc
    return methodsget(requestrpc_method, _dispatch)(
  File "/usr/local/lib/python39/dist-packages/trytond/wsgipy", line 84, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/wrapperspy", line 159, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/protocols/dispatcherpy", line 181, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_shipment_cost/salepy", line 216, in process
    super()process(sales)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelviewpy", line 774, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 958, in process
    cls_process_invoice(sales)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 970, in _process_invoice
    invoice = salecreate_invoice()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_advance_payment/salepy", line 405, in create_invoice
    invoice = super(Sale, self)create_invoice()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/commission/salepy", line 25, in create_invoice
    invoice = super(Sale, self)create_invoice()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 794, in create_invoice
    invoice_linesappend(lineget_invoice_line())
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/salepy", line 14, in get_invoice_line
    return super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_secondary_unit/salepy", line 160, in get_invoice_line
    lines = super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_shipment_cost/salepy", line 332, in get_invoice_line
    lines = super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale_advance_payment/salepy", line 474, in get_invoice_line
    lines = super(SaleLine, self)get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/analytic_sale/salepy", line 31, in get_invoice_line
    invoice_lines = super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/commission/salepy", line 87, in get_invoice_line
    lines = super()get_invoice_line()
  File "/usr/local/lib/python39/dist-packages/trytond/modules/sale/salepy", line 1521, in get_invoice_line
    invoice_lineaccount = selfproductaccount_revenue_used
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_product/productpy", line 51, in prop
    return getattr(selftemplate, field_name)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/productpy", line 18, in account_revenue_used
    return super()account_revenue_used
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_product/productpy", line 26, in wrapper
    account = selfget_account(field_name + '_used')
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_product/productpy", line 348, in get_account
    return selfaccount_categoryget_account(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/productpy", line 47, in get_account
    account = super()get_account(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_product/productpy", line 192, in get_account
    return selfparentget_account(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/productpy", line 47, in get_account
    account = super()get_account(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_product/productpy", line 192, in get_account
    return selfparentget_account(name, **pattern)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/productpy", line 50, in get_account
    account = AccountRuleapply(account)
  File "/usr/local/lib/python39/dist-packages/trytond/modules/account_rule/accountpy", line 109, in apply
    rules = clssearch([
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1442, in search
    tables, expression = cls__search_query(domain, count, query, order)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1361, in __search_query
    tables, expression = clssearch_domain(domain)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1571, in search_domain
    expression = convert(domain)
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1567, in convert
    return And((convert(d) for d in (
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1567, in <genexpr>
    return And((convert(d) for d in (
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1565, in convert
    return Or((convert(d) for d in domain[1:]))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1565, in <genexpr>
    return Or((convert(d) for d in domain[1:]))
  File "/usr/local/lib/python39/dist-packages/trytond/model/modelsqlpy", line 1558, in convert
    expression = fieldconvert_domain(domain, tables, cls)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/fieldpy", line 408, in convert_domain
    expression = Operator(column, self_domain_value(operator, value))
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/fieldpy", line 385, in _domain_value
    return selfsql_format(value)
  File "/usr/local/lib/python39/dist-packages/trytond/model/fields/datepy", line 37, in sql_format
    year, month, day = list(map(int, valuesplit("-", 2)))
ValueError: invalid literal for int() with base 10: ''

Fault: invalid literal for int() with base 10: ''
History
Date User Action Args
2022-02-26 11:47:02roundup-botsetkeyword: - backport
messages: + msg74348
2022-02-12 02:32:19roundup-botsetmessages: + msg74043
2022-02-12 02:32:09roundup-botsetmessages: + msg74042
2022-02-12 02:32:04roundup-botsetmessages: + msg74041
nosy: + roundup-bot
status: testing -> resolved
2022-02-05 22:11:48reviewbotsetmessages: + msg73897
2022-02-05 22:11:44reviewbotsetmessages: + msg73896
nosy: + reviewbot
2022-02-05 22:03:13cedsetkeyword: + backport, review
messages: + msg73895
reviews: 389951002,378261002
status: in-progress -> testing
2022-02-05 21:56:55cedsetcomponent: + account_rule
2022-02-05 21:54:07cedsetassignedto: ced
component: + product_price_list_dates, - account_rule
status: chatting -> in-progress
2021-12-06 20:52:53booraa0asetmessages: + msg72009

Showing 10 items. Show all history (warning: this could be VERY long)