diff --git a/stock_partner_lot/README.rst b/stock_partner_lot/README.rst new file mode 100644 index 000000000..868ae414b --- /dev/null +++ b/stock_partner_lot/README.rst @@ -0,0 +1,56 @@ +.. 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 + +======================================= +Show lots on the partners that own them +======================================= + +This module lets users view which lots have been transferred to each partner and +search accordingly. + +Usage +===== + +You need to enable and use the 'Manage consignee stocks (advanced)' +functionality, for example by assigning owner to stock moves or locations. + +.. 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 +`_. 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 +------------ + +* Ondřej Kuzník + +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/stock_partner_lot/__init__.py b/stock_partner_lot/__init__.py new file mode 100644 index 000000000..a0fdc10fe --- /dev/null +++ b/stock_partner_lot/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import models diff --git a/stock_partner_lot/__openerp__.py b/stock_partner_lot/__openerp__.py new file mode 100644 index 000000000..f3991cd2e --- /dev/null +++ b/stock_partner_lot/__openerp__.py @@ -0,0 +1,19 @@ +# -*- coding: utf-8 -*- +# (c) 2016 credativ ltd. - Ondřej Kuzník +# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html + +{ + 'name': 'Owner Lot Visibility', + 'summary': 'Show lots on the partners that own them', + 'version': '9.0.1.0.0', + 'category': 'Generic Modules/Inventory Control', + 'author': 'credativ ltd., ' + 'Odoo Community Association (OCA)', + 'license': 'AGPL-3', + 'depends': [ + 'stock', + ], + 'data': [ + 'views/res_partner_view.xml', + ], +} diff --git a/stock_partner_lot/models/__init__.py b/stock_partner_lot/models/__init__.py new file mode 100644 index 000000000..0fbdfcf89 --- /dev/null +++ b/stock_partner_lot/models/__init__.py @@ -0,0 +1,2 @@ +# -*- coding: utf-8 -*- +from . import res_partner diff --git a/stock_partner_lot/models/res_partner.py b/stock_partner_lot/models/res_partner.py new file mode 100644 index 000000000..ac250b26c --- /dev/null +++ b/stock_partner_lot/models/res_partner.py @@ -0,0 +1,17 @@ +# -*- coding: utf-8 -*- + +from openerp import api, fields, models + + +class ResPartner(models.Model): + _inherit = 'res.partner' + + quant_ids = fields.One2many('stock.quant', 'owner_id', + string='Owned products') + quant_count = fields.Integer('Owned Products', + compute='_compute_quant_count') + + @api.multi + def _compute_quant_count(self): + for partner in self: + partner.quant_count = len(partner.quant_ids) diff --git a/stock_partner_lot/views/res_partner_view.xml b/stock_partner_lot/views/res_partner_view.xml new file mode 100644 index 000000000..359bae3b8 --- /dev/null +++ b/stock_partner_lot/views/res_partner_view.xml @@ -0,0 +1,42 @@ + + + + + + Stock + stock.quant + {'search_default_locationgroup':1} + [('owner_id', '=', active_id)] + + + + res.partner.type.form.inherit + res.partner + + + +
+ +
+
+
+ + + res.partner.select + res.partner + + + + + + + + + +
+