我需要将一个首先声明的字段与product.py我正在制作的自定义模块相关联。这些字段在product.product类中如下所示:_name = "product.product"_description = "Product"_table = "product_product"_inherits = {'product.template': 'product_tmpl_id'}_inherit = ['mail.thread']_order = 'default_code,name_template'_columns = { 'codigo_n' : fields.char('Codigo Arancelario', size=64), 'tec_esp' : fields.char('Especificaciones tecnicas', size=72), 'qty_available': fields.function(_product_qty_available, type='float', string='Quantity On Hand'), 'virtual_available': fields.function(_product_virtual_available, type='float', string='Quantity Available'), 'incoming_qty': fields.function(_product_incoming_qty, type='float', string='Incoming'), 'outgoing_qty': fields.function(_product_outgoing_qty, type='float', string='Outgoing'), 'price': fields.function(_product_price, type='float', string='Price', digits_compute=dp.get_precision('Product Price')), 'lst_price' : fields.function(_product_lst_price, type='float', string='Public Price', digits_compute=dp.get_precision('Product Price')), 'code': fields.function(_product_code, type='char', string='Internal Reference'), 'partner_ref' : fields.function(_product_partner_ref, type='char', string='Customer ref'),它不是所有的product.py代码btw,但是它显示了我需要关联的两个字段,即前两个codigo_n和tec_esp,并且我在自定义模块中继承了该类,如下所示:_name = 'certificados.line'_description = "Items del Certificado"_inherit = 'product.product'def multi_a_b(self, cr, uid, ids, name, arg, context=None): res = {} for record in self.browse(cr, uid, ids,context): res[record.id] = record.Cantidad * record.Precio_Unitario_Declarado return res据我所知,如果我继承_name原始对象,我应该继承它的所有字段,然后添加在新类上声明的新字段。问题是,我不太确定如何继承这两个类型的字段,这些字段char已经尝试过one2many,然后many2one在自定义模块中调用它们,但是它返回一个None关系,我该如何实现呢?
添加回答
举报
0/150
提交
取消