Re: [tryton-dev] What is the fields_child and context_model

2018-10-01 Thread Markus Bala
On Monday, October 1, 2018 at 4:16:05 PM UTC+7, Cédric Krier wrote:
> On 2018-10-01 01:55, Markus Bala wrote:
> > > > It prompt error psycopg2, cannot execute INSERT because is 
> > > > readonly-transaction
> > > 
> > > On which kind of RPC call are you doing a save?
> > 
> > Traceback (most recent call last):
> >   File "/trytond/wsgi.py", line 71, in dispatch_request
> > return endpoint(request, **request.view_args)
> >   File "/trytond/protocols/dispatcher.py", line 41, in rpc
> > request, database_name, *request.rpc_params)
> >   File "/trytond/wsgi.py", line 42, in auth_required
> > return wrapped(*args, **kwargs)
> >   File "/trytond/protocols/wrappers.py", line 122, in wrapper
> > return func(request, pool, *args, **kwargs)
> >   File "/trytond/protocols/dispatcher.py", line 172, in _dispatch
> > result = rpc.result(meth(inst, *c_args, **c_kwargs))
> >   File "/trytond/model/modelview.py", line 677, in on_change
> > method()
> >   File "/trytond/model/modelview.py", line 84, in wrapper
> > result = func(self, *args, **kwargs)
> >   File "/trytond/model/fields/field.py", line 114, in wrapper
> > return func(self, *args, **kwargs)
> >   File "/trytond/modules/tri_jda/jda.py", line 189, in on_change_lodnum
> > rec.save(recs)
> >   File "/trytond/model/descriptors.py", line 33, in newfunc
> > return self.func(owner, *args, **kwargs)
> >   File "/trytond/model/modelstorage.py", line 1532, in save
> > news = cls.create([save_values[r] for r in to_create])
> >   File "/trytond/model/modelsql.py", line 580, in create
> > [insert_values], [table.id]))
> >   File "/trytond/backend/postgresql/database.py", line 61, in execute
> > cursor.execute(self, sql, args)
> > psycopg2.InternalError: cannot execute INSERT in a read-only transaction
> > 
> > 
> > -
> > Above is my stacktrace.
> > 
> > I am going to integrate with some WMS system for receiving. When user input 
> > the PO number which is "Lodnum" then tryton "on_change" and will display 
> > the WMS data to the list (MS SQL Server).
> > 
> > Background, after "on_change", I will read data from MSSQL. And insert to 
> > Tryton postgres. 
> > But when inserted, above error occurred.
> 
> on_change calls are always read-only to enforce good design and
> practice. You can not save in the database something that the user did
> not save yet. Instead you must just send modification to the client by
> setting fields (without saving).

for ModelSQL , we can set  by "self.field = value".
But how to setting the fields for context_model?

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

-- 
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/cedc16c5-6118-43b9-b96a-b991b464be3d%40googlegroups.com.


Re: [tryton-dev] What is the fields_child and context_model

2018-10-01 Thread Markus Bala
On Monday, October 1, 2018 at 3:30:04 PM UTC+7, Cédric Krier wrote:
> On 2018-10-01 01:04, Markus Bala wrote:
> > But when I try using context_model, i am going to do some "save" to model.
> 
> I do not understand. the context model is only used by the client.
> 
> > It prompt error psycopg2, cannot execute INSERT because is 
> > readonly-transaction
> 
> On which kind of RPC call are you doing a save?
> 
> -- 
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/

Traceback (most recent call last):
  File "/trytond/wsgi.py", line 71, in dispatch_request
return endpoint(request, **request.view_args)
  File "/trytond/protocols/dispatcher.py", line 41, in rpc
request, database_name, *request.rpc_params)
  File "/trytond/wsgi.py", line 42, in auth_required
return wrapped(*args, **kwargs)
  File "/trytond/protocols/wrappers.py", line 122, in wrapper
return func(request, pool, *args, **kwargs)
  File "/trytond/protocols/dispatcher.py", line 172, in _dispatch
result = rpc.result(meth(inst, *c_args, **c_kwargs))
  File "/trytond/model/modelview.py", line 677, in on_change
method()
  File "/trytond/model/modelview.py", line 84, in wrapper
result = func(self, *args, **kwargs)
  File "/trytond/model/fields/field.py", line 114, in wrapper
return func(self, *args, **kwargs)
  File "/trytond/modules/tri_jda/jda.py", line 189, in on_change_lodnum
rec.save(recs)
  File "/trytond/model/descriptors.py", line 33, in newfunc
return self.func(owner, *args, **kwargs)
  File "/trytond/model/modelstorage.py", line 1532, in save
news = cls.create([save_values[r] for r in to_create])
  File "/trytond/model/modelsql.py", line 580, in create
[insert_values], [table.id]))
  File "/trytond/backend/postgresql/database.py", line 61, in execute
cursor.execute(self, sql, args)
psycopg2.InternalError: cannot execute INSERT in a read-only transaction


-
Above is my stacktrace.

I am going to integrate with some WMS system for receiving. When user input the 
PO number which is "Lodnum" then tryton "on_change" and will display the WMS 
data to the list (MS SQL Server).

Background, after "on_change", I will read data from MSSQL. And insert to 
Tryton postgres. 
But when inserted, above error occurred.

-- 
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/a7ef917a-916d-432b-b734-d85ee2ff65d5%40googlegroups.com.


Re: [tryton-dev] What is the fields_child and context_model

2018-10-01 Thread Markus Bala
On Monday, October 1, 2018 at 2:35:05 PM UTC+7, Cédric Krier wrote:
> On 2018-09-30 09:56, Markus Bala wrote:
> > I found the balance_sheet reporting.
> > But I do not undertstand what is the field_childs at the line 04.
> 
> It is to define a tree:
> https://tryton-readthedocs.readthedocs.io/projects/server/en/latest/topics/views/index.html?highlight=field_childs#tree-view
> 
> > And what is the "context_model" at the line 10.?
> 
> It is the model to display on top of the list to alter the context of
> the view.
> 
> -- 
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/

Noted.

the context_model --> is almost similar with wizard.
But when I try using context_model, i am going to do some "save" to model.
It prompt error psycopg2, cannot execute INSERT because is readonly-transaction

is it normal?

-- 
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/bfac0338-fdf7-4219-ba7b-29d0bd5d1c92%40googlegroups.com.


[tryton-dev] Mobile Apps For tryton?

2018-09-30 Thread Markus Bala
Hi,

Is it any plan for Tryton in App?

Look at this framework from google (Flutter).

It is flexible enough can go along with tryton on the fly create UI.

I may help contribute if needed

-- 
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/f7472260-e9c6-47c5-a0bc-bfca164b1dff%40googlegroups.com.


[tryton-dev] What is the fields_child and context_model

2018-09-30 Thread Markus Bala
Line 01)
Line 02)account.account.type
Line 03)tree
Line 04)childs
Line 05)account_balance_sheet_tree
Line 06)
Line 07)
Line 08)Balance Sheet
Line 09)account.account.type
Line 10)account.balance_sheet.context
Line 11)
Line 14)
Line 17)
Line 18)

I found the balance_sheet reporting.
But I do not undertstand what is the field_childs at the line 04.
And what is the "context_model" at the line 10.?

Especially the context_model? because it already has res_model 

-- 
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/e3abda3f-ad09-46a3-84b2-ee37d838fbd8%40googlegroups.com.


Re: [tryton-dev] How to get the Report in Byte?

2018-09-28 Thread Markus Bala
On Friday, September 21, 2018 at 3:54:10 PM UTC+7, Cédric Krier wrote:
> On 2018-09-21 01:35, Markus Bala wrote:
> > > > Question 3: How to get report in byte in trytond so I can print direct 
> > > > to printer through network. Like the link below
> > > > 
> > > > https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Network-Printing-Python-Example.html
> > > 
> > > You can get the Report class from the pool and call execute on it. This
> > > will return the bytes as second element of the response.
> > 
> > Could you give me example on this? Iam litte bit confuse.
> > 
> > Currently, I am using Relatio. It should be a dirty hack. I hope can use 
> > the method directly from Trytond instead.
> > 
> > Below is my code:
> > 
> > from relatorio import Report
> > 
> > class BarcodeLabel(Workflow, ModelSQL, ModelView):
> > 
> > @classmethod
> > def print_lpn(cls, records):
> > report = Report(abspath(join(dirname(__file__), 'lpn.odt')),
> > ODT_MIME)
> > data = report(records=records).render().getvalue()
> > file_name = join(dirname(__file__), 'output_basic.odt')
> > open(file_name, 'wb').write(data)
> 
> It should be something like:
> 
> @classmethod
> def print_lpn(cls, records):
> pool = Pool()
> Report = pool.get('module.my_report', type='report')
> ext, data, print, name = Report.execute(map(int, records), {})

Hi Cedric,

I had tried above code. Overall it is working.
But some need to do correction. I had explain the code below.
For others may need in future.

line 1: @classmethod
line 2: def print_lpn(cls, records):
line 3:pool = Pool()
line 4:Report = pool.get('report_name', type='report')
line 5:ext, data, print, name = Report.execute([5,4], {})

Correction:
line 4: it only need "report_name", it do not need the 'module'.
line 5: it use [5,4] "ids" as parameter

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

-- 
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/b2ef1740-41eb-4bc6-ba6f-9f773625a635%40googlegroups.com.


[tryton-dev] How to get the timezone from client

2018-09-27 Thread Markus Bala
Hi,

I noticed that setting timezone in user preference is missing.
However, in the documentation still show the setting.

Back to topic,
My situation is to print the printer date/time in the report.
If in the libreoffice, I set the date from the report. It will take the server 
date but server's date is UTC timezone.

So, I will custom printed_date but how to get the timezone from client show 
that can show the correct time?



Best regard,
Markus Bala

-- 
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/28b55c79-55eb-455b-bb00-fd69ededc76a%40googlegroups.com.


Re: [tryton-dev] How to get the Report in Byte?

2018-09-21 Thread Markus Bala
On Friday, September 21, 2018 at 8:54:10 AM UTC, Cédric Krier wrote:
> On 2018-09-21 01:35, Markus Bala wrote:
> > > > Question 3: How to get report in byte in trytond so I can print direct 
> > > > to printer through network. Like the link below
> > > > 
> > > > https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Network-Printing-Python-Example.html
> > > 
> > > You can get the Report class from the pool and call execute on it. This
> > > will return the bytes as second element of the response.
> > 
> > Could you give me example on this? Iam litte bit confuse.
> > 
> > Currently, I am using Relatio. It should be a dirty hack. I hope can use 
> > the method directly from Trytond instead.
> > 
> > Below is my code:
> > 
> > from relatorio import Report
> > 
> > class BarcodeLabel(Workflow, ModelSQL, ModelView):
> > 
> > @classmethod
> > def print_lpn(cls, records):
> > report = Report(abspath(join(dirname(__file__), 'lpn.odt')),
> > ODT_MIME)
> > data = report(records=records).render().getvalue()
> > file_name = join(dirname(__file__), 'output_basic.odt')
> > open(file_name, 'wb').write(data)
> 
> It should be something like:
> 
> @classmethod
> def print_lpn(cls, records):
> pool = Pool()
> Report = pool.get('module.my_report', type='report')
> ext, data, print, name = Report.execute(map(int, records), {})
> 
> 
Thank you :D
> -- 
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/

-- 
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/8de59d2e-1437-40dd-ac27-1bf9ba153572%40googlegroups.com.


Re: [tryton-dev] How to get the Report in Byte?

2018-09-21 Thread Markus Bala
On Friday, September 21, 2018 at 8:20:13 AM UTC, Cédric Krier wrote:
> On 2018-09-17 01:21, Markus Bala wrote:
> > Actually I have 3 questions, below is my case:
> > 
> > I will doing barcode label for some warehouse operation.
> > 
> > Case Study:
> > At the receiving area, during receiving & storage, it will need to print 2 
> > labels. One label is product label. One label is storage label. The 
> > different between 2 labels are in the label's size.
> > Product label using 5cm x 10cm. Storage label using 15cm x 10cm.
> > 
> > Because of this, I will  have 2 labels printer. Printer (A) for product 
> > label. Printer (B) for storage Label.
> > 
> > Question 1: for "Direct Print", how can set when I click on print "Product 
> > Label" it choose Printer (A) and vice versa.
> 
> On windows, the client use the command 'print' which let the OS decide.
> So maybe you can use different file extension and configure the OS to
> choose the right printer.
> On MacOS, the client uses the 'open' command which just open the file.
> Maybe it is possible to configure the "opener" to select the right
> printer when requesting to print.
> On UNIX, it uses the 'xdg-open' command. In this case, I guess you can
> also customize xdg to select the right printer from the mime-type.

Reply: Thank, I never thought of this method. I will try this solution.
> 
> > Or alternative solution:
> > Making the printer module. Like the link below:
> > 
> > https://groups.google.com/forum/#!searchin/tryton-dev/printer|sort:date/tryton-dev/1Hu0AE5bjd8/0zCHyxkPq3EJ
> 
> Not sure it is the best option because it requires a connection between
> the server and the printer. Usually they are not in the same physical
> area.

Reply: This will be alternative. I will try on the solution no 1.
> 
> > Question 2: How to get "Tryton Client" IP from "Trytond"? the purpose to 
> > fixed the IP/PC for the label printers so other PC do not have label printer
> 
> Since 4.8, the Transaction.context has an attribute '_request' which is
> the werkzeug request object and contain the IP address of the client.
> But there is no guarantee that this attribute will always be set (for
> example from proteus request or cron job).

Nice. I have been looking this. Missed to check the transaction.context.
Thank you
> 
> > Question 3: How to get report in byte in trytond so I can print direct to 
> > printer through network. Like the link below
> > 
> > https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Network-Printing-Python-Example.html
> 
> You can get the Report class from the pool and call execute on it. This
> will return the bytes as second element of the response.

Could you give me example on this? Iam litte bit confuse.

Currently, I am using Relatio. It should be a dirty hack. I hope can use the 
method directly from Trytond instead.

Below is my code:

from relatorio import Report

class BarcodeLabel(Workflow, ModelSQL, ModelView):

@classmethod
def print_lpn(cls, records):
report = Report(abspath(join(dirname(__file__), 'lpn.odt')),
ODT_MIME)
data = report(records=records).render().getvalue()
file_name = join(dirname(__file__), 'output_basic.odt')
open(file_name, 'wb').write(data)
> 
> -- 
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/

-- 
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/8faf1a69-436e-4d66-bbfe-5af30390fe4a%40googlegroups.com.


[tryton-dev] How to get the Report in Byte?

2018-09-17 Thread Markus Bala
Hi,

Actually I have 3 questions, below is my case:

I will doing barcode label for some warehouse operation.

Case Study:
At the receiving area, during receiving & storage, it will need to print 2 
labels. One label is product label. One label is storage label. The different 
between 2 labels are in the label's size.
Product label using 5cm x 10cm. Storage label using 15cm x 10cm.

Because of this, I will  have 2 labels printer. Printer (A) for product label. 
Printer (B) for storage Label.

Question 1: for "Direct Print", how can set when I click on print "Product 
Label" it choose Printer (A) and vice versa.

Or alternative solution:
Making the printer module. Like the link below:

https://groups.google.com/forum/#!searchin/tryton-dev/printer|sort:date/tryton-dev/1Hu0AE5bjd8/0zCHyxkPq3EJ

Question 2: How to get "Tryton Client" IP from "Trytond"? the purpose to fixed 
the IP/PC for the label printers so other PC do not have label printer

Question 3: How to get report in byte in trytond so I can print direct to 
printer through network. Like the link below

https://www.zebra.com/us/en/support-downloads/knowledge-articles/ait/Network-Printing-Python-Example.html


Please help

-- 
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/b2339584-faa6-443f-9ca1-87ac13ff966e%40googlegroups.com.


Re: [tryton-dev] Crypt super_pwd in password

2016-10-19 Thread Markus Bala
On Wed, Oct 19, 2016 at 8:33 PM, Sergi Almacellas Abellana  wrote:

> El 19/10/16 a les 12:50, Markus Bala ha escrit:
>
>> Hi,
>>
>> Did anyone know how to user super_pwd for windows?
>>
> Does the python command posted in the doc [1] don't work for windows?
>
> [1] http://doc.tryton.org/3.8/trytond/doc/topics/configuration.
> html?highlight=super_pwd#super-pwd


Hi Sergi,

It do not work because "Crypt" library is only available in unix. However,
I am trying to find the  similar library that suitable to this.
But to novail.
So Maybe anyone in this group did have same experience which can help tell
the work around.

best regard,
Markus

>
>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>
> --
> 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/ms
> gid/tryton-dev/3c607363-92bb-bb88-f2c6-27425f2cf997%40koolpi.com.
>

-- 
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/CAOzpWEGHyprYpdBvXqNENwXy-hNZh22T5hCkEMEhZhv2nXRMHg%40mail.gmail.com.


Re: [tryton-dev] Re: How to call custom method in proteus

2016-10-19 Thread Markus Bala
On Wed, Oct 19, 2016 at 8:42 PM, Sergi Almacellas Abellana  wrote:

> El 19/10/16 a les 15:38, Diego Abad ha escrit:
>
>> El miércoles, 19 de octubre de 2016, 5:54:14 (UTC-5), Markus Bala
>> escribió:
>>
>> Hi,
>>
>> As we know proteus able to work as Tryton client, able to do Find,
>> update, delete, call Button, and Wizard.
>>
>>
>> Below is to call button in proteus:
>> s = ShipmentIn.find([('reference','=', ref),('state','=','draft')])
>> s.click('receive')
>>
>> My question is how to call a method by using proteus?
>>
>> Example: (how to call method add in proteus?)
>>
>> Class StockMove:
>> def add(self, val1, val2):
>> return val1 + val2
>>
>>
>> You can find a example on account module, see get_origin method,
>> there is a definition inside   cls.__rpc__.update
>>
>> http://hg.tryton.org/modules/account/file/tip/move.py#l689
>
>
Hi Diego,

Thank you.

After we add tje cls__rpc__.update, how to call this newly method in
proteus?

is it same as call button action? then how to set the parameter?

s.click('add') --> how to set val1, val2?

>
>> That's right. You have to add the modules in __rpc__ so they can be
> called from the client (and proteus also of course).
>
> But normally is not required to do such things, so I'm wondering what you
> are trying to achieve? Maybe rpc is not the right tool to solve the problem
> you have.
>
> Hi Sergi,

I am going to make a small application for Handy Terminal. This application
has limited function.
Most of the function are scan the barcode and showing the result on the
screen. and Maybe just do simple function such as adding Stock inventory or
update the stock qty.

Best Regard,

>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>
> --
> 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/ms
> gid/tryton-dev/094841f5-b50f-98cd-d059-7bb7febd663d%40koolpi.com.
>

-- 
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/CAOzpWEEtQY4sqViGeA1oujq7UVFDDMb_aWFtB%3DtF3V5JSGZc4g%40mail.gmail.com.


[tryton-dev] How to call custom method in proteus

2016-10-19 Thread Markus Bala
Hi,

As we know proteus able to work as Tryton client, able to do Find, update, 
delete, call Button, and Wizard.


Below is to call button in proteus:
s = ShipmentIn.find([('reference','=', ref),('state','=','draft')])
s.click('receive')

My question is how to call a method by using proteus?

Example: (how to call method add in proteus?)

Class StockMove:
def add(self, val1, val2):
return val1 + val2



-- 
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/2c2b848a-9cf2-4033-958b-9d400ff3090e%40googlegroups.com.


[tryton-dev] Crypt super_pwd in password

2016-10-19 Thread Markus Bala
Hi,

Did anyone know how to user super_pwd for windows?

Best Regard,
Markus Bala

-- 
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/d7a4e789-9ae8-4cec-b124-3aed56fed33f%40googlegroups.com.


Re: [tryton-dev] How to run unittest

2016-10-18 Thread Markus Bala
On Tue, Oct 18, 2016 at 3:44 PM, Sergi Almacellas Abellana  wrote:

> El 18/10/16 a les 10:27, Markus Bala ha escrit:
>
>> Hi Sergi,
>>
>> Example code as below, if in the proteus, how am I going to call
>> "test_method"?
>>
>> Class stock_move:
>> def test_method(self, value1, value2):
>> return value1 + value2
>>
> If the code is this simple and you want to test only a method I will write
> a unittest for it and don't test using proteus.
>
> IMHO Proteus should be used when testing full user interaction, on_change
> functions or full workflows.


Hi Sergi,

Sorry, I think I made you confuse.
I made 2 question in one email:

The 1st question is how to write and call unittest. I had already
understand the concept and trying to understand by hand on.

The 2nd question is how to call method from proteus. --> This is not for
Unit Test but for development.
How to call the method from proteus usign RPC?


Apologize again, to make you confuse


>
>
>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>
> --
> 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/ms
> gid/tryton-dev/b4718823-54d2-1101-60b6-7e7acacdbb06%40koolpi.com.
>

-- 
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/CAOzpWEEotp7UTa2iNEfxmXONyFSmAtB%2BDP2yb76whvrBFOp-WA%40mail.gmail.com.


Re: [tryton-dev] How to run unittest

2016-10-18 Thread Markus Bala
On Tue, Oct 18, 2016 at 3:18 PM, Sergi Almacellas Abellana  wrote:

> El 17/10/16 a les 19:27, Markus Bala ha escrit:
>
>> thank you for your comment.
>> Now I understand where to start to write my unit test. I will try later.
>>
>> I have a question.
>> Is it possible Proteus able to call method/function?
>>
> Yes, you can use proteus to call any RPC method, but I'm pretty sure we
> can give a better advice if you explain more concretly what do you want to
> do we can give a better advice.
>
> Also, make sure to take a look at the standard module test to have an idea
> of what it's possible to do and come here with your doubts if any.
>
> Hope it helps!


Hi Sergi,

Example code as below, if in the proteus, how am I going to call
"test_method"?

Class stock_move:
def test_method(self, value1, value2):
return value1 + value2


>
>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>
> --
> 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/ms
> gid/tryton-dev/870b9e2f-5eee-13b8-5f14-159970849650%40koolpi.com.
>

-- 
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/CAOzpWEEiTsqLhpN4EEh-j-KgJAorT47GZ8kyVkqz0ap5XdAPGg%40mail.gmail.com.


Re: [tryton-dev] How to run unittest

2016-10-17 Thread Markus Bala
On Mon, Oct 17, 2016 at 8:45 PM, Sergi Almacellas Abellana  wrote:

> El 17/10/16 a les 15:32, Markus Bala ha escrit:
>
>> Hi All,
>>
>> Seeing the official modules have Test folder, it contains test case and
>> scenario.
>> May I know how to run test case?
>>
>
> You have several possibilities here:
>
> 1. Run the run-test.py[1] script from the tryton server using the -m
>  to execu
> 2. Execute python setup.py test with the DB_NAME key set in the
> environemnt. For example, for runing in a memory sqlite database you can
> use the following command:
>
> DB_NAME=:memory: python setup.py test
>
> Note: The second will install the package and the required dependencies.
>
>> or when can I find the documentation for unittest?
>> 1. What are prerequisite?
>> 2. How to write?
>> 3. How to run?
>>
>
> I've done some talk about it in the past, you have the slides avaialble
> here [2] and the video record [3] (sorry but only in spanish)
>
> Hope it helps!
>
> [1] http://hg.tryton.org/trytond/file/9c2eb1b04df8/trytond/tests
> /run-tests.py
> [2] http://pokoli.github.io/testing-in-tryton/#/
> [3] https://www.youtube.com/watch?v=cGfz3MaNxec


 Hi Sergi,

thank you for your comment.
Now I understand where to start to write my unit test. I will try later.

I have a question.
Is it possible Proteus able to call method/function?

best regard

>
> --
> Sergi Almacellas Abellana
> www.koolpi.com
> Twitter: @pokoli_srk
>
> --
> 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/ms
> gid/tryton-dev/88795a5f-73ba-63fa-2716-2b6dd762e968%40koolpi.com.
>

-- 
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/CAOzpWEFUEzOiPjvAML4b37p3Dz%3DFeEHKqS-pR3mRrog5uvKW8g%40mail.gmail.com.


[tryton-dev] How to run unittest

2016-10-17 Thread Markus Bala
Hi All,

Seeing the official modules have Test folder, it contains test case and 
scenario.
May I know how to run test case?
or when can I find the documentation for unittest?
1. What are prerequisite?
2. How to write?
3. How to run?

best regard,
Markus Bala

-- 
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/9d29d30d-2b63-4195-9bff-9c34f346689e%40googlegroups.com.


Re: [tryton-dev] Unable to change Product configuration for Cost Method

2016-10-16 Thread Markus Bala
On Sat, Oct 15, 2016 at 3:29 PM, Cédric Krier  wrote:

> On 2016-10-15 01:09, Markus Bala wrote:
> > Hi,
> >
> > I want to check whether it is a bug or design as per initial.
> >
> > For Product > Configuration > Product, when want to change the value.
> >
> > It call the below method "set_default_cost_price, with the delete
> > "Property". However, the property is the system created record (xml
> below).
> > So whenever want to change the value, system will prevent it due to
> "System
> > Created Record". In other words, it will forever unable to change this
> > value.
> > Is it system design or miss on that?
>
> Please fill an issue.
>

Hi Cedric,

I was register at Tryton list. It said need to wait for email confirmation.
However, I am still not received yet.

So unable to register the issue yet

>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> 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/20161015082939.GY99626%40tetsuo.
>

-- 
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/CAOzpWEEAUw1VMVmu_RjFcZrJxP358BaqkC3rdV_0Mp7KTN5UrQ%40mail.gmail.com.


[tryton-dev] Unable to change Product configuration for Cost Method

2016-10-15 Thread Markus Bala
Hi,

I want to check whether it is a bug or design as per initial.

For Product > Configuration > Product, when want to change the value. 

It call the below method "set_default_cost_price, with the delete 
"Property". However, the property is the system created record (xml below).
So whenever want to change the value, system will prevent it due to "System 
Created Record". In other words, it will forever unable to change this 
value.
Is it system design or miss on that?


@classmethod
def set_default_cost_price_method(cls, configurations, name, value):
pool = Pool()
Property = pool.get('ir.property')
field = cls._get_product_field('cost_price_method')
properties = Property.search([
('field', '=', field.id),
('res', '=', None),
])
*Property.delete(properties)*
if value:
Property.create([{
'field': field.id,
'value': ',%s' % value,
}])




,fixed



-- 
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/177d01f2-9814-49ba-a446-6336b76af337%40googlegroups.com.


Re: [tryton-dev] Need help at threading in tryton

2016-06-20 Thread Markus Bala
On Jun 20, 2016 9:35 PM, "Cédric Krier"  wrote:
>
> On 2016-06-20 16:01, Sergi Almacellas Abellana wrote:
> > AFAIK you have to start a new transaction for each Thread. See:
> >
> >
http://doc.tryton.org/4.0/trytond/doc/ref/transaction.html?highlight=start#trytond.transaction.Transaction.start
>
May I know how to get the database name and user?

> I think it could be an interesting improvement to allow to pass the
> current transaction to a new thread (or maybe just the database
> connection and datamanagers).
>
Yes,it will good to have this.
As if going to communicate with hardware, most time, thread will be used
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> 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/20160620143237.GP4037%40tetsuo.

-- 
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/CAOzpWEEzHh4imG5cMrzX%3DLodJ0CtyRKMGdH8jvwJKnXdFYkCrQ%40mail.gmail.com.


[tryton-dev] Need help at threading in tryton

2016-06-20 Thread Markus Bala
Hi All,

Please help me!!!

I am creating a thread to read the TCP socket and the purpose to write the 
log.
When I call the database method (transaction), the thread seem like cannot 
read the existing transaction. 
In that case, the transaction return the 'nonetype'

Can anyone help how to connect or write the database in the thread method?
--

Exception in thread Thread-6:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
  File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
  File 
"/home/markus/virtualenv/trytond/local/lib/python2.7/site-packages/trytond/modules/dps_base/aioi.py",
 
line 172, in read
self.writeLog(self._controller,'r',data)
  File 
"/home/markus/virtualenv/trytond/local/lib/python2.7/site-packages/trytond/modules/dps_base/aioi.py",
 
line 59, in writeLog
return super(aioi, self).create([values])
  File 
"/home/markus/virtualenv/trytond/local/lib/python2.7/site-packages/trytond/model/modelsql.py",
 
line 471, in create
pool = Pool()
  File 
"/home/markus/virtualenv/trytond/local/lib/python2.7/site-packages/trytond/pool.py",
 
line 58, in __new__
database_name = Transaction().cursor.database_name
AttributeError: 'NoneType' object has no attribute 'database_name'

---
from threading import Thread
import socket

 
  @classmethod
def read(self, comms) 
t = Thread(target=self.receive_respond, args=())
t.start()


@classmethod
def receive_respond(self):
s = socket.socket()
host = '127.0.0.1'
port  = 5003
s.connect((host,port))

while True:
data = None

data = s.recv(4096)
print data
print 'respond:' + data
self.writeLog('r',data)


@classmethod
def writeLog(self,  type, data=None):
values = {
  'log_date': datetime.datetime.now(),
  'type': type,
  'raw_data': data,
  'data': data[8:-1],
  'seq': int(data[1:3]),
  'data_length': data[4:8]
}
return super(aioi, self).create([values])

-- 
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/bf076d97-6932-4f11-b7b8-e672c2c6d912%40googlegroups.com.


Re: [tryton-dev] Datetime field at the Tree View

2016-06-07 Thread Markus Bala


On Tuesday, June 7, 2016 at 4:36:03 PM UTC+7, Sergi Almacellas Abellana 
wrote:
>
> El 07/06/16 a les 11:33, Markus Bala ha escrit: 
> > Hi, 
> > 
> > I am facing an error. 
> > If the field is datetime and set at the TreeView. I received an error. 
> > Did anyone having same experience? 
> > 
> > Trytond version 3.8 
> Yes, there is not more a datetime widget on tree view. So you must add 
> two fields, one with date widget and other with time widget. Something 
> like: 
>
>  
>  
>
> So you will get two diferent columsn with the values. 
>

Oh I See, Thank again. Sergi.. You save my day 

>
> P.S: You can use the tryton mailing list for this kind of questions. 
> tryton-dev is for discussion about the development of tryton. 
>

Noted.
 

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

-- 
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/d0bf1821-9737-48fe-b52d-67a770160bf5%40googlegroups.com.


[tryton-dev] Datetime field at the Tree View

2016-06-07 Thread Markus Bala
Hi,

I am facing an error. 
If the field is datetime and set at the TreeView. I received an error.
Did anyone having same experience?

Trytond version 3.8


It will give an error as below:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tryton/gui/window/form.py", 
line 222, in sig_switch
self.screen.switch_view()
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 381, in switch_view
self.load_view_to_load()
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 402, in load_view_to_load
self.add_view_id(view_id, view_type)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 415, in add_view_id
return self.add_view(view)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 440, in add_view
view = View.parse(self, xml_dom, view.get('field_childs'))
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/__init__.py",
 
line 49, in parse
return ViewForm(screen, root)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 107, in __init__
container = self.parse(xml)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 143, in parse
widget = parser(node, container, node_attrs)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 235, in _parse_notebook
self.parse(node, notebook)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 143, in parse
widget = parser(node, container, node_attrs)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 268, in _parse_page
container = self.parse(node)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 143, in parse
widget = parser(node, container, node_attrs)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form.py",
 
line 296, in _parse_field
widget = Widget(self, attributes)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/form_gtk/one2many.py",
 
line 190, in __init__
exclude_field=attrs.get('relation_field', None))
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 96, in __init__
self.switch_view()
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 381, in switch_view
self.load_view_to_load()
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 402, in load_view_to_load
self.add_view_id(view_id, view_type)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 415, in add_view_id
return self.add_view(view)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/screen/screen.py",
 
line 440, in add_view
view = View.parse(self, xml_dom, view.get('field_childs'))
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/__init__.py",
 
line 47, in parse
return ViewTree(screen, root, children_field)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/list.py",
 
line 289, in __init__
self.parse(xml)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/list.py",
 
line 327, in parse
self._parse_field(node)
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/list.py",
 
line 356, in _parse_field
Widget = self.get_widget(node_attrs['widget'])
  File 
"/usr/local/lib/python2.7/dist-packages/tryton/gui/window/view_form/view/list.py",
 
line 452, in get_widget
return cls.WIDGETS[name]
KeyError: u'datetime'

-- 
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/93abd764-64cc-4ed6-a25a-ebd20fe87f18%40googlegroups.com.


Re: [tryton-dev] One2Many on_change_with Function > How to declare?

2016-06-06 Thread Markus Bala


On Monday, June 6, 2016 at 5:22:52 PM UTC+7, Sergi Almacellas Abellana 
wrote:
>
> El 06/06/16 a les 12:03, Markus Bala ha escrit: 
> > 
> > 
> > On Monday, June 6, 2016 at 4:43:34 PM UTC+7, Sergi Almacellas Abellana 
> > wrote: 
> > 
> > El 06/06/16 a les 11:40, Markus Bala ha escrit: 
> >  > 
> >  > 
> >  > The basic function is, 
> >  >   During open the service, 
> >  > When vehicle change, the part to check will change according the 
> > vehicle. 
> >  > 
> >  > The part to check is copy from Vehicle_part Table.. 
> >  > How to use one2many on_change_with to check add, update, delete? 
> > I think you want a domain, to enforce that the selected part is from 
> > the 
> > corresponding vehicle. Am I right? 
> > 
> > See: 
> > 
> http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html?highlight=domain#trytond.model.fields.Field.domain
>  
> > <
> http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html?highlight=domain#trytond.model.fields.Field.domain>
>  
>
> > 
> > 
> > 
> > Hi Sergi, 
> > 
> > Thank you for your fast respond. 
> > 
> > Yes, To enforce that selected part from vehicle. 
> So to enforce you must add a domain, that will be enforced on client 
> side and on server side. 
>
> > However, I need to put checking information for the part. so to keep the 
> > result at another table. 
> > 
> > Example: 
> > 
> > Vehicle: Car A 
> > Part: Part A, Part D, Part F. 
> > 
> > Service: Service A for Car A 
> > Part To check (the parts detail copy from table vehicle part) 
> > Part A ---> Status Minor --> Need to monitor 
> > Part D ---> Status OK 
> > Part F ---> Status Fail ---> Change the new part 
> > 
> Sorry, but I'm not sure to understand you. 
>
> Do you want to fill one line for every vehicle part, when a car is 
> selected on the Service? If so, you must implement the on_change_service 
> function that will remove the current lines (if any) and add a new line 
> for each vehicle's part. 
>

Yes, this is my initial solution. I thought the Tryton has built-in 
function for this situation

>
> > 
> ---
>  
>
> > I saw this method: 
> > 
> http://doc.tryton.org/3.4/trytond/doc/topics/models/fields_on_change.html#on-change-on-change-with-return-values
>  
> <http://www.google.com/url?q=http%3A%2F%2Fdoc.tryton.org%2F3.4%2Ftrytond%2Fdoc%2Ftopics%2Fmodels%2Ffields_on_change.html%23on-change-on-change-with-return-values&sa=D&sntz=1&usg=AFQjCNGPxnCvDO16CjJESQAdZG6TJBcWMQ>
>  
> > 
> > But do not know how to use it. 
> > 
> You have an example on the explode_bom function of the production module. 
>

Thank for the advice. I will take a look

>
> Hope it helps. -- 
> Sergi Almacellas Abellana 
> www.koolpi.com 
> Twitter: @pokoli_srk 
>

-- 
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/0c8fd595-a139-4b2b-90ff-0e238df9fbdc%40googlegroups.com.


Re: [tryton-dev] One2Many on_change_with Function > How to declare?

2016-06-06 Thread Markus Bala


On Monday, June 6, 2016 at 4:43:34 PM UTC+7, Sergi Almacellas Abellana 
wrote:
>
> El 06/06/16 a les 11:40, Markus Bala ha escrit: 
> > 
> > 
> > The basic function is, 
> >   During open the service, 
> > When vehicle change, the part to check will change according the 
> vehicle. 
> > 
> > The part to check is copy from Vehicle_part Table.. 
> > How to use one2many on_change_with to check add, update, delete? 
> I think you want a domain, to enforce that the selected part is from the 
> corresponding vehicle. Am I right? 
>
> See: 
>
> http://doc.tryton.org/4.0/trytond/doc/ref/models/fields.html?highlight=domain#trytond.model.fields.Field.domain
>  
>

Hi Sergi,

Thank you for your fast respond.

Yes, To enforce that selected part from vehicle.
However, I need to put checking information for the part. so to keep the 
result at another table.

Example:

Vehicle: Car A
Part: Part A, Part D, Part F.

Service: Service A for Car A
Part To check (the parts detail copy from table vehicle part)
Part A ---> Status Minor --> Need to monitor
Part D ---> Status OK
Part F ---> Status Fail ---> Change the new part

---
I saw this method:
http://doc.tryton.org/3.4/trytond/doc/topics/models/fields_on_change.html#on-change-on-change-with-return-values

But do not know how to use it.


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

-- 
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/b72070bf-aadc-4f83-a26f-77ee65051cdf%40googlegroups.com.


[tryton-dev] One2Many on_change_with Function > How to declare?

2016-06-06 Thread Markus Bala
Hi,

I want to create a Vehicle Service transaction.

Vehicle
---
Name
vehicle_part (one2many)

Vehicle_part
--
vehicle(many2one)
name
Type
Category
Qty

--
When I have another table to record the service and part to check.

SERVICE
--
vehicle(many2one)
part_to_check (one2many)

Part_To_check
---
service(many2one)
part_list from vehicle_part


The basic function is,
 During open the service, 
When vehicle change, the part to check will change according the vehicle.

The part to check is copy from Vehicle_part Table..
How to use one2many on_change_with to check add, update, delete?






-- 
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/bfc1458b-5261-45d0-8227-78bff0eb3377%40googlegroups.com.


Re: [tryton-dev] how to change the field states

2016-04-12 Thread Markus Bala
On Tue, Apr 12, 2016 at 1:58 PM, Ralf Peschke 
wrote:

> Hi Markus,
>
> Am 12.04.2016 um 05:55 schrieb Markus Bala:
> > Hi,
> >
> > I had an inherit model ShipmentIn. Adding new field "order_confirm". The
> > purpose when the order confirmed, other fields will be readonly.
> >
> > How I am going to modify other fields base on the "order_confirm"?
> >
> > Example:
> > Original :
> > company = fields.Many2One(.., states ={'readonly': Eval('state') !=
> > 'draft'})
> >
> > Expected:
> > company = fields.Many2One(..., states = {'readonly': Eval('state') !=
> > 'draft' | Eval('order_confirm') }
> >
> The "states" of each field are a dictionary with the keys "readonly",
> "required" and "invisible". You can change it in the setup-classmethod:
>
> @classmethod
> def __setup__(cls):
> super(YOURCLASSNAME, cls).__setup__()
> cls.company.states['readonly'] = (Eval('state') != 'draft' |
> Eval('order_confirm'))
>
>
> I hope it helps in time
>

Hi Ralf,

Thank you.

If let say I do not want to change the original state but only add the new
condition. Is it possible?

original_condition = cls.company.states['readonly']
cls.company.states['readonly'] =
(original_condition  | Eval('order_confirm'))

???

>
> --
> 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/570C9CAD.7000602%40peschke-it.de
> .
>

-- 
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/CAOzpWEFQPzH%2B%3DaqpKd2_17dvjwhF4Y9LX%3DFUZRB0%2BfFbcyGdDg%40mail.gmail.com.


[tryton-dev] how to change the field states

2016-04-11 Thread Markus Bala
Hi,

I had an inherit model ShipmentIn. Adding new field "order_confirm". The 
purpose when the order confirmed, other fields will be readonly.

How I am going to modify other fields base on the "order_confirm"?

Example:
Original :
company = fields.Many2One(.., states ={'readonly': Eval('state') != 
'draft'})

Expected:
company = fields.Many2One(..., states = {'readonly': Eval('state') != 
'draft' | Eval('order_confirm') }

Please help

-- 
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/2067b35a-e859-4c69-add3-6385eb8a7eb3%40googlegroups.com.


Re: [tryton-dev] Disable create new, modify, or delete

2016-02-17 Thread Markus Bala
On Wed, Feb 17, 2016 at 4:11 PM, Cédric Krier  wrote:

> On 2016-02-16 22:03, Markus Bala wrote:
> > Hi,
> >
> > Is it possible to disable create new or modify or delete at client side?
> >
> > Example:
> > I have a form. This form data is from "Database View" the purpose is only
> > for viewing.
> > In that case, I want to disable "Create new" function.
>
> Yes this is defined by ir.model.access:
>
> http://doc.tryton.org/3.8/trytond/doc/topics/access_rights.html?#model-access


Hi Cedric,

May I know how to set access to the button (create new button)?


>
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> 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/20160217091110.GT10143%40tetsuo
> .
>

-- 
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/CAOzpWEGuN%3DjVRxkCmQhXQJpwkiSt9X%3DYPdxMZPisnQwdjBGi6A%40mail.gmail.com.


[tryton-dev] Disable create new, modify, or delete

2016-02-16 Thread Markus Bala
Hi,

Is it possible to disable create new or modify or delete at client side?

Example:
I have a form. This form data is from "Database View" the purpose is only 
for viewing.
In that case, I want to disable "Create new" function.

best Regard,
Markus Bala

-- 
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/4aa16b79-6c40-4dca-baae-16b8c950e9d6%40googlegroups.com.


[tryton-dev] Using raw sql in table query

2016-02-15 Thread Markus Bala
Hi,

Is it posible to use Raw Sql in table_query()?
Or how to convert execute sql to active record?

Best regard

-- 
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/b1d7a514-5b4c-447a-94fb-74450c3c0601%40googlegroups.com.


Re: [tryton-dev] How to get the active_ids for the children

2016-02-15 Thread Markus Bala
On Mon, Feb 15, 2016 at 4:04 PM, Cédric Krier  wrote:

> On 2016-02-15 00:50, Markus Bala wrote:
> > hi,
> >
> > I am doing keyword action "form_action".
> >
> > Model: stock.shipment.in
> >
> > The function is to merge the stock.move data.
> >
> > My question is how can I get the selected ID for the stock.move (child).
> At
> > now, I only can get the parent;s active_id (stock.shipment.in).
>
> You can not. The One2Many should be seen as a single value so there is
> no state on that.
>
> Thank cedric, Noted

> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> 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/20160215090454.GB18582%40tetsuo
> .
>

-- 
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/CAOzpWEHvNyHhC9Ep%3Dq_7cVfbAmmJLSkcMkEEkzyObEFQH5f4gg%40mail.gmail.com.


[tryton-dev] How to get the active_ids for the children

2016-02-15 Thread Markus Bala
hi,

I am doing keyword action "form_action".

Model: stock.shipment.in

The function is to merge the stock.move data.

My question is how can I get the selected ID for the stock.move (child). At 
now, I only can get the parent;s active_id (stock.shipment.in).

Please advice

Best Regard,
Markus Bala

-- 
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/51112f65-b925-43b3-914a-fb69820473ba%40googlegroups.com.


Re: [tryton-dev] How to override the form view or choosing the form view?

2016-02-02 Thread Markus Bala
On Feb 2, 2016 6:10 PM, "Cédric Krier"  wrote:
>
> On 2016-02-02 02:53, Markus Bala wrote:
> > I am sorry.
> > Please allowed me to attached picture for explaining my trouble.
> >
> > Background:
> > 1. Creating a new boolean field "staging" at "stock.location" model.
> > 2. Creating a new form (do not want inherit), to add "staging" field
> > Trouble:
> > How to override the form when create a new object? --> refer to the
picture.
> >
> > My solution as below, it only change the display of the tree view but
not
> > form view:
> >
> >   > view_ids="wms_base.storage_tree_view,wms_base.storage_form_view" />
> >
> > <
https://lh3.googleusercontent.com/-dverRhj2sdc/VrCIB4CBsAI/GNk/aTnnADRAJCc/s1600/prob.png
>
>
> This is a miss behaviour of the client, it doesn't reuse the views of
> the field for the new creation in the search window:
>
>
http://hg.tryton.org/tryton/file/4a0f8e29ab2b/tryton/gui/window/win_search.py#l111

Is it the client bug?
Any work around? Or need to modify client code?
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>
> --
> 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/20160202110838.GU20880%40tetsuo
.

-- 
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/CAOzpWEHm52ovzk0-GR42dEqd6YxvyBat53TN7kUcp6pzZkSjyg%40mail.gmail.com.


[tryton-dev] How to override the form view or choosing the form view?

2016-02-02 Thread Markus Bala



Hi All,

I am sorry.
Please allowed me to attached picture for explaining my trouble.

Background:
1. Creating a new boolean field "staging" at "stock.location" model.
2. Creating a new form (do not want inherit), to add "staging" field
Trouble:
How to override the form when create a new object? --> refer to the picture.

My solution as below, it only change the display of the tree view but not 
form view:

 




-- 
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/afaaf383-0444-4012-8068-986288744e18%40googlegroups.com.


Re: [tryton-dev] How to overide the field property

2016-02-02 Thread Markus Bala


On Tuesday, February 2, 2016 at 4:23:28 PM UTC+7, Sergi Almacellas Abellana 
wrote:
>
> El 02/02/16 a les 10:16, Markus Bala ha escrit: 
> > Hi All, 
> > 
> > I had inherit 'stock.location', and add a new boolean field  called 
> > 'staging'. 
> > 
> > I try to change the original 'storage.location' field as below: 
> >  storage_location = fields.Many2One( 
> >  "stock.location", "Storage", states={ 
> >  'invisible': Eval('type') != 'warehouse', 
> >  'readonly': ~Eval('active'), 
> >  'required': Eval('type') == 'warehouse', 
> >  }, 
> >  domain=[ 
> >  ('type', 'in', ['storage', 'view']),*('staging','=', 
> False),* 
> >  ['OR', 
> >  ('parent', 'child_of', [Eval('id')]), 
> >  ('parent', '=', None)]], 
> >  depends=['type', 'active', 'id']) 
> > 
> > At the domain, I add ('staging','=',False). 
> > When I checked the result, seem like it do not override the field? 
>
> You should override the domain in the __setup__ method of your function. 
> Something like: 
>
> @classmethod 
> def __setup__(cls) 
> super(Class, cls).__setup__() 
> clause = ('staging', '=', False) 
> if clause not in cls.storage_location.domain: 
> cls.storage_location.domain.append(clause) 
>
> So this will modify the field when you module is loaded. 
>

Hi Sergi,

You are really a savior. Thank you 

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

-- 
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/08b50aaf-f14d-44f2-9238-d18b16fc61b4%40googlegroups.com.


[tryton-dev] How to overide the field property

2016-02-02 Thread Markus Bala
Hi All,

I had inherit 'stock.location', and add a new boolean field  called 
'staging'.

I try to change the original 'storage.location' field as below:
storage_location = fields.Many2One(
"stock.location", "Storage", states={
'invisible': Eval('type') != 'warehouse',
'readonly': ~Eval('active'),
'required': Eval('type') == 'warehouse',
},
domain=[
('type', 'in', ['storage', 'view']),*('staging','=', False),*
['OR',
('parent', 'child_of', [Eval('id')]),
('parent', '=', None)]],
depends=['type', 'active', 'id'])

At the domain, I add ('staging','=',False). 
When I checked the result, seem like it do not override the field?

Please advice

-- 
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/ba43f3b4-0396-4317-bad4-f46317d7ad46%40googlegroups.com.


[tryton-dev] How to set domain for the child form

2015-04-05 Thread Markus Bala
class Template:
__name__ = 'product.template'

packagings = fields.One2Many('product.uom-packaging.type', 
'template','Packaging')


class TemplatePackageType(ModelSQL, ModelView,):
'Prouct Packaging Type'
__name__ = 'product.uom-packaging.type'

template = fields.Many2One('product.template', 'Template', 
required=True,
select=True, ondelete='CASCADE')
barcode = fields.Char('Label/Barcode', help="Barcode label or indicator 
of the pack")
pack_uom = fields.Many2One('product.uom', 'Pack Uom', 
   domain=[
   ('category', '=', 
Eval('default_uom_category')),
   ])
default_uom_category = fields.Function(
fields.Many2One('product.uom.category', 'Default UOM Category'),
'on_change_with_default_uom_category',
searcher='search_default_uom_category')

---
When I am going to create "product.uom-packaging.type". 
May I know how the "pack_uom" able to do the domain of the 
"default_uom_category" from the "product.template"?


Best regard,
Markus bala


[tryton-dev] Possible to disable toolbar?

2015-04-03 Thread Markus Bala
Hi,

May I know, is it posible to disable the toolbar or make it invisible?

I am making an module which for production worker to record the weight 
scale reading.

So I want to control the record by button instead of the toolbar action 
(new,delete).
if i am using access to disable create and delete, they will not able to 
insert record.

Best Regard


[tryton-dev] Is it possible to use free text in table_query?

2014-12-10 Thread Markus Bala
Can I do something like the code below?

@staticmethod
def table_query():
pool = Pool()
Move = pool.get('stock.move')
Location = pool.get('stock.location')
move = Move.__table__()

product_id = Transaction().context.get('product')
warehouse_id = Transaction().context.get('warehouse', -1)
warehouse_query = Location.search([
('parent', 'child_of', [warehouse_id]),
], query=True, order=[])

from_date = Transaction().context.get('from_date')
to_date = Transaction().context.get('to_date')



query = """
SELECT row_number() over (order by f.effective_date) as 
id,
   f.effective_date,
   origin,
   shipment,
   f.name,
   f.product,
   f.default_uom AS uom,
   f.frm AS from_location,
   f.to_d AS to_location,
   CASE f.frm::text || f.to_d::text
 WHEN 'lost_foundstorage'::text THEN f.qty
 WHEN 'customerstorage'::text THEN f.qty
 WHEN 'supplierstorage'::text THEN f.qty
 ELSE 0::double precision
   END AS debit,
   CASE f.frm::text || f.to_d::text
 WHEN 'storagelost_found'::text THEN f.qty
 WHEN 'storagecustomer'::text THEN f.qty
 WHEN 'storagesupplier'::text THEN f.qty
 ELSE 0::double precision
   END AS credit,
   0 as saldo
FROM (SELECT sm.origin,
 sm.shipment,
 sm.effective_date,
 frm_loc.type AS frm,
 to_loc.type AS to_d,
 pt.name,
 sm.product,
 pt.default_uom,
 pu.symbol AS uom,
 SUM(sm.quantity / pu.factor) AS qty
  FROM stock_move sm
JOIN stock_location to_loc ON to_loc.id = 
sm.to_location
JOIN stock_location frm_loc ON frm_loc.id = 
sm.from_location
JOIN product_product pp ON pp.id = sm.product
JOIN product_template pt ON pt.id = pp.template
JOIN product_uom pu ON pu.id = sm.uom
  WHERE sm.state::text = 'done'::text
  AND   pt.active = TRUE
  GROUP BY sm.effective_date,
   frm_loc.type,
   to_loc.type,
   sm.product,
   pt.name,
   pt.default_uom,
   pu.symbol,
   sm.shipment,
   sm.origin
  ORDER BY sm.effective_date ASC,
   pt.name) f


"""


return query


Re: [tryton-dev] Permission for button wizards

2014-07-09 Thread Markus Bala
On Thu, Jul 10, 2014 at 3:19 AM, Cédric Krier  wrote:

> On 10 Jul 01:48, Markus Bala wrote:
> > On Thu, Jul 10, 2014 at 1:25 AM, Cédric Krier 
> wrote:
> >
> > > On 09 Jul 19:14, Guillem Barba Domingo wrote:
> > > > You can set the allowed groups to a button.
> > > > Search "button" in *.xml of modules (not in view directory) and you
> will
> > > > find the solution.
> > > >
> > > > Today I realized that the button is not hidden but if you try to
> click on
> > > > it it raise an error. I tried it on "Force assign" button.
> > > > Why the button is not hidden?
> > >
> > > If you don't have access, the button is readonly:
> > >
> > >
> > >
> http://hg.tryton.org/trytond/file/62f1b9747e9f/trytond/model/modelview.py#l441
> > >
> > > *File account_invoice/invoice.xml line233 - 271. *
> >
> http://hg.tryton.org/modules/account_invoice/file/09da725cfc13/invoice.xml#l233
> >
> > It provide the access for the cancel, post, validate_invoice button.
> > But when I using the same method to give the "pay" button (can be find at
> >
> http://hg.tryton.org/modules/account_invoice/file/09da725cfc13/view/invoice_form.xml#l62
> > )
> >
> > It still give the readonly state.
>
> I don't understand.
>

Below is the access i made for the "Pay" button:

pay







The result of the pay button, readonly.


> > So is there any different for giving access normal button with the wizard
> > button (
>
> No.
>
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>


Re: [tryton-dev] Permission for button wizards

2014-07-09 Thread Markus Bala
On Thu, Jul 10, 2014 at 1:25 AM, Cédric Krier  wrote:

> On 09 Jul 19:14, Guillem Barba Domingo wrote:
> > You can set the allowed groups to a button.
> > Search "button" in *.xml of modules (not in view directory) and you will
> > find the solution.
> >
> > Today I realized that the button is not hidden but if you try to click on
> > it it raise an error. I tried it on "Force assign" button.
> > Why the button is not hidden?
>
> If you don't have access, the button is readonly:
>
>
> http://hg.tryton.org/trytond/file/62f1b9747e9f/trytond/model/modelview.py#l441
>
> *File account_invoice/invoice.xml line233 - 271. *
http://hg.tryton.org/modules/account_invoice/file/09da725cfc13/invoice.xml#l233

It provide the access for the cancel, post, validate_invoice button.
But when I using the same method to give the "pay" button (can be find at
http://hg.tryton.org/modules/account_invoice/file/09da725cfc13/view/invoice_form.xml#l62
)

It still give the readonly state.

So is there any different for giving access normal button with the wizard
button (
http://hg.tryton.org/modules/account_invoice/file/09da725cfc13/invoice.py#l1372
)?

@ModelView.button_action('account_invoice.wizard_pay')
def pay(cls, invoices):
pass




>  > I think it would be better UX, but I don't investigated if it's hard to
> > impement.
>
> Are you sure you closed the client before testing new configuration
> because views are cached by the client.
>
> --
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/
>


Re: [tryton-dev] Permission for button wizards

2014-07-08 Thread Markus Bala


On Thursday, 3 October 2013 00:57:32 UTC+8, Guillem Barba wrote:
>
> 2013/10/2 Josias Pérez >
>
>> Hi,
>>
>> I'm working for a POS module on tryton.
>>
>> At the moment, have 2 question:
>>
>> 1. We create a group called Team Sales, that can access to Sales and 
>> Sales Lines, but we want that they can't view some fields (specially 
>> related to cost_price). We can hide on fields permission, but at the same 
>> time, they need to create stock moves, that requiere to read cost_price. 
>> The question is how to hide the field (cost_price) only in the view, but 
>> still can read for create the stock moves. They can't see the stock moves, 
>> only create that. 
>>
>
> define an 'states' attribute that set 'invisible' the field if user is not 
> in the required fields:
> field_name = fields.XXX(..., states={  
> 'invisible': Not(Eval('groups', []).contains(Id('MODULE', 
> 'GROUP_XML_ID'))),
> })
>  
>
> 2. How to give access permission to buttons that call wizards? They aren't 
>> listed neither on button neither in wizard permission access.
>>
>
> I supose the button get permissions from wizard (if user has permissions 
> over wizard can see the button). It make sense.
>
   May I know how to  give the permission over wizard?

I created an a group called "group_cashier". The main purpose is to create 
invoice and pay invoice.
I could find how to give the permission for "Pay" button which attached to 
the wizard "wizard_pay".
 Trying to give permission to the wizard as below script, but the pay 
button still disable. 


















>
> -- 
> Guillem Barba
> http://www.guillem.alcarrer.net 
>


[tryton-dev] Execute SQL View in ModelSQL

2014-06-21 Thread Markus Bala
Below is the python code to get the table for the "acccount_account":

 Account = pool.get('account.account')
 account = Account.__table__()

How to call the view?


Example of my view (only for example):
create view AccountMoveView as
select party.name, acc.name from account_move_line aml
inner join account_account acc on acc.id = aml.account
inner join party_party party on aml.party = party.id

How am I going to call "AccountMoveView" in the python code?

Please advice