sale_gift_card
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 Gift Card Module manages the selling and redeeming of gift cards.
The analysis found 8 Python files, 17 XML files, 13 views, 11 actions, 1 menus, and 2 reports.
Functional user guide
Who should use it
This module is relevant to people responsible for sale gift card 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_gift_card, 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.company— 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.product— must be installed and configured before testing this module.sale— must be installed and configured before testing this module.stock— must be installed and configured before testing this module.
Optional integrations
sale_point— enables an additional integration; test the combination explicitly.
Recommended initial configuration
- 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.account: groups 2 model(s), including
account.account.type,account.account.type.template. These records form the information users inspect or modify during the process. - account.configuration: groups 2 model(s), including
account.configuration,account.configuration.gift_card_account. These records form the information users inspect or modify during the process. - account.invoice: groups 1 model(s), including
account.invoice.line. 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.template: groups 1 model(s), including
product.template. These records form the information users inspect or modify during the process. - sale.configuration: groups 2 model(s), including
sale.configuration,sale.configuration.gift_card.sequence. These records form the information users inspect or modify during the process. - sale.gift_card: groups 2 model(s), including
sale.gift_card,sale.gift_card.email. 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.point: groups 4 model(s), including
sale.point.sale,sale.point.sale.line,sale.point.sale.pay,sale.point.sale.pay.gift_card. 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. - stock.move: groups 1 model(s), including
stock.move. These records form the information users inspect or modify during the process.
Typical workflow
- Select the correct company and date before creating a document.
- Complete master data before lines or details.
- Use form buttons for state changes; saving is not the same as validating or posting.
- Review warnings, totals, related documents, and traceability.
- Generate the report and compare it with the record before delivery.
Actions, states, and wizards
done— action or transition that starts done. 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.sale.point.sale.line— wizard that collects data and performs sale › point › sale › line. 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 23 Python classes and declares or extends 18 models. It uses Boolean, Char, Function, Many2One, MultiValue, One2Many, Reference. 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.account.typeaccount.account.type.templateaccount.configurationaccount.configuration.gift_card_accountaccount.invoice.lineproduct.productproduct.templatesale.configurationsale.configuration.gift_card.sequencesale.gift_cardsale.gift_card.emailsale.linesale.point.salesale.point.sale.linesale.point.sale.paysale.point.sale.pay.gift_cardsale.salestock.move
Field types used
BooleanCharFunctionMany2OneMultiValueOne2ManyReference
Detected classes and public methods
Classes: AccountType, AccountTypeTemplate, Configuration, ConfigurationGiftCardAccount, ConfigurationGiftCardSequence, GiftCard, GiftCardEmail, GiftCardLineValidationError, GiftCardReport, GiftCardValidationError, GiftCard_POS, InvoiceLine, Line, Move, MoveGiftCardValidationError, POSPay, POSPayGiftCard, POSSale, POSSaleLine, Product, Sale, Template, _LineMixin
Methods: account_expense_used(), account_revenue_used(), add_return_gift_cards(), check_valid_email(), default_company(), default_gift_card(), do(), get_gift_cards(), get_origin(), get_rec_name(), get_return_gift_card_line(), get_spent_on(), multivalue_model(), on_change_gift_card(), on_change_origin(), on_change_with_currency(), on_change_with_gift_cards_required(), on_change_with_is_gift_card(), on_change_with_is_gift_card_service(), on_change_with_total(), order_number(), process(), quote(), send(), transition_add_gift_card(), validate_fields(), view_attributes()
Code map
Detected 8 Python files, 17 XML files, and 0 explicit access files. XML connects models to views, menus, actions, and reports; access CSV files establish initial permissions.
__init__.pyaccount.pyaccount.xmldoc/conf.pyexceptions.pymessage.xmlproduct.pyproduct.xmlsale.pysale.xmlsetup.pystock.pystock.xmlview/account_configuration_form.xmlview/account_type_form.xmlview/configuration_form.xmlview/gift_card_form.xmlview/gift_card_list.xmlview/move_form.xmlview/sale_form.xmlview/sale_line_form.xmlview/sale_point_sale_form.xmlview/sale_point_sale_line_form.xmlview/sale_point_sale_pay_gift_card_form.xmlview/template_form.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 · Product · Gift Card · Sale · Stock Move · Sale Gift Card Module · Usage · Selling gift cards · Redeeming gift card
-
- doc/design.rst: The Sale Gift Card Module introduces or extends the following concepts.
-
- doc/index.rst: The Sale Gift Card Module manages the selling and redeeming of gift cards.
-
- doc/usage.rst: A gift card
Product <concept-product>can sold on aSale <sale:model-sale.sale>. When it is a service, theGift Card <model-sale.gift_card>are created and sent automatically by email to the email address from the sale line or, if this has not been filled in, to the customer's email address. When the Product is goods, the Gift Cards must be linked to the outgoingStock Moves <model-stock.move>that send the gift card to the customer.
- doc/usage.rst: A gift card