Skip to content

Commit 9bd1a57

Browse files
authored
Merge pull request #71 from Tecnativa/10.0-mig-contract_payment_mode
[MIG] contract_payment_mode: Migration to 10.0
2 parents 71cef02 + 99497e3 commit 9bd1a57

30 files changed

Lines changed: 870 additions & 15 deletions

contract_payment_mode/README.rst

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
2+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
3+
:alt: License: AGPL-3
4+
5+
=====================
6+
Contract Payment Mode
7+
=====================
8+
9+
This module allows to set a payment mode on contract for creating the invoices
10+
with this payment mode.
11+
12+
Configuration
13+
=============
14+
15+
Your user should be a Sales Manager or Accountant.
16+
17+
Usage
18+
=====
19+
20+
#. Go to *Accounting > Sales > Contracts*.
21+
#. Create one.
22+
#. Select a partner to which invoice.
23+
#. If the partner has a payment mode, this payment mode is selected here.
24+
#. If not, or if you want another payment mode, you can change it in the
25+
corresponding field.
26+
#. Click on **Generate recurring invoices automatically** checkbox.
27+
#. Add a product to invoice.
28+
#. If you create an invoice, new invoice will have the selected payment mode.
29+
30+
31+
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
32+
:alt: Try me on Runbot
33+
:target: https://runbot.odoo-community.org/runbot/110/10.0
34+
35+
Bug Tracker
36+
===========
37+
38+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/contract/issues>`_.
39+
In case of trouble, please
40+
check there if your issue has already been reported. If you spotted it first,
41+
help us smash it by providing detailed and welcomed feedback.
42+
43+
Credits
44+
=======
45+
46+
Contributors
47+
------------
48+
49+
* Ángel Moya <angel.moya@domatix.com>
50+
* Antonio Espinosa <antonioea@antiun.com>
51+
* Vicent Cubells <vicent.cubells@tecnativa.com>
52+
* David Vidal <david.vidal@tecnativa.com>
53+
54+
55+
Maintainer
56+
----------
57+
58+
.. image:: https://odoo-community.org/logo.png
59+
:alt: Odoo Community Association
60+
:target: https://odoo-community.org
61+
62+
This module is maintained by the OCA.
63+
64+
OCA, or the Odoo Community Association, is a nonprofit organization whose
65+
mission is to support the collaborative development of Odoo features and
66+
promote its widespread use.
67+
68+
To contribute to this module, please visit https://odoo-community.org.

contract_payment_mode/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# -*- coding: utf-8 -*-
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
4+
from . import models
5+
from .hooks import post_init_hook
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2015 Domatix (<www.domatix.com>)
3+
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
4+
# Copyright 2017 Tecnativa - Vicent Cubells
5+
# Copyright 2017 Tecnativa - David Vidal
6+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
7+
8+
{
9+
'name': 'Contract Payment Mode',
10+
'summary': 'Payment mode in contracts and their invoices',
11+
'version': '10.0.1.0.0',
12+
'author': 'Domatix, '
13+
'Tecnativa, '
14+
'Odoo Community Association (OCA)',
15+
'website': 'http://www.domatix.com',
16+
'depends': [
17+
'contract',
18+
'account_payment_partner'
19+
],
20+
'category': 'Sales Management',
21+
'license': 'AGPL-3',
22+
'data': [
23+
'views/contract_view.xml',
24+
],
25+
'post_init_hook': 'post_init_hook',
26+
'installable': True,
27+
'auto_install': True,
28+
}

contract_payment_mode/hooks.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# -*- coding: utf-8 -*-
2+
# Copyright 2016 Antiun Ingenieria S.L. - Antonio Espinosa
3+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
4+
5+
from odoo import api, SUPERUSER_ID
6+
import logging
7+
8+
_logger = logging.getLogger(__name__)
9+
10+
11+
def post_init_hook(cr, registry):
12+
"""Copy payment mode from partner to the new field at contract."""
13+
with api.Environment.manage():
14+
env = api.Environment(cr, SUPERUSER_ID, {})
15+
m_contract = env['account.analytic.account']
16+
contracts = m_contract.search([
17+
('payment_mode_id', '=', False),
18+
])
19+
if contracts:
20+
_logger.info('Setting payment mode: %d contracts' %
21+
len(contracts))
22+
for contract in contracts:
23+
payment_mode = contract.partner_id.customer_payment_mode_id
24+
if payment_mode:
25+
contract.payment_mode_id = payment_mode.id
26+
_logger.info('Setting payment mode: Done')

contract_payment_mode/i18n/ca.po

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
# OCA Transbot <transbot@odoo-community.org>, 2017
7+
# Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017
8+
msgid ""
9+
msgstr ""
10+
"Project-Id-Version: Odoo Server 9.0c\n"
11+
"Report-Msgid-Bugs-To: \n"
12+
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
13+
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
14+
"Last-Translator: Marc Tormo i Bochaca <mtbochaca@gmail.com>, 2017\n"
15+
"Language-Team: Catalan (https://www.transifex.com/oca/teams/23907/ca/)\n"
16+
"MIME-Version: 1.0\n"
17+
"Content-Type: text/plain; charset=UTF-8\n"
18+
"Content-Transfer-Encoding: \n"
19+
"Language: ca\n"
20+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
21+
22+
#. module: contract_payment_mode
23+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
24+
msgid "Analytic Account"
25+
msgstr "Compte analític"
26+
27+
#. module: contract_payment_mode
28+
#: model:ir.model.fields,field_description:contract_payment_mode.field_account_analytic_account_payment_mode_id
29+
msgid "Payment Mode"
30+
msgstr "Forma de pagament "

contract_payment_mode/i18n/de.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
# OCA Transbot <transbot@odoo-community.org>, 2017
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: Odoo Server 9.0c\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
12+
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
13+
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
14+
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: \n"
18+
"Language: de\n"
19+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
20+
21+
#. module: contract_payment_mode
22+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
23+
msgid "Analytic Account"
24+
msgstr "Kostenstelle"
25+
26+
#. module: contract_payment_mode
27+
#: model:ir.model.fields,field_description:contract_payment_mode.field_account_analytic_account_payment_mode_id
28+
msgid "Payment Mode"
29+
msgstr "Zahlweise"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
msgid ""
7+
msgstr ""
8+
"Project-Id-Version: contract (8.0)\n"
9+
"Report-Msgid-Bugs-To: \n"
10+
"POT-Creation-Date: 2016-11-07 03:42+0000\n"
11+
"PO-Revision-Date: 2015-11-07 12:33+0000\n"
12+
"Last-Translator: <>\n"
13+
"Language-Team: Greek (Greece) (http://www.transifex.com/oca/OCA-contract-8-0/language/el_GR/)\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Language: el_GR\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
20+
#. module: contract_payment_mode
21+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
22+
msgid "Analytic Account"
23+
msgstr "Αναλυτικός Λογαριασμός"
24+
25+
#. module: contract_payment_mode
26+
#: field:account.analytic.account,payment_mode_id:0
27+
msgid "Payment Mode"
28+
msgstr ""

contract_payment_mode/i18n/es.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
# OCA Transbot <transbot@odoo-community.org>, 2017
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: Odoo Server 9.0c\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
12+
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
13+
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
14+
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: \n"
18+
"Language: es\n"
19+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
20+
21+
#. module: contract_payment_mode
22+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
23+
msgid "Analytic Account"
24+
msgstr "Cuenta analítica"
25+
26+
#. module: contract_payment_mode
27+
#: model:ir.model.fields,field_description:contract_payment_mode.field_account_analytic_account_payment_mode_id
28+
msgid "Payment Mode"
29+
msgstr "Modo de pago"
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
msgid ""
7+
msgstr ""
8+
"Project-Id-Version: contract (8.0)\n"
9+
"Report-Msgid-Bugs-To: \n"
10+
"POT-Creation-Date: 2016-12-03 01:11+0000\n"
11+
"PO-Revision-Date: 2015-11-07 12:33+0000\n"
12+
"Last-Translator: <>\n"
13+
"Language-Team: Spanish (Mexico) (http://www.transifex.com/oca/OCA-contract-8-0/language/es_MX/)\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Language: es_MX\n"
18+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
19+
20+
#. module: contract_payment_mode
21+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
22+
msgid "Analytic Account"
23+
msgstr "Cuenta analítica"
24+
25+
#. module: contract_payment_mode
26+
#: field:account.analytic.account,payment_mode_id:0
27+
msgid "Payment Mode"
28+
msgstr ""

contract_payment_mode/i18n/fi.po

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * contract_payment_mode
4+
#
5+
# Translators:
6+
# OCA Transbot <transbot@odoo-community.org>, 2017
7+
msgid ""
8+
msgstr ""
9+
"Project-Id-Version: Odoo Server 9.0c\n"
10+
"Report-Msgid-Bugs-To: \n"
11+
"POT-Creation-Date: 2017-04-01 02:46+0000\n"
12+
"PO-Revision-Date: 2017-04-01 02:46+0000\n"
13+
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
14+
"Language-Team: Finnish (https://www.transifex.com/oca/teams/23907/fi/)\n"
15+
"MIME-Version: 1.0\n"
16+
"Content-Type: text/plain; charset=UTF-8\n"
17+
"Content-Transfer-Encoding: \n"
18+
"Language: fi\n"
19+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
20+
21+
#. module: contract_payment_mode
22+
#: model:ir.model,name:contract_payment_mode.model_account_analytic_account
23+
msgid "Analytic Account"
24+
msgstr "Analyyttinen tili"
25+
26+
#. module: contract_payment_mode
27+
#: model:ir.model.fields,field_description:contract_payment_mode.field_account_analytic_account_payment_mode_id
28+
msgid "Payment Mode"
29+
msgstr "Maksutapa"

0 commit comments

Comments
 (0)