Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] add product template multi link #210

Merged
merged 2 commits into from
Jan 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions product_multi_link/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3

==================
Product Multi Link
==================
==============================
Product Multi Links (Variants)
==============================

This module adds links between products:
This module adds links between product variants:

- cross-selling
- up-selling
Expand All @@ -17,6 +17,10 @@ These types of links are common in e-commerce shops.
It can be used as a base to implement synchronizations with
e-commerce (for instance, it is used in magentoerpconnect).

If you want to manage link between product templates (instead of product
variants), you can use the other OCA module product_template_multi_link.
(Same e-commerce repository)

Usage
=====

Expand Down
2 changes: 1 addition & 1 deletion product_multi_link/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
'name': 'Product Links',
'name': 'Product Multi Links (Variants)',
'version': '10.0.1.0.0',
'category': 'Generic Modules',
'author': "Camptocamp,Elico-Corp,Sodexis,Odoo Community Association (OCA)",
Expand Down
119 changes: 119 additions & 0 deletions product_template_multi_link/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

=============================
Product Multi Link (Template)
=============================

This module extends the functionality of sale module to support links between
products templates.

This module adds two types of links :

- **Cross Selling** : suggest your customer to purchase an additional product
- **Up Selling** : suggest your customers to purchase a higher-end product,
an upgrade, etc.

These types of links are common in e-commerce shops.

It can be used as a base to implement synchronizations with e-commerce.

Important Note
--------------

This module is linking products together (product templates), not product
variants. For that purpose, you can use the module Product Multi Link
(Variants), in the same OCA / e-commerce repository.

Usage
=====

* To mass edit or create links between products templates, Go to
Sale > Configuration > Products > Product Links

.. figure:: /product_template_multi_link/static/description/product_template_link_tree.png
:width: 800 px

A kanban view is also available

.. figure:: /product_template_multi_link/static/description/product_template_link_kanban.png
:width: 800 px


* You can manage links by product, Go to Sales > Sales > Products and select
a product

.. figure:: /product_template_multi_link/static/description/product_template_form.png
:width: 800 px

* You can so add new item, line by line, via an editable tree view

.. figure:: /product_template_multi_link/static/description/product_template_link_tree_edit.png
:width: 800 px


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

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/e-commerce/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.

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

* This module links templates together. 'product_multi_link' links variants
together. We could, in a next version of Odoo, include variants features
in that module, and adding a new group in 'Manage Product Variant Links'.

* Develop another module product_template_multi_link_customer, that adds
a new type of link named 'customer'. Those links could be generated
automatically by scheduled cron task, analyzing sale.order.line.
Odoo could create so, the 3 most products sold when a given product is
sold.

Credits
=======

Images
------

* https://www.iconfinder.com/icons/285808/auto_automobile_car_vehicle_icon
* https://www.iconfinder.com/iconsets/kitchen-appliances-computers-and-electronics

(Free for commercial Use)

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

* Sylvain LE GAL <http://www.twitter.com/legalsylvain>

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

Funders
-------

The development of this module has been financially supported by:

* GRAP, Groupement Régional Alimentaire de Proximité <http://www.grap.coop>

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.
6 changes: 6 additions & 0 deletions product_template_multi_link/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# -*- coding: utf-8 -*-
# © 2011 Guewen Baconnier,Camptocamp,Elico-Corp
# © 2016 Sodexis
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import models
27 changes: 27 additions & 0 deletions product_template_multi_link/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
# Copyright 2017-Today GRAP (http://www.grap.coop).
# @author Sylvain LE GAL <https://twitter.com/legalsylvain>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
'name': 'Product Multi Links (Template)',
'version': '10.0.1.0.0',
'category': 'Generic Modules',
'author': "GRAP,Odoo Community Association (OCA)",
'website': 'https://odoo-community.org',
'license': 'AGPL-3',
'depends': [
'sale',
],
'data': [
'security/ir.model.access.csv',
'views/action.xml',
'views/product_template_view.xml',
'views/product_template_link_view.xml',
'views/menu.xml',
],
'demo': [
'demo/product_template_link.xml',
],
'installable': True,
}
37 changes: 37 additions & 0 deletions product_template_multi_link/demo/product_template_link.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="link_apple_1" model="product.template.link">
<field name="product_template_id" ref="product.product_product_7_product_template"/>
<field name="linked_product_template_id" ref="product.product_product_9_product_template"/>
<field name="link_type">cross_sell</field>
</record>

<record id="link_apple_2" model="product.template.link">
<field name="product_template_id" ref="product.product_product_9_product_template"/>
<field name="linked_product_template_id" ref="product.product_product_7_product_template"/>
<field name="link_type">cross_sell</field>
</record>

<record id="link_membership_1" model="product.template.link">
<field name="product_template_id" ref="product.membership_2_product_template"/>
<field name="linked_product_template_id" ref="product.membership_1_product_template"/>
<field name="link_type">up_sell</field>
</record>

<record id="link_membership_2" model="product.template.link">
<field name="product_template_id" ref="product.membership_2_product_template"/>
<field name="linked_product_template_id" ref="product.membership_0_product_template"/>
<field name="link_type">up_sell</field>
</record>

<record id="link_membership_3" model="product.template.link">
<field name="product_template_id" ref="product.membership_1_product_template"/>
<field name="linked_product_template_id" ref="product.membership_0_product_template"/>
<field name="link_type">up_sell</field>
</record>



</odoo>

17 changes: 17 additions & 0 deletions product_template_multi_link/demo/res_groups.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<odoo>

<record id="group_stock_state_by_product" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

<record id="group_stock_state_by_category" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

<record id="product.group_product_variant" model="res.groups">
<field name="users" eval="[(4, ref('base.user_root'))]" />
</record>

</odoo>

122 changes: 122 additions & 0 deletions product_template_multi_link/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * product_template_multi_link
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 10.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2017-10-06 15:12+0000\n"
"PO-Revision-Date: 2017-10-06 15:12+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: product_template_multi_link
#: model:ir.model.fields,help:product_template_multi_link.field_product_template_link_link_type
msgid "* Cross-Sell : suggest your customer to purchase an additional product\n"
"* Up-Sell : suggest your customer to purchase a higher-end product, an upgrade, etc."
msgstr "* Vente Croisée : Proposer à vtre client d'acheter un autre article\n"
"* Montée en Gamme : Proposer à votre client d'acheter un article d'une gamme supérieure, une amélioration, etc."

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_create_uid
msgid "Created by"
msgstr "Créé par"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_create_date
msgid "Created on"
msgstr "Créé le"

#. module: product_template_multi_link
#: selection:product.template.link,link_type:0
msgid "Cross-Sell"
msgstr "Vente Croisée"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_display_name
msgid "Display Name"
msgstr "Nom affiché"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_id
msgid "ID"
msgstr "ID"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link___last_update
msgid "Last Modified on"
msgstr "Dernière Modification le"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_write_uid
msgid "Last Updated by"
msgstr "Dernière mise à jour par"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_write_date
msgid "Last Updated on"
msgstr "Dernière mise à jour le"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_link_type
msgid "Link type"
msgstr "Type de lien"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_linked_product_template_id
msgid "Linked Product"
msgstr "Article lié"

#. module: product_template_multi_link
#: model:ir.actions.act_window,name:product_template_multi_link.action_product_template_link
#: model:ir.actions.act_window,name:product_template_multi_link.action_product_template_link_from_product_template
#: model:ir.ui.menu,name:product_template_multi_link.menu_product_template_link
#: model:ir.ui.view,arch_db:product_template_multi_link.product_product_link_form
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_product_product_template_link_ids
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_product_template_link_ids
msgid "Product Links"
msgstr "Liens d'articles"

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

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_product_product_template_link_qty
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_product_template_link_qty
msgid "Product Links Quantity"
msgstr "Qté de liens d'articles"

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_linked_product_template_image_small
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_product_template_image_small
msgid "Small-sized image"
msgstr "Image de petite taille"

#. module: product_template_multi_link
#: model:ir.model.fields,help:product_template_multi_link.field_product_template_link_linked_product_template_image_small
#: model:ir.model.fields,help:product_template_multi_link.field_product_template_link_product_template_image_small
msgid "Small-sized image of the product. It is automatically resized as a 64x64px image, with aspect ratio preserved. Use this field anywhere a small image is required."
msgstr "Vignette de l'article. Elle sera automatiquement redimensionnée à 64 x 64 px, en préservent le rapport hauteur/largeur. Utilisez ce champ partout où une petite image est nécessaire."

#. module: product_template_multi_link
#: model:ir.model.fields,field_description:product_template_multi_link.field_product_template_link_product_template_id
msgid "Source Product"
msgstr "Article source"

#. module: product_template_multi_link
#: selection:product.template.link,link_type:0
msgid "Up-Sell"
msgstr "Montée en gamme"

#. module: product_template_multi_link
#: model:ir.model,name:product_template_multi_link.model_product_template_link
msgid "product.template.link"
msgstr "product.template.link"

4 changes: 4 additions & 0 deletions product_template_multi_link/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# -*- coding: utf-8 -*-

from . import product_template
from . import product_template_link
24 changes: 24 additions & 0 deletions product_template_multi_link/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# -*- coding: utf-8 -*-
# Copyright 2017-Today GRAP (http://www.grap.coop).
# @author Sylvain LE GAL <https://twitter.com/legalsylvain>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo import api, fields, models


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

product_template_link_ids = fields.One2many(
string='Product Links', comodel_name='product.template.link',
inverse_name='product_template_id')

product_template_link_qty = fields.Integer(
string='Product Links Quantity', compute='_product_template_link_qty',
store=True)

@api.depends('product_template_link_ids')
def _product_template_link_qty(self):
for template in self:
template.product_template_link_qty =\
len(template.product_template_link_ids)
Loading