Skip to content

Commit

Permalink
[ADD] shopinvader_customer_invoicing_mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ivantodorovich committed Jul 21, 2021
1 parent b0881a9 commit 595766b
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/shopinvader_customer_invoicing_mode/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,
)
Empty file.
1 change: 1 addition & 0 deletions shopinvader_customer_invoicing_mode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import services
14 changes: 14 additions & 0 deletions shopinvader_customer_invoicing_mode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2021 Camptocamp SA
# @author Iván Todorovich <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

{
"name": "Shopinvader Customer Invoicing Mode",
"summary": "Glue module to expose the invoicing_mode field to shopinvader",
"version": "14.0.1.0.0",
"category": "e-commerce",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"author": "Camptocamp",
"license": "AGPL-3",
"depends": ["shopinvader", "account_invoice_base_invoicing_mode"],
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Iván Todorovich <[email protected]>
2 changes: 2 additions & 0 deletions shopinvader_customer_invoicing_mode/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
This module exposes the `invoicing_mode` field added by OCA module
`account_invoice_base_invoicing_mode` to the customer service.
1 change: 1 addition & 0 deletions shopinvader_customer_invoicing_mode/services/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import customer
23 changes: 23 additions & 0 deletions shopinvader_customer_invoicing_mode/services/customer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2021 Camptocamp SA
# @author Iván Todorovich <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component


class CustomerService(Component):
_inherit = "shopinvader.customer.service"

def _validator_create(self):
res = super()._validator_create()
res.update(
{
"invoicing_mode": {"type": "string", "required": False},
}
)
return res

def _json_parser(self):
res = super()._json_parser()
res.append("invoicing_mode")
return res
1 change: 1 addition & 0 deletions shopinvader_customer_invoicing_mode/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import test_customer
18 changes: 18 additions & 0 deletions shopinvader_customer_invoicing_mode/tests/test_customer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Copyright 2021 Camptocamp SA
# @author Iván Todorovich <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.shopinvader.tests.test_customer import TestCustomerCommon


class TestCustomer(TestCustomerCommon):
def setUp(self, *args, **kwargs):
super().setUp(*args, **kwargs)
# TODO: Move to setUpClass in shopinvader's TestCustomerCommon.
self.data["invoicing_mode"] = "standard"

def test_create_customer(self):
self.data["external_id"] = "D5CdkqOEL"
res = self.service.dispatch("create", params=self.data)["data"]
partner = self.env["res.partner"].browse(res["id"])
self._test_partner_data(partner, self.data)

0 comments on commit 595766b

Please sign in to comment.