<commit_before># -*- coding: utf-8 -*-
# © 2016 Comunitea
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import ValidationError


STOCK_TO_REFRESH = 'global_real_stock'


class MrpProduction(models.Model):

    _inherit = 'mrp.production'

    global_real_stock = fields.Float('Global Real Stock',
                                     digits=dp.get_precision
                                     ('Product Unit of Measure'),
                                     help="Real stock in all companies.")
    web_global_stock = fields.Float('Web stock', readonly=True,
                                    digits=dp.get_precision
                                    ('Product Unit of Measure'))
    note = fields.Text()

    @api.multi
    def refresh_stock(self):
        for production in self:
            production.global_real_stock = \
                production.product_id.global_real_stock
            production.web_global_stock = \
                production.product_id.web_global_stock
            for line in production.move_raw_ids:
                line.global_real_stock = line.product_id.global_real_stock
                line.web_global_stock = line.product_id.web_global_stock

    @api.onchange('product_id')<commit_msg>[IMP] jim_mrp. Tipo de operacicon por defecto<commit_after># -*- coding: utf-8 -*-
# © 2016 Comunitea
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from odoo import api, fields, models, _
import odoo.addons.decimal_precision as dp
from odoo.exceptions import ValidationError


STOCK_TO_REFRESH = 'global_real_stock'


class MrpProduction(models.Model):

    _inherit = 'mrp.production'

    @api.model
    def _get_default_picking_type(self):
        domain_wh = [
            ('partner_id', '=', self.env.user.company_id.partner_id.id)]
        warehouse_id = self.env['stock.warehouse'].search(domain_wh, limit=1)
        types = warehouse_id and warehouse_id.manu_type_id
        if not types:
            return super(MrpProduction, self)._get_default_picking_type()
        return types[:1]

    global_real_stock = fields.Float('Global Real Stock',
                                     digits=dp.get_precision
                                     ('Product Unit of Measure'),
                                     help="Real stock in all companies.")
    web_global_stock = fields.Float('Web stock', readonly=True,
                                    digits=dp.get_precision
                                    ('Product Unit of Measure'))
    note = fields.Text()

    @api.multi
    def refresh_stock(self):
        for production in self:
            production.global_real_stock = \
                production.product_id.global_real_stock
            production.web_global_stock = \
                production.product_id.web_global_stock
            for line in production.move_raw_ids:
                line.global_real_stock = line.product_id.global_real_stock
                line.web_global_stock = line.product_id.web_global_stock

    @api.onchange('product_id')
{'fraction_non_alphanumeric': 0.08735705209656926, 'fraction_numerical': 0.005717916137229987, 'mean_word_length': 2.0220729366602685, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 10, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6937787', 'n_tokens_mistral': 927, 'n_tokens_neox': 872, 'n_words': 176}