EliseDup
8 years ago
14 changed files with 175 additions and 71 deletions
-
2beesdoo_base/__openerp__.py
-
10beesdoo_base/data/default_contact.xml
-
18beesdoo_base/models/partner.py
-
143beesdoo_base/views/partner.xml
-
2beesdoo_base/wizard/__init__.py
-
2beesdoo_base/wizard/member_card.py
-
21beesdoo_base/wizard/partner.py
-
2beesdoo_base/wizard/views/member_card.xml
-
22beesdoo_base/wizard/views/partner.xml
-
3beesdoo_purchase/models/__init__.py
-
14beesdoo_purchase/models/purchase.py
-
3import_odoo/__openerp__.py
-
2import_odoo/security/ir.model.access.csv
-
2requirement.txt
@ -0,0 +1,10 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<odoo> |
||||
|
<data noupdate="1"> |
||||
|
<record model="res.partner" id="commande_beescoop"> |
||||
|
<field name="name">commande@bees-coop.be</field> |
||||
|
<field name="email">commande@bees-coop.be</field> |
||||
|
<field name="active">True</field> |
||||
|
</record> |
||||
|
</data> |
||||
|
</odoo> |
@ -1,72 +1,89 @@ |
|||||
<?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': [('company_type', '=', 'company')]}" /> |
|
||||
<field name="parent_eater_id" attrs="{'invisible' : [('eater', '!=', 'eater')]}" /> |
|
||||
</field> |
|
||||
<xpath expr="//notebook" position="inside"> |
|
||||
<page string="Member Cards" |
|
||||
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" /> |
|
||||
<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> |
|
||||
|
<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> |
||||
|
<button name="toggle_active" position="attributes"> |
||||
|
<attribute name="groups" /> |
||||
|
</button> |
||||
|
</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, |
|
||||
'default_customer': 0, |
|
||||
'default_supplier': 1, |
|
||||
'default_is_company' : True, |
|
||||
'default_company_type' : 'company', } |
|
||||
|
<field name="context">{ |
||||
|
'search_default_supplier': 1, |
||||
|
'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,21 @@ |
|||||
|
# -*- 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): |
||||
|
self.partner_id._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> |
@ -1,2 +1 @@ |
|||||
# -*- coding: utf-8 -*- |
|
||||
|
|
||||
|
import purchase |
@ -0,0 +1,14 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
from openerp import models, api |
||||
|
|
||||
|
class PurchaseOrder(models.Model): |
||||
|
_inherit = 'purchase.order' |
||||
|
|
||||
|
@api.model |
||||
|
def create(self, vals): |
||||
|
purchase_order = super(PurchaseOrder, self).create(vals) |
||||
|
command_contact = self.env.ref('beesdoo_base.commande_beescoop', raise_if_not_found=False) |
||||
|
# We do not need to update sale_order.mail_followers_ids, the link is automatic ?! |
||||
|
if command_contact: |
||||
|
self.env['mail.followers'].create({'res_model' : 'purchase.order', 'res_id' : purchase_order.id, 'partner_id' : command_contact.id}) |
||||
|
return purchase_order |
@ -0,0 +1,2 @@ |
|||||
|
id,name,model_id/id,group_id/id,perm_read,perm_write,perm_create,perm_unlink |
||||
|
access_import_odoo_connection,access_import_odoo_connection,model_import_odoo_connection,,1,0,0,0 |
@ -0,0 +1,2 @@ |
|||||
|
pycoda |
||||
|
openerp-client-lib |
Write
Preview
Loading…
Cancel
Save
Reference in new issue