From 1685e7093a08e78d465aa9e0cf2779cf83607d51 Mon Sep 17 00:00:00 2001 From: Murtuza Saleh Date: Thu, 28 Mar 2019 17:52:39 +0530 Subject: [PATCH] [MIG][WIP][12.0] agreement_stock --- agreement_stock/README.rst | 9 +++--- agreement_stock/__manifest__.py | 4 +-- agreement_stock/models/agreement.py | 30 ++++++------------- agreement_stock/readme/CONTRIBUTORS.rst | 1 + agreement_stock/static/description/index.html | 4 +-- agreement_stock/views/agreement_view.xml | 18 ++++++----- agreement_stock/views/stock_view.xml | 3 +- 7 files changed, 32 insertions(+), 37 deletions(-) diff --git a/agreement_stock/README.rst b/agreement_stock/README.rst index 9a13d72d..ed38d79d 100644 --- a/agreement_stock/README.rst +++ b/agreement_stock/README.rst @@ -14,13 +14,13 @@ Agreement - Stock :target: http://www.gnu.org/licenses/agpl-3.0-standalone.html :alt: License: AGPL-3 .. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github - :target: https://github.com/OCA/contract/tree/11.0/agreement_stock + :target: https://github.com/OCA/contract/tree/12.0/agreement_stock :alt: OCA/contract .. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png - :target: https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-agreement_stock + :target: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_stock :alt: Translate me on Weblate .. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png - :target: https://runbot.odoo-community.org/runbot/110/11.0 + :target: https://runbot.odoo-community.org/runbot/110/12.0 :alt: Try me on Runbot |badge1| |badge2| |badge3| |badge4| |badge5| @@ -78,6 +78,7 @@ Contributors ~~~~~~~~~~~~ * Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. Other credits ~~~~~~~~~~~~~ @@ -110,6 +111,6 @@ Current `maintainers `__: |maintainer-smangukiya| |maintainer-max3903| -This module is part of the `OCA/contract `_ project on GitHub. +This module is part of the `OCA/contract `_ project on GitHub. You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute. diff --git a/agreement_stock/__manifest__.py b/agreement_stock/__manifest__.py index cd691d71..dda37db5 100644 --- a/agreement_stock/__manifest__.py +++ b/agreement_stock/__manifest__.py @@ -4,13 +4,13 @@ { 'name': 'Agreement - Stock', 'summary': 'Link picking to an agreement', - 'version': '11.0.0.0.1', + 'version': '12.0.1.0.0', 'category': 'Contract', 'author': 'Open Source Integrators, ' 'Odoo Community Association (OCA)', 'website': 'https://github.com/OCA/contract', 'depends': [ - 'agreement', + 'agreement_serviceprofile', 'stock', ], 'data': [ diff --git a/agreement_stock/models/agreement.py b/agreement_stock/models/agreement.py index 677762d6..ab557868 100644 --- a/agreement_stock/models/agreement.py +++ b/agreement_stock/models/agreement.py @@ -14,30 +14,18 @@ class Agreement(models.Model): @api.multi def _compute_picking_count(self): - data = self.env['stock.picking'].read_group( - [('agreement_id', 'in', self.ids)], - ['agreement_id'], ['agreement_id']) - count_data = dict((item['agreement_id'][0], - item['agreement_id_count']) for item in data) - for agreement in self: - agreement.picking_count = count_data.get(agreement.id, 0) + for ag_rec in self: + ag_rec.picking_count = self.env['stock.picking'].search_count( + [('agreement_id', 'in', ag_rec.ids)]) @api.multi def _compute_move_count(self): - data = self.env['stock.move'].read_group( - [('agreement_id', 'in', self.ids)], - ['agreement_id'], ['agreement_id']) - count_data = dict((item['agreement_id'][0], - item['agreement_id_count']) for item in data) - for agreement in self: - agreement.move_count = count_data.get(agreement.id, 0) + for ag_rec in self: + ag_rec.move_count = self.env['stock.move'].search_count( + [('agreement_id', 'in', ag_rec.ids)]) @api.multi def _compute_lot_count(self): - data = self.env['stock.production.lot'].read_group( - [('agreement_id', 'in', self.ids)], - ['agreement_id'], ['agreement_id']) - count_data = dict((item['agreement_id'][0], - item['agreement_id_count']) for item in data) - for agreement in self: - agreement.lot_count = count_data.get(agreement.id, 0) + for ag_rec in self: + ag_rec.lot_count = self.env['stock.production.lot'].search_count( + [('agreement_id', 'in', ag_rec.ids)]) diff --git a/agreement_stock/readme/CONTRIBUTORS.rst b/agreement_stock/readme/CONTRIBUTORS.rst index a76235f8..373b2a6a 100644 --- a/agreement_stock/readme/CONTRIBUTORS.rst +++ b/agreement_stock/readme/CONTRIBUTORS.rst @@ -1 +1,2 @@ * Sandip Mangukiya +* Serpent Consulting Services Pvt. Ltd. diff --git a/agreement_stock/static/description/index.html b/agreement_stock/static/description/index.html index ecf252fb..5fc88e1b 100644 --- a/agreement_stock/static/description/index.html +++ b/agreement_stock/static/description/index.html @@ -367,7 +367,7 @@ ul.auto-toc { !! This file is generated by oca-gen-addon-readme !! !! changes will be overwritten. !! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! --> -

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runbot

+

Beta License: AGPL-3 OCA/contract Translate me on Weblate Try me on Runbot

Odoo Agreement App does not provide an easy way to access stock transfers related to an agreement. Some organizations needs to have a quick access to stock transfers to track the performance of an agreement.

This module allows you to link a transfer to an agreement and @@ -444,7 +444,7 @@ mission is to support the collaborative development of Odoo features and promote its widespread use.

Current maintainers:

smangukiya max3903

-

This module is part of the OCA/contract project on GitHub.

+

This module is part of the OCA/contract project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

diff --git a/agreement_stock/views/agreement_view.xml b/agreement_stock/views/agreement_view.xml index 14a1680b..ae3d7056 100644 --- a/agreement_stock/views/agreement_view.xml +++ b/agreement_stock/views/agreement_view.xml @@ -1,42 +1,45 @@ - + Pickings ir.actions.act_window stock.picking form tree,form [('agreement_id', '=', active_id)] + {'create': False, 'edit': False}

Create Pickings

- + Moves ir.actions.act_window stock.move form tree,form [('agreement_id', '=', active_id)] + {'create': False, 'edit': False}

Create Moves

- + Lots/Serials ir.actions.act_window stock.production.lot form tree,form [('agreement_id', '=', active_id)] + {'create': False, 'edit': False}

Create Lot/Serial @@ -47,7 +50,8 @@ agreement.form.stock agreement - +