Hi,

I created the same new fields on account_tax and account_invoice_tax. I created a new tax and filled those fields. What I want is: when I insert a new product on a invoice those fields must to be filled with the same information that was registered when I configured the tax of this product.

To get this I need to modify Invoice._compute_tax and InvoiceTax.on_change_tax. I did this on core (to test) and it worked. To do this on my module I saw that Invoice._compute_tax is called by Invoice.on_change_lines and I try to call this method on my module for when user alters a line all the tax information will be automatically filled. I did this:

class Invoice:
    __name__ = 'account.invoice'

...

    def on_change_lines(self):
        super(Invoice, self).on_change_lines()



But it gives me the error: 'NoneType' object has no attribute 'items'


File "/opt/tryton/tryton/gui/window/view_form/view/form_gtk/one2many.py", line 339, in _sig_new
    many=field_size, context=ctx)

  File "/opt/tryton/tryton/gui/window/win_form.py", line 35, in __init__
    self.screen.new()

File "/opt/tryton/tryton/gui/window/view_form/screen/screen.py", line 455, in new
    group.add(record, self.new_model_position())

File "/opt/tryton/tryton/gui/window/view_form/model/group.py", line 287, in add
    self.signal('group-changed', record)

  File "/opt/tryton/tryton/signal_event.py", line 14, in signal
    fnct(self, signal_data, *data)

File "/opt/tryton/tryton/gui/window/view_form/model/field.py", line 474, in _group_changed
    self.sig_changed(record.parent)

File "/opt/tryton/tryton/gui/window/view_form/model/field.py", line 468, in sig_changed
    return super(O2MField, self).sig_changed(record)

File "/opt/tryton/tryton/gui/window/view_form/model/field.py", line 44, in sig_changed
    record.on_change(self.name, self.attrs['on_change'])

File "/opt/tryton/tryton/gui/window/view_form/model/record.py", line 533, in on_change
    self.set_on_change(res)

File "/opt/tryton/tryton/gui/window/view_form/model/record.py", line 461, in set_on_change
    for fieldname, value in values.items():

--
Iasmini Gomes
Sílex Sistemas
www.silexsistemas.com.br

---
Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus 
está ativa.
http://www.avast.com

Reply via email to