This question has been flagged
1 Reply
2018 Views

When user makes an order via website and adds his delivery address (different than the invoice address) the address generates without an email address.

Because of that when the delivery is confirmed a notification email can not be send and there is an error about empty email address.

How do I correct this? Do I need to manually add this email field inside the form?

Avatar
Discard
Author Best Answer

I've had to fix it by myself. Here is the snippet that does the job:


        <template id="custom_address" inherit_id="website_sale.address" name="Website Sale Custom Address">
            <xpath expr="//div[@id='div_email']/.." position="replace">
                <div t-attf-class="form-group #{error.get('email') and 'o_has_error' or ''} col-lg-6" id="div_email">
                    <label class="col-form-label" for="email">Email</label>
                    <input type="email" name="email" t-attf-class="form-control #{error.get('email') and 'is-invalid' or ''}" t-att-value="'email' in checkout and checkout['email']" />
                </div>
            </xpath>

            <xpath expr="//input[@name='field_required']" position="replace">
                <input type="hidden" name="field_required" t-att-value="'phone,name,email'" />
            </xpath>

        </template>
Avatar
Discard

Hi Marcus. I'm having a similar trouble with the third party shipping module I use for a V11 website. What version is the above snippet for, and what file did you insert it in?

Author

I used this snipped in version 13. It may run on other versions if the address form looks the same.

I put it in my custom module. This snippet inherits and modifies view with id "address" present in module "website_sale". You need to find if you have this view in your Odoo and if not - what other view is responsible for displaying the address form to a user.

Ok, thanks for replying. I'll give it a try.