Dinamic views

107 views
Skip to first unread message

Oscar Alvarez

unread,
May 19, 2017, 6:04:29 PM5/19/17
to tryto...@googlegroups.com
Hi Dev,

I am curious is it possible set tree view with numbers of Columns
dinamic, so the columns number must to change when Context change or to
exist any way for reach this?


Thanks for advance


Oscar Alvarez

Cédric Krier

unread,
May 19, 2017, 7:15:06 PM5/19/17
to tryto...@googlegroups.com
On 2017-05-19 17:04, Oscar Alvarez wrote:
> Hi Dev,
>
> I am curious is it possible set tree view with numbers of Columns dinamic,
> so the columns number must to change when Context change or to exist any way
> for reach this?

No columns are create when creating the view.

--
Cédric Krier - B2CK SPRL
Email/Jabber: cedric...@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/

Nicolas Évrard

unread,
May 20, 2017, 4:34:30 AM5/20/17
to tryto...@googlegroups.com
* Oscar Alvarez [2017-05-20 00:04 +0200]:
>Hi Dev,

Hello Oscar,

>I am curious is it possible set tree view with numbers of Columns
>dinamic, so the columns number must to change when Context change or
>to exist any way for reach this?

What problems are you trying to solve?

--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: nicolas...@b2ck.com

Oscar Alvarez

unread,
May 22, 2017, 6:44:21 PM5/22/17
to tryto...@googlegroups.com, Elmer Salazar
On 20/05/17 03:34, Nicolas Évrard wrote:
* Oscar Alvarez  [2017-05-20 00:04 +0200]:
Hi Dev,

Hello Oscar,

I am curious is  it possible set tree view with numbers of Columns dinamic, so the columns number must to change when Context change or to exist any way for reach this?

What problems are you trying to solve?


Hi Nicolas,

Dinamic views is important in several cases, the main use is for views used in reports, for example:

 For balance sheet we need have one view where according to the context model we can to see just one fiscalyear (1 column), two fiscalyear (2 columns) or three fiscalyear (3 columns) for comparatives in this case a new column is add/removed when the user click in reload.

 For stock products quantity report could be used for view one, two, three columns where the columns represent differents warehouses, according to warehouses selected in context maybe using "active_ids"

                                    Qty                            Qty
        Product        Warehouse 1            Warehouse  2
            A                        5                            2
            B                        7                            3
            C                        1                            25


For sales is useful for comparative reports, where the user could be view sales for one month or several months (the same fiscal year)

When we want to see just one period:
________________________________________________________________________________________

   Report Sales / Purchase / Invoice Comparative
________________________________________________________________________________________

    Start Period:  2017-02                End Period: 2017-02   <- Many2One of account.period
________________________________________________________________________________________

Filter:
---------------------------------------------------------------------------------------------------------------------
Party (Customer / Supplier)      |          2017-02           | 
---------------------------------------------------------------------------------------------------------------------
Abc Company INC                    |            $100.00          |
Xyz LLC                                    |             $359.00         |
.
.
.

When we want to see a range of periods:

________________________________________________________________________________________

   Report Sales / Purchase / Invoice Comparative
________________________________________________________________________________________

    Start Period:  2017-02                End Period: 2017-04   <- Many2One of account.period  (Just change "End period" field and click in "Reload", so then more columns are added to treeview)
________________________________________________________________________________________

Filter:
---------------------------------------------------------------------------------------------------------------------
Party (Customer / Supplier)      |          2017-02      |         2017-03       |        2017-04         | 
---------------------------------------------------------------------------------------------------------------------
Abc Company INC                    |            $100.00     |        $500.0          |            $0              |
Xyz LLC                                    |             $359.00    |            $ 0            |          $733            |
.
.
.


This feature make more powerful and flexible reports in views, so the only way to reach

I don't know maybe there is more people/developers interested in see and works around  this feature.

Oscar Alvarez

Albert Cervera i Areny

unread,
May 23, 2017, 4:37:14 PM5/23/17
to tryto...@googlegroups.com, Elmer Salazar
That is not possible yet you can find (at least) a couple of workarounds:

- You may take a look at babi module at bitbucket were the user can
configure a report and recalculate it when needed. That calculation
process creates the views that are later shown to the user, and those
may include more or less columns depending on data or how the user
configured the report. Note that its implementation could be greatly
improved by creating model fields on the fly.

- When you create a dashboard it is possible to update the data on one
of the views when a record is selected in another view. There's a
patch * from a long time ago where I proposed a way not only to
refresh data but the whole view. That means, that, for example you
could select a record in one view and it would show you a graph. But
if you select another record, then it shows a calendar, etc. I didn't
work on it further but it could be a nice and simple improvement that
would allow you to do more or less what you're looking for.

* Sorry, I was not able to find it

>
> Oscar Alvarez
>
> --
> You received this message because you are subscribed to the Google Groups
> "tryton-dev" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/tryton-dev/d55eb0ba-89de-4800-8383-0c9cda403a9a%40gmail.com.



--
Albert Cervera i Areny
http://www.NaN-tic.com
Tel. 93 553 18 03

Oscar Alvarez

unread,
May 23, 2017, 5:37:52 PM5/23/17
to tryto...@googlegroups.com
Ok thanks for Babi mention, but I can not install babi because is not
compatible with python3, I fixed setup.py, but I get still on install:

Traceback (most recent call last):
File "/home/psk/.virtualenvs/tryton40/bin/trytond-admin", line 21, in
<module>
admin.run(options)
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/trytond/admin.py",
line 48, in run
Pool(db_name).init(update=options.update, lang=lang)
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/trytond/pool.py",
line 142, in init
self.start()
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/trytond/pool.py",
line 95, in start
register_classes()
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/trytond/modules/__init__.py",
line 365, in register_classes
the_module.register()
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/nantic_babi-4.0.0-py3.5.egg/trytond/modules/babi/__init__.py",
line 35, in register
module='babi', type_='model')
File
"/home/psk/.virtualenvs/tryton40/lib/python3.5/site-packages/trytond/pool.py",
line 84, in register
assert issubclass(cls.__class__, PoolMeta), cls
AssertionError: <class 'trytond.modules.babi.babi.ActWindow'>

Yes I know missing Poolmeta, in code, etc, so it whatever changes in
Trytond API will break Babi (I dont have doubts about babi works), but
the point is I think we need really that features "Dinamic views" inside
Tryton core (maybe babi or not, I dont know)

> That calculation
> process creates the views that are later shown to the user, and those
> may include more or less columns depending on data or how the user
> configured the report. Note that its implementation could be greatly
> improved by creating model fields on the fly.
>
> - When you create a dashboard it is possible to update the data on one
Thanks I tried dashboard

Sergi Almacellas Abellana

unread,
May 24, 2017, 3:34:58 AM5/24/17
to tryto...@googlegroups.com
El 23/05/17 a les 23:37, Oscar Alvarez ha escrit:
> but I can not install babi because is not compatible with python3, I
> fixed setup.py, but I get still on install:
Have a look at:

https://bitbucket.org/nantic/trytond-babi/pull-requests/43/add-python3-support/diff



--
Sergi Almacellas Abellana
www.koolpi.com
Twitter: @pokoli_srk

Raimon Esteve

unread,
May 28, 2017, 4:18:04 PM5/28/17
to tryto...@googlegroups.com
Hie Oscar,
To do support py3, we need to move PoolMeta into the class.

Example:

__metaclass__ = PoolMeta

move into the class ActWindow, Menu, etc

Other module that use DynamicModel is survey. The PoolMeta was moved
into the class.

https://bitbucket.org/zikzakmedia/trytond-survey/
> https://groups.google.com/d/msgid/tryton-dev/fe29cbd6-0e38-d479-3092-c55a2d9f20ce%40gmail.com.



--
Si us plau, NO adjunti arxius a les seves respostes. Li preguem que
integri el text al cos del missatge. Pot respondre usant NetEtiquete
que li ajudarà a seguir la conversa.
http://es.wikipedia.org/wiki/Netiquette

Por favor, NO adjunte archivos a sus respuestas. Le rogamos que
integre el texto en el cuerpo del mensaje. Puede responder usando
NetEtiquete que le ayudará a seguir la
conversación.http://es.wikipedia.org/wiki/Netiquette

Please, DO NOT send attachment files with your answers, just copy and
paste only the text you need to send into the body of your mails.
Repply using NetEtiquete. http://en.wikipedia.org/wiki/Netiquette

Sergi Almacellas Abellana

unread,
May 30, 2017, 6:42:50 AM5/30/17
to tryto...@googlegroups.com
El 24/05/17 a les 08:13, Raimon Esteve ha escrit:
> Other module that use DynamicModel is survey. The PoolMeta was moved
> into the class.
>
> https://bitbucket.org/zikzakmedia/trytond-survey/
I'm wondering why you use dynamic model here, instead of using a Dict
field to store the survey values.

Raimon Esteve

unread,
May 30, 2017, 9:55:17 AM5/30/17
to tryto...@googlegroups.com
Hie Sergi

2017-05-30 12:42 GMT+02:00 Sergi Almacellas Abellana <se...@koolpi.com>:
> El 24/05/17 a les 08:13, Raimon Esteve ha escrit:
>>
>> Other module that use DynamicModel is survey. The PoolMeta was moved
>> into the class.
>>
>> https://bitbucket.org/zikzakmedia/trytond-survey/
>
> I'm wondering why you use dynamic model here, instead of using a Dict field
> to store the survey values.

I'm not sure with Dict fields you could:

- tree/form views and menus to acces to news models
- Navigation into fields: m2o, m2m,...
- Searchable (without function fields)
- Integrate with third tools (BI) and without transform/extract data
- ....

In other modules,you could see we use dict fields to storage some data.

Regards,

Sergi Almacellas Abellana

unread,
May 30, 2017, 10:09:35 AM5/30/17
to tryto...@googlegroups.com
El 30/05/17 a les 15:13, Raimon Esteve ha escrit:
> Hie Sergi
>
> 2017-05-30 12:42 GMT+02:00 Sergi Almacellas Abellana <se...@koolpi.com>:
>> El 24/05/17 a les 08:13, Raimon Esteve ha escrit:
>>>
>>> Other module that use DynamicModel is survey. The PoolMeta was moved
>>> into the class.
>>>
>>> https://bitbucket.org/zikzakmedia/trytond-survey/
>>
>> I'm wondering why you use dynamic model here, instead of using a Dict field
>> to store the survey values.
>
> I'm not sure with Dict fields you could:
>
> - tree/form views and menus to acces to news models
> - Navigation into fields: m2o, m2m,...

The only think you miss is m2o foreign keys check. But why you need it
for surveys?

Indeed, you will not have any new models using a dict field. But all the
survey results stored on the same table, which provides more flexibility
in case new fields are added to the survey when new values already exist.

> - Searchable (without function fields)

What's the problem with function fields? Dict fields can be searched on
the database (and have indexes if using JSONB on PostgreSQL).

> - Integrate with third tools (BI) and without transform/extract data

AFAIU third tools can also read json values, so I do not see the point.
> - ....
>
> In other modules,you could see we use dict fields to storage some data.
>
Don't understand.
Reply all
Reply to author
Forward
0 new messages