Skip to content

Commit

Permalink
[ADD] grap_custom_import_recurring_consignment
Browse files Browse the repository at this point in the history
  • Loading branch information
legalsylvain committed Jul 30, 2024
1 parent 3d78e37 commit adfb01d
Show file tree
Hide file tree
Showing 12 changed files with 77 additions and 0 deletions.
Empty file.
1 change: 1 addition & 0 deletions grap_custom_import_recurring_consignment/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
16 changes: 16 additions & 0 deletions grap_custom_import_recurring_consignment/__manifest__.py
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).

{
"name": "GRAP - Custom Import Recurring Consignment Module",
"summary": "Extra GRAP Tools to import data for" " Recurring Consignment 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_product", "recurring_consignment"],
"auto_install": True,
"installable": True,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import product_product
18 changes: 18 additions & 0 deletions grap_custom_import_recurring_consignment/models/product_product.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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 ProductProduct(models.Model):
_inherit = "product.product"

grap_import_supplier_multiplier_qty = fields.Float(
string="Product Package Quantity - Supplier (For import)", store=False
)

def _custom_import_prepare_supplierinfo_vals(self, partner, vals):
res = super()._custom_import_prepare_supplierinfo_vals(partner, vals)
res["multiplier_qty"] = vals.get("grap_import_supplier_multiplier_qty")
return res
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Sylvain LE GAL <https://twitter.com/legalsylvain>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
This module improve the "import" features provided by Odoo.

* ``product.product``:

* Allow to import deposited product. (see ``recurring_consignment`` module)
1 change: 1 addition & 0 deletions grap_custom_import_recurring_consignment/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_module
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name,uom_id,categ_id,barcode,list_price,grap_import_supplier_name,grap_import_supplier_product_code,grap_import_supplier_product_name,grap_import_supplier_gross_price,grap_import_supplier_multiplier_qty
Mention Good (Late chocolate),Units,All / Saleable,3222472195092,2.29,Ready Mat,GOOD,MENTION GOOD,1.98,24
25 changes: 25 additions & 0 deletions grap_custom_import_recurring_consignment/tests/test_module.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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 TestModuleProductSupplierinfoQtyMultiplier(TestModuleProduct):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.ProductProduct = cls.env["product.product"]

def test_01_import_product_supplierinfo_qty_multiplier(self):
products, messages = self._test_import_file(
"grap_custom_import_product_supplierinfo_qty_multiplier",
"product.product",
"product.csv",
)
self.assertFalse(messages)
self.assertEqual(len(products), 1)
self.assertEqual(products.mapped("seller_ids.multiplier_qty"), [24.0])
6 changes: 6 additions & 0 deletions setup/grap_custom_import_recurring_consignment/setup.py
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,
)

0 comments on commit adfb01d

Please sign in to comment.