Skip to content

Commit

Permalink
[MIG] Contract Payment Mode to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ThomasBinsfeld committed Jan 16, 2019
1 parent 120f166 commit f952618
Show file tree
Hide file tree
Showing 14 changed files with 533 additions and 26 deletions.
64 changes: 46 additions & 18 deletions contract_payment_mode/README.rst
Original file line number Diff line number Diff line change
@@ -1,14 +1,38 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

=====================
Contract Payment Mode
=====================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github
:target: https://github.com/OCA/contract/tree/12.0/contract_payment_mode
:alt: OCA/contract
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-contract_payment_mode
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/110/12.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module allows to set a payment mode on contract for creating the invoices
with this payment mode.

**Table of contents**

.. contents::
:local:

Configuration
=============

Expand All @@ -27,43 +51,47 @@ Usage
#. Add a product to invoice.
#. If you create an invoice, new invoice will have the selected payment mode.


.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
:alt: Try me on Runbot
:target: https://runbot.odoo-community.org/runbot/110/11.0

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
In case of trouble, please
check there if your issue has already been reported. If you spotted it first,
help us smash it by providing detailed and welcomed feedback.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us smashing it by providing a detailed and welcomed
`feedback <https://github.com/OCA/contract/issues/new?body=module:%20contract_payment_mode%0Aversion:%2012.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
~~~~~~~

* Domatix
* Tecnativa

Contributors
------------
~~~~~~~~~~~~

* Ángel Moya <angel.moya@domatix.com>
* Antonio Espinosa <antonioea@antiun.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
* Carlos Dauden <carlos.dauden@tecnativa.com>

Maintainers
~~~~~~~~~~~

Maintainer
----------
This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

This module is maintained by the OCA.

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

To contribute to this module, please visit https://odoo-community.org.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/12.0/contract_payment_mode>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 1 addition & 1 deletion contract_payment_mode/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
'name': 'Contract Payment Mode',
'summary': 'Payment mode in contracts and their invoices',
'version': '11.0.1.0.0',
'version': '12.0.1.0.0',
'author': 'Domatix, '
'Tecnativa, '
'Odoo Community Association (OCA)',
Expand Down
6 changes: 4 additions & 2 deletions contract_payment_mode/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@ class AccountAnalyticAccount(models.Model):
comodel_name='account.payment.mode',
string='Payment Mode',
domain=[('payment_type', '=', 'inbound')],
index=True,
)

@api.onchange('partner_id')
def on_change_partner_id(self):
self.payment_mode_id = self.partner_id.customer_payment_mode_id.id

@api.multi
def _prepare_invoice(self):
invoice_vals = super(AccountAnalyticAccount, self)._prepare_invoice()
def _prepare_invoice(self, date_invoice, journal=None):
invoice_vals = super(AccountAnalyticAccount, self)._prepare_invoice(
date_invoice=date_invoice, journal=journal)
if self.payment_mode_id:
invoice_vals['payment_mode_id'] = self.payment_mode_id.id
invoice = self.env['account.invoice'].new(invoice_vals)
Expand Down
1 change: 1 addition & 0 deletions contract_payment_mode/readme/CONFIGURE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Your user should be a Sales Manager or Accountant.
5 changes: 5 additions & 0 deletions contract_payment_mode/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
* Ángel Moya <angel.moya@domatix.com>
* Antonio Espinosa <antonioea@antiun.com>
* Vicent Cubells <vicent.cubells@tecnativa.com>
* David Vidal <david.vidal@tecnativa.com>
* Carlos Dauden <carlos.dauden@tecnativa.com>
2 changes: 2 additions & 0 deletions contract_payment_mode/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module allows to set a payment mode on contract for creating the invoices
with this payment mode.
9 changes: 9 additions & 0 deletions contract_payment_mode/readme/USAGE.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#. Go to *Accounting > Sales > Contracts*.
#. Create one.
#. Select a partner to which invoice.
#. If the partner has a payment mode, this payment mode is selected here.
#. If not, or if you want another payment mode, you can change it in the
corresponding field.
#. Click on **Generate recurring invoices automatically** checkbox.
#. Add a product to invoice.
#. If you create an invoice, new invoice will have the selected payment mode.
Loading

0 comments on commit f952618

Please sign in to comment.