Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge commit 'refs/pull/371/head' of git+ssh://github.com/ursais/osi-…
…addons into fko/14.0.1.0.0
- Loading branch information
Showing
21 changed files
with
439 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,86 @@ | ||
================================== | ||
Documents for Lot/Tracking Numbers | ||
================================== | ||
|
||
.. |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-ursais%2Fosi--addons-lightgray.png?logo=github | ||
:target: https://github.com/ursais/osi-addons/tree/14.0/documents_stock_production_lot | ||
:alt: ursais/osi-addons | ||
|
||
|badge1| |badge2| |badge3| | ||
|
||
This module allows you to create a document when attaching a file to a lot/tracking | ||
number. It also allows you to upload a document and attach it to an existing lot. | ||
|
||
**Table of contents** | ||
|
||
.. contents:: | ||
:local: | ||
|
||
Configuration | ||
============= | ||
|
||
#. Go to Documents | ||
#. Activate the lot/tracking number | ||
#. Configure the folder and the tags | ||
|
||
Usage | ||
===== | ||
|
||
To use this module, you need to: | ||
|
||
#. Go to Inventory > Master Data > Lot/Tracking Numbers | ||
#. Create or select a lot/tracking number | ||
#. Add an attachment | ||
#. Go to Documents | ||
#. Select the Lot/Tracking Numbers folder | ||
#. Select the file uploaded previously. It is linked to the lot/tracking number. | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues <https://github.com/ursais/osi-addons/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/ursais/osi-addons/issues/new?body=module:%20documents_stock_production_lot%0Aversion:%2014.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_. | ||
|
||
Credits | ||
======= | ||
|
||
Authors | ||
~~~~~~~ | ||
|
||
* Open Source Integrators | ||
|
||
Contributors | ||
~~~~~~~~~~~~ | ||
|
||
* Vimal Patel <vpatel@opensourceintegrators.com> | ||
|
||
Other credits | ||
~~~~~~~~~~~~~ | ||
|
||
The development of this module has been financially supported by: | ||
|
||
* Open Source Integrators <https://www.opensourceintegrators.com> | ||
|
||
Maintainers | ||
~~~~~~~~~~~ | ||
|
||
This module is maintained by Open Source Integrators. | ||
|
||
.. image:: https://github.com/ursais.png | ||
:alt: Open Source Integrators | ||
:target: https://opensourceintegrators.com | ||
|
||
Open Source Integrators™ (OSI) provides customers a unique combination of open source | ||
business process consulting and implementations. | ||
|
||
This module is part of the `ursais/osi-addons <https://github.com/ursais/osi-addons/tree/14.0/documents_helpdesk>`_ 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,4 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from . import models | ||
from . import wizards |
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,23 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
{ | ||
"name": "Documents for lot/tracking number", | ||
"version": "14.0.1.0.0", | ||
"category": "Documents", | ||
"summary": """Manage documents attached to lot/tracking numbers""", | ||
"website": "https://github.com/ursais/osi-addons", | ||
"author": "Open Source Integrators", | ||
"license": "LGPL-3", | ||
"depends": ["documents", "stock"], | ||
"data": [ | ||
"security/ir.model.access.csv", | ||
"data/documents_folder.xml", | ||
"data/documents_facet.xml", | ||
"data/documents_tag.xml", | ||
"data/documents_workflow_rule.xml", | ||
"data/res_company.xml", | ||
"views/res_config_settings.xml", | ||
"wizards/select_production_lot_view.xml", | ||
], | ||
"maintainers": ["bodedra"], | ||
} |
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,9 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record id="documents_facet_lot" model="documents.facet" forcecreate="0"> | ||
<field name="name">Lot</field> | ||
<field name="sequence">6</field> | ||
<field name="folder_id" ref="documents_folder_lot" /> | ||
</record> | ||
|
||
</odoo> |
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,11 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record id="documents_folder_lot" model="documents.folder" forcecreate="0"> | ||
<field name="name">Lot/Tracking Numbers</field> | ||
<field name="group_ids" eval="[(4, ref('base.group_user'))]" /> | ||
<field name="read_group_ids" eval="[(4, ref('base.group_user'))]" /> | ||
<field name="user_specific">True</field> | ||
<field name="sequence">12</field> | ||
</record> | ||
|
||
</odoo> |
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,9 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record id="documents_tag_new" model="documents.tag"> | ||
<field name="name">New</field> | ||
<field name="facet_id" ref="documents_facet_lot" /> | ||
<field name="sequence">10</field> | ||
</record> | ||
|
||
</odoo> |
14 changes: 14 additions & 0 deletions
14
documents_stock_production_lot/data/documents_workflow_rule.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,14 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record | ||
id="documents_workflow_rule_lot" | ||
model="documents.workflow.rule" | ||
forcecreate="0" | ||
> | ||
<field name="name">Attach to Lot/Tracking Number</field> | ||
<field name="domain_folder_id" ref="documents_folder_lot" /> | ||
<field name="condition_type">criteria</field> | ||
<field name="create_model">stock.production.lot</field> | ||
</record> | ||
|
||
</odoo> |
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,7 @@ | ||
<odoo noupdate="1"> | ||
|
||
<record id="base.main_company" model="res.company"> | ||
<field name="lot_folder" ref="documents_folder_lot" /> | ||
</record> | ||
|
||
</odoo> |
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 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from . import ( | ||
res_company, | ||
res_config_settings, | ||
stock_production_lot, | ||
documents_workflow_rule, | ||
) |
35 changes: 35 additions & 0 deletions
35
documents_stock_production_lot/models/documents_workflow_rule.py
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,35 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from odoo import fields, models | ||
|
||
|
||
class DocumentsWorkflowRule(models.Model): | ||
_inherit = ["documents.workflow.rule"] | ||
|
||
def _compute_business(self): | ||
return self._get_business() | ||
|
||
has_business_option = fields.Boolean(default=True, compute="_compute_business") | ||
create_model = fields.Selection( | ||
selection_add=[("stock.production.lot", "Lot/Tracking Number")] | ||
) | ||
|
||
def create_record(self, documents=None): | ||
res = super().create_record(documents=documents) | ||
if self.create_model == "stock.production.lot": | ||
ctx = self._context.copy() | ||
ctx.update({"documents": documents.ids}) | ||
view_id = self.env.ref( | ||
"documents_stock_production_lot.select_production_lot_view_form" | ||
).id | ||
return { | ||
"type": "ir.actions.act_window", | ||
"res_model": "select.production.lot", | ||
"name": "Lot/Tracking Number", | ||
"context": ctx, | ||
"view_mode": "form", | ||
"target": "new", | ||
"views": [(view_id, "form")], | ||
"view_id": view_id, | ||
} | ||
return res |
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,25 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from odoo import fields, models | ||
|
||
|
||
class ResCompany(models.Model): | ||
_inherit = "res.company" | ||
|
||
def _domain_company(self): | ||
company = self.env.company | ||
return ["|", ("company_id", "=", False), ("company_id", "=", company)] | ||
|
||
documents_lot_settings = fields.Boolean() | ||
lot_folder = fields.Many2one( | ||
"documents.folder", | ||
string="Lot/Tracking Number Workspace", | ||
domain=_domain_company, | ||
default=lambda self: self.env.ref( | ||
"documents_stock_production_lot.documents_folder_lot", | ||
raise_if_not_found=False, | ||
), | ||
) | ||
document_lot_tags = fields.Many2many( | ||
"documents.tag", "document_lot_tags", string="Lot/Tracking Number Tags" | ||
) |
31 changes: 31 additions & 0 deletions
31
documents_stock_production_lot/models/res_config_settings.py
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 (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from odoo import api, fields, models | ||
|
||
|
||
class ResConfigSettings(models.TransientModel): | ||
_inherit = "res.config.settings" | ||
|
||
documents_lot_settings = fields.Boolean( | ||
related="company_id.documents_lot_settings", | ||
readonly=False, | ||
string="Lot", | ||
) | ||
lot_folder = fields.Many2one( | ||
"documents.folder", | ||
related="company_id.lot_folder", | ||
readonly=False, | ||
string="Lot Default Workspace", | ||
) | ||
lot_tags = fields.Many2many( | ||
"documents.tag", | ||
"document_lot_tag", | ||
related="company_id.document_lot_tags", | ||
readonly=False, | ||
string="Lot Tags", | ||
) | ||
|
||
@api.onchange("lot_folder") | ||
def _onchange_lot_folder(self): | ||
if self.lot_folder != self.lot_tags.mapped("folder_id"): | ||
self.lot_tags = False |
19 changes: 19 additions & 0 deletions
19
documents_stock_production_lot/models/stock_production_lot.py
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,19 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
from odoo import models | ||
|
||
|
||
class StockProductionLot(models.Model): | ||
_name = "stock.production.lot" | ||
_inherit = ["stock.production.lot", "documents.mixin"] | ||
|
||
def _get_document_folder(self): | ||
return self.company_id.lot_folder | ||
|
||
def _get_document_tags(self): | ||
company = self.company_id or self.env.company | ||
return company.document_lot_tags | ||
|
||
def _check_create_documents(self): | ||
company = self.company_id or self.env.company | ||
return company.documents_lot_settings and super()._check_create_documents() |
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 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_select_production_lot,access_select_production_lot,model_select_production_lot,base.group_user,1,1,1,1 |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions
75
documents_stock_production_lot/views/res_config_settings.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,75 @@ | ||
<odoo> | ||
|
||
<record id="res_config_settings_documents_lot_view_form" model="ir.ui.view"> | ||
<field name="name">res.config.settings.view.form.documents.lot</field> | ||
<field name="model">res.config.settings</field> | ||
<field name="priority" eval="70" /> | ||
<field name="inherit_id" ref="base.res_config_settings_view_form" /> | ||
<field name="arch" type="xml"> | ||
<xpath | ||
expr="//div[hasclass('o_documents_block')]" | ||
position="attributes" | ||
> | ||
<attribute name="invisible">0</attribute> | ||
</xpath> | ||
<xpath | ||
expr="//div[hasclass('o_documents_block')]" | ||
position="inside" | ||
> | ||
<div class="row mt16 o_settings_container"> | ||
<div class="col-xs-12 col-md-6 o_setting_box"> | ||
<div class="o_setting_left_pane"> | ||
<field name="documents_lot_settings" /> | ||
</div> | ||
<div | ||
class="o_setting_right_pane o_documents_right_pane" | ||
> | ||
<label for="documents_lot_settings" /> | ||
<span | ||
class="fa fa-lg fa-building-o" | ||
title="Values set here are company-specific." | ||
aria-label="Values set here are company-specific." | ||
groups="base.group_multi_company" | ||
role="img" | ||
/> | ||
<div class="row"> | ||
<div class="text-muted col-md-12"> | ||
Centralize files attached to lot/tracking numbers. | ||
</div> | ||
</div> | ||
<div | ||
class="content-group" | ||
attrs="{'invisible' : [('documents_lot_settings', '=', False)]}" | ||
> | ||
<div class="row mt16"> | ||
<label | ||
class="o_form_label col-lg-3" | ||
for="lot_folder" | ||
string="Workspace" | ||
/> | ||
<field | ||
name="lot_folder" | ||
attrs="{'required' : [('documents_lot_settings', '=', True)]}" | ||
/> | ||
</div> | ||
<div class="row"> | ||
<label | ||
class="o_form_label col-lg-3" | ||
for="lot_tags" | ||
string="Default Tags" | ||
/> | ||
<field | ||
name="lot_tags" | ||
widget="many2many_tags" | ||
domain="[('folder_id','=', lot_folder)]" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</xpath> | ||
</field> | ||
</record> | ||
|
||
</odoo> |
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,4 @@ | ||
# Copyright (C) 2021 Open Source Integrators | ||
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl). | ||
|
||
from . import select_production_lot |
Oops, something went wrong.