Skip to content

Commit

Permalink
bicycode: add module
Browse files Browse the repository at this point in the history
  • Loading branch information
hparfr committed May 2, 2024
1 parent 4b32d79 commit fd1520c
Show file tree
Hide file tree
Showing 23 changed files with 1,369 additions and 0 deletions.
78 changes: 78 additions & 0 deletions bicycode/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
========
Bicycode
========

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:6795cd91e4bc4cc57b800db64bd12d55e3763698f924c96304b7f4c3b5855df7
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-Akretion%2Fvertical--bike-lightgray.png?logo=github
:target: https://github.com/Akretion/vertical-bike/tree/14.0/bicycode
:alt: Akretion/vertical-bike

|badge1| |badge2| |badge3|

This module adds a bicycode field on stock move lines.
These bicycodes are used to identify bicycles after production and add traceability to the bicycles.

Products have a new field to define whether they have a bicycode or not.
Picking types have a new field to define whether their pickings require a bicycode for the products that have a bicycode.

When a picking with bicycode required is done, the user must input the bicycode of the products that have a bicycode.

Bicycode are searchable from the Inventory > Configuration menu.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/Akretion/vertical-bike/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/Akretion/vertical-bike/issues/new?body=module:%20bicycode%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
~~~~~~~~~~~~

* Syera BONNEAUX <[email protected]>
* Florian MOUNIER <[email protected]>
* Raphaël Reverdy <[email protected]>

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

.. |maintainer-hparfr| image:: https://github.com/hparfr.png?size=40px
:target: https://github.com/hparfr
:alt: hparfr

Current maintainer:

|maintainer-hparfr|

This module is part of the `Akretion/vertical-bike <https://github.com/Akretion/vertical-bike/tree/14.0/bicycode>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions bicycode/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
26 changes: 26 additions & 0 deletions bicycode/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright 2023 Akretion
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl-3.0)

{
"name": "Bicycode",
"summary": "bicycode number field added on stock_move_line ",
"version": "14.0.2.0.0",
"category": "Stock",
"website": "https://github.com/akretion/vertical-bike",
"author": "Akretion",
"maintainers": ["hparfr"],
"license": "AGPL-3",
"depends": [
"stock",
],
"data": [
"security/bicycode_security.xml",
"security/ir.model.access.csv",
"views/stock_move_views.xml",
"views/product_views.xml",
"views/stock_bicycode_views.xml",
"views/stock_picking_views.xml",
"views/stock_move_line_views.xml",
"report/report_deliveryslip.xml",
],
}
165 changes: 165 additions & 0 deletions bicycode/i18n/fr.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,165 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * bicycode
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 14.0+e\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2023-09-21 09:35+0000\n"
"PO-Revision-Date: 2023-09-21 09:35+0000\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: bicycode
#: model_terms:ir.ui.view,arch_db:bicycode.report_delivery_document
msgid "<strong>Bicycode</strong>"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__name
#: model_terms:ir.ui.view,arch_db:bicycode.report_delivery_document
#: model_terms:ir.ui.view,arch_db:bicycode.view_bicycode_form
msgid "Bicycode"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_picking__bicycode_required
#: model:ir.model.fields,field_description:bicycode.field_stock_picking_type__bicycode_required
msgid "Bicycode required"
msgstr "Bicycode requis"

#. module: bicycode
#: model:ir.actions.act_window,name:bicycode.stock_bicycode_action
#: model:ir.model.fields,field_description:bicycode.field_stock_move_line__bicycode_ids
#: model:ir.ui.menu,name:bicycode.stock_bicycode_menu
#: model_terms:ir.ui.view,arch_db:bicycode.view_bicycode_tree
#: model_terms:ir.ui.view,arch_db:bicycode.view_picking_type_form
msgid "Bicycodes"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__create_uid
msgid "Created by"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__create_date
msgid "Created on"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_product_template__display_name
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__display_name
#: model:ir.model.fields,field_description:bicycode.field_stock_move_line__display_name
#: model:ir.model.fields,field_description:bicycode.field_stock_picking__display_name
#: model:ir.model.fields,field_description:bicycode.field_stock_picking_type__display_name
msgid "Display Name"
msgstr "Nom à afficher"

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_product_product__has_bicycode
#: model:ir.model.fields,field_description:bicycode.field_product_template__has_bicycode
#: model:ir.model.fields,field_description:bicycode.field_shopinvader_product__has_bicycode
#: model:ir.model.fields,field_description:bicycode.field_shopinvader_variant__has_bicycode
msgid "Has Bicycode"
msgstr "Possède un bicycode"

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_product_template__id
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__id
#: model:ir.model.fields,field_description:bicycode.field_stock_move_line__id
#: model:ir.model.fields,field_description:bicycode.field_stock_picking__id
#: model:ir.model.fields,field_description:bicycode.field_stock_picking_type__id
msgid "ID"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,help:bicycode.field_stock_picking__bicycode_required
#: model:ir.model.fields,help:bicycode.field_stock_picking_type__bicycode_required
msgid ""
"If checked, the user will have to input the bicycode of the products that "
"have one to validate the picking."
msgstr ""
"Si coché, l'utilisateur devra saisir le bicycode des articles qui en "
"possèdent un pour valider le transfert."

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_product_template____last_update
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode____last_update
#: model:ir.model.fields,field_description:bicycode.field_stock_move_line____last_update
#: model:ir.model.fields,field_description:bicycode.field_stock_picking____last_update
#: model:ir.model.fields,field_description:bicycode.field_stock_picking_type____last_update
msgid "Last Modified on"
msgstr "Dernière modification le"

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__write_uid
msgid "Last Updated by"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__write_date
msgid "Last Updated on"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__move_line_ids
msgid "Move lines"
msgstr ""

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__partner_ids
msgid "Partners"
msgstr "Partenaires"

#. module: bicycode
#: model:ir.model,name:bicycode.model_stock_picking_type
msgid "Picking Type"
msgstr "Type de transfert"

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__picking_ids
msgid "Pickings"
msgstr "Transferts"

#. module: bicycode
#: model:ir.model,name:bicycode.model_stock_move_line
msgid "Product Moves (Stock Move Line)"
msgstr "Mouvements d'article (Ligne de mouvement de stock)"

#. module: bicycode
#: model:ir.model,name:bicycode.model_product_template
msgid "Product Template"
msgstr "Modèle d'article"

#. module: bicycode
#: model:ir.model.fields,field_description:bicycode.field_stock_bicycode__sale_order_ids
msgid "Sale orders"
msgstr "Ventes"

#. module: bicycode
#: model:ir.model,name:bicycode.model_stock_picking
msgid "Transfer"
msgstr "Transfert"

#. module: bicycode
#: code:addons/bicycode/models/stock_picking.py:0
#, python-format
msgid "You have set too many bicycodes for product %s"
msgstr "Vous avez saisi trop de bicycodes pour l'article %s"

#. module: bicycode
#: code:addons/bicycode/models/stock_picking.py:0
#, python-format
msgid "You must input %d bicycode(s) for product %s"
msgstr "Vous devez saisir %d bicycode(s) pour l'article %s"

#. module: bicycode
#: model:ir.model,name:bicycode.model_stock_bicycode
msgid "stock.bicycode"
msgstr ""
4 changes: 4 additions & 0 deletions bicycode/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from . import product_template
from . import stock_bicycode
from . import stock_move
from . import stock_picking
10 changes: 10 additions & 0 deletions bicycode/models/product_template.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Copyright 2023 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import fields, models


class ProductTemplate(models.Model):
_inherit = "product.template"

has_bicycode = fields.Boolean(string="Has Bicycode", default=False)
57 changes: 57 additions & 0 deletions bicycode/models/stock_bicycode.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Copyright 2023 Akretion (http://www.akretion.com)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from odoo import api, fields, models


class StockBicycode(models.Model):
_name = "stock.bicycode"
_description = "Bicycode is an id on a bike frame"

name = fields.Char("Bicycode")

move_line_ids = fields.Many2many(
"stock.move.line",
"stock_bicycode_move_line_rel",
"bicycode_id",
"move_line_id",
string="Move lines",
)

sale_order_ids = fields.Many2many(
"sale.order",
string="Sale orders",
compute="_compute_sale_order_ids",
store=True,
)

partner_ids = fields.Many2many(
"res.partner",
string="Partners",
compute="_compute_partner_ids",
store=True,
)

picking_ids = fields.Many2many(
"stock.picking",
string="Pickings",
compute="_compute_picking_ids",
store=True,
)

@api.depends("move_line_ids")
def _compute_partner_ids(self):
for record in self:
record.partner_ids = record.move_line_ids.mapped("move_id.partner_id")

@api.depends("move_line_ids")
def _compute_sale_order_ids(self):
for record in self:
record.sale_order_ids = record.move_line_ids.mapped(
"move_id.sale_line_id.order_id"
)

@api.depends("move_line_ids")
def _compute_picking_ids(self):
for record in self:
record.picking_ids = record.move_line_ids.mapped("move_id.picking_id")
Loading

0 comments on commit fd1520c

Please sign in to comment.