Files
contract/agreement_stock/models/agreement.py
Murtuza Saleh 13829b491d [MIG][WIP][12.0] agreement_stock
[UPD] README.rst

[UPD] Update agreement_stock.pot

Update translation files

Updated by "Update PO files to match POT (msgmerge)" hook in Weblate.

Translation: contract-12.0/contract-12.0-agreement_stock
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_stock/

[UPD] README.rst

Added translation using Weblate (Chinese (Simplified))

Translated using Weblate (Chinese (Simplified))

Currently translated at 100.0% (17 of 17 strings)

Translation: contract-12.0/contract-12.0-agreement_stock
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_stock/zh_CN/

Added translation using Weblate (Spanish)

Added translation using Weblate (French)

Added translation using Weblate (Italian)

Added translation using Weblate (Portuguese (Brazil))

Translated using Weblate (Portuguese (Brazil))

Currently translated at 76.5% (13 of 17 strings)

Translation: contract-12.0/contract-12.0-agreement_stock
Translate-URL: https://translation.odoo-community.org/projects/contract-12-0/contract-12-0-agreement_stock/pt_BR/
2021-07-13 13:52:23 -06:00

32 lines
1.1 KiB
Python

# Copyright (C) 2018 - TODAY, Open Source Integrators
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class Agreement(models.Model):
_inherit = "agreement"
picking_count = fields.Integer('# Pickings',
compute='_compute_picking_count')
move_count = fields.Integer('# Moves', compute='_compute_move_count')
lot_count = fields.Integer('# Lots/Serials', compute='_compute_lot_count')
@api.multi
def _compute_picking_count(self):
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):
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):
for ag_rec in self:
ag_rec.lot_count = self.env['stock.production.lot'].search_count(
[('agreement_id', 'in', ag_rec.ids)])