Merge branch 'master' into membership_grouped
authorLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Wed, 19 Dec 2012 11:31:23 +0000 (12:31 +0100)
committerLudovic CHEVALIER <ludovic.chevalier@heureux-cyclage.org>
Wed, 19 Dec 2012 11:31:23 +0000 (12:31 +0100)
__openerp__.py
remembership.py
view/membership.xml [new file with mode: 0644]

index 0adc843..d71b1ac 100644 (file)
@@ -36,6 +36,7 @@
         'data/membership_sequence.xml',
         'view/partner.xml',
         'view/point_of_sale.xml',
+        'view/membership.xml',
     ],
     'update_xml': [],
     'demo_xml': [],
index 11f61ca..58ba74c 100644 (file)
@@ -39,6 +39,17 @@ class Partner(osv.osv):
 Partner()
 
 
+class Product(osv.osv):
+    _inherit = 'product.product'
+
+    _columns = {
+        'membership_grouped': fields.boolean('Grouped membership product', help='Check if it\'s a grouped membership product.'),
+        'membership_date2date': fields.boolean('Date to date membership product', help='Check if it\'s a date to date membership product.'),
+    }
+
+Product()
+
+
 class account_invoice_line(osv.osv):
     _inherit = 'account.invoice.line'
 
diff --git a/view/membership.xml b/view/membership.xml
new file mode 100644 (file)
index 0000000..6240239
--- /dev/null
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+    <data>
+        <record id="view_remembership_products_form" model="ir.ui.view">
+            <field name="name">Membership product</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="membership.membership_products_form"/>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='categ_id']" position="after">
+                    <field name="membership_grouped"/>
+                    <field name="membership_date2date"/>
+                </xpath>
+                <xpath expr="//label[@for='membership_date_from']" position="attributes">
+                    <attribute name="attrs">{'invisible': [('membership_date2date','=',True)]}</attribute>
+                </xpath>
+                <xpath expr="//div[child::field[@name='membership_date_from']]" position="attributes">
+                    <attribute name="attrs">{'invisible': [('membership_date2date','=',True)]}</attribute>
+                </xpath>
+            </field>
+        </record>
+        <record id="view_remembership_product_normal_form" model="ir.ui.view">
+            <field name="name">product.product.form</field>
+            <field name="model">product.product</field>
+            <field name="inherit_id" ref="membership.product_normal_form_view"/>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='membership']" position="after">
+                    <field name="membership_grouped" attrs="{'invisible': [('membership','=', False)]}"/>
+                    <field name="membership_date2date" attrs="{'invisible': [('membership','=', False)]}"/>
+                </xpath>
+                <xpath expr="//group[child::field[@name='membership_date_from']]" position="attributes">
+                    <attribute name="attrs">{'invisible': ['|',('membership','=',False),('membership_date2date','=',True)]}</attribute>
+                </xpath>
+            </field>
+        </record>
+    </data>
+</openerp>