Kohana select field misbehaves when & present - kohana

I have a Kohana select field whose output looks like this:
<select id="section" name="section">
<option value="">please choose</option>
<option value="Board of Directors">Board of Directors</option>
<option value="Central Office & Staff">Central Office & Staff</option>
<option value="Executive Committee">Executive Committee</option>
</select>
Notice that the section option contains an &. When I have a record whose section value is Central Ofice & Staff, my select field just reads "please choose" instead of having Central Office & Staff selected. This happens even when I change Central Office & Staff to Central Office & Staff in an effort to make the fields match.
It seems like this must be a common problem. How to I make the select field behave properly?

Change to
<option value="Central Office & Staff">Central Office & Staff</option>
This is because & works only for HTML, so the value from URL/DB will not match.
By the way - this would not happen if you used Form::select helper ;)

Related

Add "vendor product code" to a QWEB report in odoo 13

In the built-in sales order report, if a product has "vendor product code" set, it will show that number in front of the product's name. If it is not set, it will show the "internal reference".
We have created a new report and would like to show the internal reference/vendor product code in a column of its own.
I am unable to figure out how to reference a specific vendor for a specific product and obtain the "vendor product code". I.E. I don't know what field from what model to use.
In pseudo-code (not qweb but you get the idea):
if(sales_order_line.vendor_product_code.is_set())
print( sales_order_line.vendor_product_code)
else
print( sales_order_line.product.internal_id)
On your custom new report on the table which contain the order-line , So you can take the idea from here which test in default odoo sale order Quotation report.
Test-Product: On the purchase tab, seller_ids have vendor set with vendor_code & default_code(internal reference) too.
Code Example,
<t t-foreach="doc.order_line" t-as="line">
<t t-set="code" t-value="line.product_id.seller_ids[0].product_code if line and line.product_id and line.product_id.seller_ids and line.product_id.seller_ids[0].product_code else line.product_id.default_code"/>
<td name="td_name"><span t-field="line.name"/><br/>Code: <span t-esc="code"/></td>
</t>
From the above code, it is just for a way to use in the report q-web, as I have used here to get the 1st seller from the multiple lists.
so do your changes as per your customization
Improved logic for Custom Requirement in Code:
<t t-set="code" t-value="line.product_id.seller_ids.filtered(
lambda x: doc.partner_id == x.name).product_code if line and line.product_id and line.product_id.seller_ids else line.product_id.default_code"/>
like this way you can check that your current partner is having the seller list.
But you can add a more precise condition so for multi-partner find in seller you can not have an error with some unique condition added as per your customization.

Freemarker / Netsuite - Assign a variable to a specific item amount

I need to assign a variable to a specific item amount in Freemarker (Netsuite version) to uses in a different part of the invoice template.
I am struggling with figuring out how I can use <#assign> to do this. The item would be used only once and would go underneath the subtotal field on the invoice.
Any suggestions on how I can do this?
check the Freemarker docs
capture data:
<#assign ord_number_is>Your order number is ${record.tranid}</#assign>
${ord_number_is}
set data:
<#assign fs_6="font-size: 6pt;" />
${fs_6}
Most (all?) of the time in NetSuite transaction advanced pdf forms, the "meat" of the content for items on a transaction start with a line such as:
<table class="itemtable"><!-- start items --><#list record.item as item><#if item_index==0>
then it provides the content (usually items) in an html table and finishes the loop with a closing tag of:
</#list><!-- end items -->
When I need to first gather information from the item list but not actually print it out to the pdf, I like to follow the same structure minus the html elements. For your case, I think you want to identify a particular item in a sublist and then if it is present, record the amount for future use elsewhere in the form. Using the above structure, that would be something like this:
<!-- assign variable to hold initial value -->
<#assign item_x_amount = 0>
<!-- populate the amount if the item is present in any row -->
<#list record.item as tmpLine>
<#if (tmpLine.item == "Consulting Services")><#assign item_x_amount = item_x_amount + tmpLine.amount></#if>
</#list>
Then, later on in the code for creating the subtotal table, add in your variable lable and value. Resulting in a transaction that looks like:
Notes:
I took the liberty of expanding your request to "the sum of the amounts for a particular item". This also covers your assumption that there will only ever be one matching item on the transaction, but people rarely always follow the rules. If you definitely don't want that behavior, you can change <#assign item_x_amount = item_x_amount + tmpLine.amount> to <#assign item_x_amount = tmpLine.amount>
If the item name changes, this breaks. You did not mention how you were identifying the item in question. It is safer to use some other identifying information about the item (internal ID perhaps) or even better is a transaction line field that flags it as a row to use in this process.
I formatted the displayed result as currency using ${item_x_amount?string.currency}
Hopefully this helps! I use this technique a lot in NetSuite development.

Date cannot be pasted on chrome with using VBA - Selenium

I can change date on web page if I use internet explorer with below code(code1).
however, I changed browser to chrome with selenium. (as code 2), date section on web page is changed but it is partial.
for example: date is set 18/02/2020 on web page when it is opened. then I want to change date as 01/03/2017 but it is changed to 03/02/2017. that means, month section in macro shanged the date section, nothing changed on month section and year section is also changed
i have tried to change date order in macro like mm/dd/yyyy but ı cant get a proper date solution. just tried millions of code and still cannot find anything.
so please help me to change date section on chrome with using selenium.
Sheet1.Range("A1") = 01/03/2017
Code1
ie.document.getElementsByName("date$From")(0).Value = Sheet1.Range("A1").Text
Code2 (selenium and VBA)
obj.FindElementById("date_From").SendKeys (sheet1.Range("A1")).Text
Website code (website is behind a firewall)
<input name="date$From" type="text" value="18/02/2020" size="6" id="date_tbFrom" class="searchSelect">
<input type="hidden" name="date_From_Client" id="date_From_Client">
found a solution bymelf with try it. I used tab button usage to reach date section and used date format as 01,01,2021. used comma (,) instead of slash (/) as date seperator.
obj.FindElementByName("date$From").Clear
obj.FindElementById("place_before_date").Click
obj.SendKeys (keys.Tab)
obj.FindElementById("date$From").SendKeys (Sheet1.Range("A" & x))

Bugzilla buglist.cgi search by change history gives wrong result

I'm trying to get a csv list of bugs that were assigned to a certain assignee (e.g. newAssignee) within a given time slot in the past (e.g. January 2015), using the following query:
http://mybugzilla/buglist.cgi?chfieldfrom=2015-01-01&chfieldto=2015-01-31&chfieldvalue=newAssignee&chfield=assigned_to&ctype=csv
The result appears to be a list where the assignee changed to the desired value at ANY time, ignoring given chfieldfrom and chfieldto. Also, bugs are listed that have no change in the history within given time at all.
Your link does not work for me .. however here what I would do:
Search By People: flag "the Bug Assignee" and write in the account-name of "newAssignee"
Search By Change History: Enter the time-frame for which you want to search. Dont select any value for the fields "where ANY of the fields:" and "changed to"
Or, if you only want to see the bugs which were newly assigned to "newAssignee" in that time-slot, select "Assigne" in "where ANY of the fields:" and write the account of "newAssignee" into the field "changed to"

Sharepoint BDC - Check names not working

Long story short:
I have a BDC application definition in my sharepoint 2007 server, which is pulling data from a SQL server.
Some of this data is the Employee Name.
What i'm trying to do, is that when a user is writing a portion of the employee name in the BDC column (in the custom list) and then clicks 'Check Names', it will show him a list of the available names it found. (Like this user column type:)
now, what happens in real life when using BDC, is that i dont see the list of available users.
Any help solving this issue would be greatly appreciated!
you could resolve this problem addin a Filter for the Name Field inside the Finder method, and setting the property "UsedForDisambiguation" with "true"
Ex: This filter applys to the employee name field:
<FilterDescriptors>
<FilterDescriptor Type="Wildcard" Name="Name">
<Properties>
<Property Name="UsedForDisambiguation" Type="System.Boolean">true</Property>
</Properties>
</FilterDescriptor>
</FilterDescriptors>
Then, upgrade the BDC and when the user write the name and click the "Check names" button sharepoint will try to find the employee using the SpecificFinder (by ID), and if nothing is found then will try to find employees with this filter.
Regads!

Resources