Skip to Content
Meniu
Trebuie să fiți înregistrat pentru a interacționa cu comunitatea.
Această întrebare a fost marcată
1 Răspunde
2194 Vizualizări
Hello, I am using a conditional field where I want to obtain quantities on hand from a specific location for example from my attached WH/Stock example


Imagine profil
Abandonează
Cel mai bun răspuns
Hello  Comimprint,

you can make that studio field as compute and depends on product_id and location_id. following method of stock.quant model will return available qty of spefic product and location.


@api.model
def _get_available_quantity(self, product_id, location_id, lot_id=None, package_id=None, owner_id=None, strict=False, allow_negative=False):
""" Return the available quantity, i.e. the sum of `quantity` minus the sum of
`reserved_quantity`, for the set of quants sharing the combination of `product_id,
location_id` if `strict` is set to False or sharing the *exact same characteristics*
otherwise.
This method is called in the following usecases:
- when a stock move checks its availability
- when a stock move actually assign
- when editing a move line, to check if the new value is forced or not
- when validating a move line with some forced values and have to potentially unlink an
equivalent move line in another picking
In the two first usecases, `strict` should be set to `False`, as we don't know what exact
quants we'll reserve, and the characteristics are meaningless in this context.
In the last ones, `strict` should be set to `True`, as we work on a specific set of
characteristics.

:return: available quantity as a float


Let us know if you still need any help on this, 

Thanks,


Thanks & Regards,



CandidRoot Solutions Pvt. Ltd.

Mobile: (+91) 8849036209
Email: info@candidroot.com
Skype: live:candidroot
Web: https://www.candidroot.com
Address: 1229-1230, Iconic Shyamal, Near Shyamal Cross Road, Ahmedabad, Gujarat 380015

Imagine profil
Abandonează
Related Posts Răspunsuri Vizualizări Activitate
1
oct. 24
1845
2
oct. 24
3194
1
iul. 24
2437
0
iun. 24
1290
2
feb. 24
2824