// -*- coding: utf-8 -*-
// Encrypted ODOO Module C++ Source
// Generated by ODOO Encryption Tool

#ifdef _MSC_VER
// MSVC编译器特定指令：指定源文件编码和禁用编码警告
#pragma execution_character_set("utf-8")
#pragma warning(disable: 4819)
#endif

#include <pybind11/pybind11.h>
#include <pybind11/stl.h>
#include <pybind11/eval.h>

namespace py = pybind11;


// Encrypted code for models\fast_customer.py
const char* encrypted_code_models_fast_customer = R"PYTHON_CODE(
from odoo import models,fields,api,_
from odoo.exceptions import UserError

class FastCustomer(models.Model):
    _name = 'fast.customer'
    _description = '测试'

    name = fields.Char('名称')
)PYTHON_CODE";

void load_models_fast_customer(py::object locals_obj) {
    py::dict locals = locals_obj.cast<py::dict>();
    py::exec(encrypted_code_models_fast_customer, py::globals(), locals);
}

// Encrypted code for models\fast_vendor.py
const char* encrypted_code_models_fast_vendor = R"PYTHON_CODE(
from odoo import models,fields,api,_
from odoo.exceptions import UserError

class FastVendor(models.Model):
    _name = 'fast.vendor.demo'
    _description = '工厂测试'

    name = fields.Char('VENDOR')
    user_ids = fields.Many2many('res.users', string='绑定用户')
    partner_ids = fields.Many2many('res.partner', 'fast_vendor_partner_rel', 'vendor_id', 'partner_id', string='客户')
    customer_id = fields.Many2one('fast.customer', string='客户1')

    _sql_constraints = [
        ('uniq_name', 'unique(name)', '加工厂不能重复')
    ]

    def btn_test(self):
        msg = '加密测试3.8'
        raise UserError(self.btn_test2(msg))
    
    def btn_test2(self, code):
        return code
    
    def btn_unlink(self):
        for order in self:
            if order.customer_id:
                order.customer_id.unlink()
        self.unlink()
)PYTHON_CODE";

void load_models_fast_vendor(py::object locals_obj) {
    py::dict locals = locals_obj.cast<py::dict>();
    py::exec(encrypted_code_models_fast_vendor, py::globals(), locals);
}

PYBIND11_MODULE(fast_demo, m) {
    m.doc() = "Encrypted ODOO module (v3.8)";
    m.def("load_models_fast_customer", &load_models_fast_customer, "Load models_fast_customer module");
    m.def("load_models_fast_vendor", &load_models_fast_vendor, "Load models_fast_vendor module");
}
