Browse Source

[FIX] Runbot Warning and traceback

pull/12/head
Thibault Francois 9 years ago
parent
commit
2ac18e508f
  1. 9
      beesdoo_base/models/partner.py
  2. 2
      beesdoo_pos/models/beesdoo_pos.py

9
beesdoo_base/models/partner.py

@ -3,12 +3,14 @@ from openerp import models, fields, api, _
from openerp.exceptions import ValidationError
from openerp.addons.beesdoo_base.tools import concat_names
class Partner(models.Model):
_inherit = 'res.partner'
first_name = fields.Char('First Name')
last_name = fields.Char('Last Name', required=True)
last_name = fields.Char('Last Name')
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),
('eater', '=', 'eater')])
@ -58,3 +60,8 @@ class Partner(models.Model):
def _new_card(self, reason, user_id):
self.env['member.card'].create({'partner_id' : self.id,'responsible_id' : user_id, 'comment' : reason})
@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

2
beesdoo_pos/models/beesdoo_pos.py

@ -60,3 +60,5 @@ class BeescoopPosPartner(models.Model):
debit = sum([m.debit for m in move_lines])
eater1, eater2 = self._get_eater()
return str(round(credit - debit, 2)), eater1, eater2
last_name = fields.Char('Last Name', required=True)
Loading…
Cancel
Save