Browse Source

[MIG][WIP][12.0] agreement_stock

pull/296/head
Murtuza Saleh 5 years ago
parent
commit
1685e7093a
  1. 9
      agreement_stock/README.rst
  2. 4
      agreement_stock/__manifest__.py
  3. 30
      agreement_stock/models/agreement.py
  4. 1
      agreement_stock/readme/CONTRIBUTORS.rst
  5. 4
      agreement_stock/static/description/index.html
  6. 18
      agreement_stock/views/agreement_view.xml
  7. 3
      agreement_stock/views/stock_view.xml

9
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 <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>
Other credits
~~~~~~~~~~~~~
@ -110,6 +111,6 @@ Current `maintainers <https://odoo-community.org/page/maintainer-role>`__:
|maintainer-smangukiya| |maintainer-max3903|
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/11.0/agreement_stock>`_ project on GitHub.
This module is part of the `OCA/contract <https://github.com/OCA/contract/tree/12.0/agreement_stock>`_ project on GitHub.
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

4
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': [

30
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)])

1
agreement_stock/readme/CONTRIBUTORS.rst

@ -1 +1,2 @@
* Sandip Mangukiya <smangukiya@opensourceintegrators.com>
* Serpent Consulting Services Pvt. Ltd. <support@serpentcs.com>

4
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. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/contract/tree/11.0/agreement_stock"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-agreement_stock"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/11.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p><a class="reference external" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external" href="https://github.com/OCA/contract/tree/12.0/agreement_stock"><img alt="OCA/contract" src="https://img.shields.io/badge/github-OCA%2Fcontract-lightgray.png?logo=github" /></a> <a class="reference external" href="https://translation.odoo-community.org/projects/contract-11-0/contract-11-0-agreement_stock"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external" href="https://runbot.odoo-community.org/runbot/110/12.0"><img alt="Try me on Runbot" src="https://img.shields.io/badge/runbot-Try%20me-875A7B.png" /></a></p>
<p>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.</p>
<p>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.</p>
<p>Current <a class="reference external" href="https://odoo-community.org/page/maintainer-role">maintainers</a>:</p>
<p><a class="reference external" href="https://github.com/smangukiya"><img alt="smangukiya" src="https://github.com/smangukiya.png?size=40px" /></a> <a class="reference external" href="https://github.com/max3903"><img alt="max3903" src="https://github.com/max3903.png?size=40px" /></a></p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/11.0/agreement_stock">OCA/contract</a> project on GitHub.</p>
<p>This module is part of the <a class="reference external" href="https://github.com/OCA/contract/tree/12.0/agreement_stock">OCA/contract</a> project on GitHub.</p>
<p>You are welcome to contribute. To learn how please visit <a class="reference external" href="https://odoo-community.org/page/Contribute">https://odoo-community.org/page/Contribute</a>.</p>
</div>
</div>

18
agreement_stock/views/agreement_view.xml

@ -1,42 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record model="ir.actions.act_window"
id="action_stock_picking_agreement_specific">
<record id="action_stock_picking_agreement_specific"
model="ir.actions.act_window">
<field name="name">Pickings</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.picking</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Pickings
</p>
</field>
</record>
<record model="ir.actions.act_window"
id="action_stock_move_agreement_specific">
<record id="action_stock_move_agreement_specific"
model="ir.actions.act_window">
<field name="name">Moves</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Moves
</p>
</field>
</record>
<record model="ir.actions.act_window"
id="action_stock_production_lot_agreement_specific">
<record id="action_stock_production_lot_agreement_specific"
model="ir.actions.act_window">
<field name="name">Lots/Serials</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">stock.production.lot</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('agreement_id', '=', active_id)]</field>
<field name="context">{'create': False, 'edit': False}</field>
<field name="help" type="html">
<p class="oe_view_nocontent_create">
Create Lot/Serial
@ -47,7 +50,8 @@
<record id="partner_agreement_form_view_stock" model="ir.ui.view">
<field name="name">agreement.form.stock</field>
<field name="model">agreement</field>
<field name="inherit_id" ref="agreement.partner_agreement_form_view"/>
<field name="inherit_id"
ref="agreement_legal.partner_agreement_form_view"/>
<field name="arch" type="xml">
<xpath expr="//div[@name='button_box']" position="inside">
<button name="%(action_stock_picking_agreement_specific)d"

3
agreement_stock/views/stock_view.xml

@ -46,7 +46,8 @@
<field name="inherit_id" ref="stock.search_product_lot_filter"/>
<field name="arch" type="xml">
<xpath expr="//group" position="inside">
<filter string="Service Profile" domain="[]"
<filter string="Service Profile" name="serviceprofile_id"
domain="[]"
context="{'group_by':'serviceprofile_id'}"/>
</xpath>
</field>

Loading…
Cancel
Save