-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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 dreispt
- Loading branch information
Showing
17 changed files
with
878 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
============= | ||
Sale MRP Link | ||
============= | ||
|
||
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
!! This file is generated by oca-gen-addon-readme !! | ||
!! changes will be overwritten. !! | ||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
.. |badge1| image:: https://img.shields.io/badge/maturity-Production%2FStable-green.png | ||
:target: https://odoo-community.org/page/development-status | ||
:alt: Production/Stable | ||
.. |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%2Fsale--workflow-lightgray.png?logo=github | ||
:target: https://github.com/OCA/sale-workflow/tree/11.0/sale_mrp_link | ||
:alt: OCA/sale-workflow | ||
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png | ||
:target: https://translation.odoo-community.org/projects/sale-workflow-11-0/sale-workflow-11-0-sale_mrp_link | ||
:alt: Translate me on Weblate | ||
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png | ||
:target: https://runbot.odoo-community.org/runbot/167/11.0 | ||
:alt: Try me on Runbot | ||
|
||
|badge1| |badge2| |badge3| |badge4| |badge5| | ||
|
||
This module adds a link between the manufacturing orders and the associated sale order. | ||
A button shown in the form view of sale orders allow the user to access to the related manufacturing orders. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Known issues / Roadmap | ||
====================== | ||
|
||
The module is incompatible with the following modules: | ||
|
||
* `sale_sourced_by_line <https://github.com/OCA/sale-workflow/tree/10.0/sale_sourced_by_line>`_ | ||
* `sale_stock_picking_blocking_proc_group_by_line <https://github.com/OCA/sale-workflow/tree/10.0/sale_stock_picking_blocking_proc_group_by_line>`_ | ||
* `sale_delivery_split_date <https://github.com/OCA/sale-workflow/tree/10.0/sale_delivery_split_date>`_ | ||
* `sale_quotation_sourcing <https://github.com/OCA/sale-workflow/blob/10.0/sale_quotation_sourcing>`_ (please note this latter is not migrated yet). | ||
|
||
Please see https://github.com/OCA/sale-workflow/pull/661#discussion_r214031110 for further info. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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/sale-workflow/issues/new?body=module:%20sale_mrp_link%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 | ||
~~~~~~~ | ||
|
||
* Akretion | ||
* Agile Business Group | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Florian da Costa <[email protected]> | ||
* Alex Comba <[email protected]> | ||
* Juan Humanes <[email protected]> | ||
|
||
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/sale-workflow <https://github.com/OCA/sale-workflow/tree/11.0/sale_mrp_link>`_ project on GitHub. | ||
|
||
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/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 @@ | ||
from . import models |
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,24 @@ | ||
# Copyright 2018 Alex Comba - Agile Business Group | ||
# Copyright 2016-2018 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
{ | ||
'name': 'Sale MRP Link', | ||
'summary': 'Show manufacturing orders generated from sales order', | ||
'version': '11.0.1.0.0', | ||
'development_status': 'Production/Stable', | ||
'category': 'Sales', | ||
'website': 'https://github.com/OCA/sale-workflow', | ||
'author': 'Akretion, Agile Business Group, ' | ||
'Odoo Community Association (OCA)', | ||
'license': 'AGPL-3', | ||
'application': False, | ||
'installable': True, | ||
'depends': [ | ||
'sale_mrp', | ||
], | ||
'data': [ | ||
'views/mrp_production.xml', | ||
'views/sale_order.xml', | ||
], | ||
} |
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,54 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_mrp_link | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.0+e\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2018-06-18 15:35+0000\n" | ||
"PO-Revision-Date: 2018-06-18 17:38+0200\n" | ||
"Last-Translator: <>\n" | ||
"Language-Team: \n" | ||
"Language: it\n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: 8bit\n" | ||
"Plural-Forms: \n" | ||
"X-Generator: Poedit 1.8.7.1\n" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_mrp_production | ||
msgid "Manufacturing Order" | ||
msgstr "Ordine di produzione" | ||
|
||
#. module: sale_mrp_link | ||
#: code:addons/sale_mrp_link/models/procurement_order.py:20 | ||
#, python-format | ||
msgid "More than 1 sale order found for this group" | ||
msgstr "Trovato più di un ordine di vendita per questo gruppo" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_procurement_order | ||
msgid "Procurement" | ||
msgstr "Approvvigionamento" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.ui.view,arch_db:sale_mrp_link.view_order_form | ||
msgid "Production" | ||
msgstr "Produzione" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model.fields,field_description:sale_mrp_link.field_sale_order_production_count | ||
msgid "Production count" | ||
msgstr "Numero ordini di produzione" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "Ordine di vendita" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model.fields,field_description:sale_mrp_link.field_mrp_production_sale_order_id | ||
msgid "Source Sale Order" | ||
msgstr "SO Origine" |
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,51 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * sale_mrp_link | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 10.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: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_mrp_production | ||
msgid "Manufacturing Order" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: code:addons/sale_mrp_link/models/procurement_order.py:20 | ||
#, python-format | ||
msgid "More than 1 sale order found for this group" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_procurement_order | ||
msgid "Procurement" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.ui.view,arch_db:sale_mrp_link.view_order_form | ||
msgid "Production" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model.fields,field_description:sale_mrp_link.field_sale_order_production_count | ||
msgid "Production count" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model,name:sale_mrp_link.model_sale_order | ||
msgid "Sales Order" | ||
msgstr "" | ||
|
||
#. module: sale_mrp_link | ||
#: model:ir.model.fields,field_description:sale_mrp_link.field_mrp_production_sale_order_id | ||
msgid "Source Sale Order" | ||
msgstr "" | ||
|
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 mrp_production | ||
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,33 @@ | ||
# Copyright 2018 Alex Comba - Agile Business Group | ||
# Copyright 2016-2018 Akretion | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class MrpProduction(models.Model): | ||
_inherit = 'mrp.production' | ||
|
||
sale_order_id = fields.Many2one( | ||
comodel_name='sale.order', string='Source Sale Order') | ||
|
||
@api.model | ||
def create(self, values): | ||
if 'origin' in values: | ||
# Checking first if this comes from a 'sale.order' | ||
sale_id = self.env['sale.order'].search([ | ||
('name', '=', values['origin']) | ||
], limit=1) | ||
if sale_id: | ||
values['sale_order_id'] = sale_id.id | ||
if sale_id.client_order_ref: | ||
values['origin'] = sale_id.client_order_ref | ||
else: | ||
# Checking if this production comes from a route | ||
production_id = self.env['mrp.production'].search([ | ||
('name', '=', values['origin']) | ||
]) | ||
# If so, use the 'sale_order_id' from the parent production | ||
values['sale_order_id'] = production_id.sale_order_id.id | ||
|
||
return super(MrpProduction, self).create(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,31 @@ | ||
# Copyright 2018 Alex Comba - Agile Business Group | ||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). | ||
|
||
from odoo import api, fields, models | ||
|
||
|
||
class SaleOrder(models.Model): | ||
_inherit = 'sale.order' | ||
|
||
production_count = fields.Integer( | ||
compute='_compute_production_count') | ||
|
||
@api.multi | ||
def _compute_production_count(self): | ||
mrp_production_model = self.env['mrp.production'] | ||
for sale in self: | ||
domain = [('sale_order_id', '=', sale.id)] | ||
sale.production_count = mrp_production_model.search_count(domain) | ||
|
||
@api.multi | ||
def action_view_production(self): | ||
action = self.env.ref('mrp.mrp_production_action').read()[0] | ||
productions = self.env['mrp.production'].search( | ||
[('sale_order_id', 'in', self.ids)]) | ||
if len(productions) > 1: | ||
action['domain'] = [('id', 'in', productions.ids)] | ||
else: | ||
action['views'] = [ | ||
(self.env.ref('mrp.mrp_production_form_view').id, 'form')] | ||
action['res_id'] = productions.id | ||
return action |
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 @@ | ||
* Florian da Costa <[email protected]> | ||
* Alex Comba <[email protected]> | ||
* Juan Humanes <[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,2 @@ | ||
This module adds a link between the manufacturing orders and the associated sale order. | ||
A button shown in the form view of sale orders allow the user to access to the related manufacturing orders. |
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,8 @@ | ||
The module is incompatible with the following modules: | ||
|
||
* `sale_sourced_by_line <https://github.com/OCA/sale-workflow/tree/10.0/sale_sourced_by_line>`_ | ||
* `sale_stock_picking_blocking_proc_group_by_line <https://github.com/OCA/sale-workflow/tree/10.0/sale_stock_picking_blocking_proc_group_by_line>`_ | ||
* `sale_delivery_split_date <https://github.com/OCA/sale-workflow/tree/10.0/sale_delivery_split_date>`_ | ||
* `sale_quotation_sourcing <https://github.com/OCA/sale-workflow/blob/10.0/sale_quotation_sourcing>`_ (please note this latter is not migrated yet). | ||
|
||
Please see https://github.com/OCA/sale-workflow/pull/661#discussion_r214031110 for further info. |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.