Automates the complete order-to-cash workflow including customer setup, quotation creation, SO confirmation, delivery, invoicing, and payment.
Use this skill to simulate a full sales cycle (order-to-cash). This covers customer creation, quotation, SO confirmation, delivery validation, invoice creation via wizard, posting, and payment registration.
skip_sms context.sale.advance.payment.inv wizard (NOT private _create_invoices).account.move after setting invoice_date.# Run the full sales population (creates customers, SOs, deliveries, invoices, payments)
python3 scripts/populate_sales.py
# Setup product categories + Cost UoM + packaging (run BEFORE sales scripts)
python3 scripts/setup_products_categories.py
from scripts.config import create
customer_id = create('res.partner', {
'name': "New Customer LLC",
'email': "[email protected]",
'customer_rank': 1,
'company_type': 'company',
})
print(f"Created customer ID: {customer_id}")
from scripts.config import create
so_id = create('sale.order', {
'partner_id': customer_id,
})
create('sale.order.line', {
'order_id': so_id,
'product_id': product_id,
'product_uom_qty': 5,
'price_unit': 150.00,
})
print(f"Created Quotation ID: {so_id}")
from scripts.config import call_button
call_button('sale.order', [so_id], 'action_confirm')
print(f"Confirmed SO ID: {so_id}")
from scripts.config import search_read, read, write, execute_kw
# Find pending delivery
pickings = search_read('stock.picking',
[('sale_id', '=', so_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}})
print(f"Validated delivery {picking_id}")
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