跳至内容
菜单
此问题已终结
1 回复
2906 查看

Hi,

In the Signup form of Odoo, i have to register a society and the name of it's contact.

In my file xml, i put that :

<div class="form-group field-is-company">
<label>Register as a compagny
<input type="bool" value="true" name="is_company" class="form-control" required="required" t-att- 
readonly="'readonly' if only_passwords else None"/>Société</label>
</div>

So, after Signup, it's a society that is registered. But, the name of the child_ids doesn't appear. I tried that :

<div class="form-group field-child_ids">
<label for="child_ids.name" class="control-label">Name of the contact</label> 
<input type="text" name="child_ids.name" id="child_ids.name" class="form-control" required="required" 
t-att-readonly="'readonly' if only_passwords else None" t-att-autofocus="'autofocus' if login and not 
only_passwords else None" />
</div>

and in mycontroller.py :

class AuthSignupHome(AuthSignupHome):

def do_signup(self, qcontext):
    """ Shared helper that creates a res.partner out of a token """
    values = {key: qcontext.get(key) for key in (
        'login', 'name', 'password', 'phone', 'street',
        'zip', 'city', 'country_id','child_ids.name','is_company')}
    if not values:
        raise UserError(_("The form was not properly filled in."))
    if values.get('password') != qcontext.get('confirm_password'):
        raise UserError(_("Passwords do not match; please retype them."))
    supported_langs = [lang['code'] for lang in request.env[
        'res.lang'].sudo().search_read([], ['code'])]
    if request.lang in supported_langs:
        values['lang'] = request.lang
    self._signup_with_values(qcontext.get('token'), values)
    request.env.cr.commit()

"child_ids" it's a field "one2many. I know how to post the value of "one2many" in Signup form (like countries) but i don't know to post a value in Signup that will appear in a "One2many" like the name or phone of the contact of society. Can you help me or explain me how to do ?

Thank you so much

形象
丢弃
最佳答案

Hi, this might help you: https://youtu.be/An6YTH3kJD8

Thanks

形象
丢弃
相关帖文 回复 查看 活动
1
9月 23
3770
1
9月 21
26877
2
7月 20
4062
2
4月 25
1196
4
12月 23
24212