5 changed files with 190 additions and 0 deletions
-
29res_company_logo_secondary/README.rst
-
21res_company_logo_secondary/__init__.py
-
33res_company_logo_secondary/__openerp__.py
-
78res_company_logo_secondary/res_company.py
-
29res_company_logo_secondary/res_company_view.xml
@ -0,0 +1,29 @@ |
|||||
|
Company Logo Secondary |
||||
|
====================== |
||||
|
|
||||
|
The module associates a secondary logo and name to the company. |
||||
|
|
||||
|
The case the module required the module was because the company had some |
||||
|
alternate logo and name. |
||||
|
|
||||
|
Credits |
||||
|
======= |
||||
|
|
||||
|
Contributors |
||||
|
------------ |
||||
|
|
||||
|
* Jordi Riera <jordi.riera@savoirfairelinux.com> |
||||
|
* Pierre Gault <Pierre.Gault@savoirfairelinux.com> |
||||
|
|
||||
|
Maintainer |
||||
|
---------- |
||||
|
|
||||
|
.. image:: http://odoo-community.org/logo.png |
||||
|
:alt: Odoo Community Association |
||||
|
:target: http://odoo-community.org |
||||
|
|
||||
|
This module is maintained by the OCA. |
||||
|
|
||||
|
OCA, or the Odoo Community Association, is a nonprofit organization whose mission is to support the collaborative development of Odoo features and promote its widespread use. |
||||
|
|
||||
|
To contribute to this module, please visit http://odoo-community.org. |
@ -0,0 +1,21 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Author: Nicolas Bessi. Copyright Camptocamp SA |
||||
|
# |
||||
|
# 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 . import res_company |
@ -0,0 +1,33 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Author: Nicolas Bessi. Copyright Camptocamp SA |
||||
|
# |
||||
|
# 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': 'Company Logo Secondary', |
||||
|
'version': '1.0', |
||||
|
'author': 'Savoir-faire Linux', |
||||
|
'maintainer': 'Savoir-faire Linux, OCA', |
||||
|
'category': 'Sales', |
||||
|
'website': 'http://www.savoirfairelinux.com', |
||||
|
'depends': ['base'], |
||||
|
'data': [ |
||||
|
'res_company_view.xml', |
||||
|
], |
||||
|
'installable': True, |
||||
|
} |
@ -0,0 +1,78 @@ |
|||||
|
# -*- coding: utf-8 -*- |
||||
|
############################################################################## |
||||
|
# |
||||
|
# Author: Nicolas Bessi. Copyright Camptocamp SA |
||||
|
# |
||||
|
# 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 openerp.osv import orm, fields |
||||
|
from openerp import tools |
||||
|
|
||||
|
|
||||
|
class ResCompany(orm.Model): |
||||
|
_inherit = 'res.company' |
||||
|
|
||||
|
def _get_logo_secondary(self, cr, uid, ids, name, args, context=None): |
||||
|
result = dict.fromkeys(ids, False) |
||||
|
for obj in self.browse(cr, uid, ids, context=context): |
||||
|
result[obj.id] = tools.image_get_resized_images(obj.logo_secondary) |
||||
|
return result |
||||
|
|
||||
|
def _set_logo_secondary(self, cr, uid, id, name, value, args, context=None): |
||||
|
return self.write( |
||||
|
cr, uid, [id], |
||||
|
{'image': tools.image_resize_image_big(value)}, |
||||
|
context=context |
||||
|
) |
||||
|
|
||||
|
def _has_logo_secondary(self, cr, uid, ids, name, args, context=None): |
||||
|
result = {} |
||||
|
for obj in self.browse(cr, uid, ids, context=context): |
||||
|
result[obj.id] = obj.logo_secondary != False |
||||
|
return result |
||||
|
|
||||
|
_columns = { |
||||
|
'name_secondary': fields.char('Secondary name', size=128), |
||||
|
'logo_secondary': fields.binary("Logo Secondary"), |
||||
|
'image_medium': fields.function( |
||||
|
_get_logo_secondary, |
||||
|
fnct_inv=_set_logo_secondary, |
||||
|
string="Medium-sized logo secondary", |
||||
|
type="binary", |
||||
|
multi="_get_logo_secondary", |
||||
|
store={ |
||||
|
_inherit: ( |
||||
|
lambda self, cr, uid, ids, c={}: |
||||
|
ids, ['logo_secondary'], 10 |
||||
|
), |
||||
|
} |
||||
|
), |
||||
|
'image_small': fields.function( |
||||
|
_get_logo_secondary, |
||||
|
fnct_inv=_set_logo_secondary, |
||||
|
string="Small-sized logo secondary", |
||||
|
type="binary", |
||||
|
multi="_get_logo_secondary", |
||||
|
store={ |
||||
|
_inherit: ( |
||||
|
lambda self, cr, uid, ids, c={}: |
||||
|
ids, ['image'], 10), |
||||
|
}, |
||||
|
), |
||||
|
'has_logo_secondary': fields.function( |
||||
|
_has_logo_secondary, type="boolean" |
||||
|
), |
||||
|
|
||||
|
} |
@ -0,0 +1,29 @@ |
|||||
|
<?xml version="1.0" encoding="utf-8"?> |
||||
|
<openerp> |
||||
|
<data> |
||||
|
<record id="company_logo_secondary_view_form" model="ir.ui.view"> |
||||
|
<field name="name">Company: Logo Secondary</field> |
||||
|
<field name="model">res.company</field> |
||||
|
<field name="inherit_id" ref="base.view_company_form"/> |
||||
|
<field name="priority">100</field> |
||||
|
<field name="arch" type="xml"> |
||||
|
<notebook position="inside"> |
||||
|
<page string="Secondary Details"> |
||||
|
<div> |
||||
|
<field name="logo_secondary" widget="image" class="oe_avatar oe_left"/> |
||||
|
</div> |
||||
|
<div class="oe_title"> |
||||
|
<label for="name_secondary" class="oe_edit_only"/> |
||||
|
<h1> |
||||
|
<field name="name_secondary" class="oe_inline"/> |
||||
|
</h1> |
||||
|
</div> |
||||
|
</page> |
||||
|
</notebook> |
||||
|
|
||||
|
</field> |
||||
|
</record> |
||||
|
|
||||
|
|
||||
|
</data> |
||||
|
</openerp> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue