Files
stock-logistics-warehouse/stock_request_analytic/models/procurement_rule.py
Lois Rilo 643c954b7a [11.0] stock_request_analytic:
* clean views.
 * allow to create a stock.request with no analytic account.
 * remove copy attribute in non-stored field.
 * remove non-existing field from compute method.
2021-04-09 14:32:48 +01:00

20 lines
823 B
Python

# Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
location_id, name, origin, values, group_id):
res = super(ProcurementRule, self)._get_stock_move_values(
product_id, product_qty, product_uom, location_id, name, origin,
values, group_id)
if values.get('stock_request_id'):
analytic_account_id = self.env['stock.request'].browse(
values['stock_request_id']).analytic_account_id.id
res.update(analytic_account_id=analytic_account_id)
return res