35 lines
1.2 KiB
Python
35 lines
1.2 KiB
Python
# -*- coding: utf-8 -*-
|
|
# Copyright 2026 Nexa Systems Inc.
|
|
# License OPL-1 (Odoo Proprietary License v1.0)
|
|
|
|
from odoo import models, fields
|
|
|
|
|
|
class FusionSyncWarehouse(models.Model):
|
|
_name = 'fusion.sync.warehouse'
|
|
_description = 'Remote Warehouse (Discovered via Sync)'
|
|
_rec_name = 'name'
|
|
_order = 'name'
|
|
|
|
config_id = fields.Many2one(
|
|
'fusion.sync.config', string='Sync Config',
|
|
required=True, ondelete='cascade', index=True)
|
|
remote_warehouse_id = fields.Integer(
|
|
string='Remote Warehouse ID', required=True, index=True)
|
|
remote_lot_stock_id = fields.Integer(
|
|
string='Remote Stock Location ID',
|
|
help='The lot_stock_id on the remote warehouse, used to filter quants')
|
|
name = fields.Char(string='Warehouse Name', required=True)
|
|
code = fields.Char(string='Code')
|
|
company_name = fields.Char(string='Company')
|
|
active = fields.Boolean(default=True)
|
|
stock_line_ids = fields.One2many(
|
|
'fusion.sync.stock', 'sync_warehouse_id',
|
|
string='Stock Lines')
|
|
|
|
_sql_constraints = [
|
|
('unique_remote_warehouse',
|
|
'UNIQUE(config_id, remote_warehouse_id)',
|
|
'Each remote warehouse can only appear once per sync configuration.'),
|
|
]
|