Trello Card:
--
You can use this instructions without
virtualenvwrapper
making changes in service unit.
# Then copy this service in the `/etc/systemd/system/ara.local.service` | |
# Run your service with: | |
# # systemctl start ara.local.service | |
# Visit your ARA app in http://127.0.0.1:9191/ | |
# ----------------------------------- | |
# ARA systemd service | |
[Unit] | |
Description=ARA server |
Trabajamos con la versión 3.8 de Tryton (sabemos que ya no tiene soporte, pero no podemos hacer la migracion a una versión más reciente en estos momentos.)
Tenemos el modelo Contract
con los siguientes atributos:
class Contract:
__metaclass__ = PoolMeta
__name__ = 'contract'
class Contract: | |
""" | |
This overwrite of class Contract extend functionality of Contract | |
vanilla model. | |
Add the necessary functions to represent a ISP Contract. | |
""" | |
__metaclass__ = PoolMeta | |
__name__ = 'contract' |
Table "public.product_template"
Column | Type | Modifiers | Storage | Stats target | Description
------------------------+--------------------------------+---------------------------------------------------------------+----------+--------------+-------------------------
id | integer | not null default nextval('product_template_id_seq'::regclass) | plain | |
category | integer | | plain | | Category
create_uid | integer | | plain | | Create User
create_date | timestamp(6) without time zone |
Queremos un trigger que al cambiar un contrato de estado activation_scheduled
a requested
ejecute una acción determinada.
Se define el triguer con los siguientes parametros:
id | 10
create_uid | 34
on_create | f
create_date | 2018-03-28 09:29:31.938303
name | Trigger A
on_delete | f
test-readonly=# EXPLAIN ANALYZE(select * from party_materialized_view); | |
QUERY PLAN | |
--------------------------------------------------------------------------------------------------------------------------- | |
Seq Scan on party_materialized_view (cost=0.00..138.04 rows=1904 width=473) (actual time=0.018..1.022 rows=5235 loops=1) | |
Planning time: 0.131 ms | |
Execution time: 1.271 ms | |
(3 rows) | |
test-readonly=# EXPLAIN ANALYZE(select * from party_materialized_view where identifier_code = 'ESX640B'); | |
QUERY PLAN |
Comenzamos a investigar las queries que se realizaban al investigar un importador de CSVs que se utilizaba en una instancia de tryton 3.8.
Este importador cargaba en base de datos una serie de registros de consumo. Para ello se necesitaba conocer el contrato al que iban asociados, el tipo de producto al que pertenecía el consumo y la linea de factura a la que se enlazaría.
Podemos aprovechar para estudiar el modelo de datos que utilizamos, ya que la linea de factura ya contiene el tipo de producto y el contrato relacionadas. No se aprovecha el modelo relacional de Postgresql. este proceso, con todas sus comprobaciones, era muy costoso.