2017-04-22 7:39 GMT-03:00 Mauricio Martinez Garcia <[email protected]>:
> I create a new module for one deployment that i need, but when i plublish
> my module i receive the next error:
>
> gnuhealth@trytonserv01:~/gnuhealth/tryton/server/trytond-3.8.10/bin $
> ./trytond -d gnuhealth -u medica
>
Hi Mauricio,
for emailing errors to this list it would be better to prepent "LANG=C" to
any command line in the case you have your default language as spanish (or
any other than english). This way the output errors will be in english too.
> Traceback (most recent call last):
> File "./trytond", line 80, in <module>
> server.TrytonServer(options).run()
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/server.py",
> line 113, in run
> Pool(db_name).init(update=self.options.update, lang=lang)
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/pool.py",
> line 155, in init
> lang=lang)
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/modules/__init__.py",
> line 427, in load_modules
> _load_modules()
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/modules/__init__.py",
> line 394, in _load_modules
> load_module_graph(graph, pool, update, lang)
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/modules/__init__.py",
> line 234, in load_module_graph
> cls.__register__(module)
> File
> "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/trytond/model/modelsql.py",
> line 138, in __register__
> table = TableHandler(Transaction().cursor, cls, module_name)
> File "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/
> trytond/backend/postgresql/table.py", line 71, in __init__
> % (self.table_name, default))
> File "/home/gnuhealth/gnuhealth/tryton/server/trytond-3.8.10/
> trytond/backend/postgresql/database.py", line 296, in execute
> return self.cursor.execute(sql)
> psycopg2.ProgrammingError: no existe la relación «medica_accounting_e
>
> ntpservices_id_seq»
>
>
>
>
> This is the code,
>
As you may know in python coding, indentation matters, so the code you are
showing us is not very useful.
> i don't see why receive this error,
>
> the model at database level is correct,
>
What do you mean? How did you check this?
i create this model on mysql for testing. But when i put this on tryton,
> doesn't work.
>
As far as I know, you create modules in tryton. Then you tell tryton what
platform to choose.
It's not clear what you meant, despite the fact that it doesn't work.
>
>
>
> # -*- coding: utf-8 -*-
>
> ############################################################
> ##################
>
> #
>
> # Module developed by Mauricio Martinez for Torre Medica Santa Anita
>
> ##
>
> ############################################################
> ##################
>
> import datetime
>
> from trytond.model import ModelView, ModelSQL, fields, ModelSingleton,
> Unique
>
> from trytond.pyson import Eval, Equal
>
> from trytond.pool import Pool
>
> from trytond.modules.product import price_digits
>
>
>
> __all__ = ['AccountingServices','AccountingServicesLine','
> AccountingEntpServices','AccountingEntpServicesLine']
>
>
>
> class AccountingServices(ModelSQL, ModelView):
>
> 'Servicios de Cuenta Individual'
>
> __name__ = 'medica.accounting_services'
>
>
> name = fields.Char('ID',readonly=True)
>
> account_code = fields.Char('Codigo')
>
> clientAccount = fields.Many2One('gnuhealth.patient', 'Paciente')
>
> accounting_date = fields.Date('Fecha')
>
> state = fields.Selection([('1', 'Borrador'),
>
> ('2', 'Abierto'),
>
> ('3', 'Cancelado'),
>
> ('4', 'Cerrado'),], 'Estado')
>
> account_type = fields.Selection([('1', 'Consulta Unica'),
>
> ('2', 'Tratamiento'),], 'Tipo')
>
> accounting_services_line = fields.One2Many('medica.
> accounting_services.line',
>
> 'accounting_services_line', 'Servicios', help="Accounting Services Line")
>
>
>
> @staticmethod
>
> def default_accounting_date():
>
> return datetime.date.today()
>
>
>
>
> class AccountingServicesLine(ModelSQL, ModelView):
>
> 'Linea de Servicios de Cuenta Individual'
>
> __name__ = 'medica.accounting_services.line'
>
>
> #line_service = fields.Many2One('medica.accounting_services','Line
> Service',readonly=True)
>
> code = fields.Char('ID',readonly=True)
>
> concepto = fields.Char('Concepto')
>
> producto = fields.Many2One('product.product','Producto')
>
> descripcion = fields.Many2One('product.template','Descripcion')
>
> cantidad = fields.Float('Cantidad',
>
> digits=(16, Eval('unit_digits', 2)),
>
> states={
>
> 'invisible': Eval('type') != 'line',
>
> 'required': Eval('type') == 'line',
>
> },
>
> depends=['type', 'unit_digits'])
>
>
> unit_digits = fields.Function(fields.Integer('Unit Digits'),
>
> 'on_change_with_unit_digits')
>
> costo_unitario = fields.Numeric('Costo Unitario', digits=price_digits,
>
> states={
>
> 'invisible': Eval('type') != 'line',
>
> 'required': Eval('type') == 'line',
>
> },
>
> depends=['type'])
>
> total_costo = fields.Numeric('Costo Total')
>
> iva_aplicar = fields.Numeric('IVA')
>
> event_type = fields.Selection([('1', 'Consumo'),
>
> ('2', 'Abono'),], 'Tipo Evento')
>
>
>
> class AccountingEntpServices(ModelSQL, ModelView):
>
> 'Servicios de Cuenta Empresarial'
>
> __name__ = 'medica.accounting_Entpservices'
>
As a side note I don't know how the uppercase will work in this value.
>
> name = fields.Char('ID',readonly=True)
>
> enterprise_code = fields.Char('Cuenta Empresarial')
>
> accountingEntp_date = fields.Date('Fecha')
>
> clientAccount = fields.Many2One('company.company', 'Empresa')
>
> state = fields.Selection([('1', 'Draft'),
>
> ('2', 'Abierto'),
>
> ('3', 'Cancelado'),
>
> ('4', 'Cerrado'),], 'Estado')
>
>
> accounting_Eservices_line = fields.One2Many('
>
> medica.accounting_Entpservices.line',
>
> '
>
> accounting_Entpservices_line', 'Servicios', help="Accounting EntpServices
> Line")
>
> The second parameter of a One2Many field definition must match with a
field on the model at the one you are pointing, and that field will be used
to point back here. So in this case it will look for a field called
'accounting_Entpservices_line' in the Model 'medica.
accounting_Entpservices.line'.
You could simplify the names of your fields, seriously, it will help you
have a cleaner and easier to read code.
As an example you can look at how the moves field is defined in the sale
(sale.py and stock.py of the sale module).
>
> @staticmethod
>
> def default_accountingEntp_date():
>
> return datetime.date.today()
>
>
>
> class AccountingEntpServicesLine(ModelSQL, ModelView):
>
> 'Linea de Cuenta Empresarial'
>
> __name__ = 'medica.accounting_Entpservices.line'
>
>
> employee_code = fields.Char('Clave Empleado')
>
> #line_service = fields.Many2One('medica.accounting_services','
> Empleados',readonly=True)
>
> line_service = fields.One2Many('medica.accounting_services',
>
> 'accounting_services', 'Empleados', help="Accounting Services Line")
>
> employee_date = fields.Date('Fecha')
>
> account_type = fields.Selection([('1', 'VIP'),
>
> ('2', 'Gerente'),
>
> ('3', 'Coordinador'),
>
> ('4', 'Empleado'),], 'Tipo Empleado')
>
> adeudo_actual = fields.Numeric('Adeudo Actual')
>
>
>
>
> please, help me to identify my error, i don't sleep because i don't see
> the error, jeejjejeje.
> thanks team!
>
>
That's all I can tell about your code.
However I'll dare to advice you on other things in order for you to get
better help:
If you post an error message from a command line on an english mailing
list, and the error is not english, please prepend "LANG=C" to the command
line, this way the error will be shown in english as much as possible.
Otherwise you can seek for help on one of the spanish mailing lists
tryton-es for instance.
Also, in python indentation matters, your email lacks any, probably a
better way to share your code (if it's not published somewhere you can link
us to) is to put it in a pastebin service.
Cheers,
Karla.
--
-------------------------
Karla Mª Stenger Sábat
[email protected]
--
You received this message because you are subscribed to the Google Groups
"tryton" group.
To view this discussion on the web visit
https://groups.google.com/d/msgid/tryton/CAF9qxNpFWS7i_25ZJ5SQtm1gN4ep6ayanuLfQ1DwLdVU83a2AA%40mail.gmail.com.