addons14/sale_timesheet_rounded/models/account_analytic_line.py
def read(self, fields=None, load="_classic_read"):
        """Replace the value of unit_amount by unit_amount_rounded.

        When context key `timesheet_rounding` is True
        we change the value of unit_amount with the rounded one.
        This affects `account_analytic_line._sale_determine_order_line`.
        """
        ctx_ts_rounded = self.env.context.get("timesheet_rounding")
        fields_local = fields.copy() if fields else []
        read_unit_amount = "unit_amount" in fields_local or not fields_local
        if ctx_ts_rounded and read_unit_amount and fields_local:
            if "unit_amount_rounded" not in fields_local:
                # To add the unit_amount_rounded value on read
                fields_local.append("unit_amount_rounded")
        res = super().read(fields=fields_local, load=load)
        if ctx_ts_rounded and read_unit_amount:
            # To set the unit_amount_rounded value instead of unit_amount
            for rec in res:
                rec["unit_amount"] = rec["unit_amount_rounded"]
        return res
Replace the value of unit_amount by unit_amount_rounded.

        When context key `timesheet_rounding` is True
        we change the value of unit_amount with the rounded one.
        This affects `account_analytic_line._sale_determine_order_line`.
        
Replace the value of unit_amount by unit_amount_rounded.
When context key `timesheet_rounding` is True
we change the value of unit_amount with the rounded one.
Replace the value of unit_amount by unit_amount_rounded . When context key ` timesheet_rounding ` is True we change the value of unit_amount with the rounded one .
def read(self, fields=None, load="_classic_read"):
        ctx_ts_rounded = self.env.context.get("timesheet_rounding")
        fields_local = fields.copy() if fields else []
        read_unit_amount = "unit_amount" in fields_local or not fields_local
        if ctx_ts_rounded and read_unit_amount and fields_local:
            if "unit_amount_rounded" not in fields_local:
                fields_local.append("unit_amount_rounded")
        res = super().read(fields=fields_local, load=load)
        if ctx_ts_rounded and read_unit_amount:
            for rec in res:
                rec["unit_amount"] = rec["unit_amount_rounded"]
        return res
def read ( self , fields = None , load = "_classic_read" ) : ctx_ts_rounded = self . env . context . get ( "timesheet_rounding" ) fields_local = fields . copy ( ) if fields else [ ] read_unit_amount = "unit_amount" in fields_local or not fields_local if ctx_ts_rounded and read_unit_amount and fields_local : if "unit_amount_rounded" not in fields_local : fields_local . append ( "unit_amount_rounded" ) res = super ( ) . read ( fields = fields_local , load = load ) if ctx_ts_rounded and read_unit_amount : for rec in res : rec [ "unit_amount" ] = rec [ "unit_amount_rounded" ] return res
Replace the value of unit_amount by unit_amount_rounded.
Replace the value of unit_amount by unit_amount_rounded .
"""Replace the value of unit_amount by unit_amount_rounded.

        When context key `timesheet_rounding` is True
        we change the value of unit_amount with the rounded one.
        This affects `account_analytic_line._sale_determine_order_line`.
        """ # To add the unit_amount_rounded value on read # To set the unit_amount_rounded value instead of unit_amount
self
fields
load