-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by sebastienbeau
- Loading branch information
Showing
15 changed files
with
225 additions
and
0 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
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,59 @@ | ||
============================= | ||
Shopinvader Sale Communcation | ||
============================= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! 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-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github | ||
:target: https://github.com/shopinvader/odoo-shopinvader | ||
:alt: shopinvader/odoo-shopinvader | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module adds information fields for customers and vendors. | ||
Vendor communicates with customer with online_information_for_customer. | ||
Customer can request information to vendor with online_information_request. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader/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/shopinvader/odoo-shopinvader/issues/new?body=module:%20shopinvader_sale_communication%0Aversion:%2010.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 | ||
~~~~~~~ | ||
|
||
* ACSONE SA/NV | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Benoit Aimont <[email protected]> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader>`_ 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import services |
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 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Shopinvader Sale Communication", | ||
"summary": """ | ||
This module adds information fields for customers and vendors.""", | ||
"version": "10.0.1.0.0", | ||
"license": "AGPL-3", | ||
"author": "ACSONE SA/NV", | ||
"website": "https://shopinvader.com/", | ||
"depends": ["sale", "shopinvader"], | ||
"data": ["views/sale_order.xml"], | ||
"demo": [], | ||
"installable": False, | ||
} |
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 sale_order |
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
|
||
_inherit = "sale.order" | ||
|
||
online_information_for_customer = fields.Html( | ||
help="Fill in this field to provide your customer more information " | ||
"on his online account" | ||
) | ||
online_information_request = fields.Text( | ||
help="This field is filled by the customer to request information", | ||
readonly=True, | ||
) |
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 @@ | ||
* Benoit Aimont <[email protected]> |
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,3 @@ | ||
This module adds information fields for customers and vendors. | ||
Vendor communicates with customer with online_information_for_customer. | ||
Customer can request information to vendor with online_information_request. |
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 abstract_sale | ||
from . import cart |
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,19 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.addons.component.core import AbstractComponent | ||
|
||
|
||
class AbstractSaleService(AbstractComponent): | ||
_inherit = "shopinvader.abstract.sale.service" | ||
|
||
def _convert_one_sale(self, sale): | ||
values = super(AbstractSaleService, self)._convert_one_sale(sale) | ||
values.update( | ||
{ | ||
"online_information_for_customer": sale.online_information_for_customer, | ||
"online_information_request": sale.online_information_request, | ||
} | ||
) | ||
return values |
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,14 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 ACSONE SA/NV (<http://acsone.eu>) | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo.addons.component.core import Component | ||
|
||
|
||
class CartService(Component): | ||
_inherit = "shopinvader.cart.service" | ||
|
||
def _validator_update(self): | ||
validator = super(CartService, self)._validator_update() | ||
validator.update({"online_information_request": {"type": "string"}}) | ||
return validator |
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 test_cart | ||
from . import test_sale |
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,31 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.addons.shopinvader.tests.common import CommonCase | ||
|
||
|
||
class TestCart(CommonCase): | ||
def setUp(self): | ||
super(TestCart, self).setUp() | ||
self.cart = self.env.ref("shopinvader.sale_order_2") | ||
self.shopinvader_session = {"cart_id": self.cart.id} | ||
self.partner = self.env.ref("shopinvader.partner_1") | ||
with self.work_on_services( | ||
partner=self.partner, shopinvader_session=self.shopinvader_session | ||
) as work: | ||
self.service = work.component(usage="cart") | ||
|
||
def test_cart(self): | ||
online_information_for_customer = "CUSTOMER INFO" | ||
online_information_request = "VENDOR INFO REQUEST" | ||
params = { | ||
"online_information_for_customer": online_information_for_customer, | ||
"online_information_request": online_information_request, | ||
} | ||
self.service.dispatch("update", params=params) | ||
# online_information_for_customer should not be updated from the front | ||
self.assertFalse(self.cart.online_information_for_customer) | ||
self.assertEqual( | ||
self.cart.online_information_request, online_information_request | ||
) |
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,32 @@ | ||
# -*- coding: utf-8 -*- | ||
# Copyright 2020 ACSONE SA/NV | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
from odoo.addons.shopinvader.tests.common import CommonCase | ||
|
||
|
||
class TestSale(CommonCase): | ||
def setUp(self): | ||
super(TestSale, self).setUp() | ||
self.partner = self.env.ref("base.res_partner_2") | ||
with self.work_on_services(partner=self.partner) as work: | ||
self.service = work.component(usage="sales") | ||
|
||
def test_sale_order_info(self): | ||
online_information_for_customer = "TEST" | ||
so = self.env["sale.order"].create( | ||
{ | ||
"partner_id": self.env.ref("base.res_partner_2").id, | ||
"online_information_for_customer": online_information_for_customer, | ||
"shopinvader_backend_id": self.env.ref( | ||
"shopinvader.backend_1" | ||
).id, | ||
"typology": "sale", | ||
} | ||
) | ||
so.action_confirm() | ||
res = self.service.get(so.id) | ||
self.assertEqual( | ||
res.get("online_information_for_customer"), | ||
so.online_information_for_customer, | ||
) |
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,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- Copyright 2020 ACSONE SA/NV | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). --> | ||
|
||
<odoo> | ||
|
||
<record model="ir.ui.view" id="sale_order_form_view"> | ||
<field name="name">sale.order.form (in shopinvader_sale_communication)</field> | ||
<field name="model">sale.order</field> | ||
<field name="inherit_id" ref="sale.view_order_form"/> | ||
<field name="arch" type="xml"> | ||
<xpath expr="//notebook" postion="inside"> | ||
<page string="Information for Customer" name="customer_info"> | ||
<field name="online_information_for_customer"/> | ||
</page> | ||
<page string="Information for Salesperson" name="salesperson_info"> | ||
<field name="online_information_request"/> | ||
</page> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |