[ADD] created portal customer module, kept boolean field on res.partner object if the field is true the user is created
bzr revid: bde@tinyerp.com-20120402132803-0oa084aw0k95myid
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
|
||||
#
|
||||
# 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 portal_customer
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
|
||||
#
|
||||
# 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' : "Portal Customer",
|
||||
'version' : "1.0",
|
||||
'depends' : ["sale"],
|
||||
'author' : "OpenERP SA",
|
||||
'category': 'Portal',
|
||||
'description': """
|
||||
The Portal Customer module helps customers to track their Sales Quotations, Orders, Invoices and various
|
||||
other possibilities
|
||||
""",
|
||||
'website': 'http://www.openerp.com',
|
||||
'data': [
|
||||
],
|
||||
"init_xml" : [
|
||||
],
|
||||
"demo_xml" : [
|
||||
],
|
||||
"update_xml" : [
|
||||
"portal_customer_view.xml"
|
||||
],
|
||||
'installable': True,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,41 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
|
||||
class res_partner(osv.osv):
|
||||
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'customer_portal_access': fields.boolean('Portal'),
|
||||
}
|
||||
|
||||
def onchange_portal_create_user(self, cr, uid, ids, field, context=None):
|
||||
res_users_obj = self.pool.get('res.users')
|
||||
if field == 1:
|
||||
name = self.browse(cr, uid, ids, context=context)[0].name
|
||||
login = self.browse(cr, uid, ids, context=context)[0].email
|
||||
res_users_obj.create(cr, uid, {'name':name, 'login':login, 'new_password':login}, context=context)
|
||||
return True
|
||||
|
||||
res_partner()
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
|
||||
<data>
|
||||
|
||||
<!-- Partner Form View -->
|
||||
|
||||
<record id="view_res_partner_form" model="ir.ui.view">
|
||||
<field name="name">res.partner.form</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<field name="supplier" position="after">
|
||||
<field name="customer_portal_access" on_change="onchange_portal_create_user(customer_portal_access)"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_res_partner_form" model="ir.actions.act_window">
|
||||
<field name="name">Contacts</field>
|
||||
<field name="res_model">res.partner</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_sale_quotations"
|
||||
action="action_order_tree5" parent="base.menu_sales" name="QQQQQ"
|
||||
/>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
</openerp>
|
||||
|
||||
Reference in New Issue
Block a user