[ADD] added account_product_template module and add it account configuration view

bzr revid: tpa@tinyerp.com-20140113131845-urfw5knjkou0a0aw
This commit is contained in:
Turkesh Patel (Open ERP) 2014-01-13 18:48:45 +05:30
parent 8a43a64250
commit 04703c9e15
7 changed files with 148 additions and 0 deletions

View File

@ -105,6 +105,8 @@ class account_config_settings(osv.osv_memory):
'module_account_followup': fields.boolean('Manage customer payment follow-ups',
help='This allows to automate letters for unpaid invoices, with multi-level recalls.\n'
'-This installs the module account_followup.'),
'module_account_product_template': fields.boolean('Send products tools and information at the invoice confirmation',
help='Whith this module, link your products to a template to send complete information and tools to your customer. For instance, you invoice a training, link a template to this training product with training agenda and materials.'),
'group_proforma_invoices': fields.boolean('Allow pro-forma invoices',
implied_group='account.group_proforma_invoices',
help="Allows you to put invoices in pro-forma state."),

View File

@ -183,6 +183,10 @@
<field name="module_account_followup" class="oe_inline"/>
<label for="module_account_followup"/>
</div>
<div>
<field name="module_account_product_template" class="oe_inline"/>
<label for="module_account_product_template"/>
</div>
</div>
</group>
<group>

View File

@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
import account_product
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2011 OpenERP SA (<http://www.openerp.com>).
#
# 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/>.
#
##############################################################################
{
'name' : 'Account Product Template',
'depends' : ['account'],
'author' : 'OpenERP SA',
'category': 'Accounting & Finance',
'description': """
This module adds Product Template.
==================================
Whith this module, link your products to a template to send complete information and tools to your customer. For instance, you invoice a training, link a template to this training product with training agenda and materials.
""",
'website': 'http://www.openerp.com',
'demo': [],
'data': [
'account_product_view.xml',
'account_product_template_data.xml'
],
'js': [],
'css': [],
'qweb' : [],
'images': [],
'installable': True,
'auto_install': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,38 @@
# -*- 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 openerp.osv import fields, osv
class product_template(osv.osv):
_inherit = "product.template"
_columns = {
'email_template_id': fields.many2one('email.template','Product Email Template'),
}
class account_invoice(osv.Model):
_inherit = 'account.invoice'
def invoice_validate(self, cr, uid, ids, context=None):
for line in self.browse(cr, uid, ids[0], context=context).invoice_line:
if line.product_id.email_template_id:
self.pool.get('email.template').send_mail(cr, uid, line.product_id.email_template_id.id, uid, force_send=True, raise_exception=True, context=context)
return super(account_invoice, self).invoice_validate(cr, uid, ids, context=context)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
</data>
</openerp>

View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="product_normal_form_view_template" model="ir.ui.view">
<field name="name">product.normal.procurement.locations.inherit</field>
<field name="model">product.product</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="list_price" position="after">
<field name="email_template_id" domain="[('model','=','product.product')]"/>
</field>
</field>
</record>
<record id="action_product_email_template" model="ir.actions.act_window">
<field name="name">Product Templates</field>
<field name="res_model">email.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('model','=','product.product')]</field>
</record>
<menuitem id="menu_finance_product_template" name="Product Template" parent="account.menu_finance_configuration" action="action_product_email_template"/>
</data>
</openerp>