[ADD] : Adding module Purchase Tender with new menu structure
authorVir (Open ERP) <vir@tinyerp.com>
Mon, 18 Jan 2010 10:43:33 +0000 (16:13 +0530)
committerVir (Open ERP) <vir@tinyerp.com>
Mon, 18 Jan 2010 10:43:33 +0000 (16:13 +0530)
bzr revid: vir@tinyerp.com-20100118104333-ajkfbf0vicswg0ur

addons/purchase_tender/__init__.py [new file with mode: 0644]
addons/purchase_tender/__terp__.py [new file with mode: 0644]
addons/purchase_tender/i18n/fr_BE.po [new file with mode: 0644]
addons/purchase_tender/purchase_tender.py [new file with mode: 0644]
addons/purchase_tender/purchase_tender_sequence.xml [new file with mode: 0644]
addons/purchase_tender/purchase_tender_view.xml [new file with mode: 0644]

diff --git a/addons/purchase_tender/__init__.py b/addons/purchase_tender/__init__.py
new file mode 100644 (file)
index 0000000..68f1f7a
--- /dev/null
@@ -0,0 +1,22 @@
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+import purchase_tender
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/purchase_tender/__terp__.py b/addons/purchase_tender/__terp__.py
new file mode 100644 (file)
index 0000000..723ec14
--- /dev/null
@@ -0,0 +1,37 @@
+##############################################################################
+#    
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU Affero General Public License as
+#    published by the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.     
+#
+##############################################################################
+{
+    "name" : "Purchase - Purchase Tender",
+    "version" : "0.1",
+    "author" : "Tiny",
+    "category" : "Generic Modules/Purchase",
+    "website" : "http://www.openerp.com",
+    "description": """ This module allows you to manage your Purchase Tenders. When a purchase order is created, you now have the opportunity to save the related tender. 
+    This new object will regroup and will allow you to easily keep track and order all your purchase orders.
+""",
+    "depends" : ["purchase"],
+    "init_xml" : [],
+    "demo_xml" : [],
+    "update_xml" : ["purchase_tender_view.xml","purchase_tender_sequence.xml"],
+    "active": False,
+    "installable": True
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
diff --git a/addons/purchase_tender/i18n/fr_BE.po b/addons/purchase_tender/i18n/fr_BE.po
new file mode 100644 (file)
index 0000000..5b9c10c
--- /dev/null
@@ -0,0 +1,134 @@
+# Translation of OpenERP Server.
+# This file contains the translation of the following modules:
+#      * purchase_tender
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: OpenERP Server 5.0.6\n"
+"Report-Msgid-Bugs-To: support@openerp.com\n"
+"POT-Creation-Date: 2009-11-25 14:07:40+0000\n"
+"PO-Revision-Date: 2009-11-25 14:07:40+0000\n"
+"Last-Translator: <>\n"
+"Language-Team: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: \n"
+"Plural-Forms: \n"
+
+#. module: purchase_tender
+#: constraint:ir.ui.view:0
+msgid "Invalid XML for View Architecture!"
+msgstr "XML incorrect pour l'Architecture des Vues!"
+
+#. module: purchase_tender
+#: field:purchase.tender,date_end:0
+msgid "Date End"
+msgstr "Date de fin"
+
+#. module: purchase_tender
+#: constraint:ir.model:0
+msgid "The Object name must start with x_ and not contain any special character !"
+msgstr "Le nom de l'Objet doit commencer par x_ et ne pas comporter de caractères spéciaux !"
+
+#. module: purchase_tender
+#: view:purchase.tender:0
+#: field:purchase.tender,description:0
+msgid "Description"
+msgstr "Description"
+
+#. module: purchase_tender
+#: model:ir.model,name:purchase_tender.model_purchase_tender
+#: field:purchase.order,tender_id:0
+#: view:purchase.tender:0
+msgid "Purchase Tender"
+msgstr "Appel d'Offre"
+
+#. module: purchase_tender
+#: model:ir.actions.act_window,name:purchase_tender.action_purchase_tender
+#: model:ir.ui.menu,name:purchase_tender.menu_purchase_Tender1
+#: model:ir.ui.menu,name:purchase_tender.menu_purchase_tender
+msgid "Purchase Tenders"
+msgstr "Appels d'offre"
+
+#. module: purchase_tender
+#: selection:purchase.tender,state:0
+msgid "Open"
+msgstr "Ouvert"
+
+#. module: purchase_tender
+#: field:purchase.tender,user_id:0
+msgid "Responsible"
+msgstr "Responsable"
+
+#. module: purchase_tender
+#: model:ir.actions.act_window,name:purchase_tender.action_purchase_tender_draft
+#: model:ir.ui.menu,name:purchase_tender.menu_purchase_Tender1_draft
+msgid "Draft Purchase Tenders"
+msgstr "Appels d'Offre brouillons"
+
+#. module: purchase_tender
+#: field:purchase.tender,state:0
+msgid "State"
+msgstr "Etat"
+
+#. module: purchase_tender
+#: selection:purchase.tender,state:0
+msgid "Draft"
+msgstr "Brouillon"
+
+#. module: purchase_tender
+#: model:ir.actions.act_window,name:purchase_tender.action_purchase_tender_open
+#: model:ir.ui.menu,name:purchase_tender.menu_purchase_Tender1_open
+msgid "Open Purchase Tenders"
+msgstr "Appels d'offre ouverts"
+
+#. module: purchase_tender
+#: constraint:ir.actions.act_window:0
+msgid "Invalid model name in the action definition."
+msgstr "Nom de modèle incorrect pour la définition de l'action"
+
+#. module: purchase_tender
+#: model:ir.module.module,shortdesc:purchase_tender.module_meta_information
+msgid "Purchase - Purchase Tender"
+msgstr "Achat - Appel d'offre"
+
+#. module: purchase_tender
+#: field:purchase.tender,name:0
+msgid "Tender Reference"
+msgstr "Référence"
+
+#. module: purchase_tender
+#: selection:purchase.tender,state:0
+msgid "Close"
+msgstr "Clôturé"
+
+#. module: purchase_tender
+#: field:purchase.tender,date_start:0
+msgid "Date Start"
+msgstr "Date de début"
+
+#. module: purchase_tender
+#: view:purchase.tender:0
+msgid "Quotations"
+msgstr ""
+
+#. module: purchase_tender
+#: model:ir.module.module,description:purchase_tender.module_meta_information
+msgid " This module allows you to manage your Purchase Tenders. When a purchase order is created, you now have the opportunity to save the related tender. \n"
+"    This new object will regroup and will allow you to easily keep track and order all your purchase orders.\n"
+""
+msgstr "Ce module vous permet de gérer des appels d'offre. Quand un appel d'offre est créé, vous avez maintenant l'opportunité de conserver une trace. \n"
+"    Ce nouvel objet regroupe et conserve la trace de tous vos appels d'offre.\n"
+""
+
+#. module: purchase_tender
+#: model:ir.actions.act_window,name:purchase_tender.action_purchase_tender_new
+#: model:ir.ui.menu,name:purchase_tender.menu_purchase_Tender1_new
+msgid "New Purchase Tenders"
+msgstr "Nouveaux Appels d'Offre"
+
+#. module: purchase_tender
+#: field:purchase.tender,purchase_ids:0
+msgid "Purchase Orders"
+msgstr "Bons d'achat"
+
diff --git a/addons/purchase_tender/purchase_tender.py b/addons/purchase_tender/purchase_tender.py
new file mode 100644 (file)
index 0000000..d68281f
--- /dev/null
@@ -0,0 +1,63 @@
+# -*- encoding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution    
+#    Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
+#    $Id$
+#
+#    This program is free software: you can redistribute it and/or modify
+#    it under the terms of the GNU General Public License as published by
+#    the Free Software Foundation, either version 3 of the License, or
+#    (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU General Public License for more details.
+#
+#    You should have received a copy of the GNU General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+from osv import fields,osv
+from osv import orm
+import netsvc
+import time
+
+class purchase_tender(osv.osv):
+    _name = "purchase.tender"
+    _description="Purchase Tender"
+    _columns = {
+        'name': fields.char('Tender Reference', size=32,required=True),
+        'date_start': fields.datetime('Date Start'),
+        'date_end': fields.datetime('Date End'),
+        'user_id': fields.many2one('res.users', 'Responsible'),
+        'description': fields.text('Description'),
+        'purchase_ids' : fields.one2many('purchase.order','tender_id','Purchase Orders'),
+        'state': fields.selection([('draft','Draft'),('open','Open'),('close','Close')], 'State', required=True)
+    }
+    _defaults = {
+        'date_start': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S'),
+        'state': lambda *args: 'open',
+        'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.tender'),
+    }
+purchase_tender()
+
+class purchase_order(osv.osv):
+    _inherit = "purchase.order"
+    _description = "purchase order"
+    _columns = {
+        'tender_id' : fields.many2one('purchase.tender','Purchase Tender')
+    }
+    def wkf_confirm_order(self, cr, uid, ids, context={}):
+        res = super(purchase_order, self).wkf_confirm_order(cr, uid, ids, context)
+        for po in self.browse(cr, uid, ids, context):
+            if po.tender_id:
+                for order in po.tender_id.purchase_ids:
+                    if order.id<>po.id:
+                        wf_service = netsvc.LocalService("workflow")
+                        wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
+                    self.pool.get('purchase.tender').write(cr, uid, [po.tender_id.id], {'state':'close'})
+        return res
+purchase_order()
diff --git a/addons/purchase_tender/purchase_tender_sequence.xml b/addons/purchase_tender/purchase_tender_sequence.xml
new file mode 100644 (file)
index 0000000..222e3f4
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+        <!-- Sequences for purchase.order --> 
+        <record id="seq_type_purchase_tender_order" model="ir.sequence.type">
+            <field name="name">Purchase Tender Order</field>
+            <field name="code">purchase.order.tender</field>
+        </record>
+        <record id="seq_purchase_tender_order" model="ir.sequence">
+            <field name="name">Purchase Tender Order</field>
+            <field name="code">purchase.order.tender</field>
+            <field name="prefix">TE</field>
+            <field name="padding">5</field>
+        </record>
+    </data>
+</openerp>
diff --git a/addons/purchase_tender/purchase_tender_view.xml b/addons/purchase_tender/purchase_tender_view.xml
new file mode 100644 (file)
index 0000000..a91c36a
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+<openerp>
+    <data>
+
+    <record model="ir.ui.view" id="purchase_order_tree_inherit">
+        <field name="name">purchase.order.tree.inherit</field>
+        <field name="type">tree</field>
+        <field name="model">purchase.order</field>
+        <field name="inherit_id" ref="purchase.purchase_order_tree"/>
+        <field name="arch" type="xml">
+            <field name="name" position="after">
+                <field name="tender_id"/>
+            </field>
+        </field>
+    </record>
+
+    <record model="ir.ui.view" id="purchase_order_form_inherit">
+        <field name="name">purchase.order.form.inherit</field>
+        <field name="type">form</field>
+        <field name="model">purchase.order</field>
+        <field name="inherit_id" ref="purchase.purchase_order_form"/>
+        <field name="arch" type="xml">
+            <field name="partner_ref" position="after">
+                <field name="tender_id" select="2"/>
+            </field>
+        </field>
+    </record>
+
+        <record model="ir.ui.view" id="view_purchase_tender_form">
+            <field name="name">purchase.tender.form</field>
+            <field name="type">form</field>
+            <field name="model">purchase.tender</field>
+            <field name="arch" type="xml">
+                <form string="Purchase Tender">
+                    <field name="name" select="1"/>
+                    <field name="user_id" select="1"/>
+                    <field name="date_start" select="2"/>
+                    <field name="date_end" select="2"/>
+                    <notebook colspan="4">
+                        <page string="Description">
+                            <field name="description" colspan="4" nolabel="1" select="2"/>
+                        </page>
+                        <page string="Quotations">
+                            <field name="purchase_ids" nolabel="1" colspan="4"/>
+                        </page>
+                    </notebook>
+                    <field name="state" select="1"/>
+                </form>
+            </field>
+        </record>
+        <record model="ir.ui.view" id="view_purchase_tender_tree">
+            <field name="name">purchase.tender.tree</field>
+            <field name="type">tree</field>
+            <field name="model">purchase.tender</field>
+            <field name="arch" type="xml">
+                <tree string="Purchase Tender">
+                    <field name="name"/>
+                    <field name="user_id"/>
+                    <field name="date_start"/>
+                    <field name="date_end"/>
+                    <field name="state"/>
+                </tree>
+            </field>
+        </record>
+        <record model="ir.actions.act_window" id="action_purchase_tender">
+            <field name="name">Purchase Tenders</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">purchase.tender</field>
+            <field name="view_type">form</field>
+        </record>
+<!--        <menuitem name="Purchase Tenders" id="menu_purchase_tender" parent="purchase.menu_purchase_root"/>-->
+<!--        <menuitem id="menu_purchase_Tender1" parent="menu_purchase_tender" action="action_purchase_tender"/>-->
+               <menuitem id="menu_purchase_Tender_pro_mgt" parent="purchase.menu_procurement_management" action="action_purchase_tender"/>
+        <record model="ir.actions.act_window" id="action_purchase_tender_draft">
+            <field name="name">Draft Purchase Tenders</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">purchase.tender</field>
+            <field name="domain">[('state','=','draft')]</field>
+            <field name="view_type">form</field>
+        </record>
+<!--        <menuitem id="menu_purchase_Tender1_draft" parent="menu_purchase_Tender1" action="action_purchase_tender_draft"/>-->
+
+        <record model="ir.actions.act_window" id="action_purchase_tender_open">
+            <field name="name">Open Purchase Tenders</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">purchase.tender</field>
+            <field name="domain">[('state','=','open')]</field>
+            <field name="view_type">form</field>
+        </record>
+<!--        <menuitem id="menu_purchase_Tender1_open" parent="menu_purchase_Tender1" action="action_purchase_tender_open"/>-->
+
+        <record model="ir.actions.act_window" id="action_purchase_tender_new">
+            <field name="name">New Purchase Tenders</field>
+            <field name="type">ir.actions.act_window</field>
+            <field name="res_model">purchase.tender</field>
+            <field name="view_type">form</field>
+            <field name="view_mode">form,tree</field>
+        </record>
+<!--        <menuitem id="menu_purchase_Tender1_new" parent="menu_purchase_tender" action="action_purchase_tender_new"/>-->
+
+    </data>
+</openerp>