[tryton-dev] RFC removal of Property fields
Hi, As a PoC, I made a sets of patches that remove the Property fields on the party module. See https://bugs.tryton.org/issue2349 I introduce new MultiValueMixin/ValueMixin which helps to store many values for the same Function field and allow direct access to them without context switching. Please take a look and comment on the design of the API. It is quite important to have it right now because we will have to deal with it for many years. Thanks, -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
Re: [tryton] Disabling creation/deletion on One2Many fields
On 2015-07-30 16:30, Sergi Almacellas Abellana wrote: Hi, I have a Model which has a One2Many field to sale lines. This field will be used to update sale line quantities but I don't want the user to create new lines from here. There is some way to implement it without restricting create/delete access to sale.line model? It is not clear if you want ot prevent create/deletion from this field or for the Model. If it is only from this field, you can setup a field access. -- Cédric Krier - B2CK SPRL Email/Jabber: cedric.kr...@b2ck.com Tel: +32 472 54 46 59 Website: http://www.b2ck.com/
Re: [tryton] Disabling creation/deletion on One2Many fields
El 30/07/15 a les 16:57, Cédric Krier ha escrit: On 2015-07-30 16:30, Sergi Almacellas Abellana wrote: Hi, I have a Model which has a One2Many field to sale lines. This field will be used to update sale line quantities but I don't want the user to create new lines from here. There is some way to implement it without restricting create/delete access to sale.line model? It is not clear if you want ot prevent create/deletion from this field or for the Model. If it is only from this field, you can setup a field access. Only from this field. So yes, the field access worked as I explained in the other response. Thanks! -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk
[tryton] Disabling creation/deletion on One2Many fields
Hi, I have a Model which has a One2Many field to sale lines. This field will be used to update sale line quantities but I don't want the user to create new lines from here. There is some way to implement it without restricting create/delete access to sale.line model? BTW I managed to disable the new button but setting a size attribute to the One2Many with the current size. But this doesn't prevent to delete lines. Thanks in advance. -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk
Re: [tryton] Disabling creation/deletion on One2Many fields
2015-07-30 16:30 GMT+02:00 Sergi Almacellas Abellana se...@koolpi.com: There is some way to implement it without restricting create/delete access to sale.line model? I had this problem, and solved it by patching the client to hide the toolbar with an option to set in the view definition. I would be delighted if you found another solution ! Jean Cavallo *Coopengo*
Re: [tryton] Disabling creation/deletion on One2Many fields
El 30/07/15 a les 16:35, Jean Cavallo ha escrit: 2015-07-30 16:30 GMT+02:00 Sergi Almacellas Abellana se...@koolpi.com mailto:se...@koolpi.com: There is some way to implement it without restricting create/delete access to sale.line model? I had this problem, and solved it by patching the client to hide the toolbar with an option to set in the view definition. Mmm... I don't think this is the right solution for my case as I want the use to be able to navigate throw lines, open form view, and change view if they want. I would be delighted if you found another solution ! I just get a solution that worked for me. I added a acces rule to the One2Many field disabling the creation and deletion access, so now the buttons are disabled on the client. If you're interessed just add something like this on your xml definition: record model=ir.model.field.access id=dashboard_sale_lines_access field name=field search=[('model.model', '=', 'model_name'), ('name', '=', 'field_name')]/ field name=perm_read eval=True/ field name=perm_write eval=True/ field name=perm_create eval=False/ field name=perm_delete eval=False/ /record -- Sergi Almacellas Abellana www.koolpi.com Twitter: @pokoli_srk
Re: [tryton-fr] Accès aux attributs d'un modèle à partir d'une application web Pyramid et Tryton en module
Cette syntaxe est assez veille, on utilise depuis plus de 2 ans une syntaxe Active Record: with Transaction().start('test_lmds_tryton', 0): pool = Pool(TRYTON_DATABASE) pool.init() Product = pool.get('product.product') product = Product(id) product.name ... Ok, en revanche j’ai toujours le même problème. En fait j’essaye d’accéder à product.name dans mon template chameleon et j’ai cette erreur : return inst.__getattr__(self.name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/modules/product/product.py, line 174, in __getattr__ return getattr(self.template, name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/model/fields/field.py, line 213, in __get__ return inst.__getattr__(self.name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/modules/product/product.py, line 171, in __getattr__ return super(Product, self).__getattr__(name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/model/modelstorage.py, line 1168, in __getattr__ if self.id 0: File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/model/fields/field.py, line 213, in __get__ return inst.__getattr__(self.name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/modules/product/product.py, line 171, in __getattr__ return super(Product, self).__getattr__(name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/model/modelstorage.py, line 1166, in __getattr__ return super(ModelStorage, self).__getattr__(name) File /home/fabien/DEV/test-lmds/lib/python2.7/site-packages/trytond/model/model.py, line 434, in __getattr__ if name == 'id': RuntimeError: maximum recursion depth exceeded in cmp Mon code : @view_config(name='view', permission='view', renderer='poc:templates/custom-content-default.pt') def default_view(self): with Transaction().start(TRYTON_DATABASE, TRYTON_USER): tryton_pool.init() Product = tryton_pool.get('product.product') product = Product(self.context.custom_attribute) return { 'product': product, } En revanche, lorsque j’applique à la lettre l’exemple dans le wiki (https://code.google.com/p/tryton/wiki/TrytonPyramid) ça fonctionne. Je pense que je dois être en dehors du context manager lorsque j’appelle l’attribut name à partir de mon template (même si j’indente le return dans le with). J’ai essayé de créer un décorateur contenant le contexte manager pour décorer ma vue mais ça ne fonctionne pas mieux. Dans l’exemple pour Django ça a l’air pourtant de fonctionner, ça doit être un certain de fonctionnement de Pyramid qui m’échappe.
[tryton-fr] Accès aux attributs d'un modèle à partir d'une application web Pyramid et Tryton en module
Bonjour, Je teste l'utilisation de Tryton en tant que module dans une application web Pyramid. Je charge un produit dans une vue mais je n'arrive pas à accéder à ses attributs autre que son id, par exemple l'attribut name. Le code que j'utilise : from trytond.transaction import Transaction with Transaction().start('test_lmds_tryton', 0): tryton_pool = Pool(TRYTON_DATABASE) tryton_pool.init() product_obj = tryton_pool.get('product.product') products = product_obj.browse([id,]) return products Comment faire pour accéder aux attributs de mon produit ?
Re: [tryton-fr] Accès aux attributs d'un modèle à partir d'une application web Pyramid et Tryton en module
On 2015-07-30 10:14, Fabien Castarède wrote: Bonjour, Je teste l'utilisation de Tryton en tant que module dans une application web Pyramid. Je charge un produit dans une vue mais je n'arrive pas à accéder à ses attributs autre que son id, par exemple l'attribut name. Le code que j'utilise : from trytond.transaction import Transaction with Transaction().start('test_lmds_tryton', 0): tryton_pool = Pool(TRYTON_DATABASE) tryton_pool.init() product_obj = tryton_pool.get('product.product') products = product_obj.browse([id,]) return products Comment faire pour accéder aux attributs de mon produit ? Cette syntaxe est assez veille, on utilise depuis plus de 2 ans une syntaxe Active Record: with Transaction().start('test_lmds_tryton', 0): pool = Pool(TRYTON_DATABASE) pool.init() Product = pool.get('product.product') product = Product(id) product.name ... -- 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] Re: Linking refunds with original invoices
El dimecres, 29 juliol de 2015 8:20:04 UTC+2, Cédric Krier va escriure: On 2015-07-22 16:16, Sergi Almacellas Abellana wrote: El 22/07/15 a les 15:55, Sergi Almacellas Abellana ha escrit: Hi, We have the need of linking refunds with their original invoices. After an internal disuccion we think that the best solution is to set the origin field of the refund lines with the original invoice lines, and then add a functional field between invoices and refunds. BTW the link between lines is already set, so only missing the functional field. I don't agree that such field is missing. Having such field will prevent to credit many invoices with one credit note for example. Don't agree as such fields should be a functional Many2Many so it will allow to credit as many invoices as needed. In all Tryton design, everything is always linked at the line level to have flexibility. We must not break this rule (rember the reference copied from sale to invoice etc.) -- Cédric Krier - B2CK SPRL Email/Jabber: cedric...@b2ck.com javascript: Tel: +32 472 54 46 59 Website: http://www.b2ck.com/