Hola a todos
Estoy haciendo un nuevo modulo el cuál necesito heredar la linía de venta
del módulo ventas. El tipo de herencia que necesito es una herencia que
permita heredar todo lo necesario pero que sea independiente del modelo de
ventas (que pueda manpular el modulo heredado pero sin modificar el
original) El código del archivo .py és:
from trytond.model import ModelView, ModelSQL, fields
from trytond.pyson import Eval
from trytond.transaction import Transaction
from trytond.pool import Pool
class Sale (ModelView, ModelSQL):
'Sale'
_name = 'pos.sale'
_description = __doc__
_inherits = {'sale.sale': 'sale'}
Sale()
la parte del archivo xml donde hace referencia a la herencia és:
<record model="ir.ui.view" id="sale_tree">
<field name="model">sale.sale</field>
<field name="type">tree</field>
<field name="inherits" ref="sale.sale_view_tree"/>
<field name="arch" type="xml">
<![CDATA[
<data>
<xpath
expr="/tree"
position="replace_attributes">
</xpath>
</data>
]]>
</field>
</record>
<record model="ir.ui.view" id="sale_form">
<field name="model">sale.sale</field>
<field name="type">form</field>
<field name="inherits" ref="sale.sale_view_form"/>
<field name="arch" type="xml">
<![CDATA[
<data>
<xpath
expr="/form"
position="replace_attributes">
<form string="Sales"/>
</xpath>
]]>
</field>
</record>
<record model="ir.action.act_window" id="act_sale">
<field name="name">Sale</field>
<field name="res_model">sale.sale</field>
</record>
y el error és el siguiente:
Traceback (most recent call last):
File "/trytond/protocols/jsonrpc.py", line 108, in _marshaled_dispatch
response['result'] = dispatch_method(method, params)
File "/trytond/protocols/jsonrpc.py", line 147, in _dispatch
res = dispatch(*args)
File "/trytond/protocols/dispatcher.py", line 155, in dispatch
res = getattr(obj, method)(*args_without_context, **kargs)
File "/trytond/wizard/wizard.py", line 120, in execute
action_res = getattr(self, action)(data)
File "/trytond/ir/module/module.py", line 525, in _upgrade_module
pool.init(update=True, lang=lang)
File "/trytond/pool.py", line 118, in init
lang=lang)
File "/trytond/modules/__init__.py", line 430, in load_modules
load_module_graph(graph, pool, lang)
File "/trytond/modules/__init__.py", line 253, in load_module_graph
tryton_parser.parse_xmlstream(fp)
File "/trytond/convert.py", line 417, in parse_xmlstream
self.sax_parser.parse(source)
File "/xml/sax/expatreader.py", line 107, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/xml/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/xml/sax/expatreader.py", line 207, in feed
self._parser.Parse(data, isFinal)
File "/xml/sax/expatreader.py", line 304, in end_element
self._cont_handler.endElement(name)
File "/trytond/convert.py", line 464, in endElement
self.taghandler = self.taghandler.endElement(name)
File "/trytond/convert.py", line 260, in endElement
self.mh.import_record(self.model._name, self.values, self.xml_id)
File "/trytond/convert.py", line 836, in import_record
db_id = object_ref.create(values)
File "/trytond/ir/ui/view.py", line 204, in create
res = super(View, self).create(vals)
File "/trytond/model/modelsql.py", line 306, in create
if not hasattr(self._columns[field], 'set'):
KeyError: u'inherits'
A que se debe el error? Muchas grácies y disculpar las molestias
--
[email protected] mailing list