Automates the complete procure-to-pay workflow including vendor setup, RFQ creation, PO confirmation, receipt processing, vendor bill, and payment.
Use this skill to simulate a full purchasing cycle (procure-to-pay). This covers vendor creation, RFQ, PO confirmation, receipt validation, vendor bill posting, and payment registration.
skip_sms context.account.move (in_invoice).# Run the full purchase population (creates vendors, POs, receipts, bills, payments)
python3 scripts/populate_purchase.py
# Run the Exercise 1 purchase workflow (basic RFQ + confirm)
python3 scripts/exercise_1_purchase.py
# Setup product categories + Cost UoM + packaging (run BEFORE purchase scripts)
python3 scripts/setup_products_categories.py
from scripts.config import create
vendor_id = create('res.partner', {
'name': "Vendor Co.",
'email': "[email protected]",
'supplier_rank': 1,
'company_type': 'company',
})
from scripts.config import create
rfq_id = create('purchase.order', {
'partner_id': vendor_id,
})
create('purchase.order.line', {
'order_id': rfq_id,
'product_id': product_id,
'product_qty': 10,
'price_unit': 100.00,
})
from scripts.config import call_button
call_button('purchase.order', [rfq_id], 'button_confirm')
print(f"Confirmed PO: {rfq_id}")
from scripts.config import search_read, read, write, execute_kw
# Find pending receipts
pickings = search_read('stock.picking',
[('purchase_id', '=', rfq_id), ('state', 'not in', ['done', 'cancel'])],
['id', 'name', 'move_ids']
)
picking_id = pickings[0]['id']
# Set quantity done (Odoo 19: use 'quantity' not 'quantity_done')
for move_id in pickings[0]['move_ids']:
move_data = read('stock.move', [move_id], ['product_uom_qty'])[0]
write('stock.move', move_id, {'quantity': move_data['product_uom_qty']})
# Validate -- MUST use execute_kw with skip_sms context (NOT call_button)
execute_kw('stock.picking', 'button_validate', [[picking_id]],
{'context': {'skip_sms': True, 'skip_backorder': False}})
Important: Do NOT use call_button(...) for button_validate on stock pickings --
it cannot pass context, and the SMS wizard will block execution in Odoo 19.
from scripts.config import call_button, write