Thanks I've done some test and everything works. Take advantage this thread, can I put the name of widget only in .rng archive or I need to add in .rnc too?
Rodrigo Hübner On Mon, Jun 20, 2011 at 5:25 AM, Bertrand Chenal <[email protected]>wrote: > Le Sun, 19 Jun 2011 12:26:46 -0300, > Rodrigo Hübner <[email protected]> a écrit : > > > Hi everyone! > > > > I'm doing a test to create a new widget, but doesn't work... > > > > I added follow lines in > > "tryton/gui/window/view_form/view/form_gtk/parser.py": > > > > ... > > from richtextbox import RichTextBox > > > > WIDGETS_TYPE = { > > ... > > 'richtext': (RichTextBox, 1, True, True), > > } > > > > After i created the file richtextbox.py with some content of > > textbox.py, changing where the name of class was 'TextBox' to > > 'RichTextBox'. > > > > So, in the file "trytond/modules/product/product.xml" i changed the > > line: > > > > <field name="description" colspan="4"/> > > to > > <field name="description" widget="richtext" colspan="4"/> > > > > When I update the module product gives the following error: Invalid > > XML for view! > > > > Traceback error: > > > > [Sun Jun 19 12:24:20 2011] ERROR:ir:Invalid xml view: > > <string>:17:0:ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid > > attribute widget for element field > > <data> > > <xpath > > expr="/form" > > position="replace_attributes"> > > <form string="Products"/> > > </xpath> > > <xpath > > > > > > expr="/form/notebook/page[@id="general"]/label[@name="type"]" > > position="before"> > > <label name="code"/> > > <field name="code"/> > > </xpath> > > <xpath > > > expr="/form/notebook/page[@id="general"]" > > position="inside"> > > <separator name="description" colspan="4"/> > > <field name="description" widget="richtext" > > colspan="4"/> > > </xpath> > > </data> > > [Sun Jun 19 12:24:20 2011] ERROR:convert:Error while parsing xml file: > > In tag record: model ir.ui.view with id product_view_form. > > > > Can anyone help me with this? > > > > Rodrigo Hübner > > > > I did not test it but it seems you have to add an entry in > trytond/ir/ui/form.rng to allow the value "richtext" for the > widget widget attribute. > Take a look around line 267 (where "text" is defined). > > > -- > Bertrand Chenal > > B2CK SPRL > Rue de Rotterdam, 4 > 4000 Liège > Belgium > Tel: +32 472 54 46 59 > Email: [email protected] > Website: http://www.b2ck.com/ > > -- > [email protected] mailing list > -- [email protected] mailing list
