[ADD] add new purchase configuration
bzr revid: tpa@tinyerp.com-20120302124357-j26l817ms3s1xn5c
This commit is contained in:
parent
a86051c046
commit
d4ccb87316
|
@ -23,5 +23,6 @@ import pricelist
|
|||
import report
|
||||
import partner
|
||||
import wizard
|
||||
import res_config
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
<group colspan="2" col="2" name="uom">
|
||||
<separator string="Unit of Measure" colspan="2"/>
|
||||
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
|
||||
<field name="uom_po_id" groups="base.group_extended"/>
|
||||
<field name="uom_po_id" groups="base.group_purchase_uom_per_product"/>
|
||||
</group>
|
||||
|
||||
<group colspan="2" col="2" name="uos" groups="product.group_uos">
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class product_groups_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
|
||||
_columns = {
|
||||
'group_purchase_pricelist_per_supplier':fields.boolean("Pricelist per Supplier",
|
||||
help="""Allows to manage different prices based on rules per category of Supplier.
|
||||
Example: 10% for retailers, promotion of 5 EUR on this product, etc.
|
||||
It assigns the "Pricelist" group to all employees."""),
|
||||
'group_purchase_uom_per_product':fields.boolean("UOM per purchase product",
|
||||
help="""
|
||||
Allows you to select and maintain different unit of measures per product.
|
||||
It assigns the "UOM per purchase product" group to all employees.
|
||||
"""),
|
||||
|
||||
}
|
||||
|
||||
product_groups_configuration()
|
|
@ -19,6 +19,16 @@
|
|||
<field name="category_id" ref="base.module_category_usability"/>
|
||||
</record>
|
||||
|
||||
<record id="base.group_purchase_pricelist_per_supplier" model="res.groups">
|
||||
<field name="name">Purchase Pricelists</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
<record id="base.group_purchase_uom_per_product" model="res.groups">
|
||||
<field name="name">Purhase Product UOM</field>
|
||||
<field name="category_id" ref="base.module_category_hidden"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.rule" id="product_pricelist_comp_rule">
|
||||
<field name="name">product pricelist company rule</field>
|
||||
<field name="model_id" ref="model_product_pricelist"/>
|
||||
|
|
|
@ -27,6 +27,7 @@ import report
|
|||
import stock
|
||||
import company
|
||||
import edi
|
||||
import res_config
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@ Dashboard for purchase management that includes:
|
|||
'report/purchase_report_view.xml',
|
||||
'board_purchase_view.xml',
|
||||
'edi/purchase_order_action_data.xml',
|
||||
'res_config_view.xml',
|
||||
],
|
||||
'test': [
|
||||
'test/process/cancel_order.yml',
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<field name="priority">36</field>
|
||||
<field name="arch" type="xml">
|
||||
<page string="Sales & Purchases" position="inside">
|
||||
<group colspan="2" col="2" groups="base.group_extended">
|
||||
<group colspan="2" col="2" groups="base.group_purchase_pricelist_per_supplier">
|
||||
<separator string="Purchase Properties" colspan="2"/>
|
||||
<field name="property_product_pricelist_purchase" />
|
||||
</group>
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<menuitem
|
||||
id="menu_purchase_config_pricelist" name="Pricelists"
|
||||
parent="menu_purchase_config_purchase" sequence="50" groups="base.group_extended"/>
|
||||
parent="menu_purchase_config_purchase" sequence="50" groups="base.group_purchase_pricelist_per_supplier"/>
|
||||
|
||||
<menuitem
|
||||
action="product.product_pricelist_action" id="menu_product_pricelist_action_purhase"
|
||||
|
@ -39,7 +39,7 @@
|
|||
|
||||
<menuitem
|
||||
id="menu_purchase_unit_measure_purchase" name="Units of Measure"
|
||||
parent="purchase.menu_product_in_config_purchase" sequence="20"/>
|
||||
parent="purchase.menu_product_in_config_purchase" sequence="20" groups="base.group_purchase_uom_per_product"/>
|
||||
|
||||
<menuitem
|
||||
action="product.product_uom_categ_form_action" id="menu_purchase_uom_categ_form_action"
|
||||
|
@ -174,7 +174,7 @@
|
|||
<page string="Purchase Order">
|
||||
<field name="partner_id" on_change="onchange_partner_id(partner_id)" context="{'search_default_supplier':1,'default_supplier':1,'default_customer':0}" options='{"quick_create": false}'/>
|
||||
<field name="partner_address_id" options='{"quick_create": false}'/>
|
||||
<field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_extended"/>
|
||||
<field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_purchase_pricelist_per_supplier"/>
|
||||
<field name="origin" groups="base.group_extended"/>
|
||||
<newline/>
|
||||
<field colspan="4" name="order_line" nolabel="1" mode="tree,form">
|
||||
|
@ -182,7 +182,7 @@
|
|||
<field name="date_planned"/>
|
||||
<field name="name"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="product_uom" groups="base.group_purchase_uom_per_product"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="price_subtotal"/>
|
||||
</tree>
|
||||
|
@ -361,7 +361,7 @@
|
|||
<page string="Order Line">
|
||||
<field name="product_id" colspan="4" on_change="onchange_product_id(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes,context)" required="1"/>
|
||||
<field name="product_qty" on_change="onchange_product_id(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id,parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes,context)"/>
|
||||
<field name="product_uom" on_change="onchange_product_uom(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes,context)"/>
|
||||
<field name="product_uom" groups="base.group_purchase_uom_per_product" on_change="onchange_product_uom(parent.pricelist_id,product_id,product_qty,product_uom,parent.partner_id, parent.date_order,parent.fiscal_position,date_planned,name,price_unit,notes,context)"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date_planned" widget="date"/>
|
||||
<field name="price_unit"/>
|
||||
|
@ -403,7 +403,7 @@
|
|||
<field name="product_id"/>
|
||||
<field name="price_unit"/>
|
||||
<field name="product_qty"/>
|
||||
<field name="product_uom"/>
|
||||
<field name="product_uom" groups="base.group_purchase_uom_per_product"/>
|
||||
<field name="price_subtotal"/>
|
||||
<field name="date_planned" widget="date" width="135"/>
|
||||
<field name="state" invisible="1"/>
|
||||
|
@ -424,7 +424,7 @@
|
|||
<field name="order_id"/>
|
||||
<field name="product_id" readonly="1" />
|
||||
<field name="product_qty" readonly="1" />
|
||||
<field name="product_uom" readonly="1"/>
|
||||
<field name="product_uom" readonly="1" groups="base.group_purchase_uom_per_product"/>
|
||||
<field colspan="4" name="name"/>
|
||||
<field name="date_planned" widget="date" readonly="1"/>
|
||||
<field name="price_unit"/>
|
||||
|
|
|
@ -0,0 +1,171 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
class purchase_configuration(osv.osv_memory):
|
||||
_inherit = 'res.config'
|
||||
|
||||
_columns = {
|
||||
'default_method' : fields.selection(
|
||||
[('manual', 'Based on Purchase Order Lines'),
|
||||
('picking', 'Based on Receptions'),
|
||||
('order', 'Pre-Generate Draft Invoices based on Purchase Orders'),
|
||||
], 'Invoicing Control Method', required=True),
|
||||
'module_purchase_analytic_plans': fields.boolean('Purchase Analytic Plan',
|
||||
help ="""
|
||||
Allows the user to maintain several analysis plans. These let you split
|
||||
a line on a supplier purchase order into several accounts and analytic plans.
|
||||
It installs the purchase_analytic_plans module.
|
||||
"""),
|
||||
'module_warning': fields.boolean("Alerts by products or customers",
|
||||
help="""To trigger warnings in OpenERP objects.
|
||||
Warning messages can be displayed for objects like sale order, purchase order, picking and invoice. The message is triggered by the form's onchange event.
|
||||
It installs the warning module."""),
|
||||
'module_product_manufacturer': fields.boolean("Define a manufacturer on products",
|
||||
help="""TYou can now define the following for a product:
|
||||
* Manufacturer
|
||||
* Manufacturer Product Name
|
||||
* Manufacturer Product Code
|
||||
* Product Attributes
|
||||
.It installs the product_manufacturer module."""),
|
||||
'module_purchase_double_validation': fields.boolean("Configure Limit amount",
|
||||
help="""This allows you double-validation for purchases exceeding minimum amount.
|
||||
It installs the purchase_double_validation module."""),
|
||||
'purchase_limit': fields.float('Value'),
|
||||
'module_purchase_requisition' : fields.boolean("Track the best price with Purchase Requisition",
|
||||
help="""When a purchase order is created, you now have the opportunity to save the related requisition.
|
||||
This new object will regroup and will allow you to easily keep track and order all your purchase orders.
|
||||
It Installs purchase_requisition module."""),
|
||||
}
|
||||
|
||||
# def get_default_installed_modules(self, cr, uid, ids, context=None):
|
||||
# installed_modules = super(purchase_configuration, self).get_default_installed_modules(cr, uid, ids, context=context)
|
||||
# return installed_modules
|
||||
|
||||
# def get_default_sale_configs(self, cr, uid, ids, context=None):
|
||||
# ir_values_obj = self.pool.get('ir.values')
|
||||
# data_obj = self.pool.get('ir.model.data')
|
||||
# menu_obj = self.pool.get('ir.ui.menu')
|
||||
# result = {}
|
||||
# invoicing_groups_id = [gid.id for gid in data_obj.get_object(cr, uid, 'sale', 'menu_invoicing_sales_order_lines').groups_id]
|
||||
# picking_groups_id = [gid.id for gid in data_obj.get_object(cr, uid, 'sale', 'menu_action_picking_list_to_invoice').groups_id]
|
||||
# group_id = data_obj.get_object(cr, uid, 'base', 'group_sale_salesman').id
|
||||
# for menu in ir_values_obj.get(cr, uid, 'default', False, ['ir.ui.menu']):
|
||||
# if menu[1] == 'groups_id' and group_id in menu[2][0]:
|
||||
# if group_id in invoicing_groups_id:
|
||||
# result['sale_orders'] = True
|
||||
# if group_id in picking_groups_id:
|
||||
# result['deli_orders'] = True
|
||||
# for res in ir_values_obj.get(cr, uid, 'default', False, ['sale.order']):
|
||||
# result[res[1]] = res[2]
|
||||
# return result
|
||||
#
|
||||
# def default_get(self, cr, uid, fields_list, context=None):
|
||||
# result = super(purchase_configuration, self).default_get(
|
||||
# cr, uid, fields_list, context=context)
|
||||
# for method in dir(self):
|
||||
# if method.startswith('get_default_'):
|
||||
# result.update(getattr(self, method)(cr, uid, [], context))
|
||||
# return result
|
||||
#
|
||||
_defaults = {
|
||||
'default_method': lambda s,c,u,ctx: s.pool.get('purchase.order').default_get(c,u,['invoice_method'],context=ctx)['invoice_method'],
|
||||
}
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
ids = super(purchase_configuration, self).create(cr, uid, vals, context=context)
|
||||
self.execute(cr, uid, [ids], vals, context=context)
|
||||
return ids
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
self.execute(cr, uid, ids, vals, context=context)
|
||||
return super(purchase_configuration, self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def execute(self, cr, uid, ids, vals, context=None):
|
||||
#TODO: TO BE IMPLEMENTED
|
||||
for method in dir(self):
|
||||
if method.startswith('set_'):
|
||||
getattr(self, method)(cr, uid, ids, vals, context)
|
||||
return True
|
||||
|
||||
# def set_installed_modules(self, cr, uid, ids, vals, context=None):
|
||||
# if vals.get('task_work'):
|
||||
# vals.update({'module_project_timesheet': True, 'module_project_mrp': True})
|
||||
# else:
|
||||
# vals.update({'module_project_timesheet': False, 'module_project_mrp': False})
|
||||
#
|
||||
# super(sale_configuration, self).set_installed_modules(cr, uid, ids, vals, context=context)
|
||||
|
||||
# def set_sale_defaults(self, cr, uid, ids, vals, context=None):
|
||||
# ir_values_obj = self.pool.get('ir.values')
|
||||
# data_obj = self.pool.get('ir.model.data')
|
||||
# menu_obj = self.pool.get('ir.ui.menu')
|
||||
# res = {}
|
||||
# wizard = self.browse(cr, uid, ids)[0]
|
||||
# group_id = data_obj.get_object(cr, uid, 'base', 'group_sale_salesman').id
|
||||
#
|
||||
# if wizard.sale_orders:
|
||||
# menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_invoicing_sales_order_lines').id
|
||||
# menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['ir.ui.menu'], [(4,group_id)])
|
||||
#
|
||||
# if wizard.deli_orders:
|
||||
# menu_id = data_obj.get_object(cr, uid, 'sale', 'menu_action_picking_list_to_invoice').id
|
||||
# menu_obj.write(cr, uid, menu_id, {'groups_id':[(4,group_id)]})
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'groups_id', ['ir.ui.menu'], [(4,group_id)])
|
||||
#
|
||||
# if wizard.picking_policy:
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'picking_policy', ['sale.order'], 'one')
|
||||
#
|
||||
# if wizard.time_unit:
|
||||
# prod_id = data_obj.get_object(cr, uid, 'product', 'product_consultant').id
|
||||
# product_obj = self.pool.get('product.product')
|
||||
# product_obj.write(cr, uid, prod_id, {'uom_id': wizard.time_unit.id, 'uom_po_id': wizard.time_unit.id})
|
||||
#
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'order_policy', ['sale.order'], wizard.order_policy)
|
||||
# if wizard.task_work and wizard.time_unit:
|
||||
# company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
|
||||
# self.pool.get('res.company').write(cr, uid, [company_id], {
|
||||
# 'project_time_mode_id': wizard.time_unit.id
|
||||
# }, context=context)
|
||||
#
|
||||
# return res
|
||||
#
|
||||
# def onchange_tax_policy(self, cr, uid, ids, tax_policy, context=None):
|
||||
# self.set_tax_policy(cr, uid, ids, {'tax_policy': tax_policy}, context=context)
|
||||
# return {'value': {}}
|
||||
#
|
||||
# def set_default_taxes(self, cr, uid, ids, vals, context=None):
|
||||
# ir_values_obj = self.pool.get('ir.values')
|
||||
# taxes = self._check_default_tax(cr, uid, context=context)
|
||||
# if isinstance(vals.get('tax_value'), list):
|
||||
# taxes = vals.get('tax_value')
|
||||
# if taxes:
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'tax_id', ['sale.order'], taxes[0])
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'tax_id', ['sale.order.line'], taxes)
|
||||
# ir_values_obj.set(cr, uid, 'default', False, 'taxes_id', ['product.product'], taxes)
|
||||
|
||||
purchase_configuration()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,49 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class res_company(osv.osv):
|
||||
_inherit = "res.company"
|
||||
_columns = {
|
||||
'paypal_account': fields.char("Paypal Account", size=128, help="Paypal username (usually email) for receiving online payments."),
|
||||
'overdue_msg': fields.text('Overdue Payments Message', translate=True),
|
||||
'property_reserve_and_surplus_account': fields.property(
|
||||
'account.account',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Reserve and Profit/Loss Account",
|
||||
view_load=True,
|
||||
domain="[('type', '=', 'other')]",
|
||||
help="This account is used for transferring Profit/Loss (If It is Profit: Amount will be added, Loss : Amount will be deducted.), as calculated in Profit & Loss Report"),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'overdue_msg': '''Our records indicate that the following payments are still due. If the amount
|
||||
has already been paid, please disregard this notice. However, if you have any
|
||||
queries regarding your account, please contact us.
|
||||
Thank you in advance.
|
||||
'''
|
||||
}
|
||||
|
||||
res_company()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -46,6 +46,18 @@
|
|||
<field name="category_id" ref="purchase.category_purchase_config"/>
|
||||
<field name="type">once</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_purchase_config" model="ir.ui.view">
|
||||
<field name="name">board.purchase.form</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="purchase.view_purchase_config"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="module_purchase_double_validation" position="after">
|
||||
<field name="purchase_limit" nolabel="1"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
Loading…
Reference in New Issue