Skip to content

Commit

Permalink
Merge PR #1403 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by lmignon
  • Loading branch information
shopinvader-git-bot committed Oct 13, 2023
2 parents 0baab57 + 5b49c57 commit b0ab41a
Show file tree
Hide file tree
Showing 92 changed files with 13,758 additions and 5 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# generated from manifests external_dependencies
cerberus
extendable-pydantic>=1.2.0
extendable_pydantic>=1.0.0
extendable_pydantic>=1.2.0
Expand Down
15 changes: 12 additions & 3 deletions sale_cart/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,26 @@ class SaleOrder(models.Model):

typology = fields.Selection([("sale", "Sale"), ("cart", "Cart")], default="sale")

def _confirm_cart(self):
self.ensure_one()
self.write({"typology": "sale"})

def action_confirm_cart(self):
for record in self:
if record.typology == "sale":
# cart is already confirmed
continue
record.write({"typology": "sale"})
record._confirm_cart()
return True

def _confirm_sale(self):
self.ensure_one()
if self.typology != "sale":
self.typology = "sale"

def action_confirm(self):
res = super(SaleOrder, self).action_confirm()
for record in self:
if record.state != "draft" and record.typology != "sale":
record.typology = "sale"
if record.state != "draft":
record._confirm_sale()
return res
1 change: 1 addition & 0 deletions setup/shopinvader_restapi/odoo/addons/shopinvader_restapi
6 changes: 6 additions & 0 deletions setup/shopinvader_restapi/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,
)
4 changes: 2 additions & 2 deletions shopinvader_api_address/tests/test_shopinvader_address_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def test_update_billing_address_vat(self):
"city": "Waterloo",
"country_id": self.env.ref("base.be").id,
"street": "rue test",
"vat": "test_vat",
"vat": "BE0477472701",
}

with self._create_test_client(router=address_router) as test_client:
Expand All @@ -234,7 +234,7 @@ def test_update_billing_address_vat(self):

address = response_json

self.assertEqual(address.get("vat"), "test_vat")
self.assertEqual(address.get("vat"), "BE0477472701")
self.assertEqual(address.get("vat"), self.test_partner.vat)

def test_create_shipping_address(self):
Expand Down
113 changes: 113 additions & 0 deletions shopinvader_restapi/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
===========
Shopinvader
===========

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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/tree/14.0/shopinvader
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

This is shopinvader the odoo module for the new generation of e-commerce.

ShopInvader is an ecommerce software to create and manage easily your online store with Odoo.

This is the Odoo side of the `Shopinvader E-commerce Solution`_.

.. _Shopinvader E-commerce Solution: https://shopinvader.com

**Table of contents**

.. contents::
:local:

Known issues / Roadmap
======================

* Customer validation limitation

Customer validation is global: enable/disable affects all websites, if you have more than one.

Technical
~~~~~~~~~

* Create methods should be rewritten to support multi
* The logic to bind / unbind products and categories should be implemented as
component in place of wizard.
Previously it was possible to work with in-memory record of the wizard to
call the same logic from within odoo. In Odoo 13 it's no more the case.
That means that to rebind thousand of records we must create thousand of
rows into the database to reuse the logic provided by the wizard.
* On product.category the name is no more translatable in V13.
This functionality has been restored into shopinvader.
This should be moved into a dedicated addon

Changelog
=========

10.0.1.0.0 (2017-04-11)
~~~~~~~~~~~~~~~~~~~~~~~

* First real version : [REF] rename project to the real name : shoptor is dead long live to shopinvader", 2017-04-11)

12.0.1.0.0 (2019-05-10)
~~~~~~~~~~~~~~~~~~~~~~~

* [12.0][MIG] shopinvader

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%0Aversion:%2014.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
~~~~~~~

* Akretion

Contributors
~~~~~~~~~~~~

* Sebastien BEAU <[email protected]>
* Simone Orsi <[email protected]>
* Laurent Mignon <[email protected]>
* Raphaël Reverdy <[email protected]>
* Kevin Khao <[email protected]>

Other credits
~~~~~~~~~~~~~

The development of this module has been financially supported by:

* Akretion
* Adaptoo
* Encresdubuit
* Abilis
* Camptocamp
* Cosanum

Maintainers
~~~~~~~~~~~

This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/14.0/shopinvader>`_ project on GitHub.

You are welcome to contribute.
5 changes: 5 additions & 0 deletions shopinvader_restapi/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from . import components
from . import models
from . import services
from . import wizards
from .hooks import pre_init_hook
63 changes: 63 additions & 0 deletions shopinvader_restapi/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright 2016 Akretion (http://www.akretion.com)
# Sébastien BEAU <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

{
"name": "Shopinvader",
"summary": "Shopinvader",
"version": "16.0.1.0.0",
"category": "e-commerce",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"author": "Akretion,ACSONE SA/NV",
"license": "AGPL-3",
"application": True,
"installable": True,
"external_dependencies": {"python": ["cerberus", "unidecode"], "bin": []},
"depends": [
"base_rest",
"jsonifier",
"base_sparse_field_list_support",
"base_vat",
"component_event",
"sale",
"sale_cart",
"sale_discount_display_amount",
"server_environment",
"onchange_helper",
"queue_job",
"mail",
"base",
],
"data": [
"security/shopinvader_security.xml",
"security/ir.model.access.csv",
"security/shopinvader_backend_security.xml",
"security/shopinvader_partner_security.xml",
"wizards/shopinvader_partner_binding.xml",
"views/shopinvader_menu.xml",
"views/shopinvader_cart_step_view.xml",
"views/shopinvader_partner_view.xml",
"views/res_config_settings.xml",
"views/sale_view.xml",
"views/shopinvader_sale_view.xml",
"views/partner_view.xml",
"views/shopinvader_backend_view.xml",
"data/res_partner.xml",
"data/cart_step.xml",
"data/mail_activity_data.xml",
"data/queue_job_channel_data.xml",
"data/queue_job_function_data.xml",
],
"demo": [
"demo/account_demo.xml",
"demo/pricelist_demo.xml",
"demo/backend_demo.xml",
"demo/partner_demo.xml",
"demo/sale_demo.xml",
"demo/email_demo.xml",
"demo/notification_demo.xml",
],
"qweb": [],
"pre_init_hook": "pre_init_hook",
"development_status": "Alpha",
}
3 changes: 3 additions & 0 deletions shopinvader_restapi/components/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from . import core
from . import access_info
from . import service_context_provider
80 changes: 80 additions & 0 deletions shopinvader_restapi/components/access_info.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright 2019 Camptocamp (http://www.camptocamp.com).
# @author Simone Orsi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import Component


class PartnerAccess(Component):
"""Define access rules to partner from client side."""

_name = "shopinvader.partner.access"
_inherit = "base.shopinvader.component"
_usage = "access.info"
_apply_on = "res.partner"

@property
def service_work(self):
return getattr(self.work, "service_work", None)

@property
def partner(self):
return getattr(self.work, "partner", None)

@property
def invader_partner(self):
return getattr(self.work, "invader_partner", None)

@property
def partner_user(self):
return getattr(self.work, "partner_user", self.partner)

@property
def invader_partner_user(self):
return getattr(self.work, "invader_partner_user", self.partner)

def is_main_partner(self):
return self.partner == self.partner_user

def is_owner(self, partner_id):
return partner_id == self.partner_user.id

def for_profile(self, partner_id):
info = {"read": True, "update": True, "delete": False}
if not self.is_main_partner() and partner_id != self.partner_user.id:
info["update"] = False
return info

def for_address(self, address_id):
info = {"read": True, "update": True, "delete": True}
if self.partner_user is not None:
if not self.is_main_partner():
if not self.is_owner(address_id):
info.update({"read": True, "update": False, "delete": False})
else:
# only main partner can delete your address
info["delete"] = False
return info

def permissions(self):
"""Current user permissions mapping.
:returns: a dictionary in the format
{$component_usage: {$method: $permission_flag}}
"""
if self.partner is None:
return {"address": {}, "cart": {}}
return {
# scope: permissions
"addresses": {
# can create addresses only if profile partner is enabled
"create": self.invader_partner.is_shopinvader_active,
},
"cart": {
# can hit the button to add to cart
"add_item": self.invader_partner.is_shopinvader_active,
# can go on w/ checkout steps
"update_item": self.invader_partner.is_shopinvader_active,
},
}
19 changes: 19 additions & 0 deletions shopinvader_restapi/components/core.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copyright 2019 Camptocamp (http://www.camptocamp.com).
# @author Simone Orsi <[email protected]>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).

from odoo.addons.component.core import AbstractComponent


class BaseShopinvaderComponent(AbstractComponent):
"""Base Shopinvader Component.
All components of this module and inheriting ones should inherit from it.
"""

_name = "base.shopinvader.component"
_collection = "shopinvader.backend"

@property
def backend(self):
return self.collection
Loading

0 comments on commit b0ab41a

Please sign in to comment.