Improve the in-kind manager
Closed this issue · 4 comments
We need to allow the customization of the entitlement. To make it simpler to configure, we could have an entitlement manager that allows configuring a list of items like this:
class G2PInKindEntitlementItem(models.Model):
product_id = fields.Many2one(
"product.product", "Product", domain=[("type", "=", "product")]
)
# non-mandatory field to store a domain that is used to verify if this item is valid for a beneficiary
# For example, it could be: [('is_woman_headed_household, '=', True)]
# If the condition is not met, this calculation is not used
condition = fields.Char("Condition Domain")
# any field that is an integer of `res.partner`
# It could be the number of members, children, elderly, or any other metrics.
# if no multiplier field is set, it is considered as 1.
multiplier_field = fields.Many2one("ir.model.fields", "Multiplier")
max_multiplier = fields.Integer(
default=0,
string="Maximum number",
help="0 means no limit",
)
quantity = fields.Integer("quantity", default=1)
uom_id = fields.Many2one("uom.uom", "Unit of Measure")
I believe the multiplier_field
can be a calculated field? For example "female > 15 years old"
Would it also be possible to apply this manager (or a similar manager) to a group of in-kind entitlements? Thinking of a basket-like scenario, or actually a partial-basket-like scenario.
@jeremi as this will make it possible to contribute the same item to the household multiple times when different conditions are met, I think we should have a visual way to see the breakdown of the assistance.
Visualisation idea – the table could also be arrows with totals pointing on the pie chart pieces with touch/hover to reveal details.
I believe the
multiplier_field
can be a calculated field? For example "female > 15 years old"
Yes, exactly!
Would it also be possible to apply this manager (or a similar manager) to a group of in-kind entitlements?
Do you have an example? The idea is to allow to have three rules, for example, one for each product.
Another improvement could be to have an option to allow to match only one rule per product, and we take the one that generates the largest amount.
The idea of visualization is great.
I have pushed the fixes for this in our private repo under the branch "182-integrate-in-kind-entitlement-to-the-inventory-module".
This fixes supports all the specifications provided by @jeremi. I also added a draggable widget (handle) in the list view of the in-kind entitlement items to define the order of generation of entitlements.
I sent feedback in the PR