[tryton] Re: overriding _error_messages

2018-04-13 Thread Maxime Richez
>On the extension, I need somthing like this (I know this is the wrong 
> way):   
> 
>@classmethod
>def __setup__(cls):
> super(My_class, cls).__setup__()
> cls._error_messages.update({
> 'only_capital_letters': continue,
> })

try this : cls._error_messages['only_capital_letters'] = 'your text'

-- 
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/c16a2658-af62-4397-8f53-1c87c1ad85d4%40googlegroups.com.


[tryton] When creating manually a new move from a storage location, button "do" is readonly

2018-03-21 Thread Maxime Richez
Hello, 

When creating manually a new move with a "storage location" as from_location, 
assignation is required but "assign" button is invisible (and "do" button is 
readonly) so can't go on, bug ?

-- 
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/e1a233fa-3d9f-4ac4-a09a-1ec920e69a7f%40googlegroups.com.


[tryton] setting cost_price readonly when using "average cost price" method

2018-03-01 Thread Maxime Richez
hi, wondering why field cost_price on variant is not readonly when choosing 
average cost_price method ? Because if you set any value on the cost_price, 
it's updated when you recompute cost price... feature ?

-- 
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/d66d1fa8-643d-4d78-b8d5-ab35ebf28caa%40googlegroups.com.


Re: [tryton] Split moves on shipment in

2018-02-06 Thread Maxime Richez
> This is about splitting the shipments not the move in the shipment. And
> we do not consider that user needs to split incoming shipments because
> it is the user who fill them.

In our case, the split has to be done before the reception and changing 
quantity on the shipment create another shipment with the missing quantities 
when you click on receive. We prefer to split incoming moves while they are in 
'draft' state, then giving each line a lot number and when we receive goods we 
validate the reception.

> Normally, the split move button should be available.

Indeed, i add the code and it's working. Thanks !

-- 
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/c9d36fa2-21f6-4442-abe1-def121384448%40googlegroups.com.


[tryton] Split moves on shipment in

2018-02-06 Thread Maxime Richez
Hi,

Is there a problem to split moves on shipments in ?

For example, we receive an order of 100 items packaged in 10 boxes... we 
would like to assign a lot number on each received box before internal shipment 
(we need to prepare lot creation (which is complex) before shipment in).
We saw in stock_split module code, this is not active for shipment in, is there 
any reason ? 

Could we just add this code :

class ShipmentIn(_ShipmentSplit):

__metaclass__ = PoolMeta
__name__ = 'stock.shipment.out'

Thanks !

-- 
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/625f1402-a56e-4606-8fb0-4e5811329a85%40googlegroups.com.


Re: [tryton] Domain with function field

2018-01-23 Thread Maxime Richez
> For now, I think the Function field is the only option. The searcher
> should probably have to return a clause like [('id', 'in', query)].
> This is not optimal but it should work.

2 questions:

- In the case of the function field is only used in a treeview for filtering 
data (just for display), isn't better to define a new modelview based on a 
query (for example: 
https://bitbucket.org/zikzakmedia/trytond-product_quantity_by_location/src ) 
Would it be more optimal ?

- What about the search function if one of the field to compare with another 
field is already a function field (for example product quantity field)? Is the 
only way of doing the search is still the query (that would be very complex in 
the case of quantity field,no ?) ?

> This is issue came up from time to time. I think it could be addresses
> by extending the domain syntax. We will need to have a way to put a
> column (with the option of being nested) as value. For example we could
> have an object Field:
> 
> [('cost_price', '>', Field('list_price'))]
> 
> I think on the client we could have this syntax:
> 
> "Cost Price": > @"List Price"
>
Would be nice :-)

-- 
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/2c550d10-d63a-4a6f-9c70-8b88a2021665%40googlegroups.com.


Re: [tryton] Add the order_field method to a function field

2018-01-23 Thread Maxime Richez
Hi Lucio,

We had also to do a sort on a function field.
Another example here: 
https://codereview.tryton.org/31881002/diff/330001/purchase.py#317   (line 317)

-- 
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/09c5e396-f3f5-4627-b44d-aea48f01dd7f%40googlegroups.com.


[tryton] Domain with function field

2018-01-22 Thread Maxime Richez
Hi,

In domain definition, operand cannot be a field. So, i'm wondering how doing 
this kind of view: for example, a listing of all products having a cost_price 
greater than list price.
I would define this domain ['cost_price', '>', Eval('list_price')] but this is 
not working.
Another idea, was to define a function field on a boolean field (flag) and the 
setter of this function field will return true or false about the comparison 
between 'cost_price' and 'list_price'... and then creating a treeview with 
domain ['flag', '=' ,'True'] but once again, how to define a correct domain in 
the searcher function of the flag function field ?
Thanks for ideas, help...

-- 
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/057c16fd-ed2b-440c-ac1e-5c132173b47f%40googlegroups.com.


Re: [tryton] Tryton Docker instructions

2017-11-29 Thread Maxime Richez
Le mercredi 29 novembre 2017 16:15:08 UTC+1, Cédric Krier a écrit :
> On 2017-11-29 06:42, Thierry Bruyere wrote:
> > Le mercredi 29 novembre 2017 15:41:09 UTC+1, Sergi Almacellas Abellana a 
> > écrit :
> > > El 29/11/17 a les 14:51, Cédric Krier ha escrit:
> > > > On 2017-11-29 11:48, Sergi Almacellas Abellana wrote:
> > > >> El 29/11/17 a les 11:39, Maxime Richez ha escrit:
> > > >>>>> Could you fill and issue and propose a patch to fix it?
> > > >>>> I'm wondering what is the best options:
> > > >>>>
> > > >>>>   - show simple command without volume bound and let docker 
> > > >>>> create
> > > >>>> unnamed volumes
> > > >>>>
> > > >>>>   - show more complex command with volume bound and keep volume
> > > >>>> creation command.
> > > >>>>
> > > >>> What should i choose for the patch? Poll ?
> > > >> I think we should keep the commands simple for newcomers.
> > > >>
> > > >> Indeed, users with more docker knowledge will probably use it's own
> > > >> custom commands.
> > > > 
> > > > OK but how would you know the path of the volumes?
> > > > 
> > > Don't know. Just tried one of two options you proposed :)
> > > 
> > 
> > You can find the volume with the command :
> > 
> > docker inspect --format "{{ .Mounts }}" tryton-postgres
> 
> You mean: docker inspect  --format "{{ .Config.Volumes }}" tryton/tryton
> 
> Not sure anyone will know that.
> 
> -- 
> Cédric Krier - B2CK SPRL
> Email/Jabber: cedric.kr...@b2ck.com
> Tel: +32 472 54 46 59
> Website: http://www.b2ck.com/

So rollback with my issue ? (https://bugs.tryton.org/issue6974 ) and adding 
volume in the commands ?

-- 
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/db93b04f-1ed6-4316-a7a4-56f5f148a271%40googlegroups.com.


Re: [tryton] Tryton Docker instructions

2017-11-29 Thread Maxime Richez

> > What should i choose for the patch? Poll ?
> I think we should keep the commands simple for newcomers.
> 
> Indeed, users with more docker knowledge will probably use it's own 
> custom commands.
> 
ok. Could you add "tryton-docker" in the list of components in bugtracker? 

-- 
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/b9e952de-6012-4508-9841-6c09d26d0dd0%40googlegroups.com.


Re: [tryton] Tryton Docker instructions

2017-11-29 Thread Maxime Richez
> > Could you fill and issue and propose a patch to fix it?
> 
> I'm wondering what is the best options:
> 
> - show simple command without volume bound and let docker create
>   unnamed volumes
> 
> - show more complex command with volume bound and keep volume
>   creation command.
> 
What should i choose for the patch? Poll ?

-- 
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/19eaab08-ab9a-4d41-9f67-1d9bc0f361cc%40googlegroups.com.


[tryton] Tryton Docker instructions

2017-11-29 Thread Maxime Richez
Hi,

Yesterday, i made tryton docker installation following instructions on the 
docker page: https://hub.docker.com/r/tryton/tryton/

I noticed that created volumes at the first instruction are never used because 
other instructions never use them...

To use the "postgres" volume, the instruction "Start a PostgreSQL instance" 
should be:

sudo docker run --name tryton-postgres -v postgres:/var/lib/postgresql/data -e 
POSTGRES_PASSWORD=mysecretpassword -e POSTGRES_DB=tryton -d postgres

Don't know if it's really needed to create a tryton volume, as the only volume 
that could be exposed in tryton docker is "/var/lib/trytond/db". Maybe if we 
plan to use an sqlite database? Else it seems useless...

I would like also sharing a nice tool to easily manage your docker environment:

https://portainer.io/

-- 
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/74440d35-c9a1-49af-a52c-7b7f8706ab1a%40googlegroups.com.


Re: [tryton] Sorting Model List in proteus

2017-09-26 Thread Maxime Richez

> Proteus should do it transparently.
> 
I create an issue:

https://bugs.tryton.org/issue6784

-- 
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/5df47778-1b9a-4bf2-84a4-c064dc8e08e4%40googlegroups.com.


Re: [tryton] Sorting Model List in proteus

2017-09-26 Thread Maxime Richez
Le mardi 26 septembre 2017 13:43:28 UTC+2, Maxime Richez a écrit :
> > It seems. I think the record_removed and record_deleted are not updated
> > when adding back the same record.
> > 
> Indeed, it works if i remove "self.record_removed.add(self[index])" in pop 
> method (line 569 - proteus/__init__.py)

Is clearing record_removed and record_deleted sets in extend method a good 
solution?

-- 
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/26d7f3fb-4f25-4fea-9cdf-070baf7ce6ec%40googlegroups.com.


Re: [tryton] Sorting Model List in proteus

2017-09-26 Thread Maxime Richez

> It seems. I think the record_removed and record_deleted are not updated
> when adding back the same record.
> 
Indeed, it works if i remove "self.record_removed.add(self[index])" in pop 
method (line 569 - proteus/__init__.py)

-- 
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/9ba777b3-21c9-4bf7-b35f-a29887e87ac1%40googlegroups.com.


Re: [tryton] Sorting Model List in proteus

2017-09-26 Thread Maxime Richez
> It is strange because .pop set the _parent attribute to None.
> Are you sure you remove all the records?
> 
> Indeed I would write the code like this:
> 
> while request.quotation_lines:
> request.quotation_lines.pop()
> request.quotation_lines.extend(sorted_quotations)
> 

Thanks ! 
I applied your code, now i get an error on a required field... 
"UserError: The field "Request" on "Purchase Request For Quotation Line" is 
required."
Is there a bug ?

-- 
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/6b59237b-f852-4533-8091-69e6a84b71bb%40googlegroups.com.


[tryton] Sorting Model List in proteus

2017-09-25 Thread Maxime Richez
Hi,

I'm trying to sort a model list in proteus with sorted function... so i apply 
sort on each element of my model list and store them in a list, pop each record 
of my "unordered" model list, then try to append each record in my empty model 
list but get an error "assert record._parent is None"...
What's wrong with my scenario ?

https://pastebin.com/mcd2iTAA

Thanks for help !

-- 
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/2ca0a546-9990-4fea-8f44-20278fa8742a%40googlegroups.com.


Re: [tryton] Stock moves

2017-06-08 Thread Maxime Richez

>
>
> For me, a reparation is quite similar to a production but: 
>
> - it is based on an asset 
> - it is done where the asset is 
>
> The workflow should be: 
>
> - move asset and spare parts to the virtual production location 
> - move back the asset and new spare parts to the warehouse 
>
> You could have a checkbox on the order to inform it is done in-place. 
>
> Our machines are self-made and not referenced in tryton as assets. 
My question could be less specific and applyed to others products that 
needs to be kept in a stock with inventory, and the used by an employe or 
some people (but no sold). 
Or could inventory be extended to  consumables ???

-- 
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/396575ef-074b-4b98-8aa9-dac71ddba2e6%40googlegroups.com.


Re: [tryton] Stock moves

2017-06-08 Thread Maxime Richez

>
> And you use a production to consume those parts? Then, you will need an 
> internal shipment to move the parts only if the parts are stored on a 
> diferent warehouse. 
>

No, those parts are used for repairing machines used by production.But we 
have a lot of machines, (and then a lot of spare parts), so we keep them in 
stock with inventory.
Production machine consume other products.

>
> If you are reparing your customer machines, we should probably create a 
> new model to track the state of the repair, but for consuming the parts 
> you should probably use the internal shipment (as I pointed before). 
>
> Hope it helps. 
>

ok thanks. 

-- 
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/c63b4234-9f22-473b-9e1a-991c700d44e9%40googlegroups.com.


Re: [tryton] Stock moves

2017-06-08 Thread Maxime Richez


> I should probably use an internal shipment. 
>
> Indeed, if you are intereseted of keeping a log of which parts have been 
> "used" and which have been "lost", you can create a new location of type 
> "Lost and found", and use this new location as target location on a 
> internal shipment to track that the part have been used to repair a 
> machine and use the current "Lost and found" location for inventory. 
>
> This will give you the full picture when openeing the Stock by location 
> of a this parts products. 
>
> Hope it helps. 
>
 
 Thanks for your suggestion... Always interesting to know how other people 
proceed... and the best way to apply this "behaviour" in tryton. 
We are doing the same thing with our printer toners: we keep them in stock 
(with inventory), and each time an employee needs one,  an output move 
should be done to update stock.

-- 
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/87783ae0-60c5-4f34-94d1-3712cb031bc8%40googlegroups.com.


Re: [tryton] Stock moves

2017-06-08 Thread Maxime Richez

>
>
> As a global rule spare parts should go to the same place as the 
> repaired machines. 
> If the machine is at customers, then spare part should go there. If 
> the machine is an asset, it should stay in. 
> So you know what is at customers' and keep park configuration up-to-date. 
>

Machines are assets but not referenced in tryton, our machines (self-made) 
are used for production. 
 

>

-- 
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/934efb9d-aa59-4943-96bb-96b7892f12df%40googlegroups.com.


Re: [tryton] Stock moves

2017-06-08 Thread Maxime Richez

>
>
> Why you can not use an inventory? For me it's correct to create a 
> inventory for this parts only. 
>
> We use an inventory (for this reason those products are not checked as 
"consumables". 
My question was how to deal with the daily moves, each time someone pick a 
spare parts to repair a machine. 
What is the best move (and the easier) for this kind of stock output.
 

>
>

-- 
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/1f0a27e8-9aa9-4e5d-90c5-3162e83b473e%40googlegroups.com.


[tryton] Stock moves

2017-06-08 Thread Maxime Richez
Hi,

We have a specific warehouse with spare parts for repairing machines. Those 
"products" are not considered as consumables because we need an inventory.
What is the best way to output those products ? Internal shipment to Lost 
and Found or a specific location ? Create a "manual move" to a specific 
output zone (but it needs an invoice line...) ?
Is there a specific module or wizard to output product in stock for a such 
case... (not a sale not an inventory)
Thanks for your replies and advices !

-- 
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/e7aa75d3-b03d-4e3a-bfce-6725de727497%40googlegroups.com.


[tryton] Re: Installing tryton server - How to ? and some questions...

2017-05-05 Thread Maxime Richez

>
>
> Hi Maxime,
>
> I noticed that you are talking about the Debian distribution, so I thought 
> I would point you to a great Debian package mirror 
>  for Tryton 
> managed by Mathias Behrle.
>
> Hi Vincent, 

I Know about debian package but i prefer installing from source... Thanks!
And about python packages needed for my installation, i'll follow Dominique 
and make a requirements.txt file with python dependencies 

-- 
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/b6c6fc29-2efd-45a3-98a4-3dcc98f878bf%40googlegroups.com.


Re: Re: [tryton] Installing tryton server - How to ? and some questions...

2017-05-03 Thread Maxime Richez


> >I guess it is similar for Debian, where you have system packages as well 
>

Yes, of course, but we are using from source...

Anyway, thanks for the people who reply... even if i'm still looking for 
the best solution :-)

-- 
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/04218f0c-2c81-4485-bcfd-14f06fe534db%40googlegroups.com.


Re: [tryton] Installing tryton server - How to ? and some questions...

2017-05-02 Thread Maxime Richez
I'm curious to read how other people do their install... 

So actually, there's no "clean" and universal method to proceed python 
dependencies installation on a tryton server? 

-- 
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/401c2d27-46e8-4220-a5a2-d23f27f048a1%40googlegroups.com.


Re: [tryton] Installing tryton server - How to ? and some questions...

2017-05-02 Thread Maxime Richez

So, what's the actual solution to install all python dependencies correctly 
(as the patch is not released)?

How does everybody install a tryton server at customers ?

-- 
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/1baa81a1-6add-48da-a87e-afefb99d79ca%40googlegroups.com.


[tryton] Installing tryton server - How to ? and some questions...

2017-05-02 Thread Maxime Richez
Hi,

This subject is often coming back on the forum. 

We need some advices to correctly install trytond 4.2 on a debian server… 
(for production or testing)


Here are our first steps  on a debian 9.0 :


- installing some packages : *sudo apt install python virtualenv mercurial 
python-pip*


- creating « tryton » user : *sudo adduser tryton*


*Using user « tryton » :*


- creating directory where to install tryton : 

*mkdir /srv/tryton/4.2*


- *pip install hgnested* 

and configuring .hgrc in /home/tryton :

*[ui] *

* username = Tryton  *

* [extensions] *

* hgnested = *


- defining virtualenv in /srv/tryton/4.2 : 

*virtualenv .venv/tryton*


- switching into virtualenv : 

*/srv/tryton/4.2/source .venv/tryton/bin/activate*


- cloning in /srv/tryton/4.2 trytond 4.2 and all the modules with nclone :

*hg nclone http://hg.tryton.org/4.2/trytond -b 4.2*


- configuring trytond.cfg to use postgresql database :

*[database]*

*uri = postgresql://tryton:tryton@postgresqlsrv:5432/*


*Questions ?*


« pip install . » or « python setup.py install » ?  


How to install all python dependencies for all the modules ?


- Is there a list with all the requirements to use with pip ?

- Should i execute trytond-admin –all and install dependencies one by one 
each time i get an error ?

- What about issue https://bugs.tryton.org/issue5960 ?


Waiting for your advices/suggestions... Then we could add this "how-to" to 
documentation..
Thanks !

-- 
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/04bb2b49-db19-4675-a7c1-fe966ec5d910%40googlegroups.com.


Re: [tryton] sequence_order

2016-12-11 Thread Maxime Richez
https://bugs.tryton.org/issue6106 

-- 
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/adedb420-2368-4e22-b1e2-3996a8f3b8b2%40googlegroups.com.


[tryton] sequence_order

2016-12-09 Thread Maxime Richez
Hi,

I noticed a strange behaviour with the drag'n'drop automatic sequence order.
Let's take a purchase with 3 purchase_lines that we want reorder:
by default sequence field is empty on the 3 lines. If i drag 'n 'drop the 
last line to the first position and i save, this line will be in second 
position (???) (one sequence will stay empty and the other one will be '1').
Now if i drag''n'drop the second line to first position and i save, it will 
be ok. (sequence is still empty on the first line, and there'll be also '1' 
on the other line).
Next step, i take my first line and i put it in second position : when i 
save, this line will be in third position (with sequence '2' and the two 
others lines will have sequence '1').

Normal behaviour or bug ? Should not all the line renumbered when 
reordering ?



-- 
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/908642fb-53bd-4097-80bf-d73313f6df00%40googlegroups.com.


Re: [tryton] Error with hg nclone in OpenSuse 13.2

2016-09-29 Thread Maxime Richez


>
> Seems to be quite new, Pypi still has 0.7 
>
> Strange...

https://pypi.python.org/pypi/hgnested/0.8 

-- 
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/c8e18668-edd4-444c-9c95-a7d626cf13b0%40googlegroups.com.


Re: [tryton] Error with hg nclone in OpenSuse 13.2

2016-09-29 Thread Maxime Richez

>
>
> I have installed the following:
> Mercurial version 3.9
> hgnested version 0.7
> OpenSuse 13.2 on a virtualbox machine
>
>
> You need to install latest version of hgnested (0.8) 

pip install hgnested --upgrade

-- 
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/604dfa3a-c6a5-41c4-a891-ba05135ce368%40googlegroups.com.


Re: [tryton] Final location for TUB Codesprint

2016-09-18 Thread Maxime Richez

http://www.barcelona-metropolitan.com/practical/business-/Barcelona-best-coworking-spaces/

-- 
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/847ab97e-c713-42bd-bc7c-509f87f09429%40googlegroups.com.


Re: [tryton] [TUB2016] Call for speakers

2016-09-01 Thread Maxime Richez
Any idea about the code sprint place ? Will it be far from Barcelona ? Need 
to book 2 differents hotels ?
Any suggestions about friendly hotel and anything we should know about 
Barcelona and Tub ? 

-- 
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/0075d27f-2fff-4ba7-b79c-ad7068fb37f6%40googlegroups.com.


Re: [tryton] Adding validity dates for product supplier price

2016-07-06 Thread Maxime Richez
Don't understand, today it's working correctly but i didn't change anything 
in my code... 

Should this little feature suggested to the community, or keep it as a 
local change ?

-- 
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/398cb4b5-a5b9-4024-b00c-634908403733%40googlegroups.com.


Re: [tryton] Adding validity dates for product supplier price

2016-07-06 Thread Maxime Richez

>
>
> I do not understand. The context inside the execution of 
> get_purchase_price stays the same. So what do you name "previous 
> context"? 
>
> i mean, inside the method get_purchase_price, the method get_pattern from 
ProductSupplierPrice is called. Has the method get_pattern the same 
context  ? because when try to get 'purchase_date' from the context, it 
doesn't seems to find the variable.

have i choose the best way (see my code) using get_pattern and surcharging 
"match" method for returning a product supplier price between 2 dates ?

-- 
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/e0ad88ac-95c1-465d-a850-811963a447ec%40googlegroups.com.


[tryton] Adding validity dates for product supplier price

2016-07-05 Thread Maxime Richez
Hi, 

I would like to add start_date and  end_date for a product supplier price.

Here's my code:

http://pastebin.com/Bm9GwTps

My problem:

get_purchase_price method is called  from PurchaseLine with a specific 
context (purchase_date,...) then get_purchase_price check if there's 
product_supplier_price matching.
How to keep previous context to check if purchase_date is between 
start_date and end_date ?
Thanks for your help !

-- 
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/455702b6-8771-4bd2-b5c5-0980632a9aa6%40googlegroups.com.


[tryton] Re: Funding GTK+-3 client

2016-06-22 Thread Maxime Richez
+1

-- 
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/ee71b9c0-7f8b-44a2-8e12-75cfbdb87c09%40googlegroups.com.


Re: [tryton] Record rules : only a specific user (creator) could modify his record ?

2016-06-13 Thread Maxime Richez


> Otherwise you could try to prevent to have such error message by making 
> readonly (with states) record fields for which the user has no access 
> write. 
> It is a little bit more work but the experience for the user will be 
> better


Thanks !
Done with this code and applied to all my fields:

_STATES = {
'readonly': ((Eval('state') != 'draft') | (Eval('_user') != Eval(
'create_uid'))),
}

 

-- 
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/65cefba1-69ab-4535-a16d-9f03c9581c05%40googlegroups.com.


Re: [tryton] Record rules : only a specific user (creator) could modify his record ?

2016-06-10 Thread Maxime Richez


>
> You have to create a global rule with perm_read for all (empty domain). 
>
>
Oki thanks Cédric. It's working now :-)
Is there a way to change/personalize  "Error Message : You try to bypass an 
access rule (Document type: mymodel)"  ?
Here's my new rules :









 















 

-- 
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/2823170e-e529-428c-be3e-fc41627d0033%40googlegroups.com.


Re: [tryton] Record rules : only a specific user (creator) could modify his record ?

2016-06-09 Thread Maxime Richez


> As it is neither global nor default, are you sure you have added the 
> rule to a user when testing? 
>
>
Effectively, my rule is not added for a user, i'll set rule default.
And how to add a rule to a specific user in the xml file ? 
How can i apply my domain only when user try to modify a record ? Because 
if i apply the domain, i only see user's records and not all records..

-- 
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/efc6e1cd-b7a1-491f-937f-a5b95e969a16%40googlegroups.com.


[tryton] Record rules : only a specific user (creator) could modify his record ?

2016-06-09 Thread Maxime Richez
Hi everybody,

In my new module, i would like everyone can add a record and see records 
from other people but only the creator of a record could modify his record. 
Is it possible ?
Here's is my rule, but it's not working : 






















-- 
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/482f159e-463b-43e4-b74c-3aa97962149e%40googlegroups.com.


[tryton] Re: Neso retirement

2016-06-03 Thread Maxime Richez
Never tried Neso, so not a problem for me. 
And as an alternative you could also use Docker... 

-- 
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/295e9c96-bca9-45e8-b536-2deed973e3bf%40googlegroups.com.


Re: [tryton] Error : Model has no attribute ... when function field is not in my xml form view (visible or not)

2016-06-01 Thread Maxime Richez

>
>
> Tryton does not have a mechanism to inject dependencies from One2Many 
> model to the parent. So it has to be managed manually by adding it to 
> the view as invisible field. 
> Otherwise your code fails because self.HEADER is a memory instance which 
> has only the field the view has. 
>
>
Ok!  Thanks for the explanations :-) 

-- 
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/ef9bab56-7770-4cee-bb93-6c75ec9704a6%40googlegroups.com.


[tryton] Error : Model has no attribute ... when function field is not in my xml form view (visible or not)

2016-06-01 Thread Maxime Richez
Hi,

I have 2 classes (HEADER and LINES)

HEADER has a function field currency (because currency need to be stored on 
the LINES):

currency = fields.Function(fields.Many2One('currency.currency', 'Default 
Currency',
states=_STATES, depends=_DEPENDS),'on_change_with_currency')
...

@fields.depends('party','company')
def on_change_with_currency(self, name=None):
cursor = Transaction().connection.cursor()
Purchase = Pool().get('purchase.purchase')
table = Purchase.__table__()
if self.party:
subquery = table.select(table.currency,
where=table.party == self.party.id,
order_by=table.id,
limit=10)
cursor.execute(*subquery.select(subquery.currency,
group_by=subquery.currency,
order_by=Count(Literal(1)).desc))
row = cursor.fetchone()
if row:
currency_id, = row
return currency_id
#cls.currency_digits = self.currency.digits
elif self.company:
return self.company.currency.id
return None

LINES has also a currency field but a many2one (with as default value, 
currency from HEADER) :

currency = fields.Many2One('currency.currency', 'Currency',
states={
'required': Bool(Eval('unit_price')),
},
depends=['unit_price'])
...

@fields.depends('_parent_HEADER.currency','HEADER')
def on_change_with_currency(self):
currency = self.HEADER.currency if self.HEADER else None
if currency:
return currency.id


Currency on the HEADER doesn't need to be displayed, so this field is not 
in the xml form view. 
When i try to create a new LINE with a new HEADER, i got this error : 
'header' Model has no attribute currency 
If i had the currency field in the xml form view of the HEADER (visible or 
not) , there is no error... 
Why ?

Hope my explanations are understandable :-)





-- 
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/ab8662ca-3b8c-43d1-90f7-4d0205a7f9ff%40googlegroups.com.


Re: [tryton] Default value related to the latest data entered ...

2016-05-25 Thread Maxime Richez
 

>
> I think if I remember correctly, you must add 'purchase_requisition' in 
> the depends. 
>   
>

Yeah it's working ! :-) Thanks Cedric & Sergi ! 

-- 
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/0029bdb4-a020-4587-ba15-65a1fd75ac05%40googlegroups.com.


Re: [tryton] Default value related to the latest data entered ...

2016-05-24 Thread Maxime Richez


>
> I think in this case, it is better to define a default one on the parent 
> and use the on_change like @pokoli said to change the default value to 
> this default defined on the parent. 
>   
>

I follow your advice but how to force the "on_change_with" be executed and 
set the default value when the form is opened ? Here's is the code of my on 
change:

@fields.depends('_parent_purchase_requisition.currency')
def on_change_with_currency(self):
currency = self.purchase_requisition.currency if 
self.purchase_requisition 
else None
if currency:
return currency.id
else:
Company = Pool().get('company.company')
company = Transaction().context.get('company')
if company:
company = Company(company)
return company.currency.id



 

-- 
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/cfdbfee6-fc5c-4d41-aa5a-7652638cbafd%40googlegroups.com.


Re: [tryton] Default value related to the latest data entered ...

2016-05-23 Thread Maxime Richez


>
> If it is stored in the database, then you can make a query to find the 
> last entered.  But this works only if it is stored in the database so 
> not for One2Many list. 
>

   And in my case it's a One2Many :(

>
>
>
> For the One2Many case, it is usually better to not store default value 
> on the line but one at the parent. 
>
>
> Effectively it's the best solution to store at the parent, but in our case 
whe need the value on the lines (because at the next step of the module, we 
are working on the lines ...)
 

-- 
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/601544ec-0b52-4579-bd68-8a0f35613cf8%40googlegroups.com.


Re: [tryton] Default value related to the latest data entered ...

2016-05-23 Thread Maxime Richez

You can use an on_change_with that depends on the parent field which will 
be called by the tryton client and you can compute the value as you want. 
> 

i think there's no parent field, there's multiples lines... 

-- 
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/0e6aa819-d751-405f-b963-853c49474e19%40googlegroups.com.


[tryton] Default value related to the latest data entered ...

2016-05-23 Thread Maxime Richez
Hello,

Is it possible to define a default value in a field that depends on the 
previously entered data?

For example, I have a model with detail rows (product, quantity, 
prix_unitaire, currency):

By default the value of my currency is the currency of my company.
If I have to introduce more detail lines with a currency different from 
that of my company, to avoid to select this currency every time, is it 
possible to imagine that the default value of the currency come from the 
value of the previous detail row (and if it's the first line the currency 
of the company)? did the context keeps the last entered values?

Thanks for your help...

-- 
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/17aec7dd-f411-463d-8bbc-f7a64ad5adb3%40googlegroups.com.


[tryton] Re: Edit documentation

2016-05-09 Thread Maxime Richez
Ok thank you !

-- 
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/3ea41002-075f-44f4-85a7-5539d66946d0%40googlegroups.com.


[tryton] Edit documentation

2016-05-09 Thread Maxime Richez
Hello,

How can i edit documentation ? 

I think there's an error in this page :

http://doc.tryton.org/4.0/trytond/doc/topics/views/index.html#field

Attribute "Required" doesn't exist for a field in form view

I try to clone through http://hg.tryton.org/doc.tryton.org/  to make a 
patch but there's no source ? 

-- 
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/64701d66-6776-4258-bc01-762e6c43322e%40googlegroups.com.


Re: [tryton] Help about fields displayed by a function field

2016-02-10 Thread Maxime Richez


> This is because the One2Many's have a domain written in such way that it 
> allows only one value for those fields. So the client automatically hide 
> such fields because they don't give any information (the information is 
> in the document header). 
>
>   
Thanks ! Not easy to understand at first time all the complexity of the 
mechanisms :-)

-- 
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/49a9d73d-111c-490e-b800-074e3899dd84%40googlegroups.com.


Re: [tryton] Help about fields displayed by a function field

2016-02-10 Thread Maxime Richez


> The client doesn't know about Function field but only about the type 
> which is in this case One2Many. 
> So when a One2Many is defined on a view but without any view_ids 
> attribute, it is the default view (lower sequence) of the target Model 
> that is used (in this case of stock.move). 
>
>
Thanks for your answer. So, in this case, default view  is move_tree.xml













But there is more fields in the model than displayed in the view of the 
function field.
In shipment_in : (from_location and to_location are invisible for the 
function field "incoming_moves" and "from_location" is invisible for 
function_field "inventory_moves"  and both are using stock.move...

"from_location" and "to_location" in the class Move have the same domain
So i'm still wondering how fields are hidden in the view ?


-- 
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/d52647c0-71c6-41d6-94cb-ee0e169e9229%40googlegroups.com.


[tryton] Help about fields displayed by a function field

2016-02-09 Thread Maxime Richez




Hi everybody,

I'm working with Thierry Bruyere @ SALUC (Chemical industry located in 
Belgium)
We planned to migrate our internal erp tools to Tryton so i'm learning 
Tryton and his code.

Can someone give explanations about the display of a function field in the 
"stock.shipment.in" module. I'm wondering where are defined the displayed 
fields for the function field "incoming_moves" (in this case : product, 
quantity, uom,planned date, effective date, state

I'm analyzing the code, unsuccessfully ... 

in the file shipment_in_form.xml










in shipment.py 

Class ShipmentIn

incoming_moves = fields.Function(fields.One2Many('stock.move', 'shipment',
'Incoming Moves',
add_remove=[
('shipment', '=', None),
('from_location', '=', Eval('supplier_location')),
('state', '=', 'draft'),
('to_location', '=', Eval('warehouse_input')),
],
domain=[
('from_location', '=', Eval('supplier_location')),
('to_location', '=', Eval('warehouse_input')),
('company', '=', Eval('company')),
],
states={
'readonly': (Eval('state').in_(['received', 'done', 'cancel'
])
| ~Eval('warehouse') | ~Eval('supplier')),
},
depends=['state', 'warehouse', 'supplier_location',
'warehouse_input', 'company']),
'get_incoming_moves', setter='set_incoming_moves')


def get_inventory_moves(self, name):
moves = []
for move in self.moves:
if (move.from_location.id ==
self.warehouse.input_location.id):
moves.append(move.id)
return moves


Thank you !

-- 
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/328c6bc2-0e05-4129-8cc1-5d06b7b7cd59%40googlegroups.com.