vaab / report_birt

BIRT Report module for OpenERP
5 stars 6 forks source link

AttributeError: 'NoneType' object has no attribute 'search' #8

Open PavanKumar8909 opened 7 years ago

PavanKumar8909 commented 7 years ago

hi, i am creating one model like tax_category and another model is tax_sub i want know to do notebook in openerp6 my problem is i am getting this error"AttributeError: 'NoneType' object has no attribute 'search'"

class ci_tax_category(osv.osv): _name = 'ci.tax.category' _columns = { 'name' : fields.char('Tax Category',size=100), 'active':fields.boolean('Active'), 'tax_gst_category_id':fields.one2many('ci.tax_gst','ci_tax_gst_id','Tax1 Id'), } _sql_constraints = [('name_uniq', 'unique(name)', 'Tax Category must be unique !'), ] _defaults = {'active':True}

def copy(self, cr, uid, id, default=None, context=None): if default is None: default = {} name = self.read(cr, uid, [id], ['name'], context)[0]['name'] default.update({'name': name+ _(' (copy)'), 'events':[]}) return super(ci_tax_category, self).copy(cr, uid, id, default, context)

ci_tax_category()

class ci_tax_gst(osv.osv): _name='ci.tax_gst' _columns={ 'name':fields.char('GST Tax',required=True), 'active':fields.boolean('Active'), 'stat_amt':fields.float('Start Amount'), 'end_amt':fields.float('End Amount'),

                'cgst_per':fields.float('CGST'),
                'sgst_per':fields.float('SGST'),
                'igst_per':fields.float('IGST'),
                'ci_tax_gst_id':fields.many2one('ci.tax_category','Tax1 Id',required=True),
           }
  _sql_constraints = [
 ('Tax', 'unique (name,ci_tax_category)', 'The Tax name already exists for this Tax Category!'),

] _defaults={'active':True}

  def copy(self, cr, uid, id, default=None, context=None):
    if default is None:
        default = {}
    name = self.read(cr, uid, [id], ['name'], context)[0]['name']
    default.update({'name': name+ _(' (copy)'), 'events':[]})
    return super(ci_tax_gst, self).copy(cr, uid, id, default, context)

ci_tax_gst()

in xml i put notebook code inside the ci.tax_category form view