-
-
Notifications
You must be signed in to change notification settings - Fork 715
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
[17.0][MIG] product_company_default: Migration to 17.0 #1815
base: 17.0
Are you sure you want to change the base?
Changes from all commits
b08475a
3f35423
187b18a
b59cf13
fed7f3f
7a301d4
d981a0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
======================= | ||
Product Company Default | ||
======================= | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:d1775ceb80c8eb6e0c4c8689c19f97df927830171283af4c7ffc9f4fe22419f5 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
|
||
.. |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/17.0/product_company_default | ||
: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-17-0/product-attribute-17-0-product_company_default | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png | ||
:target: https://runboat.odoo-community.org/builds?repo=OCA/product-attribute&target_branch=17.0 | ||
:alt: Try me on Runboat | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module populates the company field with user's company as the | ||
default value when creating new products. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
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 to smash it by providing a detailed and welcomed | ||
`feedback <https://github.com/OCA/product-attribute/issues/new?body=module:%20product_company_default%0Aversion:%2017.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 | ||
======= | ||
|
||
Authors | ||
------- | ||
|
||
* Quartile Limited | ||
|
||
Contributors | ||
------------ | ||
|
||
- Aung Ko Ko Lin (Quartile) | ||
- `APSL-Nagarro <https://apsl.tech>`__: | ||
|
||
- Antoni Marroig <[email protected]> | ||
|
||
Maintainers | ||
----------- | ||
|
||
This module is maintained by the OCA. | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
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. | ||
|
||
.. |maintainer-AungKoKoLin1997| image:: https://github.com/AungKoKoLin1997.png?size=40px | ||
:target: https://github.com/AungKoKoLin1997 | ||
:alt: AungKoKoLin1997 | ||
|
||
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__: | ||
|
||
|maintainer-AungKoKoLin1997| | ||
|
||
This module is part of the `OCA/product-attribute <https://github.com/OCA/product-attribute/tree/17.0/product_company_default>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
{ | ||
"name": "Product Company Default", | ||
"version": "17.0.1.0.0", | ||
"author": "Quartile Limited, Odoo Community Association (OCA)", | ||
"website": "https://github.com/OCA/product-attribute", | ||
"depends": ["product"], | ||
"maintainers": ["AungKoKoLin1997"], | ||
"license": "AGPL-3", | ||
"data": ["data/ir_config_parameter.xml"], | ||
"demo": ["demo/demo_ir_config_parameter.xml"], | ||
"installable": True, | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<!-- System Parameter for Default Company Setting --> | ||
<record id="param_product_default_company_enable" model="ir.config_parameter"> | ||
<field name="key">product_company_default.default_company_enable</field> | ||
<field name="value">1</field> <!-- Enable by default --> | ||
</record> | ||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<odoo noupdate="1"> | ||
<!-- System Parameter for Default Company Setting --> | ||
<record id="param_product_default_company_enable" model="ir.config_parameter"> | ||
<field name="key">product_company_default.default_company_enable</field> | ||
<field name="value">0</field> <!-- Disable for tests --> | ||
</record> | ||
</odoo> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_company_default | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"PO-Revision-Date: 2023-11-07 09:39+0000\n" | ||
"Last-Translator: mymage <[email protected]>\n" | ||
"Language-Team: none\n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: nplurals=2; plural=n != 1;\n" | ||
"X-Generator: Weblate 4.17\n" | ||
|
||
#. module: product_company_default | ||
#: model:ir.model.fields,field_description:product_company_default.field_product_product__company_id | ||
#: model:ir.model.fields,field_description:product_company_default.field_product_template__company_id | ||
msgid "Company" | ||
msgstr "Azienda" | ||
|
||
#. module: product_company_default | ||
#: model:ir.model,name:product_company_default.model_product_template | ||
msgid "Product" | ||
msgstr "Prodotto" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * product_company_default | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 16.0\n" | ||
"Report-Msgid-Bugs-To: \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_company_default | ||
#: model:ir.model.fields,field_description:product_company_default.field_product_product__company_id | ||
#: model:ir.model.fields,field_description:product_company_default.field_product_template__company_id | ||
msgid "Company" | ||
msgstr "" | ||
|
||
#. module: product_company_default | ||
#: model:ir.model,name:product_company_default.model_product_template | ||
msgid "Product" | ||
msgstr "" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import product_template |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Copyright 2023 Quartile Limited | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
company_id = fields.Many2one(default=lambda self: self._default_company_id()) | ||
|
||
@api.model | ||
def _default_company_id(self): | ||
# Get the system parameter configuration | ||
param = ( | ||
self.env["ir.config_parameter"] | ||
.sudo() | ||
.get_param("product_company_default.default_company_enable") | ||
) | ||
if param == "1": | ||
return self.env.company | ||
return False |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[build-system] | ||
requires = ["whool"] | ||
build-backend = "whool.buildapi" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
- Aung Ko Ko Lin (Quartile) | ||
- [APSL-Nagarro](<https://apsl.tech>): | ||
- Antoni Marroig \<<[email protected]>\> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This module populates the company field with user's company as the | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not what the module does. Is it normal ? Moreover, using the config parameter with a company that is not enabled on user that creates the product can leads to UX problems. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the current description is not accurate. Should be "the current active one" instead of "user's company."
@rousseldenis I'm not getting this comment. The config parameter doesn't depend on the company. |
||
default value when creating new products. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we make use of
odoo.tools.str2bool
to support other trui-sh values?