mirror of
https://github.com/OCA/manufacture.git
synced 2025-01-28 16:37:15 +02:00
from AK @author Sébastien BEAU <sebastien.beau@akretion.com>
This commit is contained in:
77
product_quick_bom/README.rst
Normal file
77
product_quick_bom/README.rst
Normal file
@@ -0,0 +1,77 @@
|
||||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg
|
||||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
|
||||
:alt: License: AGPL-3
|
||||
|
||||
==============
|
||||
{module_title}
|
||||
==============
|
||||
|
||||
This module was written to create quickly the bom for your product.
|
||||
Indeed in the product form you now have a new tab "bom" that give you the posibility
|
||||
to add the bom line directly here
|
||||
|
||||
Installation
|
||||
============
|
||||
|
||||
To install this module, you just need to install it
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
No configuration is required
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
To use this module, you need to:
|
||||
|
||||
* go to a product form, click on edit, add a line in the bom tab and see that a bom
|
||||
linked to the product have been created
|
||||
|
||||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas
|
||||
:alt: Try me on Runbot
|
||||
:target: https://runbot.odoo-community.org/runbot/{repo_id}/{branch}
|
||||
|
||||
.. repo_id is available in https://github.com/OCA/maintainer-tools/blob/master/tools/repos_with_ids.txt
|
||||
.. branch is "8.0" for example
|
||||
|
||||
For further information, please visit:
|
||||
|
||||
* https://www.odoo.com/forum/help-1
|
||||
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* ...
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues <https://github.com/OCA/{project_repo}/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
|
||||
`here <https://github.com/OCA/{project_repo}/issues/new?body=module:%20{module_name}%0Aversion:%20{version}%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
|
||||
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
|
||||
* Sébastien Beau <sebastien.beau@aketion.com>
|
||||
|
||||
Maintainer
|
||||
----------
|
||||
|
||||
.. image:: https://odoo-community.org/logo.png
|
||||
:alt: Odoo Community Association
|
||||
:target: https://odoo-community.org
|
||||
|
||||
This module is maintained by the OCA.
|
||||
|
||||
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.
|
||||
|
||||
To contribute to this module, please visit http://odoo-community.org.
|
||||
24
product_quick_bom/__init__.py
Normal file
24
product_quick_bom/__init__.py
Normal file
@@ -0,0 +1,24 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# Module for OpenERP
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
from . import product
|
||||
from . import bom
|
||||
45
product_quick_bom/__openerp__.py
Normal file
45
product_quick_bom/__openerp__.py
Normal file
@@ -0,0 +1,45 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# Module for OpenERP
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
{
|
||||
"name": "Product Quick Bom",
|
||||
"summary": "Create the bom directly from the product",
|
||||
"version": "8.0.1.0.0",
|
||||
"category": "mrp",
|
||||
"website": "https://odoo-community.org/",
|
||||
"author": "Akretion, Odoo Community Association (OCA)",
|
||||
"license": "AGPL-3",
|
||||
"application": False,
|
||||
"installable": True,
|
||||
"external_dependencies": {
|
||||
"python": [],
|
||||
"bin": [],
|
||||
},
|
||||
"depends": [
|
||||
"mrp",
|
||||
],
|
||||
"data": [
|
||||
"product_view.xml",
|
||||
],
|
||||
"demo": [
|
||||
],
|
||||
}
|
||||
44
product_quick_bom/bom.py
Normal file
44
product_quick_bom/bom.py
Normal file
@@ -0,0 +1,44 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# Module for OpenERP
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
from collections import defaultdict
|
||||
from openerp.exceptions import Warning as UserError
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
_inherit = 'mrp.bom'
|
||||
|
||||
_sql_constraint = (
|
||||
'uniq_product_template',
|
||||
'uniq(product_tmpl_id)',
|
||||
'You can only have one Bom per product template',
|
||||
)
|
||||
|
||||
|
||||
class MrpBomLine(models.Model):
|
||||
_inherit = 'mrp.bom.line'
|
||||
|
||||
product_tmpl_id = fields.Many2one(
|
||||
'product.template',
|
||||
related='bom_id.product_tmpl_id',
|
||||
store=True)
|
||||
42
product_quick_bom/i18n/fr.po
Normal file
42
product_quick_bom/i18n/fr.po
Normal file
@@ -0,0 +1,42 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_quick_bom
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-09-13 16:24+0000\n"
|
||||
"PO-Revision-Date: 2015-09-13 16:24+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: product_quick_bom
|
||||
#: model:ir.model,name:product_quick_bom.model_mrp_bom
|
||||
msgid "Bill of Material"
|
||||
msgstr "Nomenclature"
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: field:product.template,bom_line_ids:0
|
||||
msgid "Bom Line"
|
||||
msgstr "Composant"
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: view:product.template:product_quick_bom.product_template_form_view
|
||||
msgid "Bom line"
|
||||
msgstr "Composant"
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: help:product.template,bom_line_ids:0
|
||||
msgid "If you product is manufactured you can selecthere the componant to product them"
|
||||
msgstr "Si votre produit est fabriqué vous pouvez définir les composants ici"
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: model:ir.model,name:product_quick_bom.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr "Modèle d'article"
|
||||
|
||||
42
product_quick_bom/i18n/product_quick_bom.pot
Normal file
42
product_quick_bom/i18n/product_quick_bom.pot
Normal file
@@ -0,0 +1,42 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * product_quick_bom
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 8.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-09-13 16:25+0000\n"
|
||||
"PO-Revision-Date: 2015-09-13 16:25+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: product_quick_bom
|
||||
#: model:ir.model,name:product_quick_bom.model_mrp_bom
|
||||
msgid "Bill of Material"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: field:product.template,bom_line_ids:0
|
||||
msgid "Bom Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: view:product.template:product_quick_bom.product_template_form_view
|
||||
msgid "Bom line"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: help:product.template,bom_line_ids:0
|
||||
msgid "If you product is manufactured you can selecthere the componant to product them"
|
||||
msgstr ""
|
||||
|
||||
#. module: product_quick_bom
|
||||
#: model:ir.model,name:product_quick_bom.model_product_template
|
||||
msgid "Product Template"
|
||||
msgstr ""
|
||||
|
||||
77
product_quick_bom/product.py
Normal file
77
product_quick_bom/product.py
Normal file
@@ -0,0 +1,77 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
###############################################################################
|
||||
#
|
||||
# Module for OpenERP
|
||||
# Copyright (C) 2015 Akretion (http://www.akretion.com).
|
||||
# @author Sébastien BEAU <sebastien.beau@akretion.com>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
###############################################################################
|
||||
|
||||
from openerp import models, fields, api
|
||||
from collections import defaultdict
|
||||
from openerp.exceptions import Warning as UserError
|
||||
|
||||
|
||||
class ProductTemplate(models.Model):
|
||||
_inherit = 'product.template'
|
||||
|
||||
bom_line_ids = fields.One2many(
|
||||
'mrp.bom.line',
|
||||
'product_tmpl_id',
|
||||
string='Bom Line',
|
||||
help='If you product is manufactured you can select'
|
||||
'here the componant to product them')
|
||||
|
||||
@api.model
|
||||
def _extract_bom_line(self, vals):
|
||||
return vals.pop('bom_line_ids', {})
|
||||
|
||||
@api.multi
|
||||
def _prepare_bom_vals(self, vals):
|
||||
return {
|
||||
'product_tmpl_id': self.id,
|
||||
'bom_line_ids': vals,
|
||||
}
|
||||
|
||||
@api.one
|
||||
def _process_bom_vals(self, vals):
|
||||
if self.bom_ids:
|
||||
self.bom_ids[0].write({'bom_line_ids': vals})
|
||||
else:
|
||||
bom = self.env['mrp.bom'].create(self._prepare_bom_vals(vals))
|
||||
|
||||
@api.model
|
||||
def create(self, vals):
|
||||
bom_vals = self._extract_bom_line(vals)
|
||||
record = super(ProductTemplate, self).create(vals)
|
||||
if bom_vals:
|
||||
record._process_bom_vals(bom_vals)
|
||||
return record
|
||||
|
||||
@api.multi
|
||||
def write(self, vals):
|
||||
bom_vals = self._extract_bom_line(vals)
|
||||
res = super(ProductTemplate, self).write(vals)
|
||||
if bom_vals:
|
||||
self._process_bom_vals(bom_vals)
|
||||
return res
|
||||
|
||||
@api.multi
|
||||
def unlink(self):
|
||||
for record in self:
|
||||
if record.bom_ids:
|
||||
record.bom_ids.unlink()
|
||||
return super(ProductTemplate, self).unlink()
|
||||
24
product_quick_bom/product_view.xml
Normal file
24
product_quick_bom/product_view.xml
Normal file
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="product_template_form_view" model="ir.ui.view">
|
||||
<field name="model">product.template</field>
|
||||
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||
<field name="priority" eval="200"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@string='Sales']" position="after">
|
||||
<page name="bom_line" string="Bom line">
|
||||
<field name="bom_line_ids">
|
||||
<tree editable="bottom">
|
||||
<field name="product_id"/>
|
||||
<field name="product_qty"/>
|
||||
</tree>
|
||||
</field>
|
||||
</page>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
BIN
product_quick_bom/static/description/icon.png
Normal file
BIN
product_quick_bom/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
79
product_quick_bom/static/description/icon.svg
Normal file
79
product_quick_bom/static/description/icon.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 45 KiB |
124
product_quick_bom/static/description/index.html
Normal file
124
product_quick_bom/static/description/index.html
Normal file
@@ -0,0 +1,124 @@
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Module name</h2>
|
||||
<p>This module was written to extend the functionality of ... to support ... and allow you to ...</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container oe_dark">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Installation</h2>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<p class="oe_mt32">To install this module, you need to:
|
||||
<ul>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=crm">
|
||||
<img src="crm_sc_01.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Configuration</h2>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<p class="oe_mt32">To configure this module, you need to:
|
||||
<ul>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=crm">
|
||||
<img src="crm_sc_01.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container oe_dark">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Usage</h2>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<p class="oe_mt32">To use this module, you need to:
|
||||
<ul>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</p>
|
||||
<p class="oe_mt32">For further information, please visit:
|
||||
<ul>
|
||||
<li><a href="https://www.odoo.com/forum/help-1">https://www.odoo.com/forum/help-1</a></li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=crm">
|
||||
<img src="crm_sc_01.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container">
|
||||
<div class="oe_row oe_spaced">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Known issues / Roadmap</h2>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<p class="oe_mt32">
|
||||
<ul>
|
||||
<li>...</li>
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
<div class="oe_span6">
|
||||
<div class="oe_demo oe_picture oe_screenshot">
|
||||
<a href="https://www.openerp.com/saas_master/demo?lang=en_US&module=crm">
|
||||
<img src="crm_sc_01.png">
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="oe_container oe_dark">
|
||||
<div class="oe_row">
|
||||
<div class="oe_span12">
|
||||
<h2 class="oe_slogan">Credits</h2>
|
||||
</div>
|
||||
<div class="oe_span12">
|
||||
<h3>Contributors</h3>
|
||||
<ul>
|
||||
<li>Firstname Lastname <<a href="mailto:email.address@example.com">email.address@example.com</a>></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="oe_span12">
|
||||
<h3>Maintainer</h3>
|
||||
<p>
|
||||
This module is maintained by the OCA.<br/>
|
||||
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.<br/>
|
||||
To contribute to this module, please visit <a href="http://odoo-community.org">http://odoo-community.org</a>.<br/>
|
||||
<a href="http://odoo-community.org"><img class="oe_picture oe_centered" src="http://odoo-community.org/logo.png"></a>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user