Commits

pkumar committed d59d6a8 Draft

added address book module to the repository with basic functionality

Comments (0)

Files changed (6)

test_module/__init__.py

+import address_book

test_module/__openerp__.py

+
+{
+    "name" : "Address Book module",
+    "version" : "0.1",
+    "author" : "pkumar",
+    'complexity': "easy",
+    "description" : """
+    """,
+    "website" : "http://www.openerp.com",
+    "depends" : [],
+    "category" : "Dev",
+    "sequence": 16,
+    "init_xml" : [],
+    "demo_xml" : [],
+    "update_xml" : ["address_book_view.xml"],
+    'test': [],
+    'installable': True,
+    'application': True,
+    'active': False,
+}

test_module/address_book.py

+from osv import fields, osv
+
+class address_book(osv.osv):
+    _name = "address.book"
+    _description = "Address Book"
+    _columns = {
+        'person_name': fields.char('Name', size=128, required=True, help=""),
+        'address': fields.text('Address'),
+        'contact_no': fields.integer('Contact'),
+        'email': fields.char('Email', size=20),
+        'state': fields.boolean('State')
+    }
+
+    def dev_active(self, cr, uid, ids):
+        self.write(cr, uid, ids, { 'state' : 'active' })
+        return True
+
+    def dev_inactive(self, cr, uid, ids):
+        self.write(cr, uid, ids, { 'state' : 'inactive' })
+        return True
+
+address_book()

test_module/address_book_view.xml

+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<record model="ir.ui.view" id="address_book_tree_view">
+<field name="name">address.book.tree</field>
+<field name="model">address.book</field>
+<field name="type">tree</field>
+<field name="arch" type="xml">
+<tree string="Address Book">
+<field name="person_name"/>
+<field name="address"/>
+<field name="contact_no"/>
+<field name="email"/>
+<field name="state"/>
+</tree>
+</field>
+</record>
+
+<record model="ir.ui.view" id="address_book_form_view">
+<field name="name">address.book.form</field>
+<field name="model">address.book</field>
+<field name="type">form</field>
+<field name="arch" type="xml">
+<form string="Address Book">
+<field name="person_name"/>
+<field name="address"/>
+<field name="contact_no"/>
+<field name="email"/>
+<field name="state"/>
+</form>
+</field>
+</record>
+
+
+<record model="ir.actions.act_window" id="action_address_book_form">
+<field name="name">address_book</field>
+<field name="res_model">address.book</field>
+</record>
+
+<menuitem name="Address Book" icon="terp-project" id="addressbook_menu" />
+<menuitem name="Person" parent="addressbook_menu" id="dev_menu_person" action="action_address_book_form" />
+
+
+</data>
+</openerp>

test_module/dev_workflow.xml

+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+<data>
+<record model="workflow" id="wkf_dev_person">
+    <field name="name">dev.wkf</field>
+    <field name="osv">dev.dev</field>
+    <field name="on_create">True</field>
+</record>
+
+<record model="workflow.activity" id="act_active">
+    <field name="wkf_id" ref="wkf_dev_person" />
+    <field name="flow_start">True</field>
+    <field name="name">active</field>
+    <field name="kind">function</field>
+    <field name="action">dev_active()</field>
+</record>
+
+<record model="workflow.activity" id="act_inactive">
+    <field name="wkf_id" ref="wkf_dev_person" />
+    <field name="flow_start">True</field>
+    <field name="name">inactive</field>
+    <field name="kind">function</field>
+    <field name="action">dev_inactive()</field>
+</record>
+
+<record model="workflow.transition" id="t1">
+    <field name="act_from" ref="act_active" />
+    <field name="act_to" ref="act_inactive" />
+    <field name="signal">dev_inactive</field>
+</record>
+
+<record model="workflow.transition" id="t2">
+    <field name="act_from" ref="act_inactive" />
+    <field name="act_to" ref="act_active" />
+    <field name="signal">dev_active</field>
+</record>
+</data>
+</openerp>

test_module/mymod_workflow.xml

+<record model="workflow" id="wkf_dev_person">
+    <field name="name">dev.wkf</field>
+    <field name="osv">dev.dev</field>
+    <field name="on_create">True</field>
+</record>
+
+<record model="workflow.activity" id="act_active">
+    <field name="wkf_id" ref="wkf_dev_person" />
+    <field name="flow_start">True</field>
+    <field name="name">active</field>
+    <field name="kind">function</field>
+    <field name="action">mymod_active()</field>
+</record>
+
+<record model="workflow.activity" id="act_inactive">
+    <field name="wkf_id" ref="wkf_dev_person" />
+    <field name="flow_start">True</field>
+    <field name="name">inactive</field>
+    <field name="kind">function</field>
+    <field name="action">mymod_inactive()</field>
+</record>
+
+<record model="workflow.transition" id="t1">
+    <field name="act_from" ref="act_active" />
+    <field name="act_to" ref="act_inactive" />
+    <field name="signal">mymod_inactive</field>
+</record>
+
+<record model="workflow.transition" id="t2">
+    <field name="act_from" ref="act_inactive" />
+    <field name="act_to" ref="act_active" />
+    <field name="signal">mymod_active</field>
+</record>
+
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.