from odoo import models, fields


class StockPicking(models.Model):
    _inherit = 'stock.picking'

    woo_tracking_number = fields.Char(string='WC Tracking Number')
    woo_carrier_id = fields.Many2one('woo.shipping.carrier', string='WC Shipping Carrier')
    woo_shipment_ids = fields.One2many('woo.shipment', 'picking_id', string='WC Shipments')
    is_woo_delivery = fields.Boolean(compute='_compute_is_woo_delivery', string='Is WC Delivery')

    def _compute_is_woo_delivery(self):
        for picking in self:
            picking.is_woo_delivery = bool(picking.woo_shipment_ids) or bool(
                picking.sale_id and picking.sale_id.woo_bind_ids
            )
