Browse Source

[ADD] Code barre pour membre GA - nouveaux coop

pull/13/head
Thibault Francois 9 years ago
parent
commit
a25777d002
  1. 1
      beesdoo_base/__openerp__.py
  2. 11
      beesdoo_base/models/partner.py
  3. 6
      beesdoo_base/security/groups.xml
  4. 3
      beesdoo_base/wizard/new_member_card.py
  5. 3
      beesdoo_base/wizard/views/new_member_card.xml

1
beesdoo_base/__openerp__.py

@ -18,6 +18,7 @@
'depends': ['point_of_sale'],
'data': [
'security/groups.xml',
'security/ir.model.access.csv',
'views/partner.xml',
'wizard/views/new_member_card.xml',

11
beesdoo_base/models/partner.py

@ -57,8 +57,15 @@ class Partner(models.Model):
card.end_date = fields.Date.today()
@api.multi
def _new_card(self, reason, user_id):
self.env['member.card'].create({'partner_id' : self.id,'responsible_id' : user_id, 'comment' : reason})
def _new_card(self, reason, user_id, barcode=False):
card_data = {
'partner_id' : self.id,
'responsible_id' : user_id,
'comment' : reason,
}
if barcode:
card_data['barcode'] = barcode
self.env['member.card'].create(card_data)
@api.noguess
def _auto_init(self, cr, context=None):

6
beesdoo_base/security/groups.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="group_force_barcode" model="res.groups">
<field name="name">Bees Card Force Barcode</field>
</record>
</odoo>

3
beesdoo_base/wizard/new_member_card.py

@ -14,9 +14,10 @@ class NewMemberCardWizard(models.TransientModel):
new_comment = fields.Text('Reason', required=True)
partner_id = fields.Many2one('res.partner', default=_get_default_partner)
force_barcode = fields.Char('Force Barcode', groups="beesdoo_base.group_force_barcode")
@api.one
def create_new_card(self):
client = self.partner_id.sudo()
client._deactivate_active_cards()
client._new_card(self.new_comment, self.env.uid)
client._new_card(self.new_comment, self.env.uid, barcode=self.force_barcode)

3
beesdoo_base/wizard/views/new_member_card.xml

@ -6,6 +6,9 @@
<field name="model">membercard.new.wizard</field>
<field name="arch" type="xml">
<form>
<group groups="beesdoo_base.group_force_barcode">
<field name="force_barcode" />
</group>
<separator string="Reason" />
<field name="new_comment" string="Raison" editable="True" />
<field name="partner_id" invisible="1" />

Loading…
Cancel
Save