Odoo Ayuda

0

0
10 Answers
1
Avatar

Axel Mendoza

--Axel Mendoza--
13613
| 8 8 10
Camaguey, Cuba
--Axel Mendoza--

DevOps - Full stack - Software Architect - Developer - Technology Integrator

I could help you to develop anything and solve complex problems based on technologies, integrations and tricky stuffs mostly in Python with OpenERP/Odoo, Zato, Django and many others frameworks programming languages and technologies.

I offers consulting services to anyone with an unanswered questions or needs for customizations. Think about it, maybe it's better to have an expert to solve your issues and projects than having a full-time employee trying to understand what to do and how

Reach me at aekroft@gmail.com

Axel Mendoza
9/3/16 2:37

You could do it using a mask on the input field and normally in combination with a regular expression to validate the format in js and in python to avoid mistakes, you will be ok

See examples here:

https://igorescobar.github.io/jQuery-Mask-Plugin/

4 Comments
Pascal Tremblay
9/3/16 9:48

Thanks Axel. Would you know in which file I should work in odoo 8 to put this code?

Pascal Tremblay
9/3/16 10:21

I would say that I have to install myself the jQuery Mask Plugin. Is it the case?

Dr Obx
9/3/16 12:02

I would try in base/static/src/js/apps.js because in base/res is res_partner so this is the best place to start or as separate module .... but i'm not an expert :) (i'm a total amateur)

Pascal Tremblay
9/3/16 12:35

thanks again. I'll see all of this.

1
Avatar

Pascal Tremblay

--Pascal Tremblay--
1914
| 6 4 10
Alma, Canadá
--Pascal Tremblay--


Pascal Tremblay
9/3/16 16:20

Here is our complete solution. Thanks to Dr Obx and Axel.

1) Download jquery mask plugin

2) Install it in ourmodule/static/src/js

3) Load the script

        <template id="ourmodule.assets_frontend" inherit_id="website.assets_frontend" name="Shop">
            <xpath expr="." position="inside">
                <script type="text/javascript" src="/website_lapagept/static/src/js/website_sale_clear_cart.js"></script>
                <script type="text/javascript" src="/website_lapagept/static/src/js/jquery-mask-plugin-master/src/jquery.mask.js"></script>
            </xpath>
        </template>


4) Add this in the file ourmodule/static/src/js/jquery-mask-plugin-master/src/jquery.mask.js

$(document).ready(function(){
//  $('.zipcode').mask('A0A 0A0');
        $('.zipcode').mask('Y9Y 9Y9',
                           {'translation': {
                                        9: {pattern: /[0-9]/},  
                                        Y: {pattern: /[A-Z]/}
                                      }
                                });
});


5) Add the correct .zipcode class to the field that should have the mask

                  <div t-attf-class="form-group #{error.get('zip') and 'has-error' or ''} col-lg-6">
                      <label class="control-label" for="zip">Code postal</label>
                      <input type="text" name="zip" class="form-control zipcode" t-att-value="checkout.get('zip')"/>
                  </div>


AND ALSO

                  <div t-attf-class="form-group #{error.get('shipping_zip') and 'has-error' or ''} col-lg-6">
                      <label class="control-label" for="shipping_zip" style="font-weight: normal">Zip / Postal Code</label>
                      <input type="text" name="shipping_zip" class="form-control zipcode" t-att-value="checkout.get('shipping_zip', '')" t-att-readonly=" 'readonly' if shipping_id &gt;= 0 else ''"/>
                  </div>



And it works fine!

1 Comentario
Axel Mendoza
9/3/16 18:07

Exactly as you do it

Realizar una pregunta
Writer
Keep Informed
1 seguidor(es)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now