[WIP] l10n_es

This commit is contained in:
Dario Lodeiros
2019-01-10 17:26:23 +01:00
parent c1b2a59686
commit 87fc71567d
34 changed files with 3022 additions and 3 deletions

View File

@@ -15,3 +15,10 @@ class ResCompany(models.Model):
calculated.")
default_cancel_policy_days = fields.Integer('Cancelation Days')
default_cancel_policy_percent = fields.Integer('Percent to pay')
cardex_warning = fields.Text(
'Warning in Cardex',
default="Time to access rooms: 14: 00h. Departure time: \
12: 00h. If the accommodation is not left at that time, \
the establishment will charge a day's stay according to \
current rate that day",
help="Notice under the signature on the traveler's ticket.")

View File

@@ -1,7 +1,8 @@
# Copyright 2017 Alexandre Díaz
# Copyright 2017 Dario Lodeiros
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from openerp import models, fields
from openerp import models, fields, api
from odoo.osv.expression import get_unaccent_wrapper
class ResPartner(models.Model):
_inherit = 'res.partner'
@@ -22,3 +23,49 @@ class ResPartner(models.Model):
reservations_count = fields.Integer('Reservations', compute='_compute_reservations_count')
folios_count = fields.Integer('Folios', compute='_compute_folios_count')
@api.model
def name_search(self, name, args=None, operator='ilike', limit=100):
result = super(ResPartner, self).name_search(name, args=None,
operator='ilike',
limit=100)
if args is None:
args = []
if name and operator in ('=', 'ilike', '=ilike', 'like', '=like'):
self.check_access_rights('read')
where_query = self._where_calc(args)
self._apply_ir_rules(where_query, 'read')
from_clause, where_clause, where_clause_params = where_query.get_sql()
where_str = where_clause and (" WHERE %s AND " % where_clause) or ' WHERE '
# search on the name of the contacts and of its company
search_name = name
if operator in ('ilike', 'like'):
search_name = '%%%s%%' % name
if operator in ('=ilike', '=like'):
operator = operator[1:]
unaccent = get_unaccent_wrapper(self.env.cr)
query = """SELECT id
FROM res_partner
{where} ({phone} {operator} {percent}
OR {mobile} {operator} {percent})
ORDER BY {display_name} {operator} {percent} desc,
{display_name}
""".format(where=where_str,
operator=operator,
phone=unaccent('phone'),
display_name=unaccent('display_name'),
mobile=unaccent('mobile'),
percent=unaccent('%s'),)
where_clause_params += [search_name]*3
if limit:
query += ' limit %s'
where_clause_params.append(limit)
self.env.cr.execute(query, where_clause_params)
partner_ids = [row[0] for row in self.env.cr.fetchall()]
if partner_ids:
result += self.browse(partner_ids).name_get()
return result

View File

@@ -7,11 +7,13 @@
name="Action checkin"
res_model='hotel.checkin.partner'
view_mode="tree,form" />
<act_window
id="action_checkin_partner_download"
name="Action checkin download"
res_model='hotel.checkin.partner'
view_mode="form" /> <!-- Menu item to open INE Codes list -->
view_mode="form" />
<menuitem
id="menu_hotel_checkin_partner"
name="Checkins"
@@ -49,7 +51,6 @@
<field name="enter_date"/>
<field name="exit_date"/>
<field name="reservation_id"/>
<!-- button type="action" class="oe_stat_button" id="checkin_partner_smart_button" icon="fa-bed" /-->
</tree>
</field>
</record>