[IMP]Base_setup:ADD Uplode LOGO WIZ to Addonse side

bzr revid: aag@tinyerp.co.in-20110413105056-elz1a907ida6yx9j
This commit is contained in:
aag (OpenERP) 2011-04-13 16:20:56 +05:30
parent 2863faf745
commit 18621c00e6
5 changed files with 135 additions and 0 deletions

View File

@ -37,6 +37,7 @@ It also helps to easily configure your company.
'depends': ['base'],
'init_xml': ['base_setup_data.xml'],
'update_xml': ['security/ir.model.access.csv',
'wizard/res_company_logo_view.xml',
'base_setup_installer.xml',
'base_setup_todo.xml',
],

View File

@ -236,6 +236,33 @@
<field name="sequence">1000</field>
<field name="state">cancel</field>
</record>
<!-- Inherit company Form -->
<record id="view_inherit_res_company_logo" model="ir.ui.view">
<field name="name">Upload Logo11</field>
<field name="model">res.company</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_company_form" />
<field name="arch" type="xml">
<data>
<xpath expr="//page[@string='General Information']" position="replace">
<page string="General Information">
<group colspan="4">
<field name="rml_header1" colspan="4"/>
<field name="rml_footer1" colspan="4"/>
<field name="rml_footer2" colspan="4"/>
<field name="currency_id" colspan="2"/>
</group>
<separator string="" colspan="4"/>
<button name="createReport" string="Preview Reports" type="object" icon="gtk-print"/>
<button name="%(action_res_company_logo)d"
string="Upload/Change Logo" type="action" icon="gtk-open"/>
</page>
</xpath>
</data>
</field>
</record>
</data>
</openerp>

View File

@ -0,0 +1,25 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 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 res_company_logo
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 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/>.
#
##############################################################################
from osv import fields, osv
import os
import tools
from tools.translate import _
class res_company_logo(osv.osv_memory):
_name = 'res.company.logo'
_columns = {
'logo' : fields.binary('Logo'),
}
_defaults={
'logo':lambda self,cr,uid,c: self.pool.get('res.company').browse(cr, uid, uid,c).logo,
}
def execute(self, cr, uid, ids, context=None):
if context is None:
context = {}
record_id = context.get('active_id', False) or False
comp_obj = self.pool.get("res.company")
get_val = self.browse(cr, uid, ids)[0]
comp_obj.write(cr, uid, record_id, {'logo': get_val.logo}, context=context)
return {'type': 'ir.actions.act_window_close'}
res_company_logo()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_res_company_logo" model="ir.ui.view">
<field name="name">res.company.logo.form</field>
<field name="model">res.company.logo</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Upload Logo">
<separator string="Upload your company logo in JPG or PNG with a format similar to 450*150 pixels" colspan="4"/>
<field colspan="4" height="150" name="logo" widget="image" nolabel="1"/>
<separator colspan="4"/>
<group colspan="4" col="6">
<label string="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" string="Upload" name="execute" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_res_company_logo" model="ir.actions.act_window">
<field name="name">Set Logo</field>
<field name="res_model">res.company.logo</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_res_company_logo"/>
<field name="target">new</field>
</record>
</data>
</openerp>