mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
add module 'procurement_auto_create_group' to 9.0
This commit is contained in:
committed by
davidborromeo
parent
5d724f7a69
commit
ffb47f6d7c
71
procurement_auto_create_group/README.rst
Normal file
71
procurement_auto_create_group/README.rst
Normal file
@@ -0,0 +1,71 @@
|
||||
.. 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
|
||||
|
||||
=============================
|
||||
Procurement Auto Create Group
|
||||
=============================
|
||||
|
||||
This module allows the system to propose automatically new procurement groups
|
||||
in procurement orders.
|
||||
|
||||
This capability is important when you want to make sure that all the stock
|
||||
moves resulting from this procurement will never be mixed with moves from
|
||||
other groups in stock transfers.
|
||||
|
||||
The stock transfers resulting from the execution of these procurements will
|
||||
only contain stock moves created from that procurement.
|
||||
|
||||
|
||||
Configuration
|
||||
=============
|
||||
|
||||
#. Go to *Inventory / Configuration / Settings* and check the option 'Advanced
|
||||
routing of products using rules' and press the 'Apply' button.
|
||||
#. Activate the developer mode.
|
||||
#. Go to *Inventory / Configuration / Routes / Routes* and check the option
|
||||
'Auto-create Procurement Group' to the pull rules where you want the
|
||||
procurement groups to be automatically proposed.
|
||||
|
||||
Usage
|
||||
=====
|
||||
|
||||
#. Go to *Inventory / Reports / Procurement Exceptions*.
|
||||
#. Create a new procurement order and make sure that it determines a pull rule
|
||||
with the option 'Auto-create Procurement Group' set.
|
||||
#. When you save the procurement order, a procurement group with format
|
||||
'PG/000001' will be 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/153/9.0
|
||||
|
||||
Bug Tracker
|
||||
===========
|
||||
|
||||
Bugs are tracked on `GitHub Issues
|
||||
<https://github.com/OCA/stock-logistics-warehouse/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.
|
||||
|
||||
Credits
|
||||
=======
|
||||
|
||||
Contributors
|
||||
------------
|
||||
* Jordi Ballester <jordi.ballester@eficent.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 https://odoo-community.org.
|
||||
5
procurement_auto_create_group/__init__.py
Normal file
5
procurement_auto_create_group/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
# # -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import models
|
||||
19
procurement_auto_create_group/__openerp__.py
Normal file
19
procurement_auto_create_group/__openerp__.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
{
|
||||
"name": "Procurement Auto Create Group",
|
||||
"version": "9.0.1.0.0",
|
||||
"depends": [
|
||||
"procurement",
|
||||
],
|
||||
"author": "Eficent,"
|
||||
"Odoo Community Association (OCA)",
|
||||
"website": "https://github.com/OCA/stock-logistics-warehouse",
|
||||
"category": "Warehouse Management",
|
||||
"data": [
|
||||
'views/procurement_view.xml',
|
||||
],
|
||||
"installable": True,
|
||||
"license": "AGPL-3",
|
||||
}
|
||||
6
procurement_auto_create_group/models/__init__.py
Normal file
6
procurement_auto_create_group/models/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from . import procurement_rule
|
||||
from . import procurement
|
||||
31
procurement_auto_create_group/models/procurement.py
Normal file
31
procurement_auto_create_group/models/procurement.py
Normal file
@@ -0,0 +1,31 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from openerp import api, models, _
|
||||
from openerp.exceptions import UserError
|
||||
|
||||
|
||||
class ProcurementOrder(models.Model):
|
||||
_inherit = 'procurement.order'
|
||||
|
||||
@api.model
|
||||
def _prepare_auto_procurement_group_data(self, procurement):
|
||||
name = self.env['ir.sequence'].next_by_code(
|
||||
'procurement.group') or False
|
||||
if not name:
|
||||
raise UserError(_('No sequence defined for procurement group'))
|
||||
return {
|
||||
'name': name
|
||||
}
|
||||
|
||||
@api.model
|
||||
def _assign(self, procurement):
|
||||
res = super(ProcurementOrder, self)._assign(procurement)
|
||||
|
||||
if (procurement.rule_id and not procurement.group_id and
|
||||
procurement.rule_id.auto_create_group):
|
||||
group_data = self._prepare_auto_procurement_group_data(procurement)
|
||||
group = self.env['procurement.group'].create(group_data)
|
||||
procurement.group_id = group
|
||||
return res
|
||||
10
procurement_auto_create_group/models/procurement_rule.py
Normal file
10
procurement_auto_create_group/models/procurement_rule.py
Normal file
@@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
from openerp import fields, models
|
||||
|
||||
|
||||
class ProcurementRule(models.Model):
|
||||
_inherit = 'procurement.rule'
|
||||
|
||||
auto_create_group = fields.Boolean(string='Auto-create Procurement Group')
|
||||
BIN
procurement_auto_create_group/static/description/icon.png
Normal file
BIN
procurement_auto_create_group/static/description/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
16
procurement_auto_create_group/views/procurement_view.xml
Normal file
16
procurement_auto_create_group/views/procurement_view.xml
Normal file
@@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
|
||||
<record model="ir.ui.view" id="view_procurement_rule_form">
|
||||
<field name="name">procurement.rule.form</field>
|
||||
<field name="model">procurement.rule</field>
|
||||
<field name="inherit_id"
|
||||
ref="procurement.view_procurement_rule_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<group name="propagation_group" position="inside">
|
||||
<field name="auto_create_group"/>
|
||||
</group>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user