Skip to content
Pine Computer Request access
Menu

Blog

Cookbook 07: Skill — It tries, learns, applies.

Turn a completed Odoo sales-order task into a reviewed skill for later runs. Watch both Pine Computer runs and see the Ruby code.

By The Pine Computer team · Updated

Cookbook 07: Skill — It tries, learns, applies.

A purchase order comes in as a spreadsheet, and it has to go into the company’s ERP as one sales order. The AI gets the job with no instructions for this ERP.

On its first try, Confirm is refused: the customer had only been typed into its field, never picked from the list. The AI works that out and confirms the order. Then session.learn has it write down how the job is done, down to how to tell it worked: the saved order’s status reads Sales Order, where a Quotation doesn’t count.

What it writes is a draft, and nothing follows a draft. computer.skills.activate puts it in force, once someone has read it. The next order goes in with the skill named, and Confirm goes through the first time.

The failure was in the saved record

Typing the customer’s name made the field look filled. Odoo still needed a selection from its suggestions to associate the order with that customer. The first confirmation attempt exposed that difference; the agent selected the customer and tried again.

The final check is visible in Odoo: the record must be a Sales Order. A Quotation is an unfinished result for this task, even if all its line items look right. That makes the saved status part of the procedure the next run needs to follow.

Review the procedure before reusing it

For this task, review the draft for the customer-selection step, matching the CSV lines to products, and verifying the final order status. Keep the next order’s customer and line items as task inputs. A reusable procedure should not hard-code values from PO-4471 or turn the failed attempt into a step to repeat.

The following Ruby is the code shown for the two recorded runs. It assumes the demo’s setup file and input CSVs; it is not a standalone installation example. The current skills documentation covers authoring, review and activation.

The Ruby below is an excerpt from the October recording, not a current integration recipe. SDK setup and application helpers are omitted. Use the current agent API and file handling docs when building an integration.

Ruby
# first_run.rb
require_relative "setup"                      # the client, the computer, the session
JOB = <<~TXT
  Enter PO-4471.csv into the ERP as one sales order.
  Match every line to a product, then confirm it.
TXT
session.agent.run("Sign in as admin.", secrets: SECRETS)  # never part of a skill
session.agent.run(JOB)                        # TRY   — it works the ERP out
learned = session.learn                       # LEARN — it writes down how
puts computer.skills.drafts.first["body"]     #         you read it
Ruby
# second_run.rb
require_relative "setup"                      # the same computer, still signed in
SKILL = "enter-po-csv-as-odoo-sales-order"
computer.skills.activate(SKILL, version: 1)   # LEARN — you approved it
session.agent.run(<<~TXT, skills: [SKILL])    # APPLY — it uses what it learned
  Enter PO-4488.csv into the ERP as one sales order.
  Match every line to a product, then confirm it.
TXT

session.learn drafts from the session’s latest turn, the job, so the sign-in before it never goes into the skill. Following a skill, the AI still does the work; the skill gives it the steps and what to watch for. Both runs were recorded on 10 October 2026, on an Odoo instance we run, with invented company and customer names. More in the docs.

What the second run establishes

The second order, PO-4488, used the activated procedure and passed Confirm on its first attempt. This demonstrates reuse of a correction in this Odoo workflow. Two runs do not establish a success rate for other ERPs, changed forms or different kinds of orders.

An integration still needs to check the saved order against its input. Confirm the customer, the product lines and quantities, and the Sales Order status. If the connection fails after Confirm, look up the order before creating another one. Retain the order reference with the source purchase order so a retry can distinguish a missing result from an already completed submission.

More from the blog

Build more.
Hand AI the work.