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

[14.0][MIG] purchase_order_move_menu #41

Open
wants to merge 4 commits into
base: 14.0
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions purchase_order_move_menu/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
========================
Purchase Order Move Menu
========================

.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! 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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-solvosci%2Fslv--purchase-lightgray.png?logo=github
:target: https://github.com/solvosci/slv-purchase/tree/13.0/purchase_order_move_menu
:alt: solvosci/slv-purchase

|badge1| |badge2| |badge3|

Adds new menu for purchase related moves.

This is the twin addon of ``sale_order_move_menu`` of ``slv-sale`` repo.
Some of the new fields are renamed, since in Sale addon were not properly
prefixed, in order to prevent conflicts.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/solvosci/slv-purchase/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/solvosci/slv-purchase/issues/new?body=module:%20purchase_order_move_menu%0Aversion:%2013.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
~~~~~~~

* Solvos

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

* David Alonso <[email protected]>

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

This module is part of the `solvosci/slv-purchase <https://github.com/solvosci/slv-purchase/tree/13.0/purchase_order_move_menu>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions purchase_order_move_menu/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
19 changes: 19 additions & 0 deletions purchase_order_move_menu/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# © 2022 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3 - See http://www.gnu.org/licenses/lgpl-3.0.html
{
"name": "Purchase Order Move Menu",
"summary": """
Adds new menu for purchase related moves
""",
"author": "Solvos",
"license": "LGPL-3",
"version": "13.0.1.0.0",
"category": "Operations/Purchase",
"website": "https://github.com/solvosci/slv-purchase",
"depends": ["purchase_stock"],
"data": [
"views/stock_move_views.xml",
"views/purchase_order_views.xml",
],
'installable': True,
}
115 changes: 115 additions & 0 deletions purchase_order_move_menu/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_move_menu
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-19 11:52+0000\n"
"PO-Revision-Date: 2022-05-19 13:54+0200\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.0\n"
"Last-Translator: \n"
"Language: es_ES\n"

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__po_currency_id
msgid "Currency"
msgstr "Moneda"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Date"
msgstr "Fecha"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "From"
msgstr "Desde"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Group By"
msgstr "Agrupar por"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Location Orig"
msgstr "Ubicación Origen"

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_order
msgid "Order Reference"
msgstr "Ref. pedido"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Picking"
msgstr "Albarán"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Product"
msgstr "Producto"

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__po_product_categ_id
msgid "Product Category"
msgstr "Categoría de producto"

#. module: purchase_order_move_menu
#: model:ir.actions.act_window,name:purchase_order_move_menu.action_stock_move_po_move_menu
#: model:ir.ui.menu,name:purchase_order_move_menu.menu_purchase_order_sale_moves
msgid "Purchase Moves"
msgstr "Movimientos de compra"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Purchase Order"
msgstr "Pedido de compra"

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_user_id
msgid "Purchase Representative"
msgstr "Representante de compras"

#. module: purchase_order_move_menu
#: model:ir.model.fields,help:purchase_order_move_menu.field_stock_move__po_product_categ_id
msgid "Select category for the current product"
msgstr "Seleccione la categoría para el producto actual"

#. module: purchase_order_move_menu
#: model:ir.model,name:purchase_order_move_menu.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de Inventario"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Stock Moves"
msgstr "Movimientos de Inventario"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "To"
msgstr "Hasta"

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "Unit of Measure"
msgstr "Unidad de Medida"

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_partner_id
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Vendor"
msgstr "Proveedor"

#. module: purchase_order_move_menu
#: model:ir.model.fields,help:purchase_order_move_menu.field_stock_move__purchase_partner_id
msgid "You can find a vendor by its Name, TIN, Email or Internal Reference."
msgstr ""
113 changes: 113 additions & 0 deletions purchase_order_move_menu/i18n/purchase_order_move_menu.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_order_move_menu
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 13.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2022-05-19 11:52+0000\n"
"PO-Revision-Date: 2022-05-19 11:52+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: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__po_currency_id
msgid "Currency"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Date"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "From"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Group By"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Location Orig"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_order
msgid "Order Reference"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Picking"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Product"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__po_product_categ_id
msgid "Product Category"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.actions.act_window,name:purchase_order_move_menu.action_stock_move_po_move_menu
#: model:ir.ui.menu,name:purchase_order_move_menu.menu_purchase_order_sale_moves
msgid "Purchase Moves"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Purchase Order"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_user_id
msgid "Purchase Representative"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,help:purchase_order_move_menu.field_stock_move__po_product_categ_id
msgid "Select category for the current product"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model,name:purchase_order_move_menu.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Stock Moves"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "To"
msgstr ""

#. module: purchase_order_move_menu
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_tree
msgid "Unit of Measure"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,field_description:purchase_order_move_menu.field_stock_move__purchase_partner_id
#: model_terms:ir.ui.view,arch_db:purchase_order_move_menu.stock_move_po_move_menu_search
msgid "Vendor"
msgstr ""

#. module: purchase_order_move_menu
#: model:ir.model.fields,help:purchase_order_move_menu.field_stock_move__purchase_partner_id
msgid "You can find a vendor by its Name, TIN, Email or Internal Reference."
msgstr ""
1 change: 1 addition & 0 deletions purchase_order_move_menu/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_move
43 changes: 43 additions & 0 deletions purchase_order_move_menu/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# © 2022 Solvos Consultoría Informática (<http://www.solvos.es>)
# License LGPL-3.0 (https://www.gnu.org/licenses/lgpl-3.0.html)

from odoo import api, fields, models


class StockMove(models.Model):
_inherit = "stock.move"

po_product_categ_id = fields.Many2one(related="product_id.categ_id")
po_currency_id = fields.Many2one(related="purchase_line_id.currency_id")
purchase_order = fields.Many2one(
related="purchase_line_id.order_id",
store=True,
)
purchase_partner_id = fields.Many2one(
related="purchase_order.partner_id",
store=True,
)
purchase_user_id = fields.Many2one(
related="purchase_line_id.order_id.user_id",
)

@api.model
def action_purchase_moves(self):
"""
Modifies original purchase stock move action depending on Purchase
role of the logged user
"""
result = self.env["ir.actions.act_window"]._for_xml_id(
"purchase_order_move_menu.action_stock_move_po_move_menu"
)
# Default (fake) domain is replaced with the right one
domain_str = "('purchase_line_id','!=', False), ('state','=', 'done')"
if not self._check_purchase_all_permissions(self.env.user):
domain_str += ", ('purchase_user_id','=',%d)" % self.env.user.id
result["domain"] = "[%s]" % domain_str

return result

@api.model
def _check_purchase_all_permissions(self, user):
return user.has_group("purchase.group_purchase_manager")
2 changes: 2 additions & 0 deletions purchase_order_move_menu/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* David Alonso <[email protected]>
* Christian Santamaría <[email protected]>
5 changes: 5 additions & 0 deletions purchase_order_move_menu/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Adds new menu for purchase related moves.

This is the twin addon of ``sale_order_move_menu`` of ``slv-sale`` repo.
Some of the new fields are renamed, since in Sale addon were not properly
prefixed, in order to prevent conflicts.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading