Browse Source
Ajout d'un wizard pour créer un nouvel enfant directement chez le travailleur. Correction de qq mots qui étaient encore en français
pull/13/head
Ajout d'un wizard pour créer un nouvel enfant directement chez le travailleur. Correction de qq mots qui étaient encore en français
pull/13/head
EliseDup
9 years ago
8 changed files with 138 additions and 69 deletions
-
1beesdoo_base/__openerp__.py
-
13beesdoo_base/models/partner.py
-
137beesdoo_base/views/partner.xml
-
2beesdoo_base/wizard/__init__.py
-
2beesdoo_base/wizard/member_card.py
-
22beesdoo_base/wizard/partner.py
-
6beesdoo_base/wizard/views/member_card.xml
-
22beesdoo_base/wizard/views/partner.xml
@ -1,72 +1,85 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<odoo> |
<odoo> |
||||
<record model="ir.actions.act_window" id="action_membercard_wizard"> |
|
||||
<field name="name">New Member Card</field> |
|
||||
<field name="res_model">membercard.new.wizard</field> |
|
||||
<field name="view_mode">form</field> |
|
||||
<field name="target">new</field> |
|
||||
</record> |
|
||||
|
<record model="ir.actions.act_window" id="action_membercard_wizard"> |
||||
|
<field name="name">New Member Card</field> |
||||
|
<field name="res_model">membercard.new.wizard</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
|
<record model="ir.actions.act_window" id="action_eater_wizard"> |
||||
|
<field name="name">New Eater</field> |
||||
|
<field name="res_model">eater.new.wizard</field> |
||||
|
<field name="view_mode">form</field> |
||||
|
<field name="target">new</field> |
||||
|
</record> |
||||
|
|
||||
<record model="ir.ui.view" id="beesdoo_partner_form_view"> |
|
||||
<field name="name">beesdoo.partner.form.view</field> |
|
||||
<field name="model">res.partner</field> |
|
||||
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" /> |
|
||||
<field name="arch" type="xml"> |
|
||||
<field name="name" position="replace"> |
|
||||
<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> |
|
||||
<field name="website" position="after"> |
|
||||
<field name="eater" |
|
||||
attrs="{'invisible': [('customer', '=', False)]}" /> |
|
||||
<field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
|
||||
</field> |
|
||||
<xpath expr="//notebook" position="inside"> |
|
||||
<page string="Carte de Membre" |
|
||||
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', '!=', 'worker_eater')]}"> |
|
||||
<separator string="Printing" /> |
|
||||
<group> |
|
||||
<field name="member_card_to_be_printed" /> |
|
||||
<field name="last_printed" /> |
|
||||
</group> |
|
||||
<separator string="Mangeurs" /> |
|
||||
<field name="child_eater_ids" widget="many2many_tags" /> |
|
||||
<separator string="Cartes" /> |
|
||||
<field string="Cartes" name="member_card_ids"> |
|
||||
<tree editable="bottom"> |
|
||||
<field name="barcode" /> |
|
||||
<field name="create_date" /> |
|
||||
<field name="end_date" /> |
|
||||
<field name="responsible_id" /> |
|
||||
<field name="comment" /> |
|
||||
<field name="valid" /> |
|
||||
</tree> |
|
||||
</field> |
|
||||
<group> |
|
||||
<button string="Nouvelle Carte" name="%(action_membercard_wizard)d" |
|
||||
type="action" /> |
|
||||
</group> |
|
||||
</page> |
|
||||
</xpath> |
|
||||
<field name="barcode" position="attributes"> |
|
||||
<attribute name="attrs">{'invisible' : [('eater', '!=', 'worker_eater')]}</attribute> |
|
||||
</field> |
|
||||
<field name="barcode" position="after"> |
|
||||
<field name="parent_barcode" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
|
||||
</field> |
|
||||
</field> |
|
||||
</record> |
|
||||
|
<record model="ir.ui.view" id="beesdoo_partner_form_view"> |
||||
|
<field name="name">beesdoo.partner.form.view</field> |
||||
|
<field name="model">res.partner</field> |
||||
|
<field name="inherit_id" ref="point_of_sale.view_partner_property_form" /> |
||||
|
<field name="arch" type="xml"> |
||||
|
<field name="name" position="replace"> |
||||
|
<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> |
||||
|
<field name="website" position="after"> |
||||
|
<field name="eater" attrs="{'invisible': [('customer', '=', False)]}" /> |
||||
|
<field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
||||
|
</field> |
||||
|
<xpath expr="//notebook" position="inside"> |
||||
|
<page string="Member Card" |
||||
|
attrs="{'invisible': ['|', ('customer', '=', False), ('eater', '!=', 'worker_eater')]}"> |
||||
|
<separator string="Printing" /> |
||||
|
<group> |
||||
|
<field name="member_card_to_be_printed" /> |
||||
|
<field name="last_printed" /> |
||||
|
</group> |
||||
|
<separator string="Eaters" /> |
||||
|
<field name="child_eater_ids" widget="many2many_tags" /> |
||||
|
<group> |
||||
|
<button string="New Eater" name="%(action_eater_wizard)d" |
||||
|
type="action" /> |
||||
|
</group> |
||||
|
<separator string="Cards" /> |
||||
|
<field string="Cards" name="member_card_ids"> |
||||
|
<tree editable="bottom"> |
||||
|
<field name="barcode" /> |
||||
|
<field name="create_date" /> |
||||
|
<field name="end_date" /> |
||||
|
<field name="responsible_id" /> |
||||
|
<field name="comment" /> |
||||
|
<field name="valid" /> |
||||
|
</tree> |
||||
|
</field> |
||||
|
<group> |
||||
|
<button string="New Card" name="%(action_membercard_wizard)d" |
||||
|
type="action" /> |
||||
|
</group> |
||||
|
</page> |
||||
|
</xpath> |
||||
|
<field name="barcode" position="attributes"> |
||||
|
<attribute name="attrs">{'invisible' : [('eater', '!=', |
||||
|
'worker_eater')]} |
||||
|
</attribute> |
||||
|
</field> |
||||
|
<field name="barcode" position="after"> |
||||
|
<field name="parent_barcode" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
||||
|
</field> |
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
<!-- S022 : By default a supplier should be a company --> |
<!-- S022 : By default a supplier should be a company --> |
||||
<record id="base.action_partner_supplier_form" model="ir.actions.act_window"> |
<record id="base.action_partner_supplier_form" model="ir.actions.act_window"> |
||||
<field name="context">{ 'search_default_supplier': 1, |
<field name="context">{ 'search_default_supplier': 1, |
||||
'default_customer': 0, |
|
||||
'default_supplier': 1, |
|
||||
'default_is_company' : True, |
|
||||
'default_company_type' : 'company', } |
|
||||
|
'default_customer': |
||||
|
0, |
||||
|
'default_supplier': 1, |
||||
|
'default_is_company' : True, |
||||
|
'default_company_type' : 'company', } |
||||
</field> |
</field> |
||||
</record> |
</record> |
||||
</odoo> |
</odoo> |
@ -1,2 +1,2 @@ |
|||||
import member_card |
|
||||
|
import member_card, partner |
||||
|
|
@ -0,0 +1,22 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, fields, api |
||||
|
|
||||
|
class NewEaterWizard(models.TransientModel): |
||||
|
""" |
||||
|
A transient model for the creation of a eater related to a worker. |
||||
|
""" |
||||
|
_name = 'eater.new.wizard' |
||||
|
|
||||
|
def _get_default_partner(self): |
||||
|
return self.env.context['active_id'] |
||||
|
|
||||
|
first_name = fields.Char('First Name', required=True) |
||||
|
last_name = fields.Char('Last Name', required=True) |
||||
|
email = fields.Char('Email') |
||||
|
|
||||
|
partner_id = fields.Many2one('res.partner', default=_get_default_partner) |
||||
|
|
||||
|
@api.one |
||||
|
def create_new_eater(self): |
||||
|
client = self.partner_id.sudo() |
||||
|
client._new_eater(self.first_name, self.last_name, self.email) |
@ -0,0 +1,22 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<!-- New eater generation wizard --> |
||||
|
<record id="Eater Wizard" model="ir.ui.view"> |
||||
|
<field name="name">New Eater Wizard</field> |
||||
|
<field name="model">eater.new.wizard</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<form string="Create a new eater"> |
||||
|
<group> |
||||
|
<field name="first_name" /> |
||||
|
<field name="last_name" /> |
||||
|
<field name="email" /> |
||||
|
</group> |
||||
|
<footer> |
||||
|
<button type="object" name="create_new_eater" string="Create" |
||||
|
class="oe_highlight" /> |
||||
|
<button special="cancel" string="Cancel" /> |
||||
|
</footer> |
||||
|
</form> |
||||
|
</field> |
||||
|
</record> |
||||
|
</odoo> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue