How to pass database name, login id, password, customer phone number, customer name as a parameter via URL to search a customer in odoo at [Sales] module under [Customers] function?
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Boekhouding
- Voorraad
- PoS
- Project
- MRP
Deze vraag is gerapporteerd
Below example gives u an idea.
In main.py
from odoo import models, fields, api
from werkzeug import url_encode
class SimpleControllerModel(models.Model):
_name ="simple.controller"
name = fields.Char(string="name")
age = fields.Integer(string="age")
designation = fields.Selection([('sw','software'),('salesman','Salesman')])
@api.multi
def webpage(self):
values = dict(self._context.get('params', {}))
print dict(self._context.get('params',{}))
values.update({
'model': self._name,
'id': self.id
# HERE PASS THE VALUES U NEED. ID is passed along with the context.
})
return{
'type': 'ir.actions.act_url',
'target': 'self',
'url': '/details/employee/%s/%s' % (self.name,self.id)
# 'url': '/details/employee/%s/%s' % (self.id,url_encode(values))
}
Then Define Controller: Like below
from odoo import http
from odoo.http import request
class SimpleController(http.Controller):
# @http.route(["/details/employee"],type='http',auth="user",methods=['GET'],website=True)
@http.route(['/details/employee/<model("simple.controller"):name>',
'/details/employee/<model("simple.controller"):name>/<model("simple.controller"):id>',
'/details/employee/<string:id>',
'/details/employee'],
type='http',auth="public",methods=['GET'],website=True)
def view(self,name,**kwargs):
print "controllerview"
if kwargs.get('model', False) == 'simple.controller':
action_xml_id = 'simple_controller.action_simple_controller'
action_id = request.env.ref(action_xml_id).id
kwargs.update({
'action': action_id,
})
values = dict(kwargs)
return request.render('simple_controller.simple_controller_templateid', values)
In template.xml.. Define below code
<odoo>
<template id="simple_controller.simple_controller_templateid" name="simple_controller">
<t t-call="website.layout">
<div class="pull-left css_editable_mode_hidden">
<ul class="list-inline">
<li>
<a class="btn btn-danger"
t-att-href="'/web#return_label=Website&model=%s&id=%s&action=%s&view_type=form' % (model, id, action)">
<span class="fa fa-long-arrow-left" />
Back
<span t-esc="test" />
</a>
</li>
</ul>
</div>
</t>
</template>
</odoo>
<a t-attfr-href="/web#id={{ record.your_field.value }}&cids=1&menu_id=584&action=620&model=daycare.child&view_type=form">Mark Attendancea>
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!
Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!
AanmeldenGerelateerde posts | Antwoorden | Weergaven | Activiteit | |
---|---|---|---|---|
|
0
apr. 24
|
1726 | ||
|
4
nov. 23
|
5739 | ||
|
0
okt. 23
|
1476 | ||
|
0
dec. 22
|
2414 | ||
|
0
jun. 22
|
1963 |