コード例 #1
0
        public static IProduct[] GetProducts(this OdooRpcClient odooRpcClient, long?companyId = null, DateTime?createdAfter = null)
        {
            OdooDomainFilter filter = new OdooDomainFilter();

            if (companyId.HasValue)
            {
                filter = filter.Filter("company_id", "=", companyId.Value);
            }

            if (createdAfter.HasValue)
            {
                filter = filter.Filter("create_date", ">", createdAfter.Value);
            }

            Task <JObject[]> task1 = odooRpcClient.Get <JObject[]>(new OdooSearchParameters(Product.MODEL));

            task1.Wait();

            Task <Product[]> task = odooRpcClient.Get <Product[]>(
                new OdooSearchParameters(
                    Product.MODEL,
                    filter
                    )
                );

            task.Wait();

            List <Product> products = task.Result.ToList();

            products.ForEach(product => product.OdooRpcClient = odooRpcClient);

            return(products.ToArray());
        }
コード例 #2
0
ファイル: RpcHelperOrders.cs プロジェクト: dtorresxp/odoonet
        public static OrderLine[] GetPosOrderLines(this OdooRpcClient odooRpcClient, long orderId)
        {
            OdooDomainFilter filter = new OdooDomainFilter().Filter("order_id", "=", orderId);

            Task <JObject[]> task1 = odooRpcClient.Get <JObject[]>(new OdooSearchParameters(OrderLine.MODEL, filter));

            task1.Wait();

            Task <OrderLine[]> task = odooRpcClient.Get <OrderLine[]>(new OdooSearchParameters(OrderLine.MODEL, filter));

            task.Wait();

            List <OrderLine> posOrderLines = task.Result.ToList();

            posOrderLines.ForEach(posOrderLine =>
            {
                posOrderLine.OdooRpcClient = odooRpcClient;
            });

            return(posOrderLines.ToArray());
        }
コード例 #3
0
        public static Company[] GetCompanies(this OdooRpcClient odooRpcClient)
        {
            Task <Company[]> task = odooRpcClient.Get <Company[]>(new OdooSearchParameters(model: Company.MODEL));

            task.Wait();

            List <Company> companies = task.Result.ToList();

            companies.ForEach(company => company.OdooRpcClient = odooRpcClient);

            return(companies.ToArray());
        }
コード例 #4
0
ファイル: RpcHelperOrders.cs プロジェクト: dtorresxp/odoonet
        public static Order[] GetPosOrders(this OdooRpcClient odooRpcClient, long?companyId = null, long?terminalId = null, long?sessionId = null, DateTime?createdAfter = null, DateTime?createdBefore = null)
        {
            OdooDomainFilter filter = new OdooDomainFilter();

            if (companyId.HasValue)
            {
                filter = filter.Filter("company_id", "=", companyId.Value);
            }
            if (terminalId.HasValue)
            {
                filter = filter.Filter("config_id", "=", terminalId.Value);
            }
            if (sessionId.HasValue)
            {
                filter = filter.Filter("session_id", "=", sessionId.Value);
            }
            if (createdAfter.HasValue)
            {
                filter = filter.Filter("create_date", ">", createdAfter.Value);
            }
            if (createdBefore.HasValue)
            {
                filter = filter.Filter("create_date", "<", createdBefore.Value);
            }

            Task <JObject[]> task1 = odooRpcClient.Get <JObject[]>(new OdooSearchParameters(model: Order.MODEL, domainFilter: filter));

            task1.Wait();

            Task <Order[]> task = odooRpcClient.Get <Order[]>(new OdooSearchParameters(model: Order.MODEL, domainFilter: filter));

            task.Wait();

            List <Order> posOrders = task.Result.ToList();

            posOrders.ForEach(posOrders => posOrders.OdooRpcClient = odooRpcClient);


            return(posOrders.ToArray());
        }
コード例 #5
0
        public static Terminal[] GetTerminals(this OdooRpcClient odooRpcClient, long companyId)
        {
            OdooDomainFilter filter = new OdooDomainFilter().Filter("company_id", "=", companyId);

            Task <Terminal[]> task = odooRpcClient.Get <Terminal[]>(new OdooSearchParameters(Terminal.MODEL, filter));

            task.Wait();

            List <Terminal> terminals = task.Result.ToList();

            terminals.ForEach(terminal => terminal.OdooRpcClient = odooRpcClient);

            return(terminals.ToArray());
        }
コード例 #6
0
        public static Company GetCompany(this OdooRpcClient odooRpcClient, string name)
        {
            Task <Company[]> task = odooRpcClient.Get <Company[]>(
                new OdooSearchParameters(
                    model: Company.MODEL,
                    domainFilter: new OdooDomainFilter().Filter("name", "=", name)
                    )
                );

            task.Wait();

            List <Company> companies = task.Result.ToList();

            companies.ForEach(company => company.OdooRpcClient = odooRpcClient);

            return(task.Result.FirstOrDefault());
        }
コード例 #7
0
        public static Terminal GetTerminal(this OdooRpcClient odooRpcClient, long companyId, string terminalName)
        {
            OdooDomainFilter filter = new OdooDomainFilter()
                                      .Filter("company_id", "=", companyId)
                                      .Filter("display_name", "=", terminalName);


            Task <Terminal[]> task = odooRpcClient.Get <Terminal[]>(new OdooSearchParameters(Terminal.MODEL, filter));

            task.Wait();

            Terminal terminal = task.Result.FirstOrDefault();

            if (terminal != null)
            {
                terminal.OdooRpcClient = odooRpcClient;
            }

            return(terminal);
        }
コード例 #8
0
        public static Session[] GetSessions(this OdooRpcClient odooRpcClient, long terminalId, DateTime?createdAfter = null, DateTime?createdBefore = null, DateTime?openedAfter = null, DateTime?openedBefore = null, DateTime?closedAfter = null, DateTime?closedBefore = null)
        {
            OdooDomainFilter filter = new OdooDomainFilter().Filter("config_id", "=", terminalId);

            if (createdAfter.HasValue)
            {
                filter = filter.Filter("create_date", ">", createdAfter.Value);
            }
            if (createdBefore.HasValue)
            {
                filter = filter.Filter("create_date", "<", createdBefore.Value);
            }
            if (openedAfter.HasValue)
            {
                filter = filter.Filter("start_at", ">", openedAfter.Value);
            }
            if (openedBefore.HasValue)
            {
                filter = filter.Filter("start_at", "<", openedBefore.Value);
            }
            if (closedAfter.HasValue)
            {
                filter = filter.Filter("stop_at", ">", closedAfter.Value);
            }
            if (closedBefore.HasValue)
            {
                filter = filter.Filter("stop_at", "<", closedBefore.Value);
            }


            Task <Session[]> task = odooRpcClient.Get <Session[]>(new OdooSearchParameters(Session.MODEL, filter));

            task.Wait();

            List <Session> sessions = task.Result.ToList();

            sessions.ForEach(session => session.OdooRpcClient = odooRpcClient);


            return(sessions.ToArray());
        }