def prestashop_attribute_option_written(session, model_name, record_id, fields=None): if session.context.get('connector_no_export'): return export_record.delay(session, model_name, record_id, priority=20)
def prestashop_product_atrribute_value_created(session, model_name, record_id, fields=None): if session.context.get('connector_no_export'): return export_record.delay(session, model_name, record_id, priority=20)
def product_product_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return for field in EXCLUDE_FIELDS: fields.pop(field, None) model = session.env[model_name] record = model.browse(record_id) if 'active' in fields and not fields['active']: prestashop_product_combination_unlink(session, record_id) return if fields: for binding in record.prestashop_bind_ids: priority = 20 if 'default_on' in fields and fields['default_on']: # PS has to uncheck actual default combination first priority = 99 export_record.delay( session, 'prestashop.product.combination', binding.id, fields, priority=priority, )
def prestashop_product_combination_create(session, model_name, record_id, fields=None): if session.context.get('connector_no_export'): return export_record.delay(session, model_name, record_id, priority=20)
def product_image_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return model = session.env[model_name] record = model.browse(record_id) for binding in record.prestashop_bind_ids: export_record.delay(session, 'prestashop.product.image', binding.id, record.file_db_store, priority=20)
def product_category_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return if set(fields.keys()) <= set(CATEGORY_EXPORT_FIELDS): model = session.env[model_name] record = model.browse(record_id) for binding in record.prestashop_bind_ids: export_record.delay(session, binding._model._name, binding.id, fields=fields, priority=20)
def attribute_option_written(session, model_name, record_id, fields=None): if session.context.get('connector_no_export'): return model = session.pool.get(model_name) record = model.browse(session.cr, session.uid, record_id, context=session.context) for binding in record.prestashop_bind_ids: export_record.delay(session, 'prestashop.product.combination.option.value', binding.id, fields, priority=20)
def prestashop_product_combination_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return fields = list(set(fields).difference(set(INVENTORY_FIELDS))) if fields: export_record.delay( session, model_name, record_id, fields, priority=20, )
def prestashop_product_template_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return fields = list(set(fields).difference(set(INVENTORY_FIELDS))) if fields: export_record.delay(session, model_name, record_id, fields, priority=20) # Propagate minimal_quantity from template to variants if 'minimal_quantity' in fields: ps_template = session.env[model_name].browse(record_id) for binding in ps_template.prestashop_bind_ids: binding.odoo_id.mapped( 'product_variant_ids.prestashop_bind_ids').write( {'minimal_quantity': binding.minimal_quantity})
def prestashop_product_category_write(session, model_name, record_id, fields): if session.context.get('connector_no_export'): return if set(fields.keys()) <= set(CATEGORY_EXPORT_FIELDS): export_record.delay(session, model_name, record_id, fields)