@ -7,8 +7,6 @@ class Partner(models.Model):
_inherit = ' res.partner '
_inherit = ' res.partner '
first_name = fields . Char ( ' First Name ' )
last_name = fields . Char ( ' Last Name ' )
eater = fields . Selection ( [ ( ' eater ' , ' Eater ' ) , ( ' worker_eater ' , ' Worker and Eater ' ) ] , string = " Eater/Worker " )
eater = fields . Selection ( [ ( ' eater ' , ' Eater ' ) , ( ' worker_eater ' , ' Worker and Eater ' ) ] , string = " Eater/Worker " )
child_eater_ids = fields . One2many ( " res.partner " , " parent_eater_id " , domain = [ ( ' customer ' , ' = ' , True ) ,
child_eater_ids = fields . One2many ( " res.partner " , " parent_eater_id " , domain = [ ( ' customer ' , ' = ' , True ) ,
( ' eater ' , ' = ' , ' eater ' ) ] )
( ' eater ' , ' = ' , ' eater ' ) ] )
@ -23,10 +21,6 @@ class Partner(models.Model):
cooperator_type = fields . Selection ( [ ( ' share_a ' , ' Share A ' ) , ( ' share_b ' , ' Share B ' ) , ( ' share_c ' , ' Share C ' ) ] , store = True , compute = None )
cooperator_type = fields . Selection ( [ ( ' share_a ' , ' Share A ' ) , ( ' share_b ' , ' Share B ' ) , ( ' share_c ' , ' Share C ' ) ] , store = True , compute = None )
@api.onchange ( ' first_name ' , ' last_name ' )
def _on_change_name ( self ) :
self . name = concat_names ( self . first_name , self . last_name )
@api.one
@api.one
@api.depends ( ' parent_eater_id ' , ' parent_eater_id.barcode ' , ' eater ' , ' member_card_ids ' )
@api.depends ( ' parent_eater_id ' , ' parent_eater_id.barcode ' , ' eater ' , ' member_card_ids ' )
def _get_bar_code ( self ) :
def _get_bar_code ( self ) :
@ -83,18 +77,12 @@ class Partner(models.Model):
card_data [ ' barcode ' ] = barcode
card_data [ ' barcode ' ] = barcode
self . env [ ' member.card ' ] . create ( card_data )
self . env [ ' member.card ' ] . create ( card_data )
@api.noguess
def _auto_init ( self , cr , context = None ) :
res = super ( Partner , self ) . _auto_init ( cr , context = context )
cr . execute ( " UPDATE res_partner set last_name = name where last_name IS NULL " )
return res
@api.multi
@api.multi
def _new_eater ( self , surname , name , email ) :
def _new_eater ( self , surname , name , email ) :
partner_data = {
partner_data = {
' name ' : surname + " " + name ,
' last_ name ' : name ,
' first_ name ' : surname ,
' lastname ' : name ,
' firstname ' : surname ,
' is_customer ' : True ,
' is_customer ' : True ,
' eater ' : ' eater ' ,
' eater ' : ' eater ' ,
' parent_eater_id ' : self . id ,
' parent_eater_id ' : self . id ,