Skip to content

Commit

Permalink
Add usage instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
lasley committed May 8, 2017
1 parent c893f0e commit 466effc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 8 deletions.
32 changes: 31 additions & 1 deletion contract_auto/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,41 @@
Contract Auto
=============

This module adds automatic payment to contracts.
This module allows for the configuration of automatic payments on invoices that are created by a contract.

Usage
=====

Enable Automatic Payment
------------------------

* Navigate to a customer contract
* Check the `Auto Pay?` box to enable automatic payment
* Configure the options as desired
* Set the `Payment Token` to the payment token that should be used for automatic payment

Automatic Payment Settings
--------------------------

The following settings are available at both the contract and contract template level:

| Name | Description |
|------|-------------|
| Invoice Message | Message template that is used to send invoices to customers upon creation. |
| Payment Retry Message | Message template that is used to alert a customer that their automatic payment failed for some reason and will be retried. |
| Payment Fail Message | Message template that is used to alert a customer that their automatic payment failed and will no longer be retried. |
| Auto Pay Retries | Amount of times to attempt an automatic payment before discontinuing and removing the payment token from the contract/account payment method. |
| Auto Pay Retry Hours | Amount of hours that should lapse until retrying failed payments. |
Payment Token
-------------

A valid payment token is required to use this module. These tokens are typically created during the `website_sale` checkout process, but they can also be created manually at the acquirer.

A payment token can be defined in one of two areas:

* Contract - Defining a payment token in the contract will allow for the use of this token for automatic payments on this contract only.
* Partner - Defining a payment token in the partner will allow for the use of this token for automatic payments on all contracts for this partner that do not have a payment token defined.

.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
Expand Down
4 changes: 2 additions & 2 deletions contract_auto/models/account_analytic_contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ def _context_mail_templates(self):
return {
'default_model_id': default_model.id,
'default_email_from': "${(object.user_id.email and '%s <%s>' % "
"(object.user_id.name, object.user_id.email) "
"or '')|safe}",
"(object.user_id.name, object.user_id.email)"
" or '')|safe}",
'default_partner_to': '${object.partner_id.id}',
'default_lang': '${object.partner_id.lang}',
'default_auto_delete': True,
Expand Down
16 changes: 11 additions & 5 deletions contract_auto/views/account_analytic_account_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,29 @@
<field name="model">account.analytic.account</field>
<field name="inherit_id" ref="contract.account_analytic_account_recurring_form_form"/>
<field name="arch" type="xml">
<xpath expr="//label[@for='recurring_invoices']" position="after">
<br />
<field name="is_auto_pay" class="oe_inline"/>
<label for="is_auto_pay"/>
<xpath expr="//button[@name='contract.act_recurring_invoices']" position="after">
<br attrs="{'invisible': [('recurring_invoices','!=',True)]}" />
<field name="is_auto_pay"
class="oe_inline"
attrs="{'invisible': [('recurring_invoices','!=',True)]}"
/>
<label for="is_auto_pay"
attrs="{'invisible': [('recurring_invoices','!=',True)]}"
/>
</xpath>
<xpath expr="//label[@for='recurring_invoice_line_ids']" position="before">
<group name="group_auto_pay"
attrs="{'invisible': [('is_auto_pay', '=', False)]}"
>
<group>
<field name="payment_token_id" />
<field name="invoice_mail_template_id" />
<field name="pay_retry_mail_template_id" />
<field name="auto_pay_retry_hours" />
</group>
<group>
<field name="pay_fail_mail_template_id" />
<field name="auto_pay_retries" />
<field name="auto_pay_retry_hours" />
</group>
</group>
</xpath>
Expand Down

0 comments on commit 466effc

Please sign in to comment.