How can I format date in Odoo 10 QWeb report?












3














t-field-option is not working.



I have tried



<span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>









share|improve this question





























    3














    t-field-option is not working.



    I have tried



    <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>









    share|improve this question



























      3












      3








      3







      t-field-option is not working.



      I have tried



      <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>









      share|improve this question















      t-field-option is not working.



      I have tried



      <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>






      qweb odoo-10






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 17 '16 at 5:55









      Bhavesh Odedra

      7,71872149




      7,71872149










      asked Dec 15 '16 at 14:25







      user5256523































          5 Answers
          5






          active

          oldest

          votes


















          0














          Try this.



          <span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>


          My Output is: May 28,2018






          share|improve this answer































            0














            According to my experience, you have used the correct way to format Qweb date, but sometimes there is problem in other thing and odoo gives error somewhere else. Hope trying this code may be helpful.



            <span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>


            also use this code



            <span t-field="o.date_order" t-field-options="{'format': 'yyyy-MM-dd'}" />


            You can also do one thing as formatting the date variable in the model itself and then show it on your QWeb report.






            share|improve this answer































              0














              To display localized date strings. Try the following:



              <span t-field="o.date_invoice" t-options="{'widget': 'date'}" />





              share|improve this answer































                0














                For those who arrive here from search engines, you can control display of date in form fields using widgets.



                <field name="date_planned" widget="date"/>


                or,



                <field name="date_planned" widget="datetime"/>





                share|improve this answer





























                  0














                  Instead of using



                  <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>


                  use



                  <span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>


                  Hope that helps!






                  share|improve this answer





















                    Your Answer






                    StackExchange.ifUsing("editor", function () {
                    StackExchange.using("externalEditor", function () {
                    StackExchange.using("snippets", function () {
                    StackExchange.snippets.init();
                    });
                    });
                    }, "code-snippets");

                    StackExchange.ready(function() {
                    var channelOptions = {
                    tags: "".split(" "),
                    id: "1"
                    };
                    initTagRenderer("".split(" "), "".split(" "), channelOptions);

                    StackExchange.using("externalEditor", function() {
                    // Have to fire editor after snippets, if snippets enabled
                    if (StackExchange.settings.snippets.snippetsEnabled) {
                    StackExchange.using("snippets", function() {
                    createEditor();
                    });
                    }
                    else {
                    createEditor();
                    }
                    });

                    function createEditor() {
                    StackExchange.prepareEditor({
                    heartbeatType: 'answer',
                    autoActivateHeartbeat: false,
                    convertImagesToLinks: true,
                    noModals: true,
                    showLowRepImageUploadWarning: true,
                    reputationToPostImages: 10,
                    bindNavPrevention: true,
                    postfix: "",
                    imageUploader: {
                    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                    allowUrls: true
                    },
                    onDemand: true,
                    discardSelector: ".discard-answer"
                    ,immediatelyShowMarkdownHelp:true
                    });


                    }
                    });














                    draft saved

                    draft discarded


















                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41166536%2fhow-can-i-format-date-in-odoo-10-qweb-report%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown
























                    5 Answers
                    5






                    active

                    oldest

                    votes








                    5 Answers
                    5






                    active

                    oldest

                    votes









                    active

                    oldest

                    votes






                    active

                    oldest

                    votes









                    0














                    Try this.



                    <span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>


                    My Output is: May 28,2018






                    share|improve this answer




























                      0














                      Try this.



                      <span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>


                      My Output is: May 28,2018






                      share|improve this answer


























                        0












                        0








                        0






                        Try this.



                        <span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>


                        My Output is: May 28,2018






                        share|improve this answer














                        Try this.



                        <span t-esc="datetime.datetime.strptime(o.sale_id.confirmation_date, '%Y-%m-%d %H:%M:%S').strftime('%B %d,%Y')"/>


                        My Output is: May 28,2018







                        share|improve this answer














                        share|improve this answer



                        share|improve this answer








                        edited Jul 19 at 6:35









                        Pang

                        6,8601563101




                        6,8601563101










                        answered May 28 at 8:54









                        Er.Ankit H Gandhi

                        544




                        544

























                            0














                            According to my experience, you have used the correct way to format Qweb date, but sometimes there is problem in other thing and odoo gives error somewhere else. Hope trying this code may be helpful.



                            <span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>


                            also use this code



                            <span t-field="o.date_order" t-field-options="{'format': 'yyyy-MM-dd'}" />


                            You can also do one thing as formatting the date variable in the model itself and then show it on your QWeb report.






                            share|improve this answer




























                              0














                              According to my experience, you have used the correct way to format Qweb date, but sometimes there is problem in other thing and odoo gives error somewhere else. Hope trying this code may be helpful.



                              <span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>


                              also use this code



                              <span t-field="o.date_order" t-field-options="{'format': 'yyyy-MM-dd'}" />


                              You can also do one thing as formatting the date variable in the model itself and then show it on your QWeb report.






                              share|improve this answer


























                                0












                                0








                                0






                                According to my experience, you have used the correct way to format Qweb date, but sometimes there is problem in other thing and odoo gives error somewhere else. Hope trying this code may be helpful.



                                <span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>


                                also use this code



                                <span t-field="o.date_order" t-field-options="{'format': 'yyyy-MM-dd'}" />


                                You can also do one thing as formatting the date variable in the model itself and then show it on your QWeb report.






                                share|improve this answer














                                According to my experience, you have used the correct way to format Qweb date, but sometimes there is problem in other thing and odoo gives error somewhere else. Hope trying this code may be helpful.



                                <span t-field="o.date_order" t-field-options='{"format": "d MMMM y"}'/>


                                also use this code



                                <span t-field="o.date_order" t-field-options="{'format': 'yyyy-MM-dd'}" />


                                You can also do one thing as formatting the date variable in the model itself and then show it on your QWeb report.







                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Oct 22 at 1:42









                                Nwawel A Iroume

                                422921




                                422921










                                answered Jul 15 at 18:08









                                Abhay Singh Rathore

                                342




                                342























                                    0














                                    To display localized date strings. Try the following:



                                    <span t-field="o.date_invoice" t-options="{'widget': 'date'}" />





                                    share|improve this answer




























                                      0














                                      To display localized date strings. Try the following:



                                      <span t-field="o.date_invoice" t-options="{'widget': 'date'}" />





                                      share|improve this answer


























                                        0












                                        0








                                        0






                                        To display localized date strings. Try the following:



                                        <span t-field="o.date_invoice" t-options="{'widget': 'date'}" />





                                        share|improve this answer














                                        To display localized date strings. Try the following:



                                        <span t-field="o.date_invoice" t-options="{'widget': 'date'}" />






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Oct 22 at 4:21









                                        Nwawel A Iroume

                                        422921




                                        422921










                                        answered Jun 21 at 0:17









                                        spacebiker

                                        2,55732139




                                        2,55732139























                                            0














                                            For those who arrive here from search engines, you can control display of date in form fields using widgets.



                                            <field name="date_planned" widget="date"/>


                                            or,



                                            <field name="date_planned" widget="datetime"/>





                                            share|improve this answer


























                                              0














                                              For those who arrive here from search engines, you can control display of date in form fields using widgets.



                                              <field name="date_planned" widget="date"/>


                                              or,



                                              <field name="date_planned" widget="datetime"/>





                                              share|improve this answer
























                                                0












                                                0








                                                0






                                                For those who arrive here from search engines, you can control display of date in form fields using widgets.



                                                <field name="date_planned" widget="date"/>


                                                or,



                                                <field name="date_planned" widget="datetime"/>





                                                share|improve this answer












                                                For those who arrive here from search engines, you can control display of date in form fields using widgets.



                                                <field name="date_planned" widget="date"/>


                                                or,



                                                <field name="date_planned" widget="datetime"/>






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Nov 13 at 6:09









                                                Tirtha R

                                                3231313




                                                3231313























                                                    0














                                                    Instead of using



                                                    <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>


                                                    use



                                                    <span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>


                                                    Hope that helps!






                                                    share|improve this answer


























                                                      0














                                                      Instead of using



                                                      <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>


                                                      use



                                                      <span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>


                                                      Hope that helps!






                                                      share|improve this answer
























                                                        0












                                                        0








                                                        0






                                                        Instead of using



                                                        <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>


                                                        use



                                                        <span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>


                                                        Hope that helps!






                                                        share|improve this answer












                                                        Instead of using



                                                        <span t-field="o.date_invoice" t-field-options='{"format": "MM/dd/yyyy"}'/>


                                                        use



                                                        <span t-field="o.date_invoice" t-options='{"format": "MM/dd/yyyy"}'/>


                                                        Hope that helps!







                                                        share|improve this answer












                                                        share|improve this answer



                                                        share|improve this answer










                                                        answered Nov 20 at 6:39









                                                        Perino

                                                        246317




                                                        246317






























                                                            draft saved

                                                            draft discarded




















































                                                            Thanks for contributing an answer to Stack Overflow!


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.





                                                            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                                            Please pay close attention to the following guidance:


                                                            • Please be sure to answer the question. Provide details and share your research!

                                                            But avoid



                                                            • Asking for help, clarification, or responding to other answers.

                                                            • Making statements based on opinion; back them up with references or personal experience.


                                                            To learn more, see our tips on writing great answers.




                                                            draft saved


                                                            draft discarded














                                                            StackExchange.ready(
                                                            function () {
                                                            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f41166536%2fhow-can-i-format-date-in-odoo-10-qweb-report%23new-answer', 'question_page');
                                                            }
                                                            );

                                                            Post as a guest















                                                            Required, but never shown





















































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown

































                                                            Required, but never shown














                                                            Required, but never shown












                                                            Required, but never shown







                                                            Required, but never shown







                                                            Popular posts from this blog

                                                            Paul Cézanne

                                                            UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                                                            Angular material date-picker (MatDatepicker) auto completes the date on focus out