How to correct taxes on an invoice

Here is the scenario:
— a sale is entered, the party is in an European Country abroad, the VAT rule is not well entered
— the sale is validated before the party is corrected
— the VAT rule is corrected on the party
— on the invoice in Draft state, I expect to be able to correct the vat line. Changing the party to choose the same again created the new vat line with the rule, but neither does it delete the old tax nor is it possible to delete it: as soon as I delete the tax, the line is recreated.

How shoud I proceed in such a case?

You should update the taxes of each invoice line and then save the invoice. Then the invoice tax lines will be recomputed automatically

Thks; worked for one invoice. For the other I got an app error.

Traceback (most recent call last):
  File "/trytond/model/modelstorage.py", line 1272, in __getattr__
    field = self._fields[name]
KeyError: 'origin_name'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/genshi/template/eval.py", line 318, in lookup_attr
    val = getattr(obj, key)
  File "/trytond/report/report.py", line 224, in __getattr__
    return getattr(record, name)
  File "/trytond/model/modelstorage.py", line 1417, in __getattr__
    read_data = self.read(list(ids), list(ffields.keys()))
  File "/trytond/model/modelsql.py", line 826, in read
    getter_results = field.get(ids, cls, field_list, values=result)
  File "/trytond/model/fields/function.py", line 103, in get
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 103, in <genexpr>
    return dict((name, call(name)) for name in names)
  File "/trytond/model/fields/function.py", line 98, in call
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/model/fields/function.py", line 98, in <genexpr>
    return dict((r.id, method(r, name)) for r in records)
  File "/trytond/modules/account_invoice/invoice.py", line 1081, in get_origins
    (l.origin_name for l in self.lines))))
  File "/trytond/modules/account_invoice/invoice.py", line 1081, in <genexpr>
    (l.origin_name for l in self.lines))))
  File "/trytond/model/modelstorage.py", line 1274, in __getattr__
    raise AttributeError('"%s" has no attribute "%s"' % (self, name))
AttributeError: "account.invoice.line,1108" has no attribute "origin_name"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/genshi/template/eval.py", line 324, in lookup_attr
    val = obj[key]
TypeError: 'TranslateModel' object is not subscriptable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 73, in dispatch_request
    return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 46, in rpc
    request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 44, in auth_required
    return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
    return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 176, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/trytond/modules/sale/invoice.py", line 20, in wrapper
    func(cls, invoices)
  File "/trytond/modules/sale/invoice.py", line 87, in post
    super(Invoice, cls).post(invoices)
  File "/trytond/modules/purchase/invoice.py", line 21, in wrapper
    func(cls, invoices)
  File "/trytond/modules/purchase/invoice.py", line 98, in post
    super(Invoice, cls).post(invoices)
  File "/trytond/model/modelview.py", line 665, in wrapper
    return func(cls, records, *args, **kwargs)
  File "/trytond/model/workflow.py", line 36, in wrapper
    result = func(cls, filtered, *args, **kwargs)
  File "/trytond/modules/account_invoice/invoice.py", line 1376, in post
    invoice.print_invoice()
  File "/trytond/modules/account_invoice/invoice.py", line 1285, in print_invoice
    InvoiceReport.execute([self.id], {})
  File "/trytond/modules/account_invoice/invoice.py", line 2428, in execute
    result = super(InvoiceReport, cls).execute(ids, data)
  File "/trytond/report/report.py", line 182, in execute
    oext, content = cls._execute(records, data, action_report)
  File "/trytond/modules/account_invoice/invoice.py", line 2409, in _execute
    result = super(InvoiceReport, cls)._execute(records, data, action)
  File "/trytond/report/report.py", line 190, in _execute
    return cls.convert(action, cls.render(action, report_context))
  File "/trytond/report/report.py", line 290, in render
    data = rel_report(**report_context).render()
  File "/relatorio/templates/base.py", line 34, in render
    return self.serializer(self.events)
  File "/relatorio/templates/opendocument.py", line 1056, in __call__
    for kind, data, pos in stream:
  File "/genshi/core.py", line 292, in _ensure
    for event in stream:
  File "/genshi/filters/i18n.py", line 691, in __call__
    for kind, data, pos in stream:
  File "/genshi/template/base.py", line 638, in _include
    for event in stream:
  File "/genshi/template/markup.py", line 327, in _match
    for event in stream:
  File "/genshi/template/base.py", line 598, in _flatten
    result = _eval_expr(data, ctxt, vars)
  File "/genshi/template/base.py", line 289, in _eval_expr
    retval = expr.evaluate(ctxt)
  File "/genshi/template/eval.py", line 178, in evaluate
    return eval(self.code, _globals, {'__data__': data})
  File "<string>", line 896, in <Expression "__relatorio_escape_invalid_chars(invoice.origins or '')">
  File "/genshi/template/eval.py", line 326, in lookup_attr
    val = cls.undefined(key, owner=obj)
  File "/genshi/template/eval.py", line 414, in undefined
    raise UndefinedError(key, owner=owner)
genshi.template.eval.UndefinedError: <trytond.report.report.Report._get_records.<locals>.TranslateModel object at 0x7fe2a80ed828> has no member named "origins"

Solved by reattaching Sale Lines as origin for product line and carrier line, in invoice draft mode.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.