Thibault Francois
9 years ago
8 changed files with 148 additions and 52 deletions
-
2beesdoo_base/__openerp__.py
-
7beesdoo_base/models/partner.py
-
7beesdoo_base/views/partner.xml
-
3beesdoo_base/wizard/__init__.py
-
52beesdoo_base/wizard/member_card.py
-
23beesdoo_base/wizard/new_member_card.py
-
82beesdoo_base/wizard/views/member_card.xml
-
24beesdoo_base/wizard/views/new_member_card.xml
@ -1 +1,2 @@ |
|||
import new_member_card |
|||
import member_card |
|||
|
@ -0,0 +1,52 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from openerp import models, fields, api |
|||
|
|||
class NewMemberCardWizard(models.TransientModel): |
|||
""" |
|||
A transient model for the creation of a new card. |
|||
The user can only define the raison why a new card is |
|||
needed and the eater/worker that is concerned. |
|||
""" |
|||
_name = 'membercard.new.wizard' |
|||
|
|||
def _get_default_partner(self): |
|||
return self.env.context['active_id'] |
|||
|
|||
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, barcode=self.force_barcode) |
|||
|
|||
|
|||
class RequestMemberCardPrintingWizard(models.TransientModel): |
|||
|
|||
_name = 'membercard.requestprinting.wizard' |
|||
|
|||
def _get_selected_partners(self): |
|||
return self.env.context['active_ids'] |
|||
|
|||
partner_ids = fields.Many2many('res.partner', default=_get_selected_partners) |
|||
|
|||
|
|||
@api.one |
|||
def request_printing(self): |
|||
self.partner_ids.write({'member_card_to_be_printed' : True}) |
|||
|
|||
class SetAsPrintedWizard(models.TransientModel): |
|||
|
|||
_name = 'membercard.set_as_printed.wizard' |
|||
|
|||
def _get_selected_partners(self): |
|||
return self.env.context['active_ids'] |
|||
|
|||
partner_ids = fields.Many2many('res.partner', default=_get_selected_partners) |
|||
|
|||
@api.one |
|||
def set_as_printed(self): |
|||
self.partner_ids.write({'member_card_to_be_printed' : False, |
|||
'last_printed' : fields.Datetime.now()}) |
@ -1,23 +0,0 @@ |
|||
# -*- coding: utf-8 -*- |
|||
from openerp import models, fields, api |
|||
|
|||
class NewMemberCardWizard(models.TransientModel): |
|||
""" |
|||
A transient model for the creation of a new card. |
|||
The user can only define the raison why a new card is |
|||
needed and the eater/worker that is concerned. |
|||
""" |
|||
_name = 'membercard.new.wizard' |
|||
|
|||
def _get_default_partner(self): |
|||
return self.env.context['active_id'] |
|||
|
|||
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, barcode=self.force_barcode) |
@ -0,0 +1,82 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
<!-- New card generation wizard --> |
|||
<record id="MemberCard Wizard" model="ir.ui.view"> |
|||
<field name="name">New MemberCard Wizard</field> |
|||
<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" /> |
|||
<footer> |
|||
<button type="object" name="create_new_card" string="Créer" |
|||
class="oe_highlight" /> |
|||
<button special="cancel" string="Annuler" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
|
|||
<record id="printing_membercard_request_wizard" model="ir.ui.view"> |
|||
<field name="name">Request Membercard Printing Wizard</field> |
|||
<field name="model">membercard.requestprinting.wizard</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<separator string="Request Printing for" /> |
|||
<field name="partner_ids" /> |
|||
<footer> |
|||
<button |
|||
type="object" |
|||
name="request_printing" |
|||
string="Request Beescard Printing" |
|||
class="oe_highlight" /> |
|||
<button special="cancel" string="Cancel" /> |
|||
</footer> |
|||
</form> |
|||
|
|||
</field> |
|||
</record> |
|||
|
|||
<act_window name="Request BEES card printing" |
|||
res_model="membercard.requestprinting.wizard" |
|||
src_model="res.partner" |
|||
view_mode="form" |
|||
target="new" |
|||
key2="client_action_multi" |
|||
id="beesdoo_base_action_request_membercard_printing" |
|||
/> |
|||
|
|||
|
|||
<record id="membercard_set_as_printed_wizard" model="ir.ui.view"> |
|||
<field name="name">Set Membercard as Printed Wizard</field> |
|||
<field name="model">membercard.set_as_printed.wizard</field> |
|||
<field name="arch" type="xml"> |
|||
<form> |
|||
<separator string="Set as Printed for" /> |
|||
<field name="partner_ids" /> |
|||
<footer> |
|||
<button |
|||
type="object" |
|||
name="set_as_printed" |
|||
string="Set as Printed" |
|||
class="oe_highlight" /> |
|||
<button special="cancel" string="Cancel" /> |
|||
</footer> |
|||
</form> |
|||
|
|||
</field> |
|||
</record> |
|||
<act_window name="Set BEES card as printed" |
|||
res_model="membercard.set_as_printed.wizard" |
|||
src_model="res.partner" |
|||
view_mode="form" |
|||
target="new" |
|||
key2="client_action_multi" |
|||
id="beesdoo_base_action_set_membercard_as_printed" |
|||
/> |
|||
</odoo> |
@ -1,24 +0,0 @@ |
|||
<?xml version="1.0" encoding="utf-8"?> |
|||
<odoo> |
|||
|
|||
<record id="MemberCard Wizard" model="ir.ui.view"> |
|||
<field name="name">New MemberCard Wizard</field> |
|||
<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" /> |
|||
<footer> |
|||
<button type="object" name="create_new_card" string="Créer" |
|||
class="oe_highlight" /> |
|||
<button special="cancel" string="Annuler" /> |
|||
</footer> |
|||
</form> |
|||
</field> |
|||
</record> |
|||
|
|||
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue