Browse Source

SOO3 : last change ( now we have a wizard to create a new card,

deactivate the others and update the bar code )
pull/5/head
EliseDup 9 years ago
parent
commit
2be812b3df
  1. 16
      beesdoo_base/models/partner.py
  2. 1
      beesdoo_base/views/partner.xml

16
beesdoo_base/models/partner.py

@ -31,7 +31,9 @@ class Partner(models.Model):
if self.eater == 'eater': if self.eater == 'eater':
self.parent_barcode = self.parent_eater_id.barcode self.parent_barcode = self.parent_eater_id.barcode
elif self.member_card_ids: elif self.member_card_ids:
self.barcode = self.member_card_ids[0].barcode
for c in self.member_card_ids:
if c.valid:
self.barcode = c.barcode
@api.one @api.one
@api.constrains('child_eater_ids', 'parent_eater_id') @api.constrains('child_eater_ids', 'parent_eater_id')
@ -49,3 +51,15 @@ class Partner(models.Model):
if command[0] == 2: if command[0] == 2:
command[0] = 3 command[0] = 3
return super(Partner, self).write(values) return super(Partner, self).write(values)
@api.multi
def _deactivate_active_cards(self):
if len(self.member_card_ids) > 0:
for c in self.member_card_ids:
if c.valid:
c.valid = False
c.end_date = fields.Date.today()
@api.multi
def _new_card(self, txt):
self.env['member.card'].create({'partner_id' : self.env.context['active_id'],'comment' : txt})

1
beesdoo_base/views/partner.xml

@ -53,6 +53,7 @@
<field name="end_date" /> <field name="end_date" />
<field name="responsible_id" /> <field name="responsible_id" />
<field name="comment" /> <field name="comment" />
<field name="valid" />
</tree> </tree>
</field> </field>
<group> <group>

Loading…
Cancel
Save