diff --git a/README.md b/README.md index 205bc5da28..ae8d5d35f4 100644 --- a/README.md +++ b/README.md @@ -22,11 +22,17 @@ addon | version | summary [account_operating_unit](account_operating_unit/) | 9.0.1.0.0 | Introduces Operating Unit fields in invoices and Accounting Entries with clearing account [account_voucher_operating_unit](account_voucher_operating_unit/) | 9.0.1.0.0 | Introduces the operating unit to vouchers [analytic_operating_unit](analytic_operating_unit/) | 9.0.1.0.0 | Analytic Operating Unit +[crm_claim_operating_unit](crm_claim_operating_unit/) | 9.0.1.0.0 | Operating Unit in CRM Claims [crm_operating_unit](crm_operating_unit/) | 9.0.1.0.0 | Operating Unit in CRM [hr_contract_operating_unit](hr_contract_operating_unit/) | 9.0.1.0.0 | HR Contract Operating Unit [operating_unit](operating_unit/) | 9.0.1.0.0 | An operating unit (OU) is an organizational entity part of a company [procurement_operating_unit](procurement_operating_unit/) | 9.0.1.0.0 | An operating unit (OU) is an organizational entity part of a company [purchase_operating_unit](purchase_operating_unit/) | 9.0.1.0.0 | An operating unit (OU) is an organizational entity part of a company +[purchase_request_operating_unit](purchase_request_operating_unit/) | 9.0.1.0.0 | Operating Unit in Purchase Requests +[purchase_request_procurement_operating_unit](purchase_request_procurement_operating_unit/) | 9.0.1.0.0 | Purchase Request Procurement with Operating Units +[purchase_request_to_requisition_operating_unit](purchase_request_to_requisition_operating_unit/) | 9.0.1.0.0 | Purchase Request to Call for Bids with Operating Units +[purchase_request_to_rfq_operating_unit](purchase_request_to_rfq_operating_unit/) | 9.0.1.0.0 | Purchase Request to RFQ with Operating Units +[purchase_requisition_operating_unit](purchase_requisition_operating_unit/) | 9.0.1.0.0 | Operating Unit in Purchase Requisitions [sale_operating_unit](sale_operating_unit/) | 9.0.1.0.0 | An operating unit (OU) is an organizational entity part of a company [sale_stock_operating_unit](sale_stock_operating_unit/) | 9.0.1.0.0 | An operating unit (OU) is an organizational entity part of a company [sales_team_operating_unit](sales_team_operating_unit/) | 9.0.1.0.0 | Sales Team Operating Unit diff --git a/crm_claim_operating_unit/README.rst b/crm_claim_operating_unit/README.rst new file mode 100644 index 0000000000..229f990897 --- /dev/null +++ b/crm_claim_operating_unit/README.rst @@ -0,0 +1,58 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +============================== +CRM Claim with Operating Units +============================== + +This module introduces the following features: + +* Adds the Operating Unit (OU) to the CRM Claim. + +* User can only view and manage the claims associated to the warehouse of the Operating Units that he has access to. + + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Eficent Business and IT Consulting Services S.L. +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/crm_claim_operating_unit/__init__.py b/crm_claim_operating_unit/__init__.py new file mode 100644 index 0000000000..871e851766 --- /dev/null +++ b/crm_claim_operating_unit/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# © 2015 Eficent Business and IT Consulting Services S.L. +# © 2015 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import models +from . import tests diff --git a/crm_claim_operating_unit/__openerp__.py b/crm_claim_operating_unit/__openerp__.py new file mode 100644 index 0000000000..5bd948376d --- /dev/null +++ b/crm_claim_operating_unit/__openerp__.py @@ -0,0 +1,21 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. +# © 2015 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Operating Unit in CRM Claims", + "version": "9.0.1.0.0", + "author": "Eficent, " + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Sales", + "depends": ["crm_claim", "operating_unit", "sales_team_operating_unit"], + "data": [ + "security/crm_security.xml", + "views/crm_claim_view.xml" + ], + 'installable': True, +} diff --git a/crm_claim_operating_unit/models/__init__.py b/crm_claim_operating_unit/models/__init__.py new file mode 100644 index 0000000000..e9d40d3be3 --- /dev/null +++ b/crm_claim_operating_unit/models/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. +# © 2015 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import crm_claim +from . import crm_team diff --git a/crm_claim_operating_unit/models/crm_claim.py b/crm_claim_operating_unit/models/crm_claim.py new file mode 100644 index 0000000000..90cad810b3 --- /dev/null +++ b/crm_claim_operating_unit/models/crm_claim.py @@ -0,0 +1,80 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. +# © 2015 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp import api, fields, models, _ +from openerp.exceptions import ValidationError + + +class CRMClaim(models.Model): + + _inherit = "crm.claim" + + @api.model + def _default_operating_unit(self): + team_id = self.env['crm.team']._get_default_team_id() + team = self.env['crm.team'].sudo().browse(team_id) + if team.operating_unit_id: + for ou in self.env.user.operating_unit_ids: + if ou.id == team.operating_unit_id.id: + return team.operating_unit_id + return self.env.user.default_operating_unit_id + else: + return self.env.user.default_operating_unit_id + + operating_unit_id = fields.Many2one( + comodel_name='operating.unit', + string='Operating Unit', + default=_default_operating_unit, + ) + + @api.onchange('team_id') + def onchange_team_id(self): + if self.team_id: + team = self.env['crm.team'].search([ + ('id', '=', self.team_id.id), + ('operating_unit_id', 'in', + [g.id for g in self.env.user.operating_unit_ids])]) + if team: + self.operating_unit_id = team.operating_unit_id + else: + self.team_id = False + self.operating_unit_id = False + + @api.onchange('operating_unit_id') + def onchange_operating_unit_id(self): + if self.operating_unit_id: + if self.operating_unit_id.id in \ + [g.id for g in self.env.user.operating_unit_ids]: + if ((not self.team_id) or + (self.team_id and self.team_id.operating_unit_id != + self.operating_unit_id)): + team = self.env['crm.team'].search( + [('operating_unit_id', 'in', + [self.operating_unit_id.id])], limit=1) + if team: + self.team_id = team + else: + self.team_id = False + else: + self.team_id = False + self.operating_unit_id = False + + @api.multi + @api.constrains('team_id') + def _check_team_operating_unit(self): + for rec in self: + if rec.operating_unit_id: + if rec.team_id and rec.team_id.operating_unit_id != \ + rec.operating_unit_id: + raise ValidationError(_('Configuration error\n' + 'The Operating Unit of the claim ' + 'must match with that of the ' + 'sales team.')) + else: + raise ValidationError(_('Configuration error\n' + 'The claim should be assigned to a ' + 'sales team and the Operating Unit ' + 'of the claim must match with that ' + 'of the sales team.')) diff --git a/crm_claim_operating_unit/models/crm_team.py b/crm_claim_operating_unit/models/crm_team.py new file mode 100644 index 0000000000..aa8819cacd --- /dev/null +++ b/crm_claim_operating_unit/models/crm_team.py @@ -0,0 +1,23 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp import api, models, _ +from openerp.exceptions import ValidationError + + +class CRMTeam(models.Model): + + _inherit = "crm.team" + + @api.multi + @api.constrains('operating_unit_id') + def _check_team_operating_unit(self): + for rec in self: + claim = self.env['crm.claim'].search( + [('team_id', '=', rec.id), ('operating_unit_id', '!=', + rec.operating_unit_id.id)]) + if claim: + raise ValidationError(_('Configuration error\n' + 'Claims already exists with another ' + 'Operation Unit')) diff --git a/crm_claim_operating_unit/security/crm_security.xml b/crm_claim_operating_unit/security/crm_security.xml new file mode 100644 index 0000000000..8b924a8dc3 --- /dev/null +++ b/crm_claim_operating_unit/security/crm_security.xml @@ -0,0 +1,21 @@ + + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + Claims from allowed operating units + + + + + + + + + diff --git a/crm_claim_operating_unit/static/description/icon.png b/crm_claim_operating_unit/static/description/icon.png new file mode 100644 index 0000000000..3a0328b516 Binary files /dev/null and b/crm_claim_operating_unit/static/description/icon.png differ diff --git a/crm_claim_operating_unit/tests/__init__.py b/crm_claim_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..6465bd9113 --- /dev/null +++ b/crm_claim_operating_unit/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2015 Eficent Business and IT Consulting Services S.L. - +# Jordi Ballester Alomar +# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_crm_claim_operating_unit diff --git a/crm_claim_operating_unit/tests/test_crm_claim_operating_unit.py b/crm_claim_operating_unit/tests/test_crm_claim_operating_unit.py new file mode 100644 index 0000000000..c9be4c54a3 --- /dev/null +++ b/crm_claim_operating_unit/tests/test_crm_claim_operating_unit.py @@ -0,0 +1,106 @@ +# -*- coding: utf-8 -*- +# © 2015-17 Eficent Business and IT Consulting Services S.L. +# © 2015 Serpent Consulting Services Pvt. Ltd.. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp.tests import common + + +class TestCrmClaimOperatingUnit(common.TransactionCase): + + def setUp(self): + super(TestCrmClaimOperatingUnit, self).setUp() + self.res_users_model = self.env['res.users'] + self.crm_claim_model = self.env['crm.claim'] + self.crm_team_model = self.env['crm.team'] + + self.company = self.env.ref('base.main_company') + self.partner = self.env.ref('base.res_partner_1') + self.grp_sale_manager = self.env.ref('base.group_sale_manager') + + # Main Operating Unit + self.main_OU = self.env.ref('operating_unit.main_operating_unit') + # B2C Operating Unit + self.b2c_OU = self.env.ref('operating_unit.b2c_operating_unit') + + # Users + self.user1 = self._create_user('user_1', + [self.grp_sale_manager], + self.company, + [self.main_OU, self.b2c_OU]) + self.user2 = self._create_user('user_2', + [self.grp_sale_manager], + self.company, + [self.b2c_OU]) + self.user3 = self._create_user('user_3', + [self.grp_sale_manager], + self.company, + [self.main_OU, self.b2c_OU]) + # Teams + self.team1 = self._create_crm_team(self.user1.id, self.main_OU) + self.team2 = self._create_crm_team(self.user2.id, self.b2c_OU) + + # Claims + self.crm_claim1 = self._create_crm_claim(self.user1.id, self.main_OU) + self.crm_claim2 = self._create_crm_claim(self.user2.id, self.b2c_OU) + self.crm_claim3 = self._create_crm_claim(self.user3.id) + + def _create_user(self, login, groups, company, operating_units): + """Creates a user.""" + group_ids = [group.id for group in groups] + user = self.res_users_model.create({ + 'name': login, + 'login': login, + 'password': 'demo', + 'email': 'example@yourcompany.com', + 'company_id': company.id, + 'company_ids': [(4, company.id)], + 'operating_unit_ids': [(4, ou.id) for ou in operating_units], + 'groups_id': [(6, 0, group_ids)] + }) + return user + + def _create_crm_team(self, uid, operating_unit): + """Create a CRM team.""" + context = {'mail_create_nosubscribe': True} + crm = self.crm_team_model.create({ + 'name': 'CRM team (' + operating_unit.name + ')', + 'operating_unit_id': operating_unit.id + }, context=context) + return crm + + def _create_crm_claim(self, uid, operating_unit=False): + """Creates a CRM Claim.""" + if not operating_unit: + operating_unit = self.crm_claim_model.sudo(uid).\ + _default_operating_unit() + claim = self.crm_claim_model.sudo(uid).create({ + 'name': " Damaged Products ", + 'operating_unit_id': operating_unit.id, + 'partner_id': self.partner.id, + 'user_id': uid, + 'team_id': self.crm_team_model.search( + [('operating_unit_id', 'in', [operating_unit.id])], + limit=1).id + }) + claim.onchange_team_id() + claim.onchange_operating_unit_id() + return claim + + def test_security(self): + # User 2 is only assigned to Operating Unit B2C, and cannot + # access claims of Main Operating Unit. + record = self.crm_claim_model.sudo( + self.user2.id).search([('id', '=', self.crm_claim1.id), + ('operating_unit_id', '=', + self.main_OU.id)]) + self.assertEqual(record.ids, [], 'User 2 should not have access to ' + 'OU %s.' % self.main_OU.name) + + def test_onchange(self): + + self.crm_claim3.operating_unit_id = self.b2c_OU + self.crm_claim3.onchange_operating_unit_id() + + self.assertEqual(self.crm_claim3.team_id.operating_unit_id, + self.b2c_OU, 'User 3 should have ' + 'assigned the operating unit %s.' % self.b2c_OU) diff --git a/crm_claim_operating_unit/views/crm_claim_view.xml b/crm_claim_operating_unit/views/crm_claim_view.xml new file mode 100644 index 0000000000..814d6b5d45 --- /dev/null +++ b/crm_claim_operating_unit/views/crm_claim_view.xml @@ -0,0 +1,44 @@ + + + + + + + CRM - Claims Tree + crm.claim + + + + + + + + + + CRM - Claims Form + crm.claim + + + + + + + + + + + CRM - Claims Search + crm.claim + + + + + + + + + + diff --git a/mrp_operating_unit/tests/test_mrp_operating_unit.py b/mrp_operating_unit/tests/test_mrp_operating_unit.py index 57be049137..86bb8c9c1f 100644 --- a/mrp_operating_unit/tests/test_mrp_operating_unit.py +++ b/mrp_operating_unit/tests/test_mrp_operating_unit.py @@ -17,7 +17,8 @@ def setUp(self): # Main Operating Unit self.ou1 = self.env.ref('operating_unit.main_operating_unit') # Chicago Operating Unit - self.chicago = self.env.ref('stock_operating_unit.operating_unit_shop0') + self.chicago = self.env.ref('stock_operating_unit.' + 'operating_unit_shop0') # Groups self.grp_mrp_saleman = self.env.ref('base.group_sale_salesman') @@ -37,7 +38,6 @@ def setUp(self): self.mrp_record2 = self._create_mrp('Manufacturing Order 2', self.chicago, self.stock_location) - def _create_user(self, login, groups, company, operating_units, context=None): """Create a user.""" @@ -84,9 +84,8 @@ def _create_mrp(self, name, operating_unit, stock_location=False): return mrp def test_mrp_ou(self): - record = self.mrp_production_model.sudo(self.user2.id).search( - [('id', '=', self.mrp_record1.id), - ('operating_unit_id', '=', - self.ou1.id)]) + record = self.mrp_production_model.sudo(self.user2.id).\ + search([('id', '=', self.mrp_record1.id), + ('operating_unit_id', '=', self.ou1.id)]) self.assertEqual(record.ids, [], 'User 2 should not have access to ' - 'OU : %s' % self.ou1.name) + 'OU : %s' % self.ou1.name) diff --git a/mrp_operating_unit/tests/test_procurement.py b/mrp_operating_unit/tests/test_procurement.py index e8e3bef123..6aa8dbff9c 100644 --- a/mrp_operating_unit/tests/test_procurement.py +++ b/mrp_operating_unit/tests/test_procurement.py @@ -28,7 +28,6 @@ def setUp(self): self.mrp_bom_method = self._create_bom() self.procurement_order = self._create_procurement_order() - def _create_procurement_rule(self): rule = self.procurement_rule_model.create({ 'name': 'Procurement rule', @@ -37,14 +36,12 @@ def _create_procurement_rule(self): return rule def _create_bom(self): - bom = self.bom_model.create({ - 'product_tmpl_id': self.product1.product_tmpl_id.id, - 'product_id': self.product1.id, - 'product_qty': '1', - 'type': 'normal', - 'product_efficiency': '1.00', - }) - return bom + bom = self.bom_model.\ + create({'product_tmpl_id': self.product1.product_tmpl_id.id, + 'product_id': self.product1.id, + 'product_qty': '1', + 'type': 'normal', + 'product_efficiency': '1.00'}) def _create_procurement_order(self): # On change for warehouse_id @@ -57,20 +54,19 @@ def _create_procurement_order(self): res = new_line.onchange_product_id(self.product1.id) if res.get('value') and res.get('value').get('product_uom'): product_uom = res.get('value').get('product_uom') - order = self.procurement_order_model.create({ - 'product_id': self.product1.id, - 'product_uom': product_uom, - 'product_qty': '10', - 'name': 'Procurement Order', - 'warehouse_id': self.warehouse.id, - 'bom_id': self.mrp_bom_method.id, - 'rule_id': self.rule.id, - 'location_id': location_id, - }) - return order + order = self.procurement_order_model.\ + create({'product_id': self.product1.id, + 'product_uom': product_uom, + 'product_qty': '10', + 'name': 'Procurement Order', + 'warehouse_id': self.warehouse.id, + 'bom_id': self.mrp_bom_method.id, + 'rule_id': self.rule.id, + 'location_id': location_id + }) def test_security(self): self.assertEqual(self.procurement_order.location_id.operating_unit_id, - self.procurement_order.production_id.operating_unit_id, - 'The Operating Unit in Procurement Order Location' + self.procurement_order.production_id.\ + operating_unit_id, 'does not match to Manufacturing Order OU.') diff --git a/oca_dependencies.txt b/oca_dependencies.txt new file mode 100644 index 0000000000..b46a770d50 --- /dev/null +++ b/oca_dependencies.txt @@ -0,0 +1 @@ +purchase-workflow diff --git a/purchase_request_operating_unit/README.rst b/purchase_request_operating_unit/README.rst new file mode 100644 index 0000000000..f935945a30 --- /dev/null +++ b/purchase_request_operating_unit/README.rst @@ -0,0 +1,58 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +===================================== +Purchase Request with Operating Units +===================================== + +This module introduces the following features: + +* Adds the Operating Unit (OU) to the Purchase Request. +* The user’s default Operating Unit (OU) is proposed at the time of creating the Purchase Request. +* Security rules are defined to ensure that users can only see the Purchase Request of that Operating Units in which they are allowed access to. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Jordi Ballester Alomar +* Aaron Henriquez +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/purchase_request_operating_unit/__init__.py b/purchase_request_operating_unit/__init__.py new file mode 100644 index 0000000000..6396f46584 --- /dev/null +++ b/purchase_request_operating_unit/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import model +from . import tests diff --git a/purchase_request_operating_unit/__openerp__.py b/purchase_request_operating_unit/__openerp__.py new file mode 100644 index 0000000000..5fbccf3600 --- /dev/null +++ b/purchase_request_operating_unit/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Operating Unit in Purchase Requests", + "version": "9.0.1.0.0", + "author": "Eficent" + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Purchase Management", + "depends": ["purchase_request", + "purchase_operating_unit"], + "data": [ + "view/purchase_request_view.xml", + "security/purchase_security.xml", + ], + 'installable': True, +} diff --git a/purchase_request_operating_unit/model/__init__.py b/purchase_request_operating_unit/model/__init__.py new file mode 100644 index 0000000000..b091c29d62 --- /dev/null +++ b/purchase_request_operating_unit/model/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import purchase_request diff --git a/purchase_request_operating_unit/model/purchase_request.py b/purchase_request_operating_unit/model/purchase_request.py new file mode 100644 index 0000000000..fd23b6e721 --- /dev/null +++ b/purchase_request_operating_unit/model/purchase_request.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp import api, fields, models, _ + + +class PurchaseRequest(models.Model): + _inherit = 'purchase.request' + + operating_unit_id = fields.Many2one( + 'operating.unit', + string='Operating Unit', + default=lambda self: + self.env['res.users']. + operating_unit_default_get(self._uid), + ) + + @api.multi + @api.constrains('operating_unit_id', 'company_id') + def _check_company_operating_unit(self): + for rec in self: + if rec.company_id and rec.operating_unit_id and \ + rec.company_id != rec.operating_unit_id.company_id: + raise Warning(_("The Company in the Purchase Request and in " + "the Operating Unit must be the same.")) + + @api.multi + @api.constrains('operating_unit_id', 'picking_type_id') + def _check_warehouse_operating_unit(self): + for rec in self: + picking_type = rec.picking_type_id + if picking_type: + if picking_type.warehouse_id and\ + picking_type.warehouse_id.operating_unit_id\ + and rec.operating_unit_id and\ + picking_type.warehouse_id.operating_unit_id !=\ + rec.operating_unit_id: + raise Warning(_("Configuration error! The Purchase Request" + " and the Warehouse of picking type must" + " belong to the same Operating Unit.")) + + +class PurchaseRequestLine(models.Model): + _inherit = 'purchase.request.line' + + operating_unit_id = fields.Many2one( + 'operating.unit', + related='request_id.operating_unit_id', + string='Operating Unit', readonly=True, + store=True, + ) diff --git a/purchase_request_operating_unit/security/purchase_security.xml b/purchase_request_operating_unit/security/purchase_security.xml new file mode 100644 index 0000000000..29b86ea6a4 --- /dev/null +++ b/purchase_request_operating_unit/security/purchase_security.xml @@ -0,0 +1,30 @@ + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + Purchase Requests from allowed operating units + + + + + + + + + + ['|',('request_id.operating_unit_id','=',False),('request_id.operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + Purchase Requests lines from allowed operating units + + + + + + + + + diff --git a/purchase_request_operating_unit/tests/__init__.py b/purchase_request_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..51e4ae06f7 --- /dev/null +++ b/purchase_request_operating_unit/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import test_purchase_request_operating_unit diff --git a/purchase_request_operating_unit/tests/test_purchase_request_operating_unit.py b/purchase_request_operating_unit/tests/test_purchase_request_operating_unit.py new file mode 100644 index 0000000000..94d75b85fe --- /dev/null +++ b/purchase_request_operating_unit/tests/test_purchase_request_operating_unit.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp.tests import common + + +class TestPurchaseRequestOperatingUnit(common.TransactionCase): + + def setUp(self): + super(TestPurchaseRequestOperatingUnit, self).setUp() + # Models + self.res_users_model = self.env['res.users'] + self.purchase_request = self.env['purchase.request'] + self.purchase_request_line = self.env['purchase.request.line'] + # Company + self.company = self.env.ref('base.main_company') + # Main Operating Unit + self.ou1 = self.env.ref('operating_unit.main_operating_unit') + # B2C Operating Unit + self.b2c = self.env.ref('operating_unit.b2c_operating_unit') + # Product + self.product1 = self.env.ref('product.product_product_7') + self.product_uom = self.env.ref('product.product_uom_unit') + # User + self.user_root = self.env.ref('base.user_root') + # Groups + self.grp_pr_mngr = self.env.\ + ref('purchase_request.group_purchase_request_manager') + # Picking Type + b2c_wh = self.env.ref('stock_operating_unit.stock_warehouse_b2c') + self.b2c_type_in_id = b2c_wh.in_type_id.id + self.picking_type = self.env.ref('stock.picking_type_in') + + # Creates Users and Purchase request + self.user1 = self._create_user( + 'user_1', [], self.company, [self.ou1]) + self.user2 = self._create_user( + 'user_2', self.grp_pr_mngr, self.company, [self.b2c]) + self.request1 = self._create_purchase_request(self.ou1) + self._purchase_line(self.request1) + self.request2 = self._create_purchase_request(self.b2c, + self.b2c_type_in_id) + self._purchase_line(self.request2) + + def _create_user(self, login, groups, company, operating_units, + context=None): + """ Create a user. """ + group_ids = [group.id for group in groups] + user = self.res_users_model.create({ + 'name': 'Test Purchase Request User', + 'login': login, + 'password': 'demo', + 'email': 'example@yourcompany.com', + 'company_id': company.id, + 'company_ids': [(4, company.id)], + 'operating_unit_ids': [(4, ou.id) for ou in operating_units], + 'groups_id': [(6, 0, group_ids)] + }) + return user + + def _purchase_line(self, request): + line = self.purchase_request_line.create({ + 'request_id': request.id, + 'product_id': self.product1.id, + 'product_uom_id': self.product_uom.id, + 'product_qty': 5.0, + }) + return line + + def _create_purchase_request(self, operating_unit, picking_type=False): + if picking_type: + purchase_request = self.purchase_request.create({ + 'assigned_to': self.user_root.id, + 'picking_type_id': self.b2c_type_in_id, + 'operating_unit_id': operating_unit.id, + }) + else: + purchase_request = self.purchase_request.create({ + 'assigned_to': self.user_root.id, + 'picking_type_id': self.picking_type.id, + 'operating_unit_id': operating_unit.id, + }) + return purchase_request + + def test_purchase_request(self): + record = self.purchase_request.sudo(self.user2.id).\ + search([('id', '=', self.request1.id), + ('operating_unit_id', '=', self.ou1.id)]) + self.assertEqual(record.ids, [], 'User 2 should not have access to ' + 'OU %s' % self.ou1.name) diff --git a/purchase_request_operating_unit/view/purchase_request_view.xml b/purchase_request_operating_unit/view/purchase_request_view.xml new file mode 100644 index 0000000000..3edc97095e --- /dev/null +++ b/purchase_request_operating_unit/view/purchase_request_view.xml @@ -0,0 +1,87 @@ + + + + + + purchase.request.tree + purchase.request + + + + + + + + + + purchase.request.form + purchase.request + + + + + + + {'operating_unit_id': operating_unit_id} + + + + + + purchase.request.list.select + purchase.request + + + + + + + + + + + + + purchase.request.line.tree + purchase.request.line + + + + + + + + + + purchase.request.line.form + purchase.request.line + + + + + + + + + + purchase.request.line.search + purchase.request.line + + + + + + + + + + + + + diff --git a/purchase_request_procurement_operating_unit/README.rst b/purchase_request_procurement_operating_unit/README.rst new file mode 100644 index 0000000000..63a701666b --- /dev/null +++ b/purchase_request_procurement_operating_unit/README.rst @@ -0,0 +1,57 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +================================================= +Purchase Request Procurement with Operating Units +================================================= + +This module introduces the following features: + +* This module passes the Operating Unit from the Procurement to the Purchase Request and also + ensures that the Purchase Request and the Procurement Order must belong to the same Operating Unit. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Jordi Ballester Alomar +* Aaron Henriquez +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/purchase_request_procurement_operating_unit/__init__.py b/purchase_request_procurement_operating_unit/__init__.py new file mode 100644 index 0000000000..c977d41e4e --- /dev/null +++ b/purchase_request_procurement_operating_unit/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). diff --git a/purchase_request_procurement_operating_unit/__openerp__.py b/purchase_request_procurement_operating_unit/__openerp__.py new file mode 100644 index 0000000000..65c704380a --- /dev/null +++ b/purchase_request_procurement_operating_unit/__openerp__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Purchase Request Procurement with Operating Units", + "version": "9.0.1.0.0", + "author": "Eficent" + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Purchase Management", + "depends": ["purchase_request_procurement", + "purchase_request_operating_unit", + 'procurement_operating_unit'], + 'installable': True, +} diff --git a/purchase_request_procurement_operating_unit/model/__init__.py b/purchase_request_procurement_operating_unit/model/__init__.py new file mode 100644 index 0000000000..d6badb6903 --- /dev/null +++ b/purchase_request_procurement_operating_unit/model/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import procurement diff --git a/purchase_request_procurement_operating_unit/model/procurement.py b/purchase_request_procurement_operating_unit/model/procurement.py new file mode 100644 index 0000000000..853cf9fe1c --- /dev/null +++ b/purchase_request_procurement_operating_unit/model/procurement.py @@ -0,0 +1,41 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp import models, api, _ + + +class Procurement(models.Model): + _inherit = 'procurement.order' + + @api.model + def _prepare_purchase_request(self, procurement): + res = super(Procurement, self)._prepare_purchase_request(procurement) + if procurement.location_id.operating_unit_id: + res.update({ + 'operating_unit_id': + procurement.location_id.operating_unit_id.id + }) + return res + + @api.multi + @api.constrains('location_id', 'request_id') + def _check_purchase_request_operating_unit(self): + for rec in self: + if rec.request_id and rec.location_id.operating_unit_id and \ + rec.request_id.operating_unit_id != \ + rec.location_id.operating_unit_id: + raise Warning(_('The Purchase Request and the Procurement ' + 'Order must belong to the same Operating' + 'Unit.')) + + @api.multi + @api.constrains('location_id', 'warehouse_id') + def _check_warehouse_operating_unit(self): + for rec in self: + if rec.warehouse_id and rec.location_id.operating_unit_id and \ + rec.warehouse_id.operating_unit_id != \ + rec.location_id.operating_unit_id: + raise Warning(_('Warehouse and location of procurement order ' + 'must belong to the same Operating Unit.')) diff --git a/purchase_request_procurement_operating_unit/tests/__init__.py b/purchase_request_procurement_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..f0cb4ad3af --- /dev/null +++ b/purchase_request_procurement_operating_unit/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_purchase_request_procurement_operating_unit diff --git a/purchase_request_procurement_operating_unit/tests/test_purchase_request_procurement_operating_unit.py b/purchase_request_procurement_operating_unit/tests/test_purchase_request_procurement_operating_unit.py new file mode 100644 index 0000000000..24ecc31c6f --- /dev/null +++ b/purchase_request_procurement_operating_unit/tests/test_purchase_request_procurement_operating_unit.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp.tests import common + + +class TestProcurement(common.TransactionCase): + + def setUp(self): + super(TestProcurement, self).setUp() + self.res_users_model = self.env['res.users'] + self.procurement_order_model = self.env['procurement.order'] + self.procurement_rule_model = self.env['procurement.rule'] + self.warehouse = self.env.ref('stock.warehouse0') + + # Main Operating Unit + self.ou1 = self.env.ref('operating_unit.main_operating_unit') + # B2C Operating Unit + self.b2c = self.env.ref('operating_unit.b2c_operating_unit') + + # Products + self.product1 = self.env.ref('product.product_product_9') + self.product1.write({'purchase_request': True}) + + # Picking Type + b2c_wh = self.env.ref('stock_operating_unit.stock_warehouse_b2c') + self.b2c_type_in_id = b2c_wh.in_type_id.id + self.picking_type = self.env.ref('stock.picking_type_in') + + self.rule = self._create_procurement_rule() + self.procurement_order = self._create_procurement_order() + + def _create_procurement_rule(self): + rule = self.procurement_rule_model.\ + create({'name': 'Procurement rule', + 'action': 'buy', + 'picking_type_id': self.picking_type.id + }) + return rule + + def _create_procurement_order(self): + # On change for warehouse_id + new_line = self.procurement_order_model.new() + res = new_line.change_warehouse_id(self.warehouse.id) + if res.get('value') and res.get('value').get('location_id'): + location_id = res.get('value').get('location_id') + # On change for product_id + new_line = self.procurement_order_model.new() + res = new_line.onchange_product_id(self.product1.id) + if res.get('value') and res.get('value').get('product_uom'): + product_uom = res.get('value').get('product_uom') + proc = self.procurement_order_model.\ + create({'product_id': self.product1.id, + 'product_uom': product_uom, + 'product_qty': '10', + 'name': 'Procurement Order', + 'warehouse_id': self.warehouse.id, + 'rule_id': self.rule.id, + 'location_id': location_id + }) + proc.check() + proc.run() + return proc + + def test_security(self): + self.assertEqual(self.procurement_order.location_id.operating_unit_id, + self.procurement_order.request_id.operating_unit_id, + 'The Operating Unit in Procurement Order Location' + 'does not match to Purchase Request OU.') diff --git a/purchase_request_to_requisition_operating_unit/README.rst b/purchase_request_to_requisition_operating_unit/README.rst new file mode 100644 index 0000000000..5ea6828062 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +====================================================== +Purchase Request to Call for Bids with Operating Units +====================================================== + +This module introduces the following features: + +* This module pass the Operating Unit from the purchase request to the bid. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Jordi Ballester Alomar +* Aaron Henriquez +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/purchase_request_to_requisition_operating_unit/__init__.py b/purchase_request_to_requisition_operating_unit/__init__.py new file mode 100644 index 0000000000..2d1268b146 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import wizard diff --git a/purchase_request_to_requisition_operating_unit/__openerp__.py b/purchase_request_to_requisition_operating_unit/__openerp__.py new file mode 100644 index 0000000000..236c7931b6 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/__openerp__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Purchase Request to Call for Bids with Operating Units", + "version": "9.0.1.0.0", + "author": "Eficent" + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Purchase Management", + "depends": ["purchase_request_to_requisition", + "purchase_request_operating_unit", + "purchase_requisition_operating_unit"], + 'installable': True, +} diff --git a/purchase_request_to_requisition_operating_unit/tests/__init__.py b/purchase_request_to_requisition_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..b6c4bb2d12 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/tests/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import test_purchase_request_to_requisition_operating_unit diff --git a/purchase_request_to_requisition_operating_unit/tests/test_purchase_request_to_requisition_operating_unit.py b/purchase_request_to_requisition_operating_unit/tests/test_purchase_request_to_requisition_operating_unit.py new file mode 100644 index 0000000000..09083d4c2b --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/tests/test_purchase_request_to_requisition_operating_unit.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp.tests import common +from openerp.tools import SUPERUSER_ID + + +class TestPurchaseRequestToRequisition(common.TransactionCase): + + def setUp(self): + super(TestPurchaseRequestToRequisition, self).setUp() + self.purchase_request = self.env['purchase.request'] + self.purchase_request_line_obj = self.env['purchase.request.line'] + self.wiz =\ + self.env['purchase.request.line.make.purchase.requisition'] + self.purchase_requisition_partner_model =\ + self.env['purchase.requisition.partner'] + self.purchase_order = self.env['purchase.order'] + # Main Operating Unit + self.ou1 = self.env.ref('operating_unit.main_operating_unit') + # Products + self.product1 = self.env.ref('product.product_product_9') + self._create_purchase_request() + + def _create_purchase_request(self): + vals = { + 'picking_type_id': self.env.ref('stock.picking_type_in').id, + 'requested_by': SUPERUSER_ID, + 'operating_unit_id': self.ou1.id + } + purchase_request = self.purchase_request.create(vals) + vals = { + 'request_id': purchase_request.id, + 'product_id': self.product1.id, + 'product_uom_id': self.env.ref('product.product_uom_unit').id, + 'product_qty': 5.0, + } + self.purchase_request_line =\ + self.purchase_request_line_obj.create(vals) + + def test_purchase_request_to_purchase_requisition(self): + wiz = self.wiz.with_context( + active_model="purchase.request.line", + active_ids=[self.purchase_request_line.id], + active_id=self.purchase_request_line.id).create({}) + wiz.make_purchase_requisition() + requisition_id =\ + self.purchase_request_line.requisition_lines.requisition_id + self.assertEqual( + requisition_id.operating_unit_id, + self.purchase_request_line.operating_unit_id, + 'Should have the same Operating Unit') diff --git a/purchase_request_to_requisition_operating_unit/wizard/__init__.py b/purchase_request_to_requisition_operating_unit/wizard/__init__.py new file mode 100644 index 0000000000..c7ea810b53 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/wizard/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import purchase_request_line_make_purchase_requisition diff --git a/purchase_request_to_requisition_operating_unit/wizard/purchase_request_line_make_purchase_requisition.py b/purchase_request_to_requisition_operating_unit/wizard/purchase_request_line_make_purchase_requisition.py new file mode 100644 index 0000000000..3b99345ed9 --- /dev/null +++ b/purchase_request_to_requisition_operating_unit/wizard/purchase_request_line_make_purchase_requisition.py @@ -0,0 +1,46 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp import api, fields, models, _ +from openerp.exceptions import except_orm + + +class PurchaseRequestLineMakePurchaseRequisition(models.TransientModel): + _inherit = "purchase.request.line.make.purchase.requisition" + + operating_unit_id = fields.Many2one( + 'operating.unit', + string='Operating Unit', + readonly=True, + ) + + @api.model + def default_get(self, fields): + res = super(PurchaseRequestLineMakePurchaseRequisition, self).\ + default_get(fields) + request_line_obj = self.env['purchase.request.line'] + request_line_ids = self._context.get('active_ids', []) + operating_unit_id = False + for line in request_line_obj.browse(request_line_ids): + line_operating_unit_id = line.request_id.operating_unit_id \ + and line.request_id.operating_unit_id.id or False + if operating_unit_id\ + and line_operating_unit_id != operating_unit_id: + raise except_orm( + _('Could not process !'), + _('You have to select lines ' + 'from the same operating unit.')) + else: + operating_unit_id = line_operating_unit_id + res['operating_unit_id'] = operating_unit_id + return res + + @api.model + def _prepare_purchase_requisition(self, picking_type_id, + company_id): + res = super(PurchaseRequestLineMakePurchaseRequisition, self).\ + _prepare_purchase_requisition(picking_type_id, company_id) + if self.operating_unit_id: + res.update({'operating_unit_id': self.operating_unit_id.id}) + return res diff --git a/purchase_request_to_rfq_operating_unit/README.rst b/purchase_request_to_rfq_operating_unit/README.rst new file mode 100644 index 0000000000..2fd4ef5d7b --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/README.rst @@ -0,0 +1,56 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +============================================ +Purchase Request to RFQ with Operating Units +============================================ + +This module introduces the following features: + +* This module pass the Operating Unit from the purchase request to the RFQ. + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Jordi Ballester Alomar +* Aaron Henriquez +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/purchase_request_to_rfq_operating_unit/__init__.py b/purchase_request_to_rfq_operating_unit/__init__.py new file mode 100644 index 0000000000..2d1268b146 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import wizard diff --git a/purchase_request_to_rfq_operating_unit/__openerp__.py b/purchase_request_to_rfq_operating_unit/__openerp__.py new file mode 100644 index 0000000000..2d125968e2 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/__openerp__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +{ + "name": "Purchase Request to RFQ with Operating Units", + "version": "9.0.1.0.0", + "author": "Eficent" + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Purchase Management", + "depends": ["purchase_request_to_rfq", "purchase_request_operating_unit"], + "data": [ + "wizard/purchase_request_line_make_purchase_order_view.xml", + ], + 'installable': True, +} diff --git a/purchase_request_to_rfq_operating_unit/tests/__init__.py b/purchase_request_to_rfq_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..b14059d887 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_purchase_request_to_rfq_operating_unit diff --git a/purchase_request_to_rfq_operating_unit/tests/test_purchase_request_to_rfq_operating_unit.py b/purchase_request_to_rfq_operating_unit/tests/test_purchase_request_to_rfq_operating_unit.py new file mode 100644 index 0000000000..0c30e3aa64 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/tests/test_purchase_request_to_rfq_operating_unit.py @@ -0,0 +1,52 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp.tests import common +from openerp.tools import SUPERUSER_ID + + +class TestPurchaseRequestToRfq(common.TransactionCase): + + def setUp(self): + super(TestPurchaseRequestToRfq, self).setUp() + self.purchase_request = self.env['purchase.request'] + self.purchase_request_line = self.env['purchase.request.line'] + self.wiz =\ + self.env['purchase.request.line.make.purchase.order'] + self.purchase_order = self.env['purchase.order'] + # Main Operating Unit + self.ou1 = self.env.ref('operating_unit.main_operating_unit') + # Products + self.product1 = self.env.ref('product.product_product_9') + self._create_purchase_request() + + def _create_purchase_request(self): + vals = { + 'picking_type_id': self.env.ref('stock.picking_type_in').id, + 'requested_by': SUPERUSER_ID, + 'operating_unit_id': self.ou1.id + } + purchase_request = self.purchase_request.create(vals) + vals = { + 'request_id': purchase_request.id, + 'product_id': self.product1.id, + 'product_uom_id': self.env.ref('product.product_uom_unit').id, + 'product_qty': 5.0, + } + self.purchase_request_line = self.purchase_request_line.create(vals) + purchase_request.button_to_approve() + purchase_request.button_approved() + + def test_purchase_request_to_purchase_requisition(self): + vals = {'supplier_id': self.env.ref('base.res_partner_12').id} + wiz_id = self.wiz.with_context( + active_model="purchase.request.line", + active_ids=[self.purchase_request_line.id], + active_id=self.purchase_request_line.id,).create(vals) + wiz_id.make_purchase_order() + purchase_id = self.purchase_request_line.purchase_lines.order_id + self.assertEqual( + purchase_id.operating_unit_id, + self.purchase_request_line.operating_unit_id, + 'Should have the same Operating Unit') diff --git a/purchase_request_to_rfq_operating_unit/wizard/__init__.py b/purchase_request_to_rfq_operating_unit/wizard/__init__.py new file mode 100644 index 0000000000..47b191dab3 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/wizard/__init__.py @@ -0,0 +1,7 @@ +# -*- coding: utf-8 -*- +# © 2015 Eficent Business and IT Consulting Services S.L. - +# Jordi Ballester Alomar +# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from . import purchase_request_line_make_purchase_order diff --git a/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order.py b/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order.py new file mode 100644 index 0000000000..57e7e454b1 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order.py @@ -0,0 +1,50 @@ +# -*- coding: utf-8 -*- +# © 2015 Eficent Business and IT Consulting Services S.L. - +# Jordi Ballester Alomar +# © 2015 Serpent Consulting Services Pvt. Ltd. - Sudhir Arya +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +from openerp import fields, models, api, _ +from openerp.exceptions import except_orm + + +class PurchaseRequestLineMakePurchaseOrder(models.TransientModel): + _inherit = "purchase.request.line.make.purchase.order" + + operating_unit_id = fields.Many2one( + 'operating.unit', + string='Operating Unit', + readonly=True, + ) + + @api.model + def default_get(self, fields): + res = super(PurchaseRequestLineMakePurchaseOrder, self).\ + default_get(fields) + request_line_obj = self.env['purchase.request.line'] + request_line_ids = self._context.get('active_ids', []) + operating_unit_id = False + for line in request_line_obj.browse(request_line_ids): + line_operating_unit_id = line.request_id.operating_unit_id \ + and line.request_id.operating_unit_id.id or False + if operating_unit_id\ + and line_operating_unit_id != operating_unit_id: + raise except_orm( + _('Could not process !'), + _('You have to select lines ' + 'from the same operating unit.')) + else: + operating_unit_id = line_operating_unit_id + res['operating_unit_id'] = operating_unit_id + return res + + @api.model + def _prepare_purchase_order(self, picking_type, location, company_id): + data = super(PurchaseRequestLineMakePurchaseOrder, self).\ + _prepare_purchase_order(picking_type, location, company_id) + if self.operating_unit_id: + data['requesting_operating_unit_id'] = \ + self.operating_unit_id.id + data['operating_unit_id'] = \ + self.operating_unit_id.id + return data diff --git a/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order_view.xml b/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order_view.xml new file mode 100644 index 0000000000..cadcda0e04 --- /dev/null +++ b/purchase_request_to_rfq_operating_unit/wizard/purchase_request_line_make_purchase_order_view.xml @@ -0,0 +1,22 @@ + + + + + Purchase Request Line Make Purchase Order + purchase.request.line.make.purchase.order + + form + + + + + + ['|', ('operating_unit_id', '=', False), ('operating_unit_id', '=', operating_unit_id)] + + + + + + + diff --git a/purchase_requisition_operating_unit/README.rst b/purchase_requisition_operating_unit/README.rst new file mode 100644 index 0000000000..5ab40a347c --- /dev/null +++ b/purchase_requisition_operating_unit/README.rst @@ -0,0 +1,62 @@ +.. image:: https://img.shields.io/badge/license-LGPLv3-blue.svg + :target: https://www.gnu.org/licenses/lgpl.html + :alt: License: LGPL-3 + +========================================= +Purchase Requisition with Operating Units +========================================= + +This module introduces the following features: + +* Security rules are defined to ensure that users can only see the Purchase Requisition of that Operating Units in which they are allowed access to. + +* Ensures that Purchase Requisition and the Warehouse in picking type belongs to the same Operating Unit (OU) . + +* When the user creates a Purchase Order (PO) from the purchase requisition the operating unit is passed to that PO. + +* Sets default Picking type whoes Operating Unit (OU) in Warehouse matches to that of the User. + + +Usage +===== + +.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas + :alt: Try me on Runbot + :target: https://runbot.odoo-community.org/runbot/213/9.0 + +Bug Tracker +=========== + +Bugs are tracked on `GitHub 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 +======= + +Images +------ + +* Odoo Community Association: `Icon `_. + +Contributors +------------ + +* Eficent Business and IT Consulting Services S.L. +* Serpent Consulting Services Pvt. Ltd. + +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. diff --git a/purchase_requisition_operating_unit/__init__.py b/purchase_requisition_operating_unit/__init__.py new file mode 100644 index 0000000000..fda70fc516 --- /dev/null +++ b/purchase_requisition_operating_unit/__init__.py @@ -0,0 +1,6 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import model +from . import tests diff --git a/purchase_requisition_operating_unit/__openerp__.py b/purchase_requisition_operating_unit/__openerp__.py new file mode 100644 index 0000000000..91e69ea5b3 --- /dev/null +++ b/purchase_requisition_operating_unit/__openerp__.py @@ -0,0 +1,22 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). + +{ + "name": "Operating Unit in Purchase Requisitions", + "version": "9.0.1.0.0", + "author": "Eficent Business and IT Consulting Services S.L., " + "Serpent Consulting Services Pvt. Ltd.," + "Odoo Community Association (OCA)", + "license": "LGPL-3", + "website": "http://www.eficent.com", + "category": "Purchase Management", + "depends": ["purchase_requisition", + "purchase_operating_unit"], + "data": [ + "view/purchase_requisition.xml", + "security/purchase_security.xml", + ], + 'installable': True, +} diff --git a/purchase_requisition_operating_unit/model/__init__.py b/purchase_requisition_operating_unit/model/__init__.py new file mode 100644 index 0000000000..fbf5f5f563 --- /dev/null +++ b/purchase_requisition_operating_unit/model/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import purchase_requisition diff --git a/purchase_requisition_operating_unit/model/purchase_requisition.py b/purchase_requisition_operating_unit/model/purchase_requisition.py new file mode 100644 index 0000000000..840b2dc0df --- /dev/null +++ b/purchase_requisition_operating_unit/model/purchase_requisition.py @@ -0,0 +1,92 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp import fields, models, api +from openerp.tools.translate import _ +from openerp.exceptions import Warning as UserError + + +class PurchaseRequisition(models.Model): + + _inherit = 'purchase.requisition' + + @api.model + def _get_picking_in(self): + res = super(PurchaseRequisition, self)._get_picking_in() + type_obj = self.env['stock.picking.type'] + operating_unit = self.env['res.users'].\ + operating_unit_default_get(self._uid) + types = type_obj.search([('code', '=', 'incoming'), + ('warehouse_id.operating_unit_id', '=', + operating_unit.id)]) + if types: + res = types[:1].id + return res + + operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit', + readonly=True, + states={'draft': [('readonly', + False)]}, + default=lambda self: + self.env['res.users']. + operating_unit_default_get(self._uid)) + + picking_type_id = fields.Many2one('stock.picking.type', 'Picking Type', + domain=[('code', '=', 'incoming')], + required=True, + default=_get_picking_in) + + @api.multi + @api.constrains('operating_unit_id', 'company_id') + def _check_company_operating_unit(self): + for rec in self: + if rec.company_id and rec.operating_unit_id and \ + rec.company_id != rec.operating_unit_id.company_id: + raise UserError(_('The Company in the Purchase Requisition and' + ' in the Operating Unit must be the same.')) + + @api.multi + @api.constrains('operating_unit_id', 'picking_type_id') + def _check_warehouse_operating_unit(self): + for rec in self: + picking_type = rec.picking_type_id + if picking_type: + if picking_type.warehouse_id and\ + picking_type.warehouse_id.operating_unit_id\ + and rec.operating_unit_id and\ + picking_type.warehouse_id.operating_unit_id !=\ + rec.operating_unit_id: + raise UserError(_('Configuration error!\nThe Operating \ + Unit in Purchase Requisition and the Warehouse of picking \ + type must belong to the same Operating Unit.')) + + @api.onchange('operating_unit_id') + def _onchange_operating_unit_id(self): + type_obj = self.env['stock.picking.type'] + if self.operating_unit_id: + types = type_obj.search([('code', '=', 'incoming'), + ('warehouse_id.operating_unit_id', '=', + self.operating_unit_id.id)]) + if types: + self.picking_type_id = types[:1] + else: + raise UserError(_("No Warehouse found with the " + "Operating Unit indicated in the " + "Purchase Requisition!")) + + @api.model + def _prepare_purchase_order(self, requisition, supplier): + res = super(PurchaseRequisition, self).\ + _prepare_purchase_order(requisition, supplier) + res.update({'operating_unit_id': requisition.operating_unit_id.id}) + return res + + +class PurchaseRequisitionLine(models.Model): + _inherit = 'purchase.requisition.line' + + operating_unit_id = fields.Many2one('operating.unit', 'Operating Unit', + related='requisition_id.' + 'operating_unit_id', + readonly=True, store=True) diff --git a/purchase_requisition_operating_unit/security/purchase_security.xml b/purchase_requisition_operating_unit/security/purchase_security.xml new file mode 100644 index 0000000000..49c8468d29 --- /dev/null +++ b/purchase_requisition_operating_unit/security/purchase_security.xml @@ -0,0 +1,33 @@ + + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + PR's from allowed operating units + + + + + + + + + + ['|',('operating_unit_id','=',False),('operating_unit_id','in',[g.id for g in user.operating_unit_ids])] + PR lines from allowed operating units + + + + + + + + + diff --git a/purchase_requisition_operating_unit/tests/__init__.py b/purchase_requisition_operating_unit/tests/__init__.py new file mode 100644 index 0000000000..5353f75ed1 --- /dev/null +++ b/purchase_requisition_operating_unit/tests/__init__.py @@ -0,0 +1,5 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from . import test_purchase_requisition_operating_unit diff --git a/purchase_requisition_operating_unit/tests/test_purchase_requisition_operating_unit.py b/purchase_requisition_operating_unit/tests/test_purchase_requisition_operating_unit.py new file mode 100644 index 0000000000..68b574a41b --- /dev/null +++ b/purchase_requisition_operating_unit/tests/test_purchase_requisition_operating_unit.py @@ -0,0 +1,81 @@ +# -*- coding: utf-8 -*- +# © 2016 Eficent Business and IT Consulting Services S.L. +# © 2016 Serpent Consulting Services Pvt. Ltd. +# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html). +from openerp.tests import common +from openerp.exceptions import ValidationError + + +class TestPurchaseRequisitionOperatingUnit(common.TransactionCase): + + # Test Cases: + # - Create Purchase Requisition + # - Change operating_unit_id will change picking_type_id correctly + # - User can't use picking_type_id not belong to same operating_unit_id + # - When create PO, the OU and picking_type_id will be pass correctly + + def setUp(self): + super(TestPurchaseRequisitionOperatingUnit, self).setUp() + self.pr_model = self.env['purchase.requisition'] + self.pr_line_model = self.env['purchase.requisition.line'] + self.po_model = self.env['purchase.order'] + # company + self.company = self.env.ref('base.main_company') + self.grp_acc_manager = self.env.ref('account.group_account_manager') + # Main Operating Unit + self.ou1 = self.env.ref('operating_unit.main_operating_unit') + # B2B Operating Unit + self.b2b = self.env.ref('operating_unit.b2b_operating_unit') + # B2C Operating Unit + self.b2c = self.env.ref('operating_unit.b2c_operating_unit') + # Partner + self.partner1 = self.env.ref('base.res_partner_1') + # Products + self.product1 = self.env.ref('product.product_product_7') + self.product2 = self.env.ref('product.product_product_9') + + def _create_pr(self): + line_products = [(self.product1, 1000), + (self.product2, 500), ] + lines = [] + for product, qty in line_products: + line_values = { + 'product_id': product.id, + 'product_qty': qty, + } + lines.append((0, 0, line_values)) + pr_vals = { + 'exclusive': 'exclusive', + 'operating_unit_id': self.ou1.id, + 'line_ids': lines, + } + # Create PR + self.pr = self.pr_model.sudo().create(pr_vals) + + def test_create_purchase_requisition(self): + self._create_pr() + # Change OU, result in warning + with self.assertRaises(ValidationError): + self.pr.operating_unit_id = self.b2c + # on_change OU + pr_mock = self.pr_model.new() + pr_mock.operating_unit_id = self.b2c + pr_mock._onchange_operating_unit_id() + picktype = pr_mock.picking_type_id # on change result + self.assertEqual(self.b2c, picktype.warehouse_id.operating_unit_id, + 'Purchase Requisition and the Warehouse of picking ' + 'type does not belong to same Operating Unit.') + # Now OU and Picking Type should be in line as b2c + self.pr.picking_type_id = picktype + # Confirm Call + self.pr.sudo().signal_workflow('sent_suppliers') + self.assertEqual(self.pr.state, 'in_progress', + 'State not changed to Confirmed') + # Create PO + pr_po = self.pr.make_purchase_order(self.partner1.id) + po_id = pr_po.get(self.pr.id) + self.po = self.po_model.browse(po_id) + self.assertEqual(self.po.operating_unit_id, self.pr.operating_unit_id, + 'Operating Unit is not correctly passed to PO') + self.assertEqual(self.po.picking_type_id, self.pr.picking_type_id, + 'Picking Type is not correctly passed to PO') diff --git a/purchase_requisition_operating_unit/view/purchase_requisition.xml b/purchase_requisition_operating_unit/view/purchase_requisition.xml new file mode 100644 index 0000000000..aa0b6d4a1b --- /dev/null +++ b/purchase_requisition_operating_unit/view/purchase_requisition.xml @@ -0,0 +1,49 @@ + + + + + + + purchase.requisition.tree + purchase.requisition + + + + + + + + + + purchase.requisition.form + purchase.requisition + + + + + + + + {'operating_unit_id': operating_unit_id} + + + + + + purchase.requisition.list.select + purchase.requisition + + + + + + + + + + + + + diff --git a/setup/crm_claim_operating_unit/odoo_addons/__init__.py b/setup/crm_claim_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/crm_claim_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/crm_claim_operating_unit/odoo_addons/crm_claim_operating_unit b/setup/crm_claim_operating_unit/odoo_addons/crm_claim_operating_unit new file mode 120000 index 0000000000..aa836c23f4 --- /dev/null +++ b/setup/crm_claim_operating_unit/odoo_addons/crm_claim_operating_unit @@ -0,0 +1 @@ +../../../crm_claim_operating_unit \ No newline at end of file diff --git a/setup/crm_claim_operating_unit/setup.py b/setup/crm_claim_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/crm_claim_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_request_operating_unit/odoo_addons/__init__.py b/setup/purchase_request_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/purchase_request_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/purchase_request_operating_unit/odoo_addons/purchase_request_operating_unit b/setup/purchase_request_operating_unit/odoo_addons/purchase_request_operating_unit new file mode 120000 index 0000000000..813c0515c8 --- /dev/null +++ b/setup/purchase_request_operating_unit/odoo_addons/purchase_request_operating_unit @@ -0,0 +1 @@ +../../../purchase_request_operating_unit \ No newline at end of file diff --git a/setup/purchase_request_operating_unit/setup.py b/setup/purchase_request_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_request_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_request_procurement_operating_unit/odoo_addons/__init__.py b/setup/purchase_request_procurement_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/purchase_request_procurement_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/purchase_request_procurement_operating_unit/odoo_addons/purchase_request_procurement_operating_unit b/setup/purchase_request_procurement_operating_unit/odoo_addons/purchase_request_procurement_operating_unit new file mode 120000 index 0000000000..a83def042a --- /dev/null +++ b/setup/purchase_request_procurement_operating_unit/odoo_addons/purchase_request_procurement_operating_unit @@ -0,0 +1 @@ +../../../purchase_request_procurement_operating_unit \ No newline at end of file diff --git a/setup/purchase_request_procurement_operating_unit/setup.py b/setup/purchase_request_procurement_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_request_procurement_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_request_to_requisition_operating_unit/odoo_addons/__init__.py b/setup/purchase_request_to_requisition_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/purchase_request_to_requisition_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/purchase_request_to_requisition_operating_unit/odoo_addons/purchase_request_to_requisition_operating_unit b/setup/purchase_request_to_requisition_operating_unit/odoo_addons/purchase_request_to_requisition_operating_unit new file mode 120000 index 0000000000..ae6610f3a5 --- /dev/null +++ b/setup/purchase_request_to_requisition_operating_unit/odoo_addons/purchase_request_to_requisition_operating_unit @@ -0,0 +1 @@ +../../../purchase_request_to_requisition_operating_unit \ No newline at end of file diff --git a/setup/purchase_request_to_requisition_operating_unit/setup.py b/setup/purchase_request_to_requisition_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_request_to_requisition_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_request_to_rfq_operating_unit/odoo_addons/__init__.py b/setup/purchase_request_to_rfq_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/purchase_request_to_rfq_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/purchase_request_to_rfq_operating_unit/odoo_addons/purchase_request_to_rfq_operating_unit b/setup/purchase_request_to_rfq_operating_unit/odoo_addons/purchase_request_to_rfq_operating_unit new file mode 120000 index 0000000000..fd4a0e6c1d --- /dev/null +++ b/setup/purchase_request_to_rfq_operating_unit/odoo_addons/purchase_request_to_rfq_operating_unit @@ -0,0 +1 @@ +../../../purchase_request_to_rfq_operating_unit \ No newline at end of file diff --git a/setup/purchase_request_to_rfq_operating_unit/setup.py b/setup/purchase_request_to_rfq_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_request_to_rfq_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +) diff --git a/setup/purchase_requisition_operating_unit/odoo_addons/__init__.py b/setup/purchase_requisition_operating_unit/odoo_addons/__init__.py new file mode 100644 index 0000000000..de40ea7ca0 --- /dev/null +++ b/setup/purchase_requisition_operating_unit/odoo_addons/__init__.py @@ -0,0 +1 @@ +__import__('pkg_resources').declare_namespace(__name__) diff --git a/setup/purchase_requisition_operating_unit/odoo_addons/purchase_requisition_operating_unit b/setup/purchase_requisition_operating_unit/odoo_addons/purchase_requisition_operating_unit new file mode 120000 index 0000000000..fc90e2c391 --- /dev/null +++ b/setup/purchase_requisition_operating_unit/odoo_addons/purchase_requisition_operating_unit @@ -0,0 +1 @@ +../../../purchase_requisition_operating_unit \ No newline at end of file diff --git a/setup/purchase_requisition_operating_unit/setup.py b/setup/purchase_requisition_operating_unit/setup.py new file mode 100644 index 0000000000..28c57bb640 --- /dev/null +++ b/setup/purchase_requisition_operating_unit/setup.py @@ -0,0 +1,6 @@ +import setuptools + +setuptools.setup( + setup_requires=['setuptools-odoo'], + odoo_addon=True, +)