how to get available quantity of Lot number - odoo-9

how to get available quantity of Lot number in multiple warehouse
suppose i have 3 warehouse A,B and C,
Lot number LOT0001
i want sum of total currently availabel quantity of LOT0001 in all three location.

In odoo you can pass filters in context.
ex:
context={'lot_id':'','owner_id':'','package_id':'','warehouse':'','force_company':'','location':''}
product.with_context(context).qty_available
In odoo base module system will automatically calculate quantity based on context.
If you not pass context then system will give you sum of all warehouse stock.
this may help you.

Related

Magento 2 same product with multiple product costs prices

I have an issue right now and I believe many people might have this issue I am wondering if someone has found a work around so my issue is I have products that I buy stock for on a daily basis due to excahnge rate and other things the same product sometimes costs me different every time so my issue is,
If I have a Samsung watch I have 5 units in stock that cost me £35 Then I see a good deal on them and buy another 10 units these cost me £30 but I still have the 5 units in stock that cost me £35 so how can I upload/update the 10 units making 15 units in total but have a seperate cost price for the 10 units compared to the 5 units as I need this for reporting profit and loss reports.
So Ideally I want to be able to update my stock qty each time I do so I need to set a new cost price for that same product for selected amount of qtys,
Right now I am currently making the same product/SKU Multiple times because the product is the same but has cost me multiple by prices and I do not want to not have it listed for sale until the other stock sells and I do not want to keep making multiple products as customers think the products are different..
Any help will be strongly appriciated!
Have you check Tire Price concept in magento ?
I think this will full fill your requirement.
Let me know if you have any query.

Fulfilling maximum customer orders

There is an inventory of products like eg. A- 10Units, B- 15units, C- 20Units and so on. We have some customer orders of some products like customer1{A- 10Units, B- 15Units}, customer2{A- 5Units, B- 10Units}, customer3{A- 5Units, B- 5Units}. The task is fulfill maximum customer orders with the limited inventory we have. The result in this case should be filling customer2 and customer3 orders instead of just customer1.[The background for this problem is a realtime online retail scenario, where we have millions of customers and millions of products and we are trying to fulfill the orders as efficiently as possible]
How do I solve this?Is there an algorithm for this kind of problem, something like optimisation?
Edit: The requirement here is fixed. The only aim here is maximizing the number of fulfilled orders regardless of value. But we have millions of users and millions of products.
This problem includes as a special case a knapsack problem. To see why consider only one product A: the storage amount of the product is your bag capacity, the order quantities are the weights and each rock value is 1. Your problem is to maximize the total value you can fit in the bag.
Don't expect an exact solution for your problem in polynomial time...
An approach I'd go for is a random search: make a list of the orders and compute a solution (i.e. complete orders in sequence, skipping the orders you cannot fulfill). Then change the solution by applying a permutation on the orders and see if it's better.
Keep going with search until time runs out or you're happy with the solution.
It can be solved by DP.
Firstly sort all your orders with respect to A in increasing order.
Use this DP :
DP[n][m][o] = DP[n-a][m-b][o-c] + 1 where n-a>=0 and m-b >=0 o-c>=0
DP[0][0][0] = 1;
Do bottom up computation :
Set DP[i][j][k] = 0 , for all i =0 to Amax; j= 0 to Bmax; k = 0 to Cmax
For Each n : 0 to Amax
For Each m : 0 to Bmax
For Each o : 0 to Cmax
if(n>=a && m>=b && o>= c)
DP[n][m][o] = DP[n-a][m-b][o-c] + 1;
You will then have to find the max value of DP[i][j][k] for all values of i,j,k possible. This is your answer. - O(n^3)
Reams have been written about order fulfillment and yet no one has come up with a standard answer. The reason being that companies have different approaches and different requirements.
There are so many variables that a one size solution that fits all is not possible.
You would have to sit down and ask hundreds of questions before you could even start to come up with an approach tailored to your customers needs.
Indeed those needs might also vary, based on the time of year, the day of the week, what promotions are currently being run, whether customers are ranked, numbers of picking and packing staff/machinery currently employed, nature, size, weight of products, where products are in the warehouse, whether certain products are in fast/automated picking lines, standard picking faces or in bulk. The list can appear endless.
Then consider whether all orders are to be filled or are you allowed to partially fill an order and back-order out of stock products.
Does the entire order have to fit in a single box or are multiple box orders permitted.
Are you dealing with multiple warehouses and if so can partial orders be sent from each or do they have to be transferred for consolidation.
Should precedence be given to local or overseas orders.
The amount of information that you need at your finger tips before you can even start to plan a methodology to fit your customers specific requirements can be enormous and sadly, you are not going to get a definitive answer. It does not exist.
Whilst I realise that this is not a) an answer or b) necessarily a welcome post, the hard truth is that you will require your customer to provide you with immense detail as to what it is that they wish to achieve, how and when.
You job, initially, is the play devils advocate, in attempting to nail them down.
P.S. Welcome to S.O.

Magento: Minimal quantity different sizes

I'm making a shop with clothing. But there is a minimal order amount per order. Now i want to have a choice that the customer can make with different sizes.
So the minimal count is 10 pieces, and if a customer wants 4 size M, 5 size L and 1 size XL. what is the easiest way in code that i can accomplish this?
I'm using simple products associated with configurable products.
Maybe this could help :)
How to get the Total Quantity Of All the Items In your Shopping Cart

How to summarize by calculated measure in Power BI?

I have transactional data which contains customer information as well as stores they shopped from. I can count the number of different stores each customer used by a simple DISTINCTCOUNT([Site Name]) measure.
There are millions of customers and I want to make a simple summary table which shows the sum of # customers who visited X number of stores. Like a histogram. Maximum stores they visited is 6, minimum is 1.
I know there are multiple ways to do this but I am new to DAX and can't do what I think yet.
The easiest way:
Assuming your DISTINCTCOUNT([Site Name]) measure is called CustomerStoreCount ...
Add a new dimension table, StoreCount, to your model containing a single column, StoreCount. Populate it with the values 1,2,3,4,5,6 (... up to maximum number of stores.)
Create a measure, ThisStoreCount = MAX(StoreCount[StoreCount]).
Create a base customer count measure, TotalCustomers:=DISTINCTCOUNT(CustomerTable[Customer])
Create a contextual measure, CustomersWhoVisitedXNumberOfStores := CALCULATE ( TotalCustomers, FILTER(VALUES(CustomerTable[Customer]), ThisStoreCount = CustomerStoreCount) )
On your pivot table / reporting tool, etc. use StoreCount[StoreCount] on the axes and CustomersWhOVisitedXNumberOfStores as the measure.
So basically walk through the customer list (since there's no relationship between StoreCount and CustomerTable), compare that customer's CustomerStoreCount with the maximum StoreCount[StoreCount] value, which for each StoreCount[StoreCount] value is ... drum roll itself. If it matches, keep it, otherwise filter it out; you end up with a count of customers whose store visits equals the value of StoreCount[StoreCount].
And of course the more general modeling hint: when you want to display a metric by something (i.e. customer count by number of stores visited), that something is an attribute, not a metric.

Select products to get maximum cart value

Given a list of products available in the store, i need to select set of products to my cart in such a way that, my cart value should be maximum it can.
Restrictions are like, cart has a dimension l*w*h. Products selected should individually and totally fit into the cart giving maximum possible value to cart. One 1 item per product can be selected.
I have product id, price, l, w, ht, weight of each product with me. How can this be accomplished???
I came up with a logic as below.
Calculate volume of the cart
Calculate volume of product and value of product per cubic cm using its price
Sort the product list based on value/cucm
Start adding products from the sorted list like 1st, 2nd , 3rd, etc. till the cart gets filled.
If a product cannot fit into the cart, skip it and select the next possible product from the sorted list.
Once list is obtained, check if any product in the selected list can be replaced with another product with less volume but results in more cart value.
But this is not getting me the correct product list with maximum cart value. What is the problem in the above logic?
Are the three dimensions integer valued with some finite bound ? Then it can be solved with dynamic programming. But I think there should some assumptions made, e.g. the partition of sub-problems should be end-to-end cutting planes etc. Without that dynamic programming would be infeasible.
The key trick here is that you need to account for possibilities that a box can be oriented in several ways, and it is the number of ways to align its own three dimensions along the three axes of the cart. It is 3! = 6 for three dimensions. So in the dynamic programming when you process the i-th product, include all the 6 ways interpret its 3 dimensions as L,W,H.

Resources