from odoo import models, fields


class SaleOrder(models.Model):
    _inherit = 'sale.order'

    woo_bind_ids = fields.One2many('woo.order', 'sale_order_id', string='WooCommerce Orders')
    woo_order_count = fields.Integer(compute='_compute_woo_order_count', string='WC Orders')

    def _compute_woo_order_count(self):
        for order in self:
            order.woo_order_count = len(order.woo_bind_ids)
