Hi,

The new field was inserted on table, but it doesn't appears on screen. I
know that is not calling the file invoice_line_form.xml, because I put
purposely an wrong name at the 'expr' and it raises no error when I use
the screen.

What I did:

I inserted a new field on account.invoice.line
Module: nfse_br

invoice.py

...

__metaclass__ = PoolMeta
__all__ = ['Invoice', 'InvoiceLine']

...

class InvoiceLine:
    __name__ = 'account.invoice.line'

    slx_desconto = fields.Numeric(u'Desconto', digits=(16, 4))


invoice.xml (I've tried 2 ways)

1st) inheriting only from account_invoice.invoice_view_form

...
            <field name="inherit" ref="account_invoice.invoice_view_form"/>
...

2st) inheriting from account_invoice.invoice_view_form and
account_invoice.invoice_line_view_form

...
            <field name="inherit" ref="account_invoice.invoice_view_form"/>
...

...
            <field name="inherit"
ref="account_invoice.invoice_line_view_form"/>

...


Folder view: invoice_line_form.xml

<?xml version="1.0"?>
<data>
    <xpath
expr="/form/notebook/page[@id='general']/field[@name='unit_price']"
position='after'>
        <label name="slx_desconto"/>
        <field name="slx_desconto"/>
    </xpath>
</data>


__init__.py

...
def register():
    Pool.register(
        NumeracaoRPS,
        NFSe,
        Company,
        NumeracaoRPSLine,
        Invoice,
        InvoiceLine,
        module='nfse_br', type_='model'
    )


tryton.cfg

...

depends:
    company
    currency
    ir
    party
    res
    digital_certificate
    company_silex
    account
    account_invoice
    account_br
xml:
    nfse_br.xml
    company.xml
    invoice.xml


I tried to follow the instructions of Guillem
(https://groups.google.com/forum/#!topic/tryton/8RMQDF_M0W0) and I
create unit tests to debug, but I don't know if I do right:

1. I created a folder tests: nfse_br/tests


2. __init__.py
from .test_tryton import all_suite as suite


3. test_nfse_br.py

import unittest
import trytond.tests.test_tryton
from trytond.tests.test_tryton import test_view, test_depends


class TestCase(unittest.TestCase):
    '''
    Test module.
    '''

    def setUp(self):
        trytond.tests.test_tryton.install_module('nfse_br')

    def test0010nfse_br(self):
        '''
        Test views.
        '''
        test_view('nfse_br')

    def test0010depends(self):
        '''
        Test depends.
        '''
        test_depends()


def suite():
    suite = trytond.tests.test_tryton.suite()
    suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestCase))
    return suite

# if __name__ == '__main__':
unittest.TextTestRunner(verbosity=2).run(suite())

I don't know why the field isn't shown on the screen.

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

Reply via email to