-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ADD] grap_custom_import_purchase_triple_discount
- Loading branch information
1 parent
1bc50e1
commit b1eb0fa
Showing
16 changed files
with
106 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +0,0 @@ | ||
==================================================================== | ||
GRAP - Custom Import Product Supplierinfo Quantity Multiplier Module | ||
==================================================================== | ||
|
||
.. | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! source digest: sha256:9b8df078c1fb893b68650c2ee64e375d840edd6d1f8f7bfdb0f1a4da37012215 | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |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-grap%2Fgrap--odoo--import-lightgray.png?logo=github | ||
:target: https://github.com/grap/grap-odoo-import/tree/16.0/grap_custom_import_product_supplierinfo_qty_multiplier | ||
:alt: grap/grap-odoo-import | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module improve the "import" features provided by Odoo. | ||
|
||
* ``product.product``: | ||
|
||
* Allow to recover ``multiplier_qty`` field in the supplier info level. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/grap/grap-odoo-import/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/grap/grap-odoo-import/issues/new?body=module:%20grap_custom_import_product_supplierinfo_qty_multiplier%0Aversion:%2016.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 | ||
~~~~~~~ | ||
|
||
* GRAP | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Sylvain LE GAL <https://twitter.com/legalsylvain> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is part of the `grap/grap-odoo-import <https://github.com/grap/grap-odoo-import/tree/16.0/grap_custom_import_product_supplierinfo_qty_multiplier>`_ project on GitHub. | ||
|
||
You are welcome to contribute. | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
17 changes: 17 additions & 0 deletions
17
grap_custom_import_purchase_triple_discount/__manifest__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (C) 2019 - 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.html). | ||
|
||
{ | ||
"name": "GRAP - Custom Product Import - Purchase Triple Discount Module", | ||
"summary": "Extra GRAP Tools to import product data for" | ||
" Purchase Triple Discount module", | ||
"version": "16.0.1.0.0", | ||
"category": "Tools", | ||
"author": "GRAP", | ||
"website": "https://github.com/grap/grap-odoo-import", | ||
"license": "AGPL-3", | ||
"depends": ["grap_custom_import_purchase_discount", "purchase_triple_discount"], | ||
"auto_install": True, | ||
"installable": True, | ||
} |
2 changes: 2 additions & 0 deletions
2
grap_custom_import_purchase_triple_discount/models/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import custom_import_product_mixin | ||
from . import product_template |
16 changes: 16 additions & 0 deletions
16
grap_custom_import_purchase_triple_discount/models/custom_import_product_mixin.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Copyright (C) 2024 - 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.html). | ||
|
||
from odoo import models | ||
|
||
|
||
class CustomImportProductMixin(models.AbstractModel): | ||
_name = "custom.import.product.mixin" | ||
_inherit = ["custom.import.product.mixin"] | ||
|
||
def _custom_import_prepare_supplierinfo_vals(self, partner, vals): | ||
res = super()._custom_import_prepare_supplierinfo_vals(partner, vals) | ||
res["discount2"] = (vals.get("grap_import_supplier_discount_2") or 0.0) * 100 | ||
res["discount3"] = (vals.get("grap_import_supplier_discount_3") or 0.0) * 100 | ||
return res |
17 changes: 17 additions & 0 deletions
17
grap_custom_import_purchase_triple_discount/models/product_template.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Copyright (C) 2024 - 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.html). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class ProductTemplate(models.Model): | ||
_inherit = "product.template" | ||
|
||
grap_import_supplier_discount_2 = fields.Float( | ||
string="Supplier Discount 2 (For import)", store=False | ||
) | ||
|
||
grap_import_supplier_discount_3 = fields.Float( | ||
string="Supplier Discount 3 (For import)", store=False | ||
) |
1 change: 1 addition & 0 deletions
1
grap_custom_import_purchase_triple_discount/readme/CONTRIBUTORS.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Sylvain LE GAL <https://twitter.com/legalsylvain> |
6 changes: 6 additions & 0 deletions
6
grap_custom_import_purchase_triple_discount/readme/DESCRIPTION.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
This module improve the "import" features provided by Odoo. | ||
|
||
* ``product.product``: | ||
|
||
* Allow to recover ``discount2`` and ``discount3`` fields | ||
in the supplier info level. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import test_module |
2 changes: 2 additions & 0 deletions
2
grap_custom_import_purchase_triple_discount/tests/templates/product/product.csv
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
name,uom_id,categ_id,grap_import_supplier_name,grap_import_supplier_discount_1,grap_import_supplier_discount_2,grap_import_supplier_discount_3 | ||
Mention Good (Late chocolate),Units,All / Saleable,Ready Mat,0.33,0.22,0.11 |
34 changes: 34 additions & 0 deletions
34
grap_custom_import_purchase_triple_discount/tests/test_module.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Copyright (C) 2024 - 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.html). | ||
|
||
from odoo.tests import tagged | ||
|
||
from odoo.addons.grap_custom_import_product.tests.test_module import TestModuleProduct | ||
|
||
|
||
@tagged("post_install", "-at_install") | ||
class TestModulePurchaseTripleDiscount(TestModuleProduct): | ||
@classmethod | ||
def setUpClass(cls): | ||
super().setUpClass() | ||
cls.ProductProduct = cls.env["product.product"] | ||
|
||
def _test_import_purchase_discount(self, model): | ||
products, messages = self._test_import_file( | ||
"grap_custom_import_purchase_triple_discount", | ||
model, | ||
"product.csv", | ||
folder="product", | ||
) | ||
self.assertFalse(messages) | ||
self.assertEqual(len(products), 1) | ||
self.assertEqual(products.seller_ids.discount, 33.0) | ||
self.assertEqual(products.seller_ids.discount2, 22.0) | ||
self.assertEqual(products.seller_ids.discount3, 11.0) | ||
|
||
def test_01_import_purchase_discount_product(self): | ||
self._test_import_purchase_discount("product.product") | ||
|
||
def test_02_import_purchase_discount_template(self): | ||
self._test_import_purchase_discount("product.template") |
1 change: 1 addition & 0 deletions
1
...m_import_purchase_triple_discount/odoo/addons/grap_custom_import_purchase_triple_discount
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../grap_custom_import_purchase_triple_discount |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |