diff --git a/addons/product/__init__.py b/addons/product/__init__.py index 4247b49d41b..a7e0be09dc5 100644 --- a/addons/product/__init__.py +++ b/addons/product/__init__.py @@ -23,5 +23,6 @@ import pricelist import report import partner import wizard +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/product/product_view.xml b/addons/product/product_view.xml index a1857748b9d..2e0b5a7d963 100644 --- a/addons/product/product_view.xml +++ b/addons/product/product_view.xml @@ -126,7 +126,7 @@ - + diff --git a/addons/product/res_config.py b/addons/product/res_config.py new file mode 100644 index 00000000000..f6fd1911a10 --- /dev/null +++ b/addons/product/res_config.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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() \ No newline at end of file diff --git a/addons/product/security/product_security.xml b/addons/product/security/product_security.xml index 5c993b9cd61..e915362867d 100644 --- a/addons/product/security/product_security.xml +++ b/addons/product/security/product_security.xml @@ -19,6 +19,16 @@ + + Purchase Pricelists + + + + + Purhase Product UOM + + + product pricelist company rule diff --git a/addons/purchase/__init__.py b/addons/purchase/__init__.py index 66f92a60831..c9adeac874e 100644 --- a/addons/purchase/__init__.py +++ b/addons/purchase/__init__.py @@ -27,6 +27,7 @@ import report import stock import company import edi +import res_config # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/purchase/__openerp__.py b/addons/purchase/__openerp__.py index 5b3902cf1cd..ff1c416c07f 100644 --- a/addons/purchase/__openerp__.py +++ b/addons/purchase/__openerp__.py @@ -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', diff --git a/addons/purchase/partner_view.xml b/addons/purchase/partner_view.xml index 06ba97079eb..e15e36a7c4e 100644 --- a/addons/purchase/partner_view.xml +++ b/addons/purchase/partner_view.xml @@ -9,7 +9,7 @@ 36 - + diff --git a/addons/purchase/purchase_view.xml b/addons/purchase/purchase_view.xml index 1c936055aff..e6260c1c13f 100644 --- a/addons/purchase/purchase_view.xml +++ b/addons/purchase/purchase_view.xml @@ -14,7 +14,7 @@ + parent="menu_purchase_config_purchase" sequence="50" groups="base.group_purchase_pricelist_per_supplier"/> + parent="purchase.menu_product_in_config_purchase" sequence="20" groups="base.group_purchase_uom_per_product"/> - + @@ -182,7 +182,7 @@ - + @@ -361,7 +361,7 @@ - + @@ -403,7 +403,7 @@ - + @@ -424,7 +424,7 @@ - + diff --git a/addons/purchase/res_config.py b/addons/purchase/res_config.py new file mode 100644 index 00000000000..5cc883d2fe5 --- /dev/null +++ b/addons/purchase/res_config.py @@ -0,0 +1,171 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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: \ No newline at end of file diff --git a/addons/purchase_analytic_plans/company.py b/addons/purchase_analytic_plans/company.py new file mode 100644 index 00000000000..4ad4d1226d7 --- /dev/null +++ b/addons/purchase_analytic_plans/company.py @@ -0,0 +1,49 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2010 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +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: diff --git a/addons/purchase_double_validation/purchase_double_validation_installer.xml b/addons/purchase_double_validation/purchase_double_validation_installer.xml index 490581e472b..1905c63a706 100644 --- a/addons/purchase_double_validation/purchase_double_validation_installer.xml +++ b/addons/purchase_double_validation/purchase_double_validation_installer.xml @@ -46,6 +46,18 @@ once - + + + board.purchase.form + board.board + form + + + + + + + +