Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP][MIG][12.0] mobile app picking #241

Closed
wants to merge 27 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
a4ccf79
[ADD] mobile_app_picking
legalsylvain Feb 8, 2019
5455593
[V1.1]
legalsylvain Feb 20, 2019
d457486
version 1.2
legalsylvain Feb 22, 2019
9b9e542
[V1.3]
legalsylvain Mar 18, 2019
490c4bc
[DOC] set modules in Beta development status
legalsylvain Jul 12, 2019
73d6d76
[UPD] Update mobile_app_abstract.pot
oca-travis Nov 15, 2019
2e07e0a
[UPD] README.rst
OCA-git-bot Nov 15, 2019
4911acd
[ADD] icon.png
OCA-git-bot Nov 15, 2019
3a7757f
[ADD] mobile_app_picking
legalsylvain Feb 8, 2019
f20cbd4
[V1.1]
legalsylvain Feb 20, 2019
4cd0b21
[DOC] set modules in Beta development status
legalsylvain Jul 12, 2019
4574ec0
[UPD] Update mobile_app_angular.pot
oca-travis Nov 15, 2019
de04cfb
[UPD] README.rst
OCA-git-bot Nov 15, 2019
fbbbac6
[ADD] icon.png
OCA-git-bot Nov 15, 2019
2bf0cf9
[ADD] mobile_app_picking
legalsylvain Feb 8, 2019
78349fa
[V1.1]
legalsylvain Feb 20, 2019
320fbd8
version 1.2
legalsylvain Feb 22, 2019
7848974
[V1.3]
legalsylvain Mar 18, 2019
e1f08a2
[IMP] add link to open picking in mobile app
Apr 29, 2019
4f4982d
[REF] use moves instead of move lines
legalsylvain Jul 12, 2019
51846a5
[DOC] set modules in Beta development status
legalsylvain Jul 12, 2019
f4543bb
[ADD] test
legalsylvain Jul 12, 2019
c80b4c0
[DOC] improve roadmap and description after reviews
legalsylvain Nov 15, 2019
0950675
[FIX] pylint
legalsylvain Nov 15, 2019
38c83f3
[UPD] Update mobile_app_picking.pot
oca-travis Nov 15, 2019
26dea96
[UPD] README.rst
OCA-git-bot Nov 15, 2019
2c92101
[MIG][12.0] mobile_app_abstract / mobile_app_angular / mobile_app_pic…
legalsylvain Jan 14, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
86 changes: 86 additions & 0 deletions mobile_app_abstract/README.rst
@@ -0,0 +1,86 @@
==================
Mobile App - Tools
==================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-OCA%2Fstock--logistics--barcode-lightgray.png?logo=github
:target: https://github.com/OCA/stock-logistics-barcode/tree/11.0/mobile_app_abstract
:alt: OCA/stock-logistics-barcode
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-logistics-barcode-11-0/stock-logistics-barcode-11-0-mobile_app_abstract
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
:target: https://runbot.odoo-community.org/runbot/150/11.0
:alt: Try me on Runbot

|badge1| |badge2| |badge3| |badge4| |badge5|

This module is a toolkit module that provides generics tools usefull
for mobile application. It does'nt provide any end features by itself.

It also provides demo data (barcodes on products) to make easier tests
of the mobile applications.

**Technical Information**

* Add a new abstract model ``mobile.app.mxin`` that introduces generic
functions to receive and provide json communication.

**See also**

* ``mobile_app_picking`` module (same repository)

**Table of contents**

.. contents::
:local:

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-barcode/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/OCA/stock-logistics-barcode/issues/new?body=module:%20mobile_app_abstract%0Aversion:%2011.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://www.twitter.com/legalsylvain)

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

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/stock-logistics-barcode <https://github.com/OCA/stock-logistics-barcode/tree/11.0/mobile_app_abstract>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
1 change: 1 addition & 0 deletions mobile_app_abstract/__init__.py
@@ -0,0 +1 @@
from . import models
22 changes: 22 additions & 0 deletions mobile_app_abstract/__manifest__.py
@@ -0,0 +1,22 @@
# 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': 'Mobile App - Tools',
'summary': 'Provides generic tools by API for Mobile Apps',
'version': '12.0.1.0.0',
'category': 'Tools',
'author': 'GRAP,Odoo Community Association (OCA)',
'website': 'https://github.com/OCA/stock-logistics-barcode',
'license': 'AGPL-3',
'development_status': 'Beta',
'depends': [
'stock',
],
'demo': [
'demo/product_product.xml',
'demo/res_groups.xml',
],
'installable': True,
}
18 changes: 18 additions & 0 deletions mobile_app_abstract/demo/product_product.xml
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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).
-->

<odoo>

<!-- <record id="product.product_product_5b_product_template" model="product.template">
<field name="barcode">9782330075989</field>
</record>

<record id="product.product_product_16_product_template" model="product.template">
<field name="barcode">9782020896320</field>
</record> -->

</odoo>
67 changes: 67 additions & 0 deletions mobile_app_abstract/demo/res_groups.xml
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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).
-->

<odoo>

<record id="product.group_product_variant" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="stock.group_tracking_owner" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="stock.group_stock_multi_locations" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="stock.group_stock_multi_warehouses" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="stock.group_tracking_lot" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="product.group_stock_packaging" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="product.group_uom" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>

<record id="stock.group_production_lot" model="res.groups">
<field name="users" eval="[
(4, ref('base.user_root')),
(4, ref('base.user_demo')),
]"/>
</record>


</odoo>
37 changes: 37 additions & 0 deletions mobile_app_abstract/i18n/fr.po
@@ -0,0 +1,37 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mobile_app_abstract
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-02-20 09:34+0000\n"
"PO-Revision-Date: 2019-02-20 09:34+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin_display_name
msgid "Display Name"
msgstr "Nom à afficher"

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin_id
msgid "ID"
msgstr "ID"

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin___last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: mobile_app_abstract
#: model:ir.model,name:mobile_app_abstract.model_mobile_app_mxin
msgid "mobile.app.mxin"
msgstr "mobile.app.mxin"
35 changes: 35 additions & 0 deletions mobile_app_abstract/i18n/mobile_app_abstract.pot
@@ -0,0 +1,35 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * mobile_app_abstract
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 11.0\n"
"Report-Msgid-Bugs-To: \n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin_display_name
msgid "Display Name"
msgstr ""

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin_id
msgid "ID"
msgstr ""

#. module: mobile_app_abstract
#: model:ir.model.fields,field_description:mobile_app_abstract.field_mobile_app_mxin___last_update
msgid "Last Modified on"
msgstr ""

#. module: mobile_app_abstract
#: model:ir.model,name:mobile_app_abstract.model_mobile_app_mxin
msgid "mobile.app.mxin"
msgstr ""

1 change: 1 addition & 0 deletions mobile_app_abstract/models/__init__.py
@@ -0,0 +1 @@
from . import mobile_app_abstract
119 changes: 119 additions & 0 deletions mobile_app_abstract/models/mobile_app_abstract.py
@@ -0,0 +1,119 @@
# 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).

from odoo import api, models


class MobileAppAbstract(models.AbstractModel):
_name = 'mobile.app.mixin'
_description = "Mobile App Mixin Abstract Model"

# To Overload Section
@api.model
def get_custom_fields_list(self):
"""Overload this function to define which field values should
be displayed on the mobile application, when scanning a product"""
return []

# Public API Section
@api.model
def check_group(self, group_ext_id):
return self.env.user.has_group(group_ext_id)

# Export Section
@api.model
def _export_partner(self, partner):
if not partner:
return {}
return {
'id': partner.id,
'name': partner.name,
'customer': partner.customer,
'supplier': partner.supplier,
'parent_id': self._export_partner(partner.parent_id),
}

@api.model
def _export_uom(self, uom):
if not uom:
return {}
return {
'id': uom.id,
'name': uom.name,
}

@api.model
def _export_product(self, product, custom_fields):
if not product:
return {}
# Custom product fields
custom_vals = {}
for field_name, field_display in custom_fields.items():
if field_name[-3:] == '_id':
value = getattr(product, field_name).name
elif field_name[-4:] == '_ids':
value = ", ".join(
[attr.name for attr in getattr(product, field_name)])
else:
value = getattr(product, field_name)
custom_vals[field_display] = value

return {
'id': product.id,
'name': product.name,
'display_name': product.display_name,
'barcode': product.barcode,
'custom_vals': custom_vals,
}

# Custom Section
@api.model
def _extract_param(self, params, value_path, default_value=False):
if not type(params) is dict:
return False
if '.' in value_path:
# Recursive call
value_path_split = value_path.split('.')
first_key = value_path_split[0]
return self._extract_param(
params.get(first_key),
'.'.join(value_path_split[1:]),
default_value)
else:
return params.get(value_path, default_value)

@api.model
def _get_custom_fields_dict(self):
"""Return a list of (field_name, field_display) for each custom
product fields that should be displayed during the inventory.

Don't work yet with computed fields (like display_name)"""

# Get custom fields
res = {}

custom_field_names = self.get_custom_fields_list()

# Add Custom product fields
for field_name in custom_field_names:
res[field_name] = self._get_field_display(field_name)
return res

@api.model
def _get_field_display(self, field_name):
IrTranslation = self.env['ir.translation']
# Determine model name
if field_name in self.env['product.product']._fields.keys():
model = 'product.product'
else:
model = 'product.template'
# Get translation if defined
translation_ids = IrTranslation.search([
('lang', '=', self.env.context.get('lang', False)),
('type', '=', 'field'),
('name', '=', '%s,%s' % (model, field_name))])
if translation_ids:
return translation_ids[0].value
else:
return self.env[model]._fields[field_name].string
1 change: 1 addition & 0 deletions mobile_app_abstract/readme/CONTRIBUTORS.rst
@@ -0,0 +1 @@
* Sylvain LE GAL (https://www.twitter.com/legalsylvain)