mirror of
https://github.com/OCA/pms.git
synced 2025-01-29 00:17:45 +02:00
[IMP] Add property logo field
This commit is contained in:
committed by
Darío Lodeiros
parent
d4c1a25ed2
commit
3b0643e42d
@@ -2,13 +2,14 @@
|
||||
# Copyright 2019 Dario Lodeiros
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
|
||||
|
||||
import base64
|
||||
import datetime
|
||||
import time
|
||||
|
||||
import pytz
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from odoo import _, api, fields, models
|
||||
from odoo import _, api, fields, models, modules
|
||||
from odoo.exceptions import ValidationError
|
||||
from odoo.osv import expression
|
||||
from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
@@ -16,6 +17,14 @@ from odoo.tools import DEFAULT_SERVER_DATE_FORMAT
|
||||
from odoo.addons.base.models.res_partner import _tz_get
|
||||
|
||||
|
||||
def get_default_logo():
|
||||
with open(modules.get_module_resource('pms',
|
||||
'static/img',
|
||||
'property_logo.png'),
|
||||
'rb') as f:
|
||||
return base64.b64encode(f.read())
|
||||
|
||||
|
||||
class PmsProperty(models.Model):
|
||||
_name = "pms.property"
|
||||
_description = "Property"
|
||||
@@ -213,6 +222,10 @@ class PmsProperty(models.Model):
|
||||
inverse_name="pms_property_id",
|
||||
copy=False,
|
||||
)
|
||||
logo = fields.Binary(
|
||||
string="Image in checkin",
|
||||
default=get_default_logo(),
|
||||
)
|
||||
|
||||
@api.depends_context(
|
||||
"checkin",
|
||||
|
||||
BIN
pms/static/img/property_logo.png
Executable file
BIN
pms/static/img/property_logo.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 37 KiB |
@@ -12,6 +12,11 @@
|
||||
</h1>
|
||||
<label for="company_id" />
|
||||
<field name="company_id" class="oe_inline" />
|
||||
<field
|
||||
name="logo"
|
||||
widget="image"
|
||||
class="oe_avatar"
|
||||
/>
|
||||
<div class="col-6">
|
||||
<label for="ref" />
|
||||
<field name="ref" />
|
||||
|
||||
Reference in New Issue
Block a user