Skip to content

Instantly share code, notes, and snippets.

View ofelix03's full-sized avatar

Felix Otoo ofelix03

View GitHub Profile
@api.model
def create(self, vals):
if not self.check_access_rights('create', raise_exception=False):
raise ValidationError(_("Sorry! you don't have the right permission to create this record"))
# user has right permission, continue with operation
return super(Customer, self).create(vals)
base_url = self.get_base_url()
self.env['ir.config_parameter'].get_param('web.base_url')
def action_add_bank(self):
action = self.get_formview_action()
action['target'] = 'new'
action['default_bank_reference': self.bank_reference
return action
def action_add_bank(self):
return {
'name': 'Add New Bank',
'type': 'ir.actions.act_window',
'res_model': 'kyc.customer.bank',
'view_type': 'form',
'view_mode': 'form',
'view_id': form_view.id,
'res_id': self.id,
'target': 'new',
def action_add_bank(self):
action = self.env.ref("kyc.add_bank_action").read()[0]
action['target'] = 'new'
action['context'] = {
'default_bank_reference': self.bank_reference
}
return action
select u.*, last_visited
from users u,
lateral(
select concat(date, ' ', time) "last_visited" from site_visits
where user_id = u.id
order by id desc
limit 1
) last_visited
where u.email = '[email protected]'
select *, (
select concat(date, ' ', time) "last_visited" from site_visits
where user_id = u.id
order by id desc
limit 1
) "last_visited"
from users u
name email ip_addresses
Cyb Tratton [email protected] 144.229.128.12
Phillie Godfray [email protected] 42.37.250.26
Ringo Bras [email protected] 27.78.199.6
Chrissy Daniells [email protected]
Molly Domek [email protected]
Jaynell Jertz [email protected] 78.184.170.180
Nannie Ewell [email protected]
Earlie Duffin [email protected] 168.13.188.42
Letta Folger [email protected] 70.43.100.92
SELECT name, email, s.ip_addresses
FROM users u
LEFT JOIN LATERAL (
SELECT user_id, string_agg(ip_address, ',') "ip_addresses"
FROM site_visits
WHERE country in ('China')
and user_id = u.id
GROUP BY user_id
) s
ON u.id = s.user_id