Skip to content

Commit

Permalink
Merge b3b6e78 into bc76a3f
Browse files Browse the repository at this point in the history
  • Loading branch information
florian-dacosta committed Apr 19, 2016
2 parents bc76a3f + b3b6e78 commit 0180317
Show file tree
Hide file tree
Showing 10 changed files with 264 additions and 0 deletions.
66 changes: 66 additions & 0 deletions sale_supplier_service/README.rst
Original file line number Diff line number Diff line change
@@ -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

=====================
Sale Supplier Service
=====================

This module allows to automatically create a purchase order when a product of
type service is sold.


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

To configure the product of type 'service' that you want to buy autmatically
You have to choose a pull rule on the product form, in the procurement tab.


Known issues / Roadmap
======================

The purpose of this module is not to import the data of the file but only exchange files with external application.


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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/sale-workflow/issues>`_. 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/
sale-workflow/issues/new?body=module:%20
sale_supplier_service%0Aversion:%20
8.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Credits
=======

Images
------

* Odoo Community Association: `Icon <https://github.com/OCA/maintainer-tools/blob/master/template/module/static/description/icon.svg>`_.


Contributors
------------

* Florian da Costa <florian.dacosta@akretion.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.

21 changes: 21 additions & 0 deletions sale_supplier_service/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
#
#
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
#

from . import model
24 changes: 24 additions & 0 deletions sale_supplier_service/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# coding: utf-8
# @ 2016 Florian da Costa @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{'name': 'Sale Supplier Service',
'version': '8.0.1.0.0',
'author': 'Akretion,Odoo Community Association (OCA)',
'website': 'www.akretion.com',
'license': 'AGPL-3',
'category': 'Sales Management',
'summary': """
Allow to automatically create purchase order when a service product
is sold.
""",
'depends': [
'purchase',
'sale',
],
'data': [
'view/product_view.xml'
],
'installable': True,
'application': False,
}
42 changes: 42 additions & 0 deletions sale_supplier_service/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_supplier_service
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-19 11:02+0000\n"
"PO-Revision-Date: 2016-04-19 11:02+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_supplier_service
#: field:product.template,buy_service_rule_id:0
msgid "Buy Service Rule"
msgstr "Règle d'approvisionnement d'achat de service"

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_product_product
msgid "Product"
msgstr "Article"

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_sale_order
msgid "Sales Order"
msgstr "Commande de ventes"

#. module: sale_supplier_service
#: view:product.template:sale_supplier_service.view_template_service_rule_form
msgid "Supply Chain Information"
msgstr "Circuit logistique"

42 changes: 42 additions & 0 deletions sale_supplier_service/i18n/sale_supplier_service.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * sale_supplier_service
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 8.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-04-19 11:05+0000\n"
"PO-Revision-Date: 2016-04-19 11:05+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: sale_supplier_service
#: field:product.template,buy_service_rule_id:0
msgid "Buy Service Rule"
msgstr ""

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_product_product
msgid "Product"
msgstr ""

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_product_template
msgid "Product Template"
msgstr ""

#. module: sale_supplier_service
#: model:ir.model,name:sale_supplier_service.model_sale_order
msgid "Sales Order"
msgstr ""

#. module: sale_supplier_service
#: view:product.template:sale_supplier_service.view_template_service_rule_form
msgid "Supply Chain Information"
msgstr ""

6 changes: 6 additions & 0 deletions sale_supplier_service/model/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import product
from . import sale_order
26 changes: 26 additions & 0 deletions sale_supplier_service/model/product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, api, fields


class ProductTemplate(models.Model):
_inherit = 'product.template'

buy_service_rule_id = fields.Many2one(
'procurement.rule',
string='Buy Service Rule')


class ProductProduct(models.Model):
_inherit = 'product.product'

@api.multi
def need_procurement(self):
res = super(ProductProduct, self).need_procurement()
for product in self:
if not res and product.type == 'service' and \
product.buy_service_rule_id:
return True
return res
18 changes: 18 additions & 0 deletions sale_supplier_service/model/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# -*- coding: utf-8 -*-
# © 2016 Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, api


class SaleOrder(models.Model):
_inherit = 'sale.order'

@api.model
def _prepare_order_line_procurement(self, order, line, group_id=False):
res = super(SaleOrder, self)._prepare_order_line_procurement(
order, line, group_id=group_id)
if (line.product_id.type == 'service' and
line.product_id.buy_service_rule_id):
res['rule_id'] = line.product_id.buy_service_rule_id.id
return res
Binary file added sale_supplier_service/static/description/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 19 additions & 0 deletions sale_supplier_service/view/product_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?xml version="1.0"?>
<openerp>
<data>

<record id="view_template_service_rule_form" model="ir.ui.view">
<field name="name">template.service.rule.form</field>
<field name="model">product.template</field>
<field name="inherit_id" ref="stock.view_template_property_form"/>
<field name="arch" type="xml">
<group name="procurement_uom" position="after" >
<group string="Supply Chain Information" attrs="{'invisible': [('type', '!=', 'service')]}" groups="base.group_user">
<field name="buy_service_rule_id" domain="[('action', '=', 'buy')]"/>
</group>
</group>
</field>
</record>

</data>
</openerp>

0 comments on commit 0180317

Please sign in to comment.