[REM] purchase_requisition_stock_dropshipping: rem old call to tender pt1
The Call to Tender purchase requisition is being removed and implemented as something managed completely within a PO. This includes removing the 'tenders' option for products which means the dropshipping + auto-create call to tenders use case no longer exists => this module is no longer needed. Part of task: 2695116 Upgrade PR: odoo/upgrade#3586 Part-of: odoo/odoo#87656
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import models
|
||||
@@ -1,22 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name': 'Purchase Requisition Stock Dropshipping',
|
||||
'version': '1.0',
|
||||
'category': 'Hidden',
|
||||
'summary': 'Purchase Requisition, Stock, Dropshipping',
|
||||
'description': """
|
||||
This module makes the link between the purchase requisition and dropshipping applications.
|
||||
|
||||
Set shipping address on purchase orders created from purchase agreements
|
||||
and link with originating sale order.
|
||||
""",
|
||||
'depends': ['purchase_requisition_stock', 'stock_dropshipping'],
|
||||
'data': [
|
||||
'views/purchase_views.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': True,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
-36
@@ -1,36 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_requisition_stock_dropshipping
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server saas~14.5\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2021-09-14 10:29+0000\n"
|
||||
"PO-Revision-Date: 2021-09-14 10:29+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: purchase_requisition_stock_dropshipping
|
||||
#: model:ir.model.fields,field_description:purchase_requisition_stock_dropshipping.field_purchase_requisition_line__sale_line_id
|
||||
msgid "Origin Sale Order Line"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_requisition_stock_dropshipping
|
||||
#: model:ir.model,name:purchase_requisition_stock_dropshipping.model_purchase_order
|
||||
msgid "Purchase Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_requisition_stock_dropshipping
|
||||
#: model:ir.model,name:purchase_requisition_stock_dropshipping.model_purchase_requisition
|
||||
msgid "Purchase Requisition"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_requisition_stock_dropshipping
|
||||
#: model:ir.model,name:purchase_requisition_stock_dropshipping.model_purchase_requisition_line
|
||||
msgid "Purchase Requisition Line"
|
||||
msgstr ""
|
||||
@@ -1,4 +0,0 @@
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import purchase
|
||||
from . import purchase_requisition
|
||||
@@ -1,16 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import api, models
|
||||
|
||||
|
||||
class PurchaseOrder(models.Model):
|
||||
_inherit = 'purchase.order'
|
||||
|
||||
@api.onchange('requisition_id')
|
||||
def _onchange_requisition_id(self):
|
||||
super()._onchange_requisition_id()
|
||||
if self.requisition_id and self.requisition_id.procurement_group_id:
|
||||
self.group_id = self.requisition_id.procurement_group_id.id
|
||||
if self.group_id.sale_id.partner_id:
|
||||
self.dest_address_id = self.group_id.sale_id.partner_id.id
|
||||
@@ -1,26 +0,0 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class PurchaseRequisition(models.Model):
|
||||
_inherit = 'purchase.requisition'
|
||||
|
||||
def _prepare_tender_values(self, product_id, product_qty, product_uom, location_id, name, origin, company_id, values):
|
||||
res = super()._prepare_tender_values(product_id, product_qty, product_uom, location_id, name, origin, company_id, values)
|
||||
if 'sale_line_id' in values:
|
||||
res['line_ids'][0][2]['sale_line_id'] = values['sale_line_id']
|
||||
return res
|
||||
|
||||
|
||||
class PurchaseRequisitionLine(models.Model):
|
||||
_inherit = "purchase.requisition.line"
|
||||
|
||||
sale_line_id = fields.Many2one('sale.order.line', string="Origin Sale Order Line")
|
||||
|
||||
def _prepare_purchase_order_line(self, name, product_qty=0.0, price_unit=0.0, taxes_ids=False):
|
||||
res = super()._prepare_purchase_order_line(name, product_qty, price_unit, taxes_ids)
|
||||
if self.sale_line_id:
|
||||
res['sale_line_id'] = self.sale_line_id.id
|
||||
return res
|
||||
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from . import test_purchase_requisition_stock_dropshipping
|
||||
-56
@@ -1,56 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo.fields import Command
|
||||
from odoo.tests import common
|
||||
from odoo.tests.common import Form
|
||||
|
||||
|
||||
class TestPurchaseRequisitionStockDropshipping(common.TransactionCase):
|
||||
|
||||
def test_purchase_requisition_stock_dropshipping(self):
|
||||
|
||||
# create 'dropship - call for tender' product
|
||||
product = self.env['product.product'].create({'name': 'prsds-product'})
|
||||
dropshipping_route = self.env.ref('stock_dropshipping.route_drop_shipping')
|
||||
product.write({'route_ids': [Command.set([dropshipping_route.id])]})
|
||||
product.write({'purchase_requisition': 'tenders'})
|
||||
|
||||
# sell this product
|
||||
customer = self.env['res.partner'].create({'name': 'prsds-customer'})
|
||||
sale_order = self.env['sale.order'].create({
|
||||
'partner_id': customer.id,
|
||||
'partner_invoice_id': customer.id,
|
||||
'partner_shipping_id': customer.id,
|
||||
'order_line': [Command.create({
|
||||
'name': product.name,
|
||||
'product_id': product.id,
|
||||
'product_uom_qty': 10.00,
|
||||
'product_uom': product.uom_id.id,
|
||||
'price_unit': 10,
|
||||
})],
|
||||
})
|
||||
|
||||
# confirm order
|
||||
sale_order.action_confirm()
|
||||
|
||||
# call for tender must exists
|
||||
call_for_tender = self.env['purchase.requisition'].search([('origin', '=', sale_order.name)])
|
||||
self.assertTrue(call_for_tender)
|
||||
|
||||
# confirm call for tender
|
||||
call_for_tender.action_in_progress()
|
||||
|
||||
# create purchase order from call for tender
|
||||
vendor = self.env['res.partner'].create({'name': 'prsds-vendor'})
|
||||
f = Form(self.env['purchase.order'].with_context(default_requisition_id=call_for_tender))
|
||||
f.partner_id = vendor
|
||||
purchase_order = f.save()
|
||||
|
||||
# check purchase order
|
||||
self.assertEqual(purchase_order.requisition_id.id, call_for_tender.id, 'Purchase order should be linked with call for tender')
|
||||
self.assertEqual(purchase_order.dest_address_id.id, customer.id, 'Purchase order should be delivered at customer')
|
||||
self.assertEqual(len(purchase_order.order_line), 1, 'Purchase order should have one line')
|
||||
purchase_order_line = purchase_order.order_line
|
||||
self.assertEqual(purchase_order_line.sale_order_id.id, sale_order.id, 'Purchase order should be linked with sale order')
|
||||
self.assertEqual(purchase_order_line.sale_line_id.id, sale_order.order_line.id, 'Purchase order line should be linked with sale order line')
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<odoo>
|
||||
<data>
|
||||
<record id="purchase_order_view_form_inherit" model="ir.ui.view">
|
||||
<field name="name">purchase.order.form.inherit</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.purchase_order_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='origin']" position="after">
|
||||
<field name="group_id" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree//field[@name='price_subtotal']" position="after">
|
||||
<field name="sale_line_id" invisible="1"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user