Hi!
This is probably another easy one, but I couldn't find a module that uses
buttons (and I want to), so I can't see sources for this one (I watched
Party,Company, and gnu_health modules and no one uses buttons it seems).
The problem is that I can't call an internal class function. The button
shows in the GUI but when I hit it it says:
"calling method apreto in hello.algo is not allowed"
I thought it could be a matter of permissions or scope, but can't find the
answer. Any suggestion is greatly appreciated. Thanks in advance!
The code (not the entire file cos it's long) would be:
from trytond.model import ModelView, ModelSQL, fields
from trytond.pool import Pool
from trytond.res import User
from trytond.pyson import Eval, If
class Algo(ModelSQL,ModelView):
'Algo'
_name = 'hello.algo'
_description = __doc__
name = fields.Char('Nombre')
holas = fields.Many2Many('hello.relacion','algo','hola','Holas')
cosa=fields.Char('Cosa')
def apreto(self,ids):
for elem in self.browse(ids):
elem.cosa="lelele"
Algo()
The xml for the form view is just (I suppose only de "button" tag is
important here):
<record model="ir.ui.view" id="algo_view_form">
<field name="model">hello.algo</field>
<field name="type">form</field>
<field name="arch" type="xml">
<![CDATA[
<form string="Algo Formularialmente...">
<label name="name"/>
<field name="name" xfill="1"/>
<label name="holas"/>
<field name="holas"/>
<label name="cosa"/>
<field name="cosa"/>
<button string="Apretar acá" name="apreto"/>
</form>
]]>
</field>
</record>
--
[email protected] mailing list