The date in my Invoice is currently showing as:
21/11/2014 16:59:15
I want to show just month something like this:
11
I tried using t-esc with strftime but that doesn't work:
<span t-esc="o.date_order.strftime('%m')" />
Try:
<span t-field="o.date_order" t-field-options='{"format": "MM"}'/>
More on supported format patterns.
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
Hope, It will be use.
Related
html code:
<input id="19eb0353-6208-4baa-8f89-f7af0a6edb91" type="date" placeholder="Date of Birth" value="" name="dateOfBirth" data-componentname="dateOfBirth" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-ddlabel="dd" data-mmlabel="mm" data-yyyylabel="yyyy">
ID is dynamic
Trying to enter the day month and year but not sure how to write it
I know this is the data but cant find anything on selecting these specific labels inside the input
data-ddlabel="dd" data-mmlabel="mm" data-yyyylabel="yyyy"
Tried Xpath, css selector but the ID is dynamic
You can use the below css.
input[type='date']
or the below xpath
//input[#type='date']
Screenshot:
when registration page opens (after clicking join now), you can use xpath like "//select[#id='nike-unite-date-id-mm']" to select date, month and year separately (like dropdown).
OR
you can directly point to specific date using xpath
"//select[#id='nike-unite-date-id-mm']//option[contains(text(),'10')].click()"
this will directly select the date, similarly can be done for months and year by changing #id
Please use below code.
I have tested, it worked for me.
driver.findElement(By.xpath("//input[#type='date']")).sendKeys("04/04/1989");
Please let me know if you face any error.
You can try this (example using python):
from selenium.webdriver.support.ui import Select
month = Select(driver.find_element_by_id('nike-unite-date-id-mm'))
month.select_by_visible_text("08")
day = Select(driver.find_element_by_id('nike-unite-date-id-dd'))
month.select_by_visible_text("21")
year = Select(driver.find_element_by_id('nike-unite-date-id-yyyy'))
month.select_by_visible_text("2019")
And use Select Method like this:
<option value="01"> 01 </option>
^^
select_by_visible_text("01")
<option value="01"> 01 </option>
^^^^^^^^^^
select_by_value("01")
How to Convert datetime to time in qweb report. Now return 2016-11-03 07:40:55 I want only 07:40:55
My solution is not working:
<span t-esc="o.start" t-field-options='{"format": "hh.mm.ss"}'/>
Change t-esc to t-field. t-field-options only works on t-field.
I am currently working on my first Odoo (v8) template and want to check if a contact person has a specific title.
What currently works is:
Sehr geehrter <span t-field="o.partner_id.title"></span> <span t-field="o.partner_id.name"></span>
This outputs:
Sehr geehrter Herr Klaus Koffer
As you can see I use the german translation of the system.
My question is: How can I check for "Mister" and "Miss"? The following example does not work. Is there a way to get the internav values as they are obviously not "Mister".
<p t-if="o.partner_id.title == 'Mister'">
Thanks in advance.
You can refer our blog to know about qweb.
Just try it in your code.
t-if="o.partner_id.title.name == 'Mister'"
Because o.partner_id.title gives an object of res.partner.title model.
So, you have to user o.partner_id.title.name. that's it.
Just you can check the condition using <t> </t> Tag for add the condition in Qweb View.
Better way u should use the <t> Tag insted of <p> Tag
some thing like this
<t t-if="o.partner_id.title == 'Mister'">
Your login will add hear for Mister title
</t>
I hope this should helpful for you ..)
I have the view report_invoice_document showing the VAT client number, using next code:
<span t-field="o.partner_id.vat"/>
However, the number that appears is CO8000000001 and I need just the number without letters and if it's possible formatted this way 800.000.000-1.
I was trying to find documentation about t-field-options to customize the field but I didn't have luck with that.
Thanks.
Try:
<span t-esc="o.partner_id.vat[2:]"/>
t-esc supports Python code.
I've created a DateTextBox like:
<input dojoType="dijit.form.DateTextBox" constraints="{max: Date.now()}" id="startDate" />
When the page loads there is no value in the field. I would like the value to default to today. Is there a way to handle this? I know I could use the "value" attribute and set it in the declaration, but that only allows me to put a static date in the field, not a dynamic date.
It would also be good if the solution works with a form reset too.
Thanks for the help!
The parser supports the "now" keyword, so you could do:
<input dojoType=dijit.form.DateTextBox value="now">
Of course, for programmatic creation you would simply do:
new dijit.form.DateTextBox({value: new Date()})
Your solution:
<input dojoType=dijit.form.DateTextBox value="now">
If you want to make the date other than today:
<input dojoType=dijit.form.DateTextBox value="now" constraints="{max: new Date()}">