Merge branch 'master' of git:~/gitrepos/cam-template
commit
4fc2a5d78f
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# cam_invoice_skonto, Custom Module for OpenERP
|
||||
# Copyright (C) 2014 Camadeus Consulting GmbH (<http://www.camadeus.at>).
|
||||
#
|
||||
# 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 cam_invoice_skonto
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# cam_invoice_skonto, Custom Module for OpenERP
|
||||
# Copyright (C) 2014 Camadeus Consulting GmbH (<http://www.camadeus.at>).
|
||||
#
|
||||
# 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': 'Camadeus Invoice Skonto',
|
||||
'version': '1.0',
|
||||
'category': 'Custom',
|
||||
'description':
|
||||
"""
|
||||
- Fügt die Felder Netto Tage, Skonto Tage, Skonto Prozent zu Zahlungsbedingungen (account.payment.term) hinzu.
|
||||
- Fügt die Felder Skonto Fälligkeit und Betrag inkl. Skonto zur Rechnung (account.invoice) hinzu.
|
||||
""",
|
||||
'author': 'camadeus GmbH',
|
||||
'website': 'http://www.camadeus.at',
|
||||
'depends': ['account'],
|
||||
'data': [
|
||||
'cam_invoice_skonto_view.xml',
|
||||
'cam_invoice_skonto_data.xml',
|
||||
],
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
}
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,85 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# cam_invoice_skonto, Custom Module for OpenERP
|
||||
# Copyright (C) 2014 Camadeus Consulting GmbH (<http://www.camadeus.at>).
|
||||
#
|
||||
# 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
|
||||
from openerp import models, fields as f, api
|
||||
import openerp.addons.decimal_precision as dp
|
||||
from datetime import date, timedelta, datetime
|
||||
|
||||
class account_payment_term(osv.osv):
|
||||
_inherit = 'account.payment.term'
|
||||
|
||||
_columns = {
|
||||
'netto_tage': fields.integer('Netto Tage'),
|
||||
'skonto_tage': fields.integer('Skonto Tage'),
|
||||
'skonto_prozent': fields.float('Skonto Prozent'),
|
||||
}
|
||||
|
||||
def write(self, cr, uid, ids, values, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
tl_obj = self.pool.get('account.payment.term.line')
|
||||
for pay_term in self.browse(cr, uid, ids, context=context):
|
||||
# Delete old account.payment.term.line
|
||||
for tl_id in pay_term.line_ids:
|
||||
tl_obj.unlink(cr, uid, tl_id.id, context=context)
|
||||
# Create new account.payment.term.line based on netto_tage
|
||||
days = 0
|
||||
if('netto_tage' in values):
|
||||
days = values['netto_tage']
|
||||
else:
|
||||
days = pay_term.netto_tage
|
||||
values['line_ids'] = [(0,0, {'payment_id':pay_term.id, 'value': 'balance', 'days': days, 'days2':0})]
|
||||
|
||||
return super(account_payment_term, self).write(cr, uid, ids, values, context=context)
|
||||
|
||||
def create(self, cr, uid, vals, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
new_id = super(account_payment_term, self).create(cr, uid, vals, context=context)
|
||||
self.write(cr, uid, new_id, {'netto_tage': vals['netto_tage']}, context=context)
|
||||
|
||||
return new_id
|
||||
|
||||
class account_invoice(models.Model):
|
||||
_inherit = 'account.invoice'
|
||||
|
||||
@api.one
|
||||
def _skonto_betrag_inkl(self):
|
||||
if self.payment_term and self.payment_term.skonto_prozent:
|
||||
self.skonto_betrag_inkl = self.amount_total * (1 - self.payment_term.skonto_prozent/100.0)
|
||||
|
||||
skonto_faelligkeit = f.Date(string=u'Skonto Fälligkeit', readonly=True)
|
||||
skonto_betrag_inkl = f.Float(string='Betrag inkl. Skonto', digits=dp.get_precision('Account'), readonly=True, compute='_skonto_betrag_inkl')
|
||||
|
||||
@api.multi
|
||||
def action_skonto_faelligkeit_assign(self):
|
||||
for inv in self:
|
||||
if inv.payment_term and inv.payment_term.skonto_tage:
|
||||
inv.write({'skonto_faelligkeit': datetime.strptime(inv.date_invoice, '%Y-%m-%d') + timedelta(days=inv.payment_term.skonto_tage)})
|
||||
return True
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# cam_invoice_skonto, Custom Module for OpenERP
|
||||
# Copyright (C) 2014 Camadeus Consulting GmbH (<http://www.camadeus.at>).
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="account.act_open" model="workflow.activity">
|
||||
<field name="action">action_date_assign()
|
||||
action_move_create()
|
||||
action_number()
|
||||
invoice_validate()
|
||||
action_skonto_faelligkeit_assign()</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# cam_invoice_skonto, Custom Module for OpenERP
|
||||
# Copyright (C) 2014 Camadeus Consulting GmbH (<http://www.camadeus.at>).
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
##############################################################################
|
||||
-->
|
||||
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- account.payment.term -->
|
||||
<record id="view_payment_term_form" model="ir.ui.view">
|
||||
<field name="name">cam_invoice_skonto.payment.term.form</field>
|
||||
<field name="model">account.payment.term</field>
|
||||
<field name="inherit_id" ref="account.view_payment_term_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//form[@string='Payment Term']/separator[@string='Computation']" position="replace">
|
||||
</xpath>
|
||||
<xpath expr="//form[@string='Payment Term']/field[@name='line_ids']" position="replace">
|
||||
<group col="4">
|
||||
<field name="skonto_tage"/>
|
||||
<field name="netto_tage"/>
|
||||
<field name="skonto_prozent"/>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- account.invoice -->
|
||||
<record id="invoice_form" model="ir.ui.view">
|
||||
<field name="name">cam_invoice_skonto.invoice.form</field>
|
||||
<field name="model">account.invoice</field>
|
||||
<field name="inherit_id" ref="account.invoice_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_due" position="after">
|
||||
<field name="skonto_faelligkeit"/>
|
||||
</field>
|
||||
<field name="residual" position="before">
|
||||
<field name="skonto_betrag_inkl"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 11 KiB |
|
|
@ -115,10 +115,11 @@ class Config():
|
|||
'cam_max_width',
|
||||
'oerp_no_phoning_home',
|
||||
'cam_custom',
|
||||
'cam_reports',
|
||||
'account_cancel',
|
||||
'cam_reports',
|
||||
'account_cancel',
|
||||
'cam_invoice_skonto',
|
||||
#'crm',
|
||||
#'sale',
|
||||
#'cam_hr_overtime',
|
||||
#'cam_hr',
|
||||
]
|
||||
]
|
||||
|
|
|
|||
Loading…
Reference in New Issue