Entitlement Manager
The entitlement manager determines what a beneficiary is entitled to for a given cycle.
odoo.addons.g2p_programs.models.managers.entitlement_manager
provides the class BaseEntitlementManager
define
the interface for this manager. DefaultCashEntitlementManager
is the default implementation of this class
for cash distribution.
The BaseEntitlementManager
can be extended to implement any other type of distribution such as in-kind
.
- class odoo.addons.g2p_programs.models.managers.entitlement_manager.BaseEntitlementManager[source]
- approve_entitlements(entitlements)[source]
This method is used to approve the entitlement list of the beneficiaries. :param cycle: The cycle. :param cycle_memberships: The beneficiaries. :return:
- open_entitlement_form(rec)[source]
This method is used to open the form view of a selected entitlement. :param rec: The entitlement. :return:
- open_entitlements_form(cycle)[source]
This method is used to open the list view of entitlements in a cycle. :param cycle: The cycle. :return:
- class odoo.addons.g2p_programs.models.managers.entitlement_manager.DefaultCashEntitlementManager[source]
- IS_CASH_ENTITLEMENT = True
- amount_per_cycle
Encapsulates a
float
expressed in a givenres_currency
.The decimal precision and currency symbol are taken from the
currency_field
attribute.- Parameters
currency_field (str) – name of the
Many2one
field holding theres_currency
this monetary field is expressed in (default: ‘currency_id’)
- amount_per_individual_in_group
Encapsulates a
float
expressed in a givenres_currency
.The decimal precision and currency symbol are taken from the
currency_field
attribute.- Parameters
currency_field (str) – name of the
Many2one
field holding theres_currency
this monetary field is expressed in (default: ‘currency_id’)
- create_date
Encapsulates a python
datetime
object.
- create_uid
The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
- Parameters
comodel_name (str) – name of the target model
Mandatory
except for related or extended fields.domain – an optional domain to set on candidate values on the client side (domain or string)
context (dict) – an optional context to use on the client side when handling that field
ondelete (str) – what to do when the referred record is deleted; possible values are:
'set null'
,'restrict'
,'cascade'
auto_join (bool) – whether JOINs are generated upon search through that field (default:
False
)delegate (bool) – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)check_company (bool) – Mark the field to be verified in
_check_company()
. Add a default company domain depending on the field attributes.
- currency_id
The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
- Parameters
comodel_name (str) – name of the target model
Mandatory
except for related or extended fields.domain – an optional domain to set on candidate values on the client side (domain or string)
context (dict) – an optional context to use on the client side when handling that field
ondelete (str) – what to do when the referred record is deleted; possible values are:
'set null'
,'restrict'
,'cascade'
auto_join (bool) – whether JOINs are generated upon search through that field (default:
False
)delegate (bool) – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)check_company (bool) – Mark the field to be verified in
_check_company()
. Add a default company domain depending on the field attributes.
- display_name
Basic string field, can be length-limited, usually displayed as a single-line string in clients.
- Parameters
size (int) – the maximum size of values stored for that field
trim (bool) – states whether the value is trimmed or not (by default,
True
). Note that the trim operation is applied only by the web client.translate (bool or callable) – enable the translation of the field’s values; use
translate=True
to translate field values as a whole;translate
may also be a callable such thattranslate(callback, value)
translatesvalue
by usingcallback(term)
to retrieve the translation of terms.
- entitlement_validation_group_id
The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
- Parameters
comodel_name (str) – name of the target model
Mandatory
except for related or extended fields.domain – an optional domain to set on candidate values on the client side (domain or string)
context (dict) – an optional context to use on the client side when handling that field
ondelete (str) – what to do when the referred record is deleted; possible values are:
'set null'
,'restrict'
,'cascade'
auto_join (bool) – whether JOINs are generated upon search through that field (default:
False
)delegate (bool) – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)check_company (bool) – Mark the field to be verified in
_check_company()
. Add a default company domain depending on the field attributes.
- id
Special case for field ‘id’.
- max_individual_in_group
Encapsulates an
int
.
- transfer_fee_amt
Encapsulates a
float
expressed in a givenres_currency
.The decimal precision and currency symbol are taken from the
currency_field
attribute.- Parameters
currency_field (str) – name of the
Many2one
field holding theres_currency
this monetary field is expressed in (default: ‘currency_id’)
- transfer_fee_pct
Encapsulates a
float
.The precision digits are given by the (optional)
digits
attribute.- Parameters
digits (tuple(int,int) or str) – a pair (total, decimal) or a string referencing a
DecimalPrecision
record name.
When a float is a quantity associated with an unit of measure, it is important to use the right tool to compare or round values with the correct precision.
The Float class provides some static methods for this purpose:
round()
to round a float with the given precision.is_zero()
to check if a float equals zero at the given precision.compare()
to compare two floats at the given precision.Example
To round a quantity with the precision of the unit of measure:
fields.Float.round(self.product_uom_qty, precision_rounding=self.product_uom_id.rounding)
To check if the quantity is zero with the precision of the unit of measure:
fields.Float.is_zero(self.product_uom_qty, precision_rounding=self.product_uom_id.rounding)
To compare two quantities:
field.Float.compare(self.product_uom_qty, self.qty_done, precision_rounding=self.product_uom_id.rounding)
The compare helper uses the __cmp__ semantics for historic purposes, therefore the proper, idiomatic way to use this helper is like so:
if result == 0, the first and second floats are equal if result < 0, the first float is lower than the second if result > 0, the first float is greater than the second
- write_date
Encapsulates a python
datetime
object.
- write_uid
The value of such a field is a recordset of size 0 (no record) or 1 (a single record).
- Parameters
comodel_name (str) – name of the target model
Mandatory
except for related or extended fields.domain – an optional domain to set on candidate values on the client side (domain or string)
context (dict) – an optional context to use on the client side when handling that field
ondelete (str) – what to do when the referred record is deleted; possible values are:
'set null'
,'restrict'
,'cascade'
auto_join (bool) – whether JOINs are generated upon search through that field (default:
False
)delegate (bool) – set it to
True
to make fields of the target model accessible from the current model (corresponds to_inherits
)check_company (bool) – Mark the field to be verified in
_check_company()
. Add a default company domain depending on the field attributes.