Skip to main content
Version: Tryton 7.0 (LTS)

sale

Tryton 7.0 · Reference generated from the official source code

This page combines editorial guidance with evidence extracted from the selected official branch. Always test the flow with your own permissions and configuration.

Purpose

The Sale Module helps organise and manage sales made by the company. It adds the concept of a sale to Tryton and allows it to be tracked through its states from draft to done. It also oversees the creation of customer shipments and invoices for the sales, and allows reports to be generated that contain aggregated sales figures.

The analysis found 11 Python files, 44 XML files, 54 views, 124 actions, 8 menus, and 1 reports.

Functional user guide

Who should use it

This module is relevant to people responsible for sale processes, company configuration, and result review. Administrators should participate whenever dependencies, permissions, or sequences are introduced.

What you will be able to do

After configuration, you will be able to identify the records added by sale, execute actions in the correct state, produce its reports, and understand the information shared with other modules.

Requirements and preparation

Before activation, verify company, currency, users, and groups. Install and configure required dependencies first. When real data exists, rehearse activation and upgrades on a restored copy.

Activate dependencies first, review company configuration, and rehearse the complete workflow before production use.

Required dependencies

  • account — must be installed and configured before testing this module.
  • account_invoice — must be installed and configured before testing this module.
  • account_invoice_stock — must be installed and configured before testing this module.
  • account_product — must be installed and configured before testing this module.
  • company — must be installed and configured before testing this module.
  • country — must be installed and configured before testing this module.
  • currency — must be installed and configured before testing this module.
  • ir — must be installed and configured before testing this module.
  • party — must be installed and configured before testing this module.
  • product — must be installed and configured before testing this module.
  • res — must be installed and configured before testing this module.
  • stock — must be installed and configured before testing this module.

Optional integrations

  • Activate the module and sign in again to load menus and permissions.
  • Review new company configuration options and defaults.
  • Assign groups to test users using least privilege.
  • Create small, verifiable master data before bulk imports.
  • Run one complete scenario from draft to final state and inspect related records.

Module objects and concepts

  • account.invoice: groups 2 model(s), including account.invoice, account.invoice.line. These records form the information users inspect or modify during the process.
  • party.erase: groups 1 model(s), including party.erase. These records form the information users inspect or modify during the process.
  • party.party: groups 3 model(s), including party.party, party.party.customer_currency, party.party.sale_method. These records form the information users inspect or modify during the process.
  • party.replace: groups 1 model(s), including party.replace. These records form the information users inspect or modify during the process.
  • product.configuration: groups 2 model(s), including product.configuration, product.configuration.default_lead_time. These records form the information users inspect or modify during the process.
  • product.lead_time: groups 1 model(s), including product.lead_time. These records form the information users inspect or modify during the process.
  • product.product: groups 1 model(s), including product.product. These records form the information users inspect or modify during the process.
  • product.sale: groups 1 model(s), including product.sale.context. These records form the information users inspect or modify during the process.
  • product.template: groups 1 model(s), including product.template. These records form the information users inspect or modify during the process.
  • sale.configuration: groups 3 model(s), including sale.configuration, sale.configuration.sale_method, sale.configuration.sequence. These records form the information users inspect or modify during the process.
  • sale.handle: groups 4 model(s), including sale.handle.invoice.exception, sale.handle.invoice.exception.ask, sale.handle.shipment.exception, sale.handle.shipment.exception.ask. These records form the information users inspect or modify during the process.
  • sale.line: groups 1 model(s), including sale.line. These records form the information users inspect or modify during the process.
  • sale.line-account: groups 1 model(s), including sale.line-account.tax. These records form the information users inspect or modify during the process.
  • sale.line-ignored-stock: groups 1 model(s), including sale.line-ignored-stock.move. These records form the information users inspect or modify during the process.
  • sale.line-recreated-stock: groups 1 model(s), including sale.line-recreated-stock.move. These records form the information users inspect or modify during the process.
  • sale.modify_header: groups 1 model(s), including sale.modify_header. These records form the information users inspect or modify during the process.
  • sale.open_customer: groups 1 model(s), including sale.open_customer. These records form the information users inspect or modify during the process.
  • sale.reporting: groups 21 model(s), including sale.reporting.context, sale.reporting.country, sale.reporting.country.subdivision, sale.reporting.country.subdivision.time_series, sale.reporting.country.time_series. These records form the information users inspect or modify during the process.
  • sale.return_sale: groups 2 model(s), including sale.return_sale, sale.return_sale.start. These records form the information users inspect or modify during the process.
  • sale.sale: groups 1 model(s), including sale.sale. These records form the information users inspect or modify during the process.
  • sale.sale-ignored-account: groups 1 model(s), including sale.sale-ignored-account.invoice. These records form the information users inspect or modify during the process.
  • sale.sale-recreated-account: groups 1 model(s), including sale.sale-recreated-account.invoice. These records form the information users inspect or modify during the process.
  • stock.move: groups 1 model(s), including stock.move. These records form the information users inspect or modify during the process.
  • stock.shipment: groups 2 model(s), including stock.shipment.out, stock.shipment.out.return. These records form the information users inspect or modify during the process.

Typical workflow

  1. Select the correct company and date before creating a document.
  2. Complete master data before lines or details.
  3. Use form buttons for state changes; saving is not the same as validating or posting.
  4. Review warnings, totals, related documents, and traceability.
  5. Generate the report and compare it with the record before delivery.

Actions, states, and wizards

  • cancel — action or transition that starts cancel. Check permissions, current state, and related records before running it.
  • confirm — action or transition that starts confirm. Check permissions, current state, and related records before running it.
  • draft — action or transition that starts draft. Check permissions, current state, and related records before running it.
  • handle_invoice_exception — action or transition that starts handle invoice exception. Check permissions, current state, and related records before running it.
  • handle_shipment_exception — action or transition that starts handle shipment exception. Check permissions, current state, and related records before running it.
  • manual_invoice — action or transition that starts manual invoice. Check permissions, current state, and related records before running it.
  • manual_shipment — action or transition that starts manual shipment. Check permissions, current state, and related records before running it.
  • modify_header — action or transition that starts modify header. Check permissions, current state, and related records before running it.
  • process — action or transition that starts process. Check permissions, current state, and related records before running it.
  • quote — action or transition that starts quote. Check permissions, current state, and related records before running it.
  • cancelled — action or transition that starts cancelled. Check permissions, current state, and related records before running it.
  • confirmed — action or transition that starts confirmed. Check permissions, current state, and related records before running it.
  • done — action or transition that starts done. Check permissions, current state, and related records before running it.
  • processing — action or transition that starts processing. Check permissions, current state, and related records before running it.
  • quotation — action or transition that starts quotation. Check permissions, current state, and related records before running it.
  • received — action or transition that starts received. Check permissions, current state, and related records before running it.
  • sale.handle.invoice.exception — wizard that collects data and performs sale › handle › invoice › exception. Check permissions, current state, and related records before running it.
  • sale.handle.shipment.exception.ask — wizard that collects data and performs sale › handle › shipment › exception › ask. Check permissions, current state, and related records before running it.
  • sale.modify_header — wizard that collects data and performs sale › modify header. Check permissions, current state, and related records before running it.
  • sale.open_customer — wizard that collects data and performs sale › open customer. Check permissions, current state, and related records before running it.
  • sale.reporting.country.tree.open — wizard that collects data and performs sale › reporting › country › tree › open. Check permissions, current state, and related records before running it.
  • sale.reporting.region.tree.open — wizard that collects data and performs sale › reporting › region › tree › open. Check permissions, current state, and related records before running it.
  • sale.return_sale.start — wizard that collects data and performs sale › return sale › start. Check permissions, current state, and related records before running it.

Controls before production

  • Define who creates, reviews, confirms, cancels, and reads.
  • Test closed periods, unauthorized users, and incomplete data.
  • Verify numbering, currency, rounding, and time zone where applicable.
  • Document error correction without direct database edits.
  • Include its tables and files in backup and restore procedures.

Troubleshooting

  • If a menu is missing, verify activation, module-list update, groups, and a new login session.
  • If a field rejects a value, inspect its domain, company, state, and configured dependencies.
  • If a button is hidden or disabled, check permissions and valid transitions; never change state with SQL.
  • If results differ, reproduce a minimal case and compare related records before and after.
  • Keep the full traceback, version, active modules, and minimal data needed to diagnose an error.

Developer guide

Architecture and extension points

The package contains 68 Python classes and declares or extends 55 models. It uses Boolean, Char, Date, Float, Function, Integer, Many2Many, Many2One, MultiValue, Numeric, One2Many, Reference, Selection, Text, TimeDelta. Developers should first determine whether a class creates a model or uses PoolMeta to extend one, preserve super() calls, and avoid duplicating dependency rules.

Registered or extended models

  • account.invoice
  • account.invoice.line
  • party.erase
  • party.party
  • party.party.customer_currency
  • party.party.sale_method
  • party.replace
  • product.configuration
  • product.configuration.default_lead_time
  • product.lead_time
  • product.product
  • product.sale.context
  • product.template
  • sale.configuration
  • sale.configuration.sale_method
  • sale.configuration.sequence
  • sale.handle.invoice.exception
  • sale.handle.invoice.exception.ask
  • sale.handle.shipment.exception
  • sale.handle.shipment.exception.ask
  • sale.line
  • sale.line-account.tax
  • sale.line-ignored-stock.move
  • sale.line-recreated-stock.move
  • sale.modify_header
  • sale.open_customer
  • sale.reporting.context
  • sale.reporting.country
  • sale.reporting.country.subdivision
  • sale.reporting.country.subdivision.time_series
  • sale.reporting.country.time_series
  • sale.reporting.country.tree
  • sale.reporting.country.tree.open
  • sale.reporting.customer
  • sale.reporting.customer.category
  • sale.reporting.customer.category.time_series
  • sale.reporting.customer.category.tree
  • sale.reporting.customer.time_series
  • sale.reporting.main
  • sale.reporting.main.time_series
  • sale.reporting.product
  • sale.reporting.product.category
  • sale.reporting.product.category.time_series
  • sale.reporting.product.category.tree
  • sale.reporting.product.time_series
  • sale.reporting.region.tree
  • sale.reporting.region.tree.open
  • sale.return_sale
  • sale.return_sale.start
  • sale.sale
  • sale.sale-ignored-account.invoice
  • sale.sale-recreated-account.invoice
  • stock.move
  • stock.shipment.out
  • stock.shipment.out.return

Field types used

  • Boolean
  • Char
  • Date
  • Float
  • Function
  • Integer
  • Many2Many
  • Many2One
  • MultiValue
  • Numeric
  • One2Many
  • Reference
  • Selection
  • Text
  • TimeDelta

Detected classes and public methods

Classes: Abstract, AbstractTimeseries, Configuration, ConfigurationSaleMethod, ConfigurationSequence, Context, Country, CountryMixin, CountryTimeseries, CountryTree, Customer, CustomerCategory, CustomerCategoryMixin, CustomerCategoryTimeseries, CustomerCategoryTree, CustomerMixin, CustomerTimeseries, DefaultLeadTime, Erase, HandleInvoiceException, HandleInvoiceExceptionAsk, HandleShipmentException, HandleShipmentExceptionAsk, Invoice, Line, Main, MainTimeseries, ModifyHeader, ModifyHeaderStateView, Move, OpenCountryTree, OpenCustomer, OpenRegionTree, Party, PartyCustomerCurrency, PartyLocationError, PartySaleMethod, Product, ProductCategory, ProductCategoryMixin, ProductCategoryTimeseries, ProductCategoryTree, ProductLeadTime, ProductMixin, ProductTimeseries, RegionTree, Replace, ReturnSale, ReturnSaleStart, Sale, SaleConfirmError, SaleContext, SaleIgnoredInvoice, SaleLine, SaleLineIgnoredMove, SaleLineRecreatedMove, SaleLineTax, SaleMoveQuantity, SaleQuotationError, SaleRecreatedInvoice, SaleReport, SaleValidationError, ShipmentOut, ShipmentOutReturn, Subdivision, SubdivisionMixin, SubdivisionTimeseries, Template

Methods: cancel(), check_erase_company(), check_for_quotation(), check_method(), check_move_quantity(), check_origin_types(), compute_shipping_date(), compute_taxes(), compute_unit_price(), confirm(), copy(), create(), create_invoice(), create_shipment(), default(), default_ask(), default_company(), default_currency(), default_from_date(), default_invoice_method(), default_invoice_state(), default_locations(), default_payment_term(), default_period(), default_sale_invoice_method(), default_sale_sequence(), default_sale_shipment_method(), default_shipment_method(), default_shipment_state(), default_state(), default_to_date(), default_type(), default_warehouse(), delete(), delivery_full_address(), do(), do_open_(), do_return_(), do_start(), done(), draft(), execute(), fields_to_replace(), full_number(), func(), get_amount(), get_context(), get_cost_price(), get_currency(), get_defaults(), get_from_location(), get_invoice_line(), get_invoice_state(), get_invoices(), get_move(), get_move_product_types(), get_moves(), get_moves_exception(), get_moves_progress(), get_name(), get_origin(), get_rec_name(), get_resources_to_copy(), get_sale(), get_sale_exception_state(), get_sale_price(), get_sale_price_uom(), get_sale_states(), get_sales(), get_shipment_state(), get_tax_amount(), get_time_series(), get_to_location(), get_total(), get_trend(), get_view(), get_warehouse(), handle_invoice_exception(), handle_shipment_exception(), is_done(), lead_time_used(), manual_invoice(), manual_shipment(), method(), modify_header(), multivalue_model(), on_change_company(), on_change_default_uom(), on_change_invoice_party(), on_change_lines(), on_change_party(), on_change_product(), on_change_quantity(), on_change_sale(), on_change_shipment_party(), on_change_taxes(), on_change_type(), on_change_unit(), on_change_with_amount(), on_change_with_company()

Code map

Detected 11 Python files, 44 XML files, and 0 explicit access files. XML connects models to views, menus, actions, and reports; access CSV files establish initial permissions.

  • __init__.py
  • configuration.py
  • configuration.xml
  • doc/conf.py
  • exceptions.py
  • invoice.py
  • invoice.xml
  • message.xml
  • party.py
  • party.xml
  • product.py
  • product.xml
  • sale.py
  • sale.xml
  • sale_reporting.py
  • sale_reporting.xml
  • setup.py
  • stock.py
  • stock.xml
  • view/configuration_form.xml
  • view/handle_invoice_exception_ask_form.xml
  • view/handle_shipment_exception_ask_form.xml
  • view/modify_header_form.xml
  • view/move_list_shipment.xml
  • view/party_form.xml
  • view/product_configuration_form.xml
  • view/product_list_sale_line.xml
  • view/product_sale_context_form.xml
  • view/return_sale_start_form.xml
  • view/sale_form.xml
  • view/sale_line_form.xml
  • view/sale_line_tree.xml
  • view/sale_line_tree_sequence.xml
  • view/sale_reporting_context_form.xml
  • view/sale_reporting_country_tree.xml
  • view/sale_reporting_customer_category_list.xml
  • view/sale_reporting_customer_category_tree.xml
  • view/sale_reporting_customer_graph_number.xml
  • view/sale_reporting_customer_graph_revenue.xml
  • view/sale_reporting_customer_list.xml
  • view/sale_reporting_main_graph_number.xml
  • view/sale_reporting_main_graph_revenue.xml
  • view/sale_reporting_main_list.xml
  • view/sale_reporting_main_time_series_graph_number.xml
  • view/sale_reporting_main_time_series_graph_revenue.xml
  • view/sale_reporting_main_time_series_list.xml
  • view/sale_reporting_product_category_list.xml
  • view/sale_reporting_product_category_tree.xml
  • view/sale_reporting_product_graph_number.xml
  • view/sale_reporting_product_graph_revenue.xml

Test plan

  • Activation on an empty database and upgrade from the previous revision.
  • Create, update, copy, and delete according to state and access rights.
  • Every button, transition, and wizard with valid and invalid scenarios.
  • Applicable multi-company rules, translations, time zones, and currencies.
  • Combined installation with required and optional dependencies.
  • Backup and restore of records, attachments, and generated reports.

Compatibility and upgrades

Keep server and modules on series 7.0. Before upgrading, compare tryton.cfg, __register__ migrations, state changes, XML IDs, and permissions. A successful build does not replace a rehearsed migration or functional data reconciliation.

Official documentation evidence

Topics found: Design · Sale · Reports · Sale Report · Wizards · Handle Shipment Exception · Handle Invoice Exception · Modify Header · Return Sale · Sale Context · Sale Reporting · By Customer · By Product · By Category · By Region · By Country · By Subdivision · Configuration · Sale Module · Usage · Listing customers · Making products salable · Finding sale prices and availability · Creating a sales order · Changing a sales order · Shipping a sale · Part shipments · Invoicing a sale · Handling shipment and invoice exceptions · Finishing a sale · Getting sales data · Cancelling sales · Handling customer returns

    • doc/design.rst: The Sale Module introduces the concepts that are required to manage sales. It also extends existing concepts so sales become an fully integrated part of the system.
    • doc/index.rst: The Sale Module helps organise and manage sales made by the company. It adds the concept of a sale to Tryton and allows it to be tracked through its states from draft to done. It also oversees the creation of customer shipments and invoices for the sales, and allows reports to be generated that contain aggregated sales figures.
    • doc/usage/index.rst: Configuration, management, and reporting tasks relating to sales can be found under the [Sales] main menu item.
    • doc/usage/presales.rst: In Tryton, by definition, the Parties <party:model-party.party> that have bought Products <product:concept-product> from your Company <company:model-company.company> are its customers. The Sale Module lets you get a list of these from the [Parties --> Parties --> Associated to Sales] main menu item.
    • doc/usage/process.rst: Creating a new sales order is simply a matter of creating a new Sale <model-sale.sale> and adding the lines that are required. Most of the fields are optional or have sensible default values.
    • doc/usage/reporting.rst: You can analyse aggregated sales data using the items found under the [Sales --> Reporting] main menu item. These Sales Reports <concept-sale.reporting> allow you to view sales grouped by a range of different factors.
    • doc/usage/returns.rst: You can easily cancel Sales <model-sale.sale> that are not yet confirmed using the Cancel button.

View source code