Add "vendor product code" to a QWEB report in odoo 13 - 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.

Related

Is it possible to have a custom field in Inventory Detail subrecord on Item Receipt? NETSUITE

Just like expiration date on inventory number subrecord on Item Receipt, can we have a custom field for manufacturing date in inventory number subrecord. Is there any feature need to be enabled? Does NetSuite have any functionality of Production/Manufacturing date? or any way to create a custom field in inventory number subrecord that is visible in IR subrecord?
As far as I am aware, it is not possible to add a custom field to the inventory detail subrecord. Checking the CUSTOMISATION > LIST, RECORDS & FIELDS NS menu (using the administrator role), this sub-record is not available. I have, however, in the past re-created the subrecord using a Suitelet and a saved search which auto-populates the item lines with additional columns. Perhaps this route is a potential solution for you too.
I have recently encountered this in an implementation. We were requested to add the Gross Weight and Net Weight fields in the Inventory Details window.
We used a SuiteApp called Lot Auto Number (Answer ID: 100706).

NetSuite Saved Search Result Is Blank

I tried to create a saved search to pull information from the "Shipping Method" field under Item Fulfillment; while the result is not showing any information even there is information under the "Shipping Method field".
Please see the criteria and result as follows.
Can someone please suggest how can I fix this?
Thank you.
Criteria:
Main Line is true
Type is Item Fulfillment
Status is Item Fulfillment:Picked
Date is after 9/1/2019
Result:
Created From : Internal ID
Created From : Document Number
Shipping Method (Custom Body)
Shipping Carrier
The shipping method field you have is a custom body field. It is not the native shipping method field, which is "Ship Via".
If you are setting a custom shipping method, that's ok, just as long as it's setup properly on your end. In this case, it may be, but you may be expecting different data as what you're describing is in the "Ship Via" field.

How to retrieve value in selected SharePoint list item column

In a SharePoint list, I have a column that holds a foreign key ID to another list. For example:
list teachers
list classes with foreign key column teacherID to teacher item
I am trying to create a Power Automate flow that starts with a SharePoint "For a selected item" in classes and then modifies the referenced teacher list item.
"For selected item" in classes
Modify teachers item referenced by classes.teacherID
All(!) I need to do is get the value of teacherID, but that has turned out to be incredibly difficult. How can I do this? I'm new to Power Automate so any suggestions appreciated.
What I've tried:
Created a second action to email me output from the first action (because I don't know any other way to "debug" or "watch" this). Added many different types of Dynamic content and expressions to the email body. teacherID never appears. It is not in the list of Dynamic content fields. I cannot find in expressions tried e.g. triggerBody, trigger, output, actions('For a selected item') (which is an error for some unknown reason but I'm not trying to understand why at the moment). In the JSON, all I have been able to retrieve so far is ID, itemURL, fileName, FileId (which looks the same as ID).
My next thought was, okay, maybe "For a selected item" doesn't have access to the other list columns, but maybe "Get item" does. So, I inserted a "Get item" (singular, not "Get items) but this frustratingly did not make any difference.
What I am trying to do should be very simple and straightforward. The documentation is sparse, and it sucks TBH.
If the lookup column name is teacherID, you should use teacherID Id in the flow to find the item in teachers
You could create the flow like this:
"For a selected item" in classes
"Get item" in classes
"Update item" in teachers

WHERE statement to display contacts on sidebar

I have multiple product pages (same page template), and each page is supposed to have different sales rep contacts on the sidebar. I set up the sidebar contact box as a repeater to pull data/filter data from a SalesRep page type. The SalesRep page type has a field called ContactForPage; and my plan is to put in a string from the product page URL, so that if the string match the page URL, the contact will be displayed on the sidebar for that page.
Example:
Current page url is: www.domain.com/products/product-123
John Doe has ContactForPage = product-abc
Jane Doe has ContactForPage = product-123
Jane Doe will be displayed as contact because the field value matched part of the URL.
I've been trying to write the WHERE statement but don't really know the syntax. Could you help!
Something like: WHERE: SalesRep.ContactForPage LIKE '%CurrentDocument.NodeAliasPath%'
Fist of all using URL as in SQL query is not a good idea. You have to define relation between sales reps and products correctly. Probably one sales reps might be selling TV, the other - cellphones. But if you want to directly connect product to sales man. You can use Related Pages and relationship structure.
Create new Relationship name, i.e. "is Salesman of Product" so
Page A (saleman page) will be related to Page B (product page) via the relationship above
Add related pages, i.e. for all salesmen pages add corresponding products via API or via properties > related pages
Use web RelatedPages web part to shows salesmen list on the right
I see a problem in your design. I assume a sales rep may mange multiple products, correct? If that's the case, you should add a field to the Product pagetype which allows you to select the sales rep instead of the add a field to the SalesRep pagetype, because how will you enter multiple products?
The field (e.g. SalesRepID) you add to the Product PageType can be a drop down list for select the sale rep. You can use Query to auto generate the list from the SaleRep page type. e.g. "SELECT RepID, RepName FROM custom_SalesRep". The RepID would be stored in the SalesRepID field.
For display, you can use the repeater set for SalesRep pagetype and use WHERE condition like this:
RepID = {% CurrentDocument.GetValue("SalesRepID") %}
The Relationship is working both ways. You can have multiple documents related one and vice versa, i.e. one product can be sold by many salesmen and one salesman can sell different products. You just need to define one relationship. If you have a relationship between "Product A" Page and "Salesman John" Page, you will see this relation on both pages in properties > related page.
All I am saying is this: you do not need to add extra fields to your page types (either salesman or product), you should use relationship instead.
Read here Displaying related documents.

Netsuite, Filtering the Items allowed to sell based on a customer classification

I am wondering if it is possible in NetSuite to filter items available to sell based on a customer.
The requirement is that the company restricts selling certain items to some selected customers. Just wanted to know if this is possible in NetSuite.
I am aware that it is possible in sales order form to have an 'Item saved search' as the filtering criteria. But this does not allow filtering items based on selected customer fields. Seems 'Item saved search' that is assigned for the form can only use static fields or some variables from the 'Item work flow'.
Other way I tried is by restricting the 'Custom' price level on the sales order form. This way I am able stop selling anything not assigned to the customer price level. But I cannot stop those items being listed in the drop-down and search list.
Really appreciate any help on this.
You can use clientscript with validateLine function
Create script parameter with item list record type and select item which you want to restrict.
Within validateLine function restrict item which is selected within a script parameter record.
I was successful in filtering class based on a particular department and the following approach was followed:
var selectedCustom = 'T';
var v_form = type + '_form';
var formCustom = document.forms[v_form];
var fldCustom = getFormElement(formCustom, fldnamCustom.toLowerCase());
Using the above approach the following function was able to filter the list of values
addSelectOption(document, ldCustom, v_class, v_class_id, selectedCustom);

Resources