summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold Moyaux <arm@odoo.com>2020-01-15 15:56:36 +0000
committerSimon Lejeune <sle@openerp.com>2020-03-05 14:31:13 +0000
commit7eb22cef2f0c75c8a7f20ac26e5d47348e5ca6ef (patch)
tree96cb979ce1027546c875f67914034c653ac5a455
parent6f247d799a5e15ca0e6d3ea77f3cb378b1c92e8a (diff)
[IMP] purchase_requisition: remove useless inherit
_prepapre_tender_values in only call from purchase_requisition_stock. It's not needed to have 2 functions, everything should be in purchase_requisition_stock.
-rw-r--r--addons/purchase_requisition/models/purchase_requisition.py14
-rw-r--r--addons/purchase_requisition_stock/models/purchase_requisition.py18
2 files changed, 14 insertions, 18 deletions
diff --git a/addons/purchase_requisition/models/purchase_requisition.py b/addons/purchase_requisition/models/purchase_requisition.py
index 431180d737f..d3614b12003 100644
--- a/addons/purchase_requisition/models/purchase_requisition.py
+++ b/addons/purchase_requisition/models/purchase_requisition.py
@@ -151,20 +151,6 @@ class PurchaseRequisition(models.Model):
requisition_line.supplier_info_ids.unlink()
self.write({'state': 'done'})
- def _prepare_tender_values(self, product_id, product_qty, product_uom, location_id, name, origin, company_id, values):
- return{
- 'origin': origin,
- 'date_end': values['date_planned'],
- 'user_id': False,
- 'warehouse_id': values.get('warehouse_id') and values['warehouse_id'].id or False,
- 'company_id': company_id.id,
- 'line_ids': [(0, 0, {
- 'product_id': product_id.id,
- 'product_uom_id': product_uom.id,
- 'product_qty': product_qty,
- })],
- }
-
def unlink(self):
if any(requisition.state not in ('draft', 'cancel') for requisition in self):
raise UserError(_('You can only delete draft requisitions.'))
diff --git a/addons/purchase_requisition_stock/models/purchase_requisition.py b/addons/purchase_requisition_stock/models/purchase_requisition.py
index 3614b16fb7d..d490edace07 100644
--- a/addons/purchase_requisition_stock/models/purchase_requisition.py
+++ b/addons/purchase_requisition_stock/models/purchase_requisition.py
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
-from odoo import api, fields, models, _
+from odoo import fields, models
class PurchaseRequisition(models.Model):
@@ -21,9 +21,19 @@ class PurchaseRequisition(models.Model):
picking_type_id = fields.Many2one('stock.picking.type', 'Operation Type', required=True, default=_get_picking_in, domain="['|',('warehouse_id', '=', False), ('warehouse_id.company_id', '=', company_id)]")
def _prepare_tender_values(self, product_id, product_qty, product_uom, location_id, name, origin, company_id, values):
- res = super(PurchaseRequisition, self)._prepare_tender_values(product_id, product_qty, product_uom, location_id, name, origin, company_id, values)
- res['line_ids'][0][2]['move_dest_id'] = values.get('move_dest_ids') and values['move_dest_ids'][0].id or False
- return res
+ return {
+ 'origin': origin,
+ 'date_end': values['date_planned'],
+ 'user_id': False,
+ 'warehouse_id': values.get('warehouse_id') and values['warehouse_id'].id or False,
+ 'company_id': company_id.id,
+ 'line_ids': [(0, 0, {
+ 'product_id': product_id.id,
+ 'product_uom_id': product_uom.id,
+ 'product_qty': product_qty,
+ 'move_dest_id': values.get('move_dest_ids') and values['move_dest_ids'][0].id or False
+ })],
+ }
class PurchaseRequisitionLine(models.Model):