Skip to content

Commit

Permalink
[12.0][MIG] product_profile: Migration to 12.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinkhao committed Feb 13, 2020
1 parent c783c41 commit 2e67995
Show file tree
Hide file tree
Showing 15 changed files with 305 additions and 161 deletions.
105 changes: 62 additions & 43 deletions product_profile/README.rst
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
.. image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: https://www.gnu.org/licenses/agpl
:alt: License: AGPL-3

===============
Product Profile
===============

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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%2Fproduct--attribute-lightgray.png?logo=github
:target: https://github.com/OCA/product-attribute/tree/12.0/product_profile
:alt: OCA/product-attribute
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/product-attribute-12-0/product-attribute-12-0-product_profile
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/135/12.0
:alt: Try me on Runbot

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

This module provides easier products configuration (in one click).
It allows to configure a product template with only one field.

.. figure:: static/img/field.png
.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_profile/static/img/field.png
:alt: profile field on product
:width: 600 px

Expand All @@ -26,23 +45,22 @@ Note: This module is meant to be used by skilled people in database fields creat

Additional feature: a default value can be attached to a profile (see § Configuration, part 3)

**Table of contents**

.. contents::
:local:

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

1. Create your own profile here:
1. Create your own profile here:
Sales > Configuration > Product > Product Profiles

.. figure:: static/img/list.png
.. figure:: https://raw.githubusercontent.com/OCA/product-attribute/12.0/product_profile/static/img/list.png
:alt: profile list
:width: 600 px

2. To have more fields available to attach to this profile you must define
these fields in the model 'product.profile' in your own module
If the field name (and its type) is the same than those in 'product.template'
then values of these will be populated automatically
in 'product.template'
Example of fields declaration in your own module:
2. Extend "product.profile" model to add fields from product.template, either in normal mode or default mode (see note section below). These fields should be identical to their original fields **(especially "required" field attribute)**.

.. code-block:: python
Expand All @@ -64,9 +82,11 @@ Configuration
string='Can be Purchased')
available_in_pos = fields.Boolean()
3. Second behavior: you might want to add a default behavior to these fields:
in this case use prefix "profile_default\_" for your field name
in 'product.profile' model.
3. Insert data (xml or csv) and define values for each field defined above
for each configuration scenario

Note :
You might want to declare profile fields as defaults. To do this, just prefix the field with "profile_default".

.. code-block:: python
Expand All @@ -82,16 +102,9 @@ Configuration
"you to define the route of the product: "
"whether it will be bought, manufactured, MTO/MTS,...")
In this case 'categ_id' field (from product.template) is populated
with 'profile_default_categ_id' value but can be updated manually
by the user.
Careful: each time you change profile, the default value is also populated
whatever the previous value. Custom value is only keep if don't
change the profile.

4. Insert data (xml or csv) and define values for each field defined above
for each configuration scenario

Default fields only influence the records the first time they are set.
- if the profile is modified, changes are not propagated to all the records that have this profile
- if the record previously had another profile, changing profile will not influence default values

Usage
=====
Expand All @@ -106,45 +119,51 @@ Install **Product Profile Example** module to see a use case in action.

Profiles are also defined as search filter and group.

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

- More robust/less error-prone functionality for required fields
- More flexible/configurable behaviour for profile fields (instead of only default/nondefault fields)

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

Bugs are tracked on `GitHub Issues
<https://github.com/OCA/product-attribute/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.
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-attribute/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/product-attribute/issues/new?body=module:%20product_profile%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
=======

Images
------
Authors
~~~~~~~

* Odoo Community Association: `Icon <https://odoo-community.org/logo.png>`_.
* Akretion

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

* David BEAL <david.beal@akretion.com>
* Sébastien BEAU <sebastien.beau@akretion.com>
* Abdessamad HILALI <abdessamad.hilali@akretion.com>
* Kevin Khao <kevin.khao@akretion.com>

Iconography
-----------

https://www.iconfinder.com/icondesigner
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/product-attribute <https://github.com/OCA/product-attribute/tree/12.0/product_profile>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
7 changes: 3 additions & 4 deletions product_profile/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,18 @@

{
"name": "Product Profile",
"version": "10.0.1.0.0",
"version": "12.0.1.0.0",
"author": "Akretion, Odoo Community Association (OCA)",
"summary": "Allow to configure a product in 1 click",
"category": "product",
"depends": ["sale",],
"website": "http://www.akretion.com/",
"depends": ["sale_management"],
"website": "https://github.com/oca/product-attribute",
"data": [
"security/group.xml",
"views/product_view.xml",
"views/config_view.xml",
"security/ir.model.access.csv",
],
"demo": ["demo/product.profile.csv",],
"installable": True,
"license": "AGPL-3",
}
3 changes: 0 additions & 3 deletions product_profile/demo/product.profile.csv

This file was deleted.

3 changes: 1 addition & 2 deletions product_profile/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding: utf-8
# © 2015 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from . import product
from . import product_profile
from . import product
from . import config
8 changes: 4 additions & 4 deletions product_profile/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models
from .product import PROFILE_MENU
from .product_profile import PROFILE_MENU


class BaseConfigSettings(models.TransientModel):
_inherit = "base.config.settings"
class ResConfigSettings(models.TransientModel):
_inherit = "res.config.settings"

group_product_profile = fields.Boolean(
string="Display Product Profile fields",
implied_group="product_profile.group_product_profile",
implied_group="product_profile.group_product_profile_user",
help="Display fields computed by product profile "
"module.\nFor debugging purpose see menu\n%s" % PROFILE_MENU,
)
Loading

0 comments on commit 2e67995

Please sign in to comment.