35 lines
1.1 KiB
Python
35 lines
1.1 KiB
Python
from odoo import fields, models
|
|
|
|
|
|
class WooProductMap(models.Model):
|
|
_name = 'woo.product.map'
|
|
_description = 'WooCommerce Product Mapping'
|
|
|
|
instance_id = fields.Many2one('woo.instance', required=True, ondelete='cascade')
|
|
product_id = fields.Many2one('product.product')
|
|
woo_product_id = fields.Integer()
|
|
woo_product_name = fields.Char()
|
|
woo_sku = fields.Char()
|
|
woo_product_type = fields.Selection([
|
|
('simple', 'Simple'),
|
|
('variable', 'Variable'),
|
|
('grouped', 'Grouped'),
|
|
('external', 'External'),
|
|
])
|
|
woo_parent_id = fields.Integer()
|
|
is_variation = fields.Boolean()
|
|
sync_price = fields.Boolean(default=True)
|
|
sync_inventory = fields.Boolean(default=True)
|
|
sync_images = fields.Boolean(default=True)
|
|
woo_image_ids = fields.Char() # JSON
|
|
last_synced = fields.Datetime()
|
|
company_id = fields.Many2one(
|
|
'res.company', required=True, default=lambda self: self.env.company,
|
|
)
|
|
state = fields.Selection([
|
|
('unmapped', 'Unmapped'),
|
|
('mapped', 'Mapped'),
|
|
('conflict', 'Conflict'),
|
|
('error', 'Error'),
|
|
], default='unmapped')
|