[DEL] purchase_double_validation: remove deprecated module
Reason: complete rewrite of the Purchase module. Responsible: fp, nim
This commit is contained in:
@@ -1,4 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
import purchase_double_validation_installer
|
||||
@@ -1,29 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
{
|
||||
'name' : 'Double Validation on Purchases',
|
||||
'version' : '1.1',
|
||||
'category': 'Purchase Management',
|
||||
'depends' : ['base','purchase'],
|
||||
'description': """
|
||||
Double-validation for purchases exceeding minimum amount.
|
||||
=========================================================
|
||||
|
||||
This module modifies the purchase workflow in order to validate purchases that
|
||||
exceeds minimum amount set by configuration wizard.
|
||||
""",
|
||||
'website': 'https://www.odoo.com/page/purchase',
|
||||
'data': [
|
||||
'purchase_double_validation_workflow.xml',
|
||||
'purchase_double_validation_installer.xml',
|
||||
'purchase_double_validation_view.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/purchase_double_validation_demo.yml',
|
||||
'test/purchase_double_validation_test.yml'
|
||||
],
|
||||
'demo': [],
|
||||
'installable': True,
|
||||
'auto_install': False
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
# Translation of Odoo Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * purchase_double_validation
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 9.0\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2015-08-25 09:00+0000\n"
|
||||
"PO-Revision-Date: 2015-08-25 09:00+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_double_validation
|
||||
#: model:ir.model.fields,help:purchase_double_validation.field_purchase_config_settings_limit_amount
|
||||
msgid "Amount after which validation of purchase is required."
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_double_validation
|
||||
#: model:ir.ui.view,arch_db:purchase_double_validation.purchase_order_search_inherit
|
||||
msgid "Purchase orders which are not approved yet."
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_double_validation
|
||||
#: model:ir.ui.view,arch_db:purchase_double_validation.purchase_order_search_inherit
|
||||
msgid "To Approve"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_double_validation
|
||||
#: model:ir.model.fields,field_description:purchase_double_validation.field_purchase_config_settings_limit_amount
|
||||
msgid "limit to require a second approval"
|
||||
msgstr ""
|
||||
|
||||
#. module: purchase_double_validation
|
||||
#: model:ir.model,name:purchase_double_validation.model_purchase_config_settings
|
||||
msgid "purchase.config.settings"
|
||||
msgstr ""
|
||||
|
||||
@@ -1,29 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from openerp.osv import fields, osv
|
||||
|
||||
class purchase_config_settings(osv.osv_memory):
|
||||
_inherit = 'purchase.config.settings'
|
||||
_columns = {
|
||||
'limit_amount': fields.integer('limit to require a second approval',required=True,
|
||||
help="Amount after which validation of purchase is required."),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'limit_amount': 5000,
|
||||
}
|
||||
|
||||
def get_default_limit_amount(self, cr, uid, fields, context=None):
|
||||
ir_model_data = self.pool.get('ir.model.data')
|
||||
transition = ir_model_data.get_object(cr, uid, 'purchase_double_validation', 'trans_confirmed_double_lt')
|
||||
field, value = transition.condition.split('<', 1)
|
||||
return {'limit_amount': int(value)}
|
||||
|
||||
def set_limit_amount(self, cr, uid, ids, context=None):
|
||||
ir_model_data = self.pool.get('ir.model.data')
|
||||
config = self.browse(cr, uid, ids[0], context)
|
||||
waiting = ir_model_data.get_object(cr, uid, 'purchase_double_validation', 'trans_confirmed_double_gt')
|
||||
waiting.write({'condition': 'amount_total >= %s' % config.limit_amount})
|
||||
confirm = ir_model_data.get_object(cr, uid, 'purchase_double_validation', 'trans_confirmed_double_lt')
|
||||
confirm.write({'condition': 'amount_total < %s' % config.limit_amount})
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_double_purchase_configuration" model="ir.ui.view">
|
||||
<field name="name">Purchase Application</field>
|
||||
<field name="model">purchase.config.settings</field>
|
||||
<field name="inherit_id" ref="purchase.view_purchase_configuration"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="module_purchase_double_validation" position="replace">
|
||||
<label for="module_purchase_double_validation"/>
|
||||
<div>
|
||||
<field name="module_purchase_double_validation" widget="radio"/>
|
||||
<label for="limit_amount"/>
|
||||
<field name="limit_amount" attrs="{'required': [('module_purchase_double_validation','=', 1)]}" class="oe_inline"/>
|
||||
</div>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="purchase_order_search_inherit">
|
||||
<field name="name">purchase.order.list.select.inherit</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="purchase.view_purchase_order_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='draft']" position="after">
|
||||
<filter name="to_approve" string="To Approve" domain="[('state','in',('wait','confirmed'))]" help="Purchase orders which are not approved yet."/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,43 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="act_double_wait" model="workflow.activity">
|
||||
<field name="wkf_id" ref="purchase.purchase_order"/>
|
||||
<field name="name">WaitForApproval</field>
|
||||
<field name="kind">dummy</field>
|
||||
</record>
|
||||
|
||||
<record id="act_double_check" model="workflow.activity">
|
||||
<field name="wkf_id" ref="purchase.purchase_order"/>
|
||||
<field name="name">CheckForApproval</field>
|
||||
<field name="split_mode">OR</field>
|
||||
<field name="kind">dummy</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirmed_double_check" model="workflow.transition">
|
||||
<field name="act_from" ref="purchase.act_confirmed"/>
|
||||
<field name="act_to" ref="act_double_check"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirmed_double_gt" model="workflow.transition">
|
||||
<field name="act_from" ref="act_double_check"/>
|
||||
<field name="act_to" ref="act_double_wait"/>
|
||||
<field name="condition">amount_untaxed >= 5000</field>
|
||||
<field name="signal">purchase_approve</field>
|
||||
<field name="group_id" ref="purchase.group_purchase_manager"/>
|
||||
</record>
|
||||
|
||||
<record id="trans_confirmed_double_lt" model="workflow.transition">
|
||||
<field name="act_from" ref="act_double_check"/>
|
||||
<field name="act_to" ref="act_double_wait"/>
|
||||
<field name="condition">amount_untaxed < 5000</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_double_app_conf" model="workflow.transition">
|
||||
<field name="act_from" ref="act_double_wait"/>
|
||||
<field name="act_to" ref="purchase.act_router"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,15 +0,0 @@
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_11}:
|
||||
partner_id: base.res_partner_12
|
||||
order_line:
|
||||
- product_id: product.product_product_6
|
||||
product_qty: 10
|
||||
price_unit: 400
|
||||
-
|
||||
!record {model: purchase.order, id: purchase_order_12}:
|
||||
partner_id: base.res_partner_1
|
||||
order_line:
|
||||
- product_id: product.product_product_12
|
||||
product_qty: 10
|
||||
price_unit: 200
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
-
|
||||
I set new limit amount from Configure Limit Amount for Purchase .
|
||||
-
|
||||
!record {model: purchase.config.settings, id: purchase_double_validation_installer_1}:
|
||||
limit_amount: 3000
|
||||
-
|
||||
!python {model: purchase.config.settings}: |
|
||||
self.execute(cr, uid, [ref("purchase_double_validation_installer_1")])
|
||||
-
|
||||
In order to test the flow, I confirmed the purchase order.
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_11}
|
||||
-
|
||||
I check that the order which was initially in the draft state has transmit to confirm state for double validation it should not an Approve state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_11, severity: error, string: Purchase Order should not be in Approved state.}:
|
||||
- state != 'approved'
|
||||
-
|
||||
I Approved the purchase order.
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_11}
|
||||
-
|
||||
I check that the order which was initially in the confirmed state has transmit to approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_11, severity: error, string: Purchase Order should be in Approved state.}:
|
||||
- state == 'approved'
|
||||
-
|
||||
I confirmed the purchase order of amount of less than Limit amount.
|
||||
-
|
||||
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_12}
|
||||
-
|
||||
I check that the order is in approved state.
|
||||
-
|
||||
!assert {model: purchase.order, id: purchase_order_12, severity: error, string: Purchase Order should be in Approved state.}:
|
||||
- state == 'approved'
|
||||
|
||||
Reference in New Issue
Block a user