Odoo Mindscape. Understand Odoo faster. Explore modules, fields, dependencies and version differences in one place instead of digging through the source code.

Module: Sales

Entity: sale.order

Compute Method: _compute_partner_credit_warning

Inputs Method Outputs
for order in self:
            order = order.with_company(order.company_id)
            order.partner_credit_warning = ""
            show_warning = (
                order.state in ("draft", "sent") and order.company_id.account_use_credit_limit
            )
            if show_warning:
                order.partner_credit_warning = self.env[
                    "account.move"
                ]._build_credit_warning_message(
                    order.sudo(),  # ensure access to `credit` & `credit_limit` fields
                    current_amount=(order.amount_total / order.currency_rate),
                )

Back to entity