This question has been flagged
3 Replies
12683 Views

I have  a field priority = fields.Selection(

    [('10', '10'), ('20', '20'), ('30', '30'), ('40', '40'), ('50', '50'), ('60', '60'), ('70', '70'),
('80', '80'), ('90', '90'), ('100', '100')], string='Priority (%)', default='10')
I want to display this field in my website Form
@http.route(['/wishlist_create_website'], type="http", auth="public", methods=['GET'], website=True)
def register_admission1(self, **kw):
product_id = request.env['product.product'].sudo().search([])
     #How to fetch priority field value from backend?
    kw.update({'products': product_id,})
return request.render('my.my_control', kw)

Avatar
Discard

At which model did you define priority?

Author

hi...

class Myorder():

_name='my.wisho'

Best Answer

Suppose if you defined in simple.controller Just like belo example:


class SimpleController(http.Controller):

    @http.route(["/details/employee/<model('simple.controller'):part>/"],

                type='http', auth="user", methods=['GET'], website=True, cors="*")

    def view(self,part,**kwargs):

        action_id = request.env.ref('simple_controller.action_simple_controller').id

         return_kwargs = dict(kwargs)

        kwargs.update({'action':action_id,'model':'simple.controller','accept': '/details/employee/accept/%s/?%s' % (part.id,                        url_encode(return_kwargs)),  'deny': '/details/employee/deny/%s/?%s' % (part.id, url_encode(return_kwargs))})

        value = dict(kwargs)

        priority_get = request.env['simple.controller'].sudo().browse(int(kwargs.get('id')))

        print   priority_get.priority 

        return request.render('simple_controller.simple_controller_templateid', value, part.uuid)


Avatar
Discard
Best Answer



Use <select> to show the Selection field in website form. 

<form action="/wishlist_create_website/" method="post" ................>
    .........
        <select>
            <option value="10">10</option>
            <option value="20">20</option>
            <option value="30">30</option>
            <option value="40">40/option>

                 .......
        </select>         
    .........
</form>







Avatar
Discard