Tryton - Issues

 

Issue8348

Title can't delete empty invoice if account_tax_cash is installed.
Priority bug Status testing
Superseder Nosy List ced, reviewbot, risto3
Type crash Components account_tax_cash
Assigned To ced Keywords review
Reviews 263531002
View: 263531002

Created on 2019-05-13.16:20:52 by risto3, last changed by reviewbot.

Messages
review263531002 updated at https://codereview.tryton.org/263531002/#ps281551002
msg49826 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2019-05-22.23:41:53
Here is review263531002 which should fix it.
msg49712 (view) Author: [hidden] (risto3) Date: 2019-05-13.16:20:51
Easy to reproduce.... install account_tax_cash
then create an invoice without any lines then try to delete:

Traceback (most recent call last):
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 73, in dispatch_request
    return endpoint(request, **requestview_args)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 46, in rpc
    request, database_name, *requestrpc_params)
  File "/usr/local/lib/python35/dist-packages/trytond/wsgipy", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/wrapperspy", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/protocols/dispatcherpy", line 176, in _dispatch
    result = rpcresult(meth(*c_args, **c_kwargs))
  File "/usr/local/lib/python35/dist-packages/trytond/modules/sale/invoicepy", line 20, in wrapper
    func(cls, invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/sale/invoicepy", line 82, in delete
    super(Invoice, cls)delete(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/purchase/invoicepy", line 21, in wrapper
    func(cls, invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/purchase/invoicepy", line 74, in delete
    super(Invoice, cls)delete(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/account_invoice/invoicepy", line 1091, in delete
    clscancel(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/sale/invoicepy", line 20, in wrapper
    func(cls, invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/sale/invoicepy", line 97, in cancel
    super(Invoice, cls)cancel(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/purchase/invoicepy", line 21, in wrapper
    func(cls, invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/purchase/invoicepy", line 108, in cancel
    super(Invoice, cls)cancel(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/model/modelviewpy", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/model/workflowpy", line 36, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/account_tax_cash/accountpy", line 289, in cancel
    cls_update_tax_cash_basis(invoices)
  File "/usr/local/lib/python35/dist-packages/trytond/modules/account_tax_cash/accountpy", line 309, in _update_tax_cash_basis
    for line in invoicemovelines:
AttributeError: 'NoneType' object has no attribute 'lines'



in account.py line 309
        for invoice in invoices:
            if invoice.company not in periods:
                periods[invoice.company] = Period.find(
                    invoice.company.id, date=date)
            period = periods[invoice.company]
            ratio = invoice.cash_paid_ratio
==>         for line in invoice.move.lines:    # move can be None here!
                to_update[(period, ratio)].extend(line.tax_lines)
History
Date User Action Args
2019-05-22 23:59:46reviewbotsetnosy: + reviewbot
messages: + msg49828
2019-05-22 23:41:53cedsetstatus: unread -> testing
keyword: + review
nosy: + ced
messages: + msg49826
reviews: 263531002
assignedto: ced
type: crash
2019-05-13 16:20:52risto3create

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