forked from Trust-Code/odoo-brasil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request Trust-Code#83 from kmee/feature/hr_timesheet_invoice
[NEW] Modulo para criar faturas, com impostos BR, baseado em planilhas de horas.
- Loading branch information
Showing
5 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Copyright (C) 2014 KMEE (http://www.kmee.com.br) | ||
# @author Luis Felipe Mileo <mileo@kmee.com.br> | ||
# | ||
# 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 hr_timesheet_invoice | ||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Copyright (C) 2014 KMEE (http://www.kmee.com.br) | ||
# @author Luis Felipe Mileo <mileo@kmee.com.br> | ||
# | ||
# 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': 'Brazilian Invoice on Timesheets', | ||
'version': '1.0', | ||
'category': 'Sales Management', | ||
'description': """ | ||
Generate your Invoices from Expenses, Timesheet Entries. | ||
======================================================== | ||
Module to generate invoices based on costs (human resources, expenses, ...). | ||
With Brazilian Taxes | ||
You can define price lists in analytic account, make some theoretical revenue | ||
reports.""", | ||
'author': 'KMEE', | ||
'website': 'http://www.kmee.com.br', | ||
'depends': ['l10n_br_account', | ||
'hr_timesheet_invoice', | ||
], | ||
'data': [ | ||
'hr_timesheet_invoice_data.xml', | ||
'hr_timesheet_invoice_view.xml', | ||
], | ||
'installable': True, | ||
'auto_install': False, | ||
} | ||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# -*- encoding: utf-8 -*- | ||
############################################################################## | ||
# | ||
# Copyright (C) 2014 KMEE (http://www.kmee.com.br) | ||
# @author Luis Felipe Mileo <mileo@kmee.com.br> | ||
# | ||
# 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 osv | ||
|
||
|
||
class AccountAnalyticLine(osv.osv): | ||
_inherit = 'account.analytic.line' | ||
|
||
def invoice_cost_create(self, cr, uid, ids, data=None, context=None): | ||
|
||
inv_obj = self.pool.get('account.invoice') | ||
line_obj = self.pool.get('account.invoice.line') | ||
|
||
context.update({'type': 'out_invoice'}) | ||
|
||
invoice_ids = super(AccountAnalyticLine, self).invoice_cost_create( cr, uid, ids, data, context) | ||
|
||
for invoice in inv_obj.browse(cr, uid, invoice_ids, context=context): | ||
|
||
line_ids = line_obj.search(cr, uid, [('invoice_id', '=', invoice.id)]) | ||
|
||
if invoice.payment_term: | ||
payment_term = invoice.payment_term.id | ||
else: | ||
payment_term = False | ||
if invoice.partner_bank_id: | ||
bank = invoice.partner_bank_id.id | ||
else: | ||
bank = False | ||
|
||
if invoice.fiscal_category_id: | ||
fiscal_category_id = invoice.fiscal_category_id.id | ||
else: | ||
fiscal_category_id = False | ||
|
||
onchange = inv_obj.onchange_partner_id(cr, uid, [invoice.id], 'out_invoice', invoice.partner_id.id, invoice.date_invoice, payment_term, bank, invoice.company_id.id, fiscal_category_id) | ||
|
||
parent_fposition_id = onchange['value']['fiscal_position'] | ||
|
||
for line in invoice.invoice_line: | ||
|
||
result = line_obj.product_id_change(cr, uid, ids, line.product_id.id, line.uos_id.id, line.quantity, line.name, | ||
'out_invoice', invoice.partner_id.id, | ||
fposition_id=False, price_unit=line.price_unit, | ||
currency_id=invoice.currency_id.id, context=context, company_id=invoice.company_id.id, | ||
parent_fiscal_category_id=fiscal_category_id, | ||
parent_fposition_id=parent_fposition_id) | ||
|
||
line_obj.write(cr, uid, [line.id],result['value'],context) | ||
inv_obj.write(cr, uid, [invoice.id], onchange['value'], context=context) | ||
return invoice_ids |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data noupdate="1"> | ||
|
||
</data> | ||
</openerp> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<openerp> | ||
<data> | ||
|
||
</data> | ||
</openerp> |