mirror of
https://github.com/OCA/contract.git
synced 2025-02-13 17:57:24 +02:00
[ADD] product_contract: Create module
* Add contract functionality to `product.templates` * Add logic to create contracts from `sale.order` that contains contract products.
This commit is contained in:
66
product_contract/README.rst
Normal file
66
product_contract/README.rst
Normal file
@@ -0,0 +1,66 @@
|
||||
.. 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
|
||||
|
||||
================
|
||||
Product Contract
|
||||
================
|
||||
|
||||
This module adds support for products to be linked to contract templates.
|
||||
It also adds functionality to automatically create a contract, from the template,
|
||||
when a ``sale.order`` contains a product that implements a contract.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
#. Go to Sales -> Products and select or create a product.
|
||||
#. Check "Is a contract" and select the contract template related to the
|
||||
product
|
||||
|
||||
.. 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/10.0
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* None
|
||||
|
||||
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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Images
|
||||
------
|
||||
|
||||
* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Ted Salmon <tsalmon@laslabs.com>
|
||||
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. 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.
|
||||
5
product_contract/__init__.py
Normal file
5
product_contract/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
23
product_contract/__manifest__.py
Normal file
23
product_contract/__manifest__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
{
|
||||
'name': 'Product Contract',
|
||||
'version': '10.0.1.0.0',
|
||||
'category': 'Contract Management',
|
||||
'license': 'AGPL-3',
|
||||
'author': "LasLabs, "
|
||||
"Odoo Community Association (OCA)",
|
||||
'website': 'https://laslabs.com',
|
||||
'depends': [
|
||||
'contract',
|
||||
'product',
|
||||
'sale',
|
||||
],
|
||||
'data': [
|
||||
'views/product_template_view.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'application': False,
|
||||
}
|
||||
51
product_contract/i18n/de.po
Normal file
51
product_contract/i18n/de.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
|
||||
"Language-Team: German (https://www.transifex.com/oca/teams/23907/de/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: de\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Vertrag"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/es.po
Normal file
51
product_contract/i18n/es.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
|
||||
"Language-Team: Spanish (https://www.transifex.com/oca/teams/23907/es/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: es\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Contrato"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/fr.po
Normal file
51
product_contract/i18n/fr.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# leemannd <denis.leemann@camptocamp.com>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: leemannd <denis.leemann@camptocamp.com>, 2017\n"
|
||||
"Language-Team: French (https://www.transifex.com/oca/teams/23907/fr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: fr\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Contrat"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/hr.po
Normal file
51
product_contract/i18n/hr.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Bole <bole@dajmi5.com>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: Bole <bole@dajmi5.com>, 2017\n"
|
||||
"Language-Team: Croatian (https://www.transifex.com/oca/teams/23907/hr/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: hr\n"
|
||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Ugovor"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
52
product_contract/i18n/hr_HR.po
Normal file
52
product_contract/i18n/hr_HR.po
Normal file
@@ -0,0 +1,52 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Bole <bole@dajmi5.com>, 2017
|
||||
# OCA Transbot <transbot@odoo-community.org>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: OCA Transbot <transbot@odoo-community.org>, 2017\n"
|
||||
"Language-Team: Croatian (Croatia) (https://www.transifex.com/oca/teams/23907/hr_HR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: hr_HR\n"
|
||||
"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Ugovor"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr "Predložak ugovora"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/it.po
Normal file
51
product_contract/i18n/it.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Lorenzo Battistini <lorenzo.battistini@agilebg.com>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: Lorenzo Battistini <lorenzo.battistini@agilebg.com>, 2017\n"
|
||||
"Language-Team: Italian (https://www.transifex.com/oca/teams/23907/it/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: it\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Contratto"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr "Template di contratto"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/nl.po
Normal file
51
product_contract/i18n/nl.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Erwin van der Ploeg <erwin@odooexperts.nl>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: Erwin van der Ploeg <erwin@odooexperts.nl>, 2017\n"
|
||||
"Language-Team: Dutch (https://www.transifex.com/oca/teams/23907/nl/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: nl\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Contract"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/pt_BR.po
Normal file
51
product_contract/i18n/pt_BR.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Albert Vonpupp <vonpupp@gmail.com>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: Albert Vonpupp <vonpupp@gmail.com>, 2017\n"
|
||||
"Language-Team: Portuguese (Brazil) (https://www.transifex.com/oca/teams/23907/pt_BR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: pt_BR\n"
|
||||
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Contrato"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
51
product_contract/i18n/tr_TR.po
Normal file
51
product_contract/i18n/tr_TR.po
Normal file
@@ -0,0 +1,51 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_contract
|
||||
#
|
||||
# Translators:
|
||||
# Ediz Duman <neps1192@gmail.com>, 2017
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 10.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2017-04-27 02:40+0000\n"
|
||||
"PO-Revision-Date: 2017-04-27 02:40+0000\n"
|
||||
"Last-Translator: Ediz Duman <neps1192@gmail.com>, 2017\n"
|
||||
"Language-Team: Turkish (Turkey) (https://www.transifex.com/oca/teams/23907/tr_TR/)\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Language: tr_TR\n"
|
||||
"Plural-Forms: nplurals=1; plural=0;\n"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_sale_order_line_contract_id
|
||||
msgid "Contract"
|
||||
msgstr "Sözleşme"
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_contract_template_id
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_contract_template_id
|
||||
msgid "Contract Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_product_is_contract
|
||||
#: model:ir.model.fields,field_description:product_contract.field_product_template_is_contract
|
||||
msgid "Is a contract"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order
|
||||
msgid "Sales Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_contract
|
||||
#: model:ir.model,name:product_contract.model_sale_order_line
|
||||
msgid "Sales Order Line"
|
||||
msgstr ""
|
||||
7
product_contract/models/__init__.py
Normal file
7
product_contract/models/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import product_template
|
||||
from . import sale_order
|
||||
from . import sale_order_line
|
||||
23
product_contract/models/product_template.py
Normal file
23
product_contract/models/product_template.py
Normal file
@@ -0,0 +1,23 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, fields, models
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
is_contract = fields.Boolean('Is a contract')
|
||||
contract_template_id = fields.Many2one(
|
||||
comodel_name='account.analytic.contract',
|
||||
string='Contract Template',
|
||||
)
|
||||
|
||||
@api.onchange('is_contract')
|
||||
def _change_is_contract(self):
|
||||
""" Clear the relation to contract_template_id when downgrading
|
||||
product from contract
|
||||
"""
|
||||
if not self.is_contract:
|
||||
self.contract_template_id = False
|
||||
27
product_contract/models/sale_order.py
Normal file
27
product_contract/models/sale_order.py
Normal file
@@ -0,0 +1,27 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class SaleOrder(models.Model):
|
||||
_inherit = 'sale.order'
|
||||
|
||||
@api.multi
|
||||
def action_confirm(self):
|
||||
""" If we have a contract in the order, set it up """
|
||||
for rec in self:
|
||||
order_lines = self.mapped('order_line').filtered(
|
||||
lambda r: r.product_id.is_contract
|
||||
)
|
||||
for line in order_lines:
|
||||
contract_tmpl = line.product_id.contract_template_id
|
||||
contract = self.env['account.analytic.account'].create({
|
||||
'name': '%s Contract' % rec.name,
|
||||
'partner_id': rec.partner_id.id,
|
||||
'contract_template_id': contract_tmpl.id,
|
||||
})
|
||||
line.contract_id = contract.id
|
||||
contract.recurring_create_invoice()
|
||||
return super(SaleOrder, self).action_confirm()
|
||||
14
product_contract/models/sale_order_line.py
Normal file
14
product_contract/models/sale_order_line.py
Normal file
@@ -0,0 +1,14 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
contract_id = fields.Many2one(
|
||||
comodel_name='account.analytic.account',
|
||||
string='Contract'
|
||||
)
|
||||
6
product_contract/tests/__init__.py
Normal file
6
product_contract/tests/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import test_product_template
|
||||
from . import test_sale_order
|
||||
31
product_contract/tests/test_product_template.py
Normal file
31
product_contract/tests/test_product_template.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestProductTemplate(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestProductTemplate, self).setUp()
|
||||
self.product = self.env.ref(
|
||||
'product.product_product_4_product_template'
|
||||
)
|
||||
self.contract = self.env['account.analytic.contract'].create({
|
||||
'name': 'Test',
|
||||
'recurring_rule_type': 'yearly',
|
||||
'recurring_interval': 12345,
|
||||
})
|
||||
|
||||
def test_change_is_contract(self):
|
||||
""" It should verify that the contract_template_id is removed
|
||||
when is_contract is False """
|
||||
self.product.is_contract = True
|
||||
self.product.contract_template_id = self.contract.id
|
||||
self.product.is_contract = False
|
||||
self.product._change_is_contract()
|
||||
self.assertEquals(
|
||||
len(self.product.contract_template_id),
|
||||
0
|
||||
)
|
||||
34
product_contract/tests/test_sale_order.py
Normal file
34
product_contract/tests/test_sale_order.py
Normal file
@@ -0,0 +1,34 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 LasLabs Inc.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from mock import MagicMock
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSaleOrder(TransactionCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestSaleOrder, self).setUp()
|
||||
self.product = self.env.ref('product.product_product_1')
|
||||
self.sale = self.env.ref('sale.sale_order_2')
|
||||
self.contract = self.env['account.analytic.contract'].create({
|
||||
'name': 'Test',
|
||||
'recurring_rule_type': 'yearly',
|
||||
'recurring_interval': 12345,
|
||||
})
|
||||
self.product.product_tmpl_id.is_contract = True
|
||||
self.product.product_tmpl_id.contract_template_id = self.contract.id
|
||||
|
||||
def test_action_done(self):
|
||||
""" It should create a contract when the sale for a contract is set
|
||||
to done for the first time """
|
||||
self.env['account.analytic.account']._patch_method(
|
||||
'create', MagicMock()
|
||||
)
|
||||
self.sale.action_confirm()
|
||||
self.env['account.analytic.account'].create.assert_called_once_with({
|
||||
'name': '%s Contract' % self.sale.name,
|
||||
'partner_id': self.sale.partner_id.id,
|
||||
'contract_template_id': self.contract.id,
|
||||
})
|
||||
29
product_contract/views/product_template_view.xml
Normal file
29
product_contract/views/product_template_view.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
Copyright 2017 LasLabs Inc.
|
||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
-->
|
||||
|
||||
<odoo>
|
||||
|
||||
<record id="product_template_form_contract_view" model="ir.ui.view">
|
||||
<field name="name">account.invoice.select.contract</field>
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[@name='options']" position="inside">
|
||||
<div>
|
||||
<field name="is_contract" />
|
||||
<label for="is_contract" />
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//group[@name='group_standard_price']" position="inside">
|
||||
<field name="contract_template_id"
|
||||
attrs="{'invisible': [('is_contract', '=', False)],
|
||||
'required':[('is_contract', '=', True)]}" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user