Em 21/10/2013 16:52, Mark Hayden (local) escreveu:
On Mon, 2013-10-21 at 15:29 -0200, Gmail - Iasmini wrote:
Hello,

I added new fields in invoice, but they are not being added at the table
and screen. For instance, field active:
I haven't done a thorough look at all the code you've shown here but one
thing I have noted is that you have not described the steps required to
make the Tryton server recognise your modifications and alter the
database/schema accordingly.

It seems to me you've researched Tryton development pretty thoroughly so
I apologise if you already know this and it sounds like the stupid tech
support guy asking if you've turned your PC off and on again, but have
you verified your work is being built and installed preoperly?  Once you
have the code in place you have to do the following (at least as of the
version I use)

1. you must run "trytond" with the "-u" switch to update its module
information.

/opt/trytond/bin$ ./trytond -d cavucador -u nfse_br

Yes, I did this. And it suceeded: server:Update/Init succeed!
But, after that I look at the table account_invoice and no field was added.

2. you must go into the Tryton client and "install" your module, which
will run the routines to update the database schema (and in the case of
upgrading perhaps do some data migration?).  This step seems no to be
required if schema is not affected and you are just changing logic.

The module is already installed. I'm customizing it.

info on this is in Tryton documentation, but it is not "development"
docs it is more "admin/user" docs.

It might help people if you give more details like relevant portions of
your log files and the output resulting from the "trytond -u" command.

Hope this helps...

Thank you!

1) invoice.py

# -*- coding: utf-8 -*-
from trytond.model import fields
from trytond.pool import PoolMeta

__metaclass__ = PoolMeta
__all__ = ['Invoice']


class Invoice:
      __name__ = 'account.invoice'

      active = fields.Boolean('Active', select=True)


2) invoice.xml

<?xml version="1.0"?>
<tryton>
      <data>
          <record model="ir.ui.view" id="view_invoice_nfse_form">
              <field name="model">account_invoice.invoice</field>
              <field name="inherit" ref="account_invoice.invoice_view_form"/>
              <field name="type">form</field>
              <field name="name">invoice_form</field>
          </record>
      </data>
</tryton>


3) __init__.py

from trytond.pool import Pool
from nfse_br import *
from company import *
from invoice import *


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

4) invoice_form.xml

<?xml version="1.0"?>
<data>
      <xpath expr="/form/field[@name='invoice_address']" position='after'>
          <label name="active"/>
          <field name="active"/>
      </xpath>
</data>

5) tryton.cfg

[tryton]
version=2.9.0
depends:
      company
      currency
      ir
      party
      res
      digital_certificate
      company_silex
      account
      account_br
xml:
      nfse_br.xml
      company.xml
      invoice.xml


Can you help me, please?



--
Iasmini Gomes
Sílex Sistemas
[email protected]
www.silexsistemas.com.br

Reply via email to