Browse Source

S003 : create a wizard to add a new card

pull/5/head
EliseDup 9 years ago
parent
commit
54106a4c46
  1. 4
      beesdoo_base/models/membercard.py
  2. 38
      beesdoo_base/views/partner.xml

4
beesdoo_base/models/membercard.py

@ -33,8 +33,8 @@ class MemberCard(models.Model):
# A transient model for the creation of a new card. The user can only define the raison why # 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. # a new card is needed and the eater/worker that is concerned.
class BeesMemberCardWizard(models.TransientModel):
_name = 'beesmembercard.wizard'
class MemberCardWizard(models.TransientModel):
_name = 'membercard.wizard'
new_comment = fields.Char('Raison', required=True) new_comment = fields.Char('Raison', required=True)

38
beesdoo_base/views/partner.xml

@ -1,6 +1,28 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<odoo> <odoo>
<record id="MemberCard Wizard" model="ir.ui.view">
<field name="name">New MemberCard Wizard</field>
<field name="model">membercard.wizard</field>
<field name="arch" type="xml">
<form>
<group>
<field name="new_comment" string="Raison" editable="True" />
</group>
<footer>
<button type="object" name="create_new_card" string="Créer"
class="oe_highlight" />
<button special="cancel" string="Annuler" />
</footer>
</form>
</field>
</record>
<act_window id="action_membercard_wizard"
name="Créer une nouvelle carte de membre - Désactiver l'ancienne"
src_model="member.card" res_model="membercard.wizard" view_mode="form"
target="new" multi="True" />
<record model="ir.ui.view" id="beesdoo_partner_form_view"> <record model="ir.ui.view" id="beesdoo_partner_form_view">
<field name="name">beesdoo.partner.form.view</field> <field name="name">beesdoo.partner.form.view</field>
<field name="model">res.partner</field> <field name="model">res.partner</field>
@ -8,11 +30,14 @@
<field name="arch" type="xml"> <field name="arch" type="xml">
<field name="name" position="replace"> <field name="name" position="replace">
<field name="name" class="oe_read_only" /> <field name="name" class="oe_read_only" />
<field name="first_name" placeholder="First Name" class="oe_edit_only" attrs="{'invisible' : [('company_type', '=', 'company')]}"/>
<field name="last_name" placeholder="Last Name" class="oe_edit_only" default_focus="1"/>
<field name="first_name" placeholder="First Name" class="oe_edit_only"
attrs="{'invisible' : [('company_type', '=', 'company')]}" />
<field name="last_name" placeholder="Last Name" class="oe_edit_only"
default_focus="1" />
</field> </field>
<field name="website" position="after"> <field name="website" position="after">
<field name="eater" attrs="{'invisible': [('company_type', '=', 'company')]}"/>
<field name="eater"
attrs="{'invisible': [('company_type', '=', 'company')]}" />
<field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> <field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" />
</field> </field>
<xpath expr="//notebook" position="inside"> <xpath expr="//notebook" position="inside">
@ -30,10 +55,15 @@
<field name="comment" /> <field name="comment" />
</tree> </tree>
</field> </field>
<group>
<button string="Nouvelle Carte" name="%(action_membercard_wizard)d"
type="action" />
</group>
</page> </page>
</xpath> </xpath>
<field name="barcode" position="attributes"> <field name="barcode" position="attributes">
<attribute name="attrs">{'invisible' : [('eater', '!=', 'worker_eater')]}</attribute>
<attribute name="attrs">{'invisible' : [('eater', '!=',
'worker_eater')]}</attribute>
</field> </field>
<field name="barcode" position="after"> <field name="barcode" position="after">
<field name="parent_barcode" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> <field name="parent_barcode" attrs="{'invisible' : [('eater', '!=', 'eater')]}" />

Loading…
Cancel
Save