diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py
index d4408d63bfe..39e40555f39 100644
--- a/addons/account/__openerp__.py
+++ b/addons/account/__openerp__.py
@@ -34,14 +34,15 @@
Budgets
Customer and Supplier Invoices
Bank statements
+ Reconciliation process by partner
Creates a dashboards for accountants that includes:
* List of uninvoiced quotations
* Graph of aged receivables
- * Graph of aged incomes
+ * Graph of aged incomes
The processes like maintaining of general ledger is done through the defined financial Journals (entry move line or
grouping is maintained through journal) for a particular financial year and for preparation of vouchers there is a
-module named account_voucherss
+module named account_vouchers
""",
'website': 'http://www.openerp.com',
'init_xml': [],
@@ -85,6 +86,7 @@ module named account_voucherss
'wizard/account_compare_account_balance_report_view.xml',
'wizard/account_third_party_ledger.xml',
'wizard/account_reconcile_view.xml',
+ 'wizard/account_reconcile_partner_process_view.xml',
'wizard/account_automatic_reconcile_view.xml',
'project/wizard/project_account_analytic_line_view.xml',
'account_end_fy.xml',
diff --git a/addons/account/account.py b/addons/account/account.py
index f946723e350..06060f59e28 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -616,17 +616,17 @@ class account_journal(osv.osv):
'type_control_ids': fields.many2many('account.account.type', 'account_journal_type_rel', 'journal_id','type_id', 'Type Controls', domain=[('code','<>','view'), ('code', '<>', 'closed')]),
'account_control_ids': fields.many2many('account.account', 'account_account_type_rel', 'journal_id','account_id', 'Account', domain=[('type','<>','view'), ('type', '<>', 'closed')]),
'view_id': fields.many2one('account.journal.view', 'Display Mode', required=True, help="Gives the view used when writing or browsing entries in this journal. The view tells Open ERP which fields should be visible, required or readonly and in which order. You can create your own view for a faster encoding in each journal."),
- 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]",help="It acts as a default account for credit amount"),
- 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]",help="It acts as a default account for debit amount"),
+ 'default_credit_account_id': fields.many2one('account.account', 'Default Credit Account', domain="[('type','!=','view')]", help="It acts as a default account for credit amount"),
+ 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"),
'centralisation': fields.boolean('Centralised counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."),
- 'update_posted': fields.boolean('Allow Cancelling Entries',help="Check this box if you want to cancel the entries related to this journal or want to cancel the invoice related to this journal"),
+ 'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"),
'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."),
'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=True),
'user_id': fields.many2one('res.users', 'User', help="The user responsible for this journal"),
'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'),
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want new account moves to pass through the \'draft\' state and instead goes directly to the \'posted state\' without any manual validation.'),
- 'company_id': fields.many2one('res.company', 'Company', required=True,select=1,help="Company associated with a journal"),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, select=1, help="Company related to this journal"),
'invoice_sequence_id': fields.many2one('ir.sequence', 'Invoice Sequence', \
help="The sequence used for invoice numbers in this journal."),
'allow_date':fields.boolean('Check Date not in the Period', help= 'If set to True then do not accept the entry if the entry date is not into the period dates'),
@@ -678,7 +678,6 @@ class account_journal(osv.osv):
res= {'value':{'centralisation': False}}
return res
-
account_journal()
class account_fiscalyear(osv.osv):
@@ -772,7 +771,7 @@ class account_period(osv.osv):
'fiscalyear_id': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True, states={'done':[('readonly',True)]}, select=True),
'state': fields.selection([('draft','Draft'), ('done','Done')], 'State', readonly=True,
help='When monthly periods are created. The state is \'Draft\'. At the end of monthly period it is in \'Done\' state.'),
- 'company_id': fields.related('fiscalyear_id','company_id',type='many2one',relation='res.company',string='Company',store=True)
+ 'company_id': fields.related('fiscalyear_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True)
}
_defaults = {
'state': lambda *a: 'draft',
@@ -878,7 +877,7 @@ class account_journal_period(osv.osv):
'state': fields.selection([('draft','Draft'), ('printed','Printed'), ('done','Done')], 'State', required=True, readonly=True,
help='When journal period is created. The state is \'Draft\'. If a report is printed it comes to \'Printed\' state. When all transactions are done, it comes in \'Done\' state.'),
'fiscalyear_id': fields.related('period_id', 'fiscalyear_id', string='Fiscal Year', type='many2one', relation='account.fiscalyear'),
- 'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company')
+ 'company_id': fields.related('journal_id', 'company_id', type='many2one', relation='res.company', string='Company')
}
def _check(self, cr, uid, ids, context={}):
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 45edefe6082..b8719f26242 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -577,6 +577,39 @@ class account_move_line(osv.osv):
# writeoff; entry generated for the difference between the lines
#
+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+ if context is None:
+ context = {}
+ if context and context.get('next_partner_only', False):
+ if not context.get('partner_id', False):
+ partner = self.get_next_partner_only(cr, uid, offset, context)
+ else:
+ partner = context.get('partner_id', False)
+ if not partner:
+ return []
+ args.append(('partner_id', '=', partner[0]))
+ return super(account_move_line, self).search(cr, uid, args, offset, limit, order, context, count)
+
+ def get_next_partner_only(self, cr, uid, offset=0, context=None):
+ cr.execute(
+ """
+ SELECT p.id
+ FROM res_partner p
+ RIGHT JOIN (
+ SELECT l.partner_id as partner_id, SUM(l.debit) as debit, SUM(l.credit) as credit
+ FROM account_move_line l
+ LEFT JOIN account_account a ON (a.id = l.account_id)
+ LEFT JOIN res_partner p ON (l.partner_id = p.id)
+ WHERE a.reconcile IS TRUE
+ AND l.reconcile_id IS NULL
+ AND (p.last_reconciliation_date IS NULL OR l.date > p.last_reconciliation_date)
+ AND l.state <> 'draft'
+ GROUP BY l.partner_id
+ ) AS s ON (p.id = s.partner_id)
+ ORDER BY p.last_reconciliation_date LIMIT 1 OFFSET %s""", (offset,)
+ )
+ return cr.fetchone()
+
def reconcile_partial(self, cr, uid, ids, type='auto', context=None):
merges = []
unmerge = []
@@ -730,6 +763,11 @@ class account_move_line(osv.osv):
# because of the way the line_id are defined: (4, x, False)
for id in ids:
wf_service.trg_trigger(uid, 'account.move.line', id, cr)
+
+ if lines and lines[0]:
+ partner_id = lines[0].partner_id.id
+ if context and context.get('stop_reconcile', False):
+ self.pool.get('res.partner').write(cr, uid, [partner_id], {'last_reconciliation_date': time.strftime('%Y-%m-%d %H:%M:%S')})
return r_id
def view_header_get(self, cr, user, view_id, view_type, context):
@@ -838,13 +876,14 @@ class account_move_line(osv.osv):
journal_id = m.journal_id.id
period_id = m.period_id.id
else:
- journal_id = context['journal_id']
- period_id = context['period_id']
- journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])[0]
- if journal.allow_date:
- period = self.pool.get('account.period').browse(cr, uid, [period_id])[0]
- if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') or not time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
- raise osv.except_osv(_('Error'),_('The date of your Ledger Posting is not in the defined period !'))
+ journal_id = context.get('journal_id',False)
+ period_id = context.get('period_id',False)
+ if journal_id:
+ journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])[0]
+ if journal.allow_date and period_id:
+ period = self.pool.get('account.period').browse(cr, uid, [period_id])[0]
+ if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') or not time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
+ raise osv.except_osv(_('Error'),_('The date of your Ledger Posting is not in the defined period !'))
else:
return True
diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml
index 694a48177d9..a93179e3f98 100644
--- a/addons/account/account_view.xml
+++ b/addons/account/account_view.xml
@@ -842,7 +842,9 @@
-
+
+
+
@@ -1167,11 +1169,11 @@
form,tree
-
+ groups="group_account_user"/> -->
@@ -1180,7 +1182,19 @@
+ parent="periodical_processing_reconciliation" groups="group_account_user" />
+
+
+
+
-->
-
+
+
-
+
+
-
+
+ res.partner.form.reconcile
+ res.partner
+
+
+
+
+
+
+
+
diff --git a/addons/account/product.py b/addons/account/product.py
index 0d17b83ea58..ce91b9b0743 100644
--- a/addons/account/product.py
+++ b/addons/account/product.py
@@ -20,7 +20,6 @@
##############################################################################
import time
-
import netsvc
from osv import fields, osv
diff --git a/addons/account/wizard/__init__.py b/addons/account/wizard/__init__.py
index 39971f5c11a..c56c6c2e764 100644
--- a/addons/account/wizard/__init__.py
+++ b/addons/account/wizard/__init__.py
@@ -22,6 +22,7 @@
import account_automatic_reconcile
import account_move_line_reconcile_select
import account_move_line_unreconcile_select
+import account_reconcile_partner_process
import account_reconcile
import account_unreconcile
import account_invoice_refund
diff --git a/addons/account/wizard/account_move_line_reconcile_select_view.xml b/addons/account/wizard/account_move_line_reconcile_select_view.xml
index 220c9e541de..4f88f618727 100644
--- a/addons/account/wizard/account_move_line_reconcile_select_view.xml
+++ b/addons/account/wizard/account_move_line_reconcile_select_view.xml
@@ -31,8 +31,8 @@
new
-
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_move_line_select.py b/addons/account/wizard/account_move_line_select.py
index 32ecf85f375..546bb08c754 100644
--- a/addons/account/wizard/account_move_line_select.py
+++ b/addons/account/wizard/account_move_line_select.py
@@ -43,7 +43,6 @@ class account_move_line_select(osv.osv_memory):
else:
fiscalyear_ids = [context['fiscalyear']]
-# fiscalyear_ids = fiscalyear_obj.search(cr, uid, [('state', '=', 'draft')])
fiscalyears = fiscalyear_obj.browse(cr, uid, fiscalyear_ids)
period_ids = []
diff --git a/addons/account/wizard/account_move_line_unreconcile_select_view.xml b/addons/account/wizard/account_move_line_unreconcile_select_view.xml
index 1daae353725..f2a3882db91 100644
--- a/addons/account/wizard/account_move_line_unreconcile_select_view.xml
+++ b/addons/account/wizard/account_move_line_unreconcile_select_view.xml
@@ -31,8 +31,8 @@
new
-
+
\ No newline at end of file
diff --git a/addons/account/wizard/account_reconcile_partner_process.py b/addons/account/wizard/account_reconcile_partner_process.py
new file mode 100644
index 00000000000..6a1e354837d
--- /dev/null
+++ b/addons/account/wizard/account_reconcile_partner_process.py
@@ -0,0 +1,100 @@
+# -*- 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 .
+#
+##############################################################################
+import time
+
+from osv import osv, fields
+from tools.translate import _
+
+class account_partner_reconcile_process(osv.osv_memory):
+ _name = 'account.partner.reconcile.process'
+ _description = 'Reconcilation Process partner by partner'
+
+ def _get_to_reconcile(self, cr, uid, context=None):
+ cr.execute(
+ "SELECT l.partner_id " \
+ "FROM account_move_line AS l LEFT JOIN res_partner p ON (p.id = l.partner_id) " \
+ "WHERE l.reconcile_id IS NULL " \
+ "AND (%s > to_char(p.last_reconciliation_date, 'YYYY-MM-DD') " \
+ "OR p.last_reconciliation_date IS NULL ) " \
+ "AND l.state <> 'draft' " \
+ "GROUP BY l.partner_id ",(time.strftime('%Y-%m-%d'),)
+ )
+ return len(map(lambda x: x[0], cr.fetchall())) - 1
+
+ def _get_today_reconciled(self, cr, uid, context=None):
+ cr.execute(
+ "SELECT l.partner_id " \
+ "FROM account_move_line AS l LEFT JOIN res_partner p ON (p.id = l.partner_id) " \
+ "WHERE l.reconcile_id IS NULL " \
+ "AND %s = to_char(p.last_reconciliation_date, 'YYYY-MM-DD') " \
+ "AND l.state <> 'draft' " \
+ "GROUP BY l.partner_id ",(time.strftime('%Y-%m-%d'),)
+ )
+ return len(map(lambda x: x[0], cr.fetchall())) + 1
+
+ def _get_partner(self, cr, uid, context=None):
+ partner = self.pool.get('account.move.line').get_next_partner_only(cr, uid, offset=1, context=context)
+ if not partner:
+ return False
+ return partner[0]
+
+ def data_get(self, cr, uid, to_reconcile, today_reconciled, context=None):
+ return {'progress': (100 / float(to_reconcile + today_reconciled)) * today_reconciled}
+
+ def default_get(self, cr, uid, fields, context=None):
+ res = super(account_partner_reconcile_process, self).default_get(cr, uid, fields, context=context)
+ if 'to_reconcile' in res and 'today_reconciled' in res:
+ data = self.data_get(cr, uid, res['to_reconcile'], res['today_reconciled'], context)
+ res.update(data)
+ return res
+
+ def next_partner(self, cr, uid, ids, context=None):
+ partner_id = self.pool.get('account.move.line').read(cr, uid, context['active_id'], ['partner_id'])['partner_id'][0]
+ self.pool.get('res.partner').write(cr, uid, partner_id, {'last_reconciliation_date': time.strftime('%Y-%m-%d')}, context)
+ #TODO: we have to find a way to update the context of the current tab (we could open a new tab with the context but it's not really handy)
+ #TODO: remove that comments when the client side dev is done
+ #context.update({'partner_id': self.browse(cr, uid, ids, context)[0].next_partner_id})
+ #return {'context': context,
+ # 'target': 'opener',
+ # 'name': 'reconciliation process',
+ # 'view_type': 'form',
+ # 'view_mode': 'tree,form',
+ # 'res_model': 'account.move.line',
+ # 'type': 'ir.actions.act_window'
+ #}
+ return {}
+
+ _columns = {
+ 'to_reconcile': fields.float('Remaining Partners', readonly=True, help='This is the remaining partners for who you should check if there is something to reconcile or not. This figure already count the current partner as reconciled.'),
+ 'today_reconciled': fields.float('Partners Reconciled Today', readonly=True, help='This figure depicts the total number of partners that have gone throught the reconciliation process today. The current partner is counted as already processed.'),
+ 'progress': fields.float('Progress', readonly=True, help='Shows you the progress made today on the reconciliation process. Given by \nPartners Reconciled Today \ (Remaining Partners + Partners Reconciled Today)'),
+ 'next_partner_id': fields.many2one('res.partner', 'Next Partner to Reconcile', readonly=True, help='This field shows you the next partner that will be automatically chosen by the system to go through the reconciliation process, based on the latest day it have been reconciled.'), # TODO: remove the readonly=True when teh client side will allow to update the context of existing tab, so that the user can change this value if he doesn't want to follow openerp proposal
+ }
+
+ _defaults = {
+ 'to_reconcile': _get_to_reconcile,
+ 'today_reconciled': _get_today_reconciled,
+ 'next_partner_id': _get_partner,
+ }
+
+account_partner_reconcile_process()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/wizard/account_reconcile_partner_process_view.xml b/addons/account/wizard/account_reconcile_partner_process_view.xml
new file mode 100644
index 00000000000..f119243a470
--- /dev/null
+++ b/addons/account/wizard/account_reconcile_partner_process_view.xml
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+ Partner Reconcilation Process
+ account.partner.reconcile.process
+ form
+
+
+
+
+
+
+ Reconciliation: Go to Next Partner
+ account.partner.reconcile.process
+ ir.actions.act_window
+ form
+ tree,form
+
+ {'record_id':active_id}
+ new
+
+
+
+
+ Partner reconciliation
+ client_action_multi
+
+ action
+ account.move.line
+
+
+
+
+
diff --git a/addons/account_coda/wizard/coda_import.py b/addons/account_coda/wizard/coda_import.py
index 34054bc5009..82fc7bf877c 100644
--- a/addons/account_coda/wizard/coda_import.py
+++ b/addons/account_coda/wizard/coda_import.py
@@ -221,7 +221,7 @@ def _coda_parsing(self, cr, uid, data, context):
bk_st_id = pool.get('account.bank.statement').create(cr,uid,{
'journal_id': statement['journal_id'],
'date':time.strftime('%Y-%m-%d',time.strptime(statement['date'],"%y/%m/%d")),
-# 'period_id':statement['period_id'],
+ 'period_id':statement['period_id'],
'balance_start': statement["balance_start"],
'balance_end_real': statement["balance_end_real"],
'state': 'draft',
diff --git a/addons/board/i18n/id.po b/addons/board/i18n/id.po
index 8c3357a0c30..8a8a3b2a9e0 100644
--- a/addons/board/i18n/id.po
+++ b/addons/board/i18n/id.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2009-11-09 13:47+0000\n"
-"Last-Translator: <>\n"
+"PO-Revision-Date: 2010-06-19 01:36+0000\n"
+"Last-Translator: Abdul Munif Hanafi \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:15+0000\n"
+"X-Launchpad-Export-Date: 2010-06-20 03:34+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: board
@@ -21,6 +21,7 @@ msgstr ""
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
+"Nama Objek harus berawalan dengan x_ dan tidak mengandung karakter khusus !"
#. module: board
#: model:ir.model,name:board.model_board_board
@@ -30,7 +31,7 @@ msgstr ""
#. module: board
#: field:board.note,user_id:0
msgid "Author"
-msgstr ""
+msgstr "Pencipta"
#. module: board
#: model:ir.module.module,shortdesc:board.module_meta_information
@@ -41,22 +42,22 @@ msgstr ""
#: view:board.note:0
#: field:board.note,note:0
msgid "Note"
-msgstr ""
+msgstr "Catatan"
#. module: board
#: field:board.board.line,width:0
msgid "Width"
-msgstr ""
+msgstr "Lebar"
#. module: board
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
-msgstr ""
+msgstr "Nama model tidak sah di definsi aksi"
#. module: board
#: field:board.board.line,name:0
msgid "Title"
-msgstr ""
+msgstr "Judul"
#. module: board
#: model:ir.actions.act_window,name:board.action_view_board_list_form
@@ -73,7 +74,7 @@ msgstr ""
#. module: board
#: wizard_view:board.board.menu.create,init:0
msgid "Menu Information"
-msgstr ""
+msgstr "Informasi Menu"
#. module: board
#: field:board.board,line_ids:0
@@ -88,12 +89,12 @@ msgstr ""
#. module: board
#: field:board.note,date:0
msgid "Date"
-msgstr ""
+msgstr "Tanggal"
#. module: board
#: model:ir.ui.menu,name:board.next_id_50
msgid "Configuration"
-msgstr ""
+msgstr "Konfigurasi"
#. module: board
#: field:board.note.type,name:0
@@ -108,7 +109,7 @@ msgstr ""
#. module: board
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
-msgstr ""
+msgstr "XML tidak sah untuk Menampilkan Arsitektur!"
#. module: board
#: wizard_field:board.board.menu.create,init,menu_parent_id:0
@@ -118,7 +119,7 @@ msgstr ""
#. module: board
#: view:board.note:0
msgid "Notes"
-msgstr ""
+msgstr "Catatan"
#. module: board
#: model:ir.model,name:board.model_board_note_type
@@ -140,7 +141,7 @@ msgstr ""
#. module: board
#: field:board.board.line,position:0
msgid "Position"
-msgstr ""
+msgstr "Posisi"
#. module: board
#: model:ir.actions.act_window,name:board.dashboard_open
@@ -150,7 +151,7 @@ msgstr ""
#. module: board
#: wizard_field:board.board.menu.create,init,menu_name:0
msgid "Menu Name"
-msgstr ""
+msgstr "Nama Menu"
#. module: board
#: field:board.note,type:0
@@ -160,7 +161,7 @@ msgstr ""
#. module: board
#: selection:board.board.line,position:0
msgid "Left"
-msgstr ""
+msgstr "Kiri"
#. module: board
#: field:board.board,view_id:0
@@ -170,7 +171,7 @@ msgstr ""
#. module: board
#: selection:board.board.line,position:0
msgid "Right"
-msgstr ""
+msgstr "Kanan"
#. module: board
#: field:board.board.line,sequence:0
@@ -181,7 +182,7 @@ msgstr ""
#: view:board.board:0
#: wizard_button:board.board.menu.create,init,create_menu:0
msgid "Create Menu"
-msgstr ""
+msgstr "Buat Menu"
#. module: board
#: model:ir.ui.menu,name:board.dashboard_menu
@@ -191,7 +192,7 @@ msgstr ""
#. module: board
#: field:board.board.line,height:0
msgid "Height"
-msgstr ""
+msgstr "Tinggi"
#. module: board
#: model:ir.actions.wizard,name:board.wizard_board_create_menu
@@ -201,7 +202,7 @@ msgstr ""
#. module: board
#: wizard_button:board.board.menu.create,init,end:0
msgid "Cancel"
-msgstr ""
+msgstr "Batal"
#. module: board
#: view:board.board:0
diff --git a/addons/delivery/i18n/pl.po b/addons/delivery/i18n/pl.po
index d395d60a8a2..20d2799ecd9 100644
--- a/addons/delivery/i18n/pl.po
+++ b/addons/delivery/i18n/pl.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-05-03 08:04+0000\n"
-"Last-Translator: Piotr Lipski \n"
+"PO-Revision-Date: 2010-06-19 13:34+0000\n"
+"Last-Translator: Grzegorz Grzelak (Cirrus.pl) \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-05-05 03:47+0000\n"
+"X-Launchpad-Export-Date: 2010-06-20 03:34+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: delivery
@@ -57,7 +57,7 @@ msgstr ""
#. module: delivery
#: field:delivery.grid,state_ids:0
msgid "States"
-msgstr "Stany"
+msgstr "Regiony"
#. module: delivery
#: constraint:ir.actions.act_window:0
@@ -68,6 +68,7 @@ msgstr "Nieprawidłowa nazwa modelu w definicji akcji."
#: help:res.partner,property_delivery_carrier:0
msgid "This delivery method will be used when invoicing from packing."
msgstr ""
+"Ta metoda dostawy będzie stosowana przy fakturowaniu z wydania zewnętrznego."
#. module: delivery
#: model:ir.model,name:delivery.model_delivery_grid
@@ -109,7 +110,7 @@ msgstr "Pozycja tabeli opłat za dostawy"
#. module: delivery
#: model:ir.ui.menu,name:delivery.menu_delivery
msgid "Delivery"
-msgstr "Dostawa"
+msgstr "Wydanie zewnętrzne"
#. module: delivery
#: view:delivery.grid.line:0
@@ -151,7 +152,7 @@ msgstr "="
#. module: delivery
#: field:delivery.carrier,product_id:0
msgid "Delivery Product"
-msgstr ""
+msgstr "Dostawa jako produkt"
#. module: delivery
#: view:delivery.grid.line:0
diff --git a/addons/email_template/email_template_account_view.xml b/addons/email_template/email_template_account_view.xml
index 65973fea9f7..4a35134bb41 100644
--- a/addons/email_template/email_template_account_view.xml
+++ b/addons/email_template/email_template_account_view.xml
@@ -96,6 +96,8 @@
+
diff --git a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
index f919299e583..d40829cf120 100644
--- a/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
+++ b/addons/hr_attendance/wizard/hr_attendance_sign_in_out.py
@@ -164,7 +164,6 @@ class hr_sign_in_out(osv.osv_memory):
return {} # To do: Return Success message
def sign_out(self, cr, uid, data, context=None):
-
emp_id = data['emp_id']
if 'last_time' in data:
if data['last_time'] > time.strftime('%Y-%m-%d %H:%M:%S'):
diff --git a/addons/hr_contract/i18n/hi.po b/addons/hr_contract/i18n/hi.po
index a80f3f55224..c3a930020a5 100644
--- a/addons/hr_contract/i18n/hi.po
+++ b/addons/hr_contract/i18n/hi.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
-"PO-Revision-Date: 2010-01-25 07:27+0000\n"
-"Last-Translator: vir (Open ERP) \n"
+"PO-Revision-Date: 2010-06-20 20:17+0000\n"
+"Last-Translator: abhishek \n"
"Language-Team: Hindi \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-04-17 04:14+0000\n"
+"X-Launchpad-Export-Date: 2010-06-21 03:42+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_contract
@@ -57,7 +57,7 @@ msgstr ""
#. module: hr_contract
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
-msgstr ""
+msgstr "कार्य की परिभाषा में मॉडल का नाम अमान्य है."
#. module: hr_contract
#: field:hr.contract,employee_id:0
@@ -82,7 +82,7 @@ msgstr ""
#. module: hr_contract
#: field:hr.contract,function:0
msgid "Function"
-msgstr ""
+msgstr "फंक्शन"
#. module: hr_contract
#: field:hr.employee,marital_status:0
@@ -91,7 +91,7 @@ msgstr ""
#: model:ir.actions.act_window,name:hr_contract.action_hr_marital_status
#: model:ir.ui.menu,name:hr_contract.hr_menu_marital_status
msgid "Marital Status"
-msgstr ""
+msgstr "वैवाहिक वस्तुस्थिति"
#. module: hr_contract
#: view:hr.employee:0
@@ -108,7 +108,7 @@ msgstr ""
#. module: hr_contract
#: field:hr.contract.wage.type,type:0
msgid "Type"
-msgstr ""
+msgstr "प्रकार"
#. module: hr_contract
#: field:hr.contract,wage_type_id:0
@@ -150,19 +150,19 @@ msgstr ""
#. module: hr_contract
#: field:hr.contract,date_end:0
msgid "End Date"
-msgstr ""
+msgstr "समाप्ति तिथि"
#. module: hr_contract
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
-msgstr ""
+msgstr "संरचना देखने के लिए अमान्य XML!"
#. module: hr_contract
#: view:hr.contract:0
#: field:hr.contract,notes:0
#: view:hr.employee:0
msgid "Notes"
-msgstr ""
+msgstr "टिप्पणियाँ"
#. module: hr_contract
#: view:hr.contract:0
@@ -209,12 +209,12 @@ msgstr ""
#. module: hr_contract
#: field:hr.employee,place_of_birth:0
msgid "Place of Birth"
-msgstr ""
+msgstr "जन्म स्थान"
#. module: hr_contract
#: field:hr.employee,manager:0
msgid "Manager"
-msgstr ""
+msgstr "मैनेजर"
#. module: hr_contract
#: view:hr.contract.wage.type.period:0
@@ -239,7 +239,7 @@ msgstr ""
#. module: hr_contract
#: field:hr.contract,date_start:0
msgid "Start Date"
-msgstr ""
+msgstr "प्रारंभ दिनांक"
#. module: hr_contract
#: field:hr.employee.marital.status,description:0
diff --git a/addons/hr_payroll/__openerp__.py b/addons/hr_payroll/__openerp__.py
index 9f1c59abc4f..9a5ff2187e2 100644
--- a/addons/hr_payroll/__openerp__.py
+++ b/addons/hr_payroll/__openerp__.py
@@ -37,7 +37,6 @@
'website':'http://www.openerp.com',
'depends': [
'hr',
- 'account',
'hr_contract',
'hr_holidays',
'hr_expense'
diff --git a/addons/hr_payroll/hr_payroll.py b/addons/hr_payroll/hr_payroll.py
index 93146b565b9..ee24bc3cd21 100644
--- a/addons/hr_payroll/hr_payroll.py
+++ b/addons/hr_payroll/hr_payroll.py
@@ -213,66 +213,29 @@ class payroll_register(osv.osv):
def compute_sheet(self, cr, uid, ids, context={}):
emp_pool = self.pool.get('hr.employee')
slip_pool = self.pool.get('hr.payslip')
- func_pool = self.pool.get('hr.payroll.structure')
- slip_line_pool = self.pool.get('hr.payslip.line')
wf_service = netsvc.LocalService("workflow")
- vals = self.read(cr, uid, ids)[0]
+ vals = self.browse(cr, uid, ids)[0]
emp_ids = emp_pool.search(cr, uid, [])
for emp in emp_pool.browse(cr, uid, emp_ids):
- old_slips = slip_pool.search(cr, uid, [('employee_id','=',emp.id), ('date','=',vals['date'])])
+ old_slips = slip_pool.search(cr, uid, [('employee_id','=',emp.id), ('date','=',vals.date)])
if old_slips:
slip_pool.write(cr, uid, old_slips, {'register_id':ids[0]})
for sid in old_slips:
wf_service.trg_validate(uid, 'hr.payslip', sid, 'compute_sheet', cr)
continue
-
- sql_req= '''
- SELECT c.wage as wage, struct_id as function
- FROM hr_contract c
- LEFT JOIN hr_employee emp on (c.employee_id=emp.id)
- LEFT JOIN hr_contract_wage_type cwt on (cwt.id = c.wage_type_id)
- LEFT JOIN hr_contract_wage_type_period p on (cwt.period_id = p.id)
- WHERE
- (emp.id=%s) AND
- (date_start <= %s) AND
- (date_end IS NULL OR date_end >= %s)
- LIMIT 1
- '''
- cr.execute(sql_req, (emp.id, vals['date'], vals['date']))
- contract_info = cr.dictfetchone()
-
- if not contract_info:
- continue
-
- function = contract_info['struct_id']
- lines = []
- if function:
- func = func_pool.read(cr, uid, function, ['line_ids'])
- lines = slip_line_pool.browse(cr, uid, func['line_ids'])
-
+
res = {
'employee_id':emp.id,
- 'basic':contract_info['wage'],
'register_id':ids[0],
- 'name':vals['name'],
- 'date':vals['date'],
- 'journal_id':vals['journal_id'][0],
- 'bank_journal_id':vals['bank_journal_id'][0]
+ 'name':vals.name,
+ 'date':vals.date,
+ 'journal_id':vals.journal_id.id,
+ 'bank_journal_id':vals.bank_journal_id.id
}
slip_id = slip_pool.create(cr, uid, res)
-
- old_slip_id = slip_line_pool.search(cr, uid, [('slip_id','=',slip_id)])
- slip_line_pool.unlink(cr, uid, old_slip_id)
-
- for line in lines:
- slip_line_pool.copy(cr, uid, line.id, {'slip_id':slip_id, 'employee_id':False, 'function_id':False}, {})
-
- for line in emp.line_ids:
- slip_line_pool.copy(cr, uid, line.id, {'slip_id':slip_id, 'employee_id':False, 'function_id':False}, {})
-
wf_service.trg_validate(uid, 'hr.payslip', slip_id, 'compute_sheet', cr)
number = self.pool.get('ir.sequence').get(cr, uid, 'salary.register')
@@ -314,15 +277,17 @@ class payroll_register(osv.osv):
for sid in sids:
wf_service.trg_validate(uid, 'hr.payslip', sid, 'final_verify_sheet', cr)
-
for reg in self.browse(cr, uid, ids):
accs = {}
for slip in reg.line_ids:
pid = False
if accs.get(slip.employee_id.property_bank_account.code, False) == False:
+ company_name = self.pool.get('res.users').browse(cr, uid, uid).company_id.name
+ bank_name = slip.employee_id.property_bank_account.name
+ number = self.pool.get('ir.sequence').get(cr, uid, 'payment.advice')
advice = {
- 'name': 'Payment Advice from %s / Bank Account %s' % (self.pool.get('res.users').browse(cr, uid, uid).company_id.name, slip.employee_id.property_bank_account.name),
- 'number': self.pool.get('ir.sequence').get(cr, uid, 'payment.advice'),
+ 'name': 'Payment Advice from %s / Bank Account %s' % (company_name, bank_name),
+ 'number': number,
'register_id':reg.id,
'account_id':slip.employee_id.property_bank_account.id
}
@@ -331,16 +296,18 @@ class payroll_register(osv.osv):
else:
pid = accs[slip.employee_id.property_bank_account.code]
- pline = {
- 'advice_id':pid,
- 'name':slip.employee_id.otherid,
- 'employee_id':slip.employee_id.id,
- 'amount':slip.other_pay + slip.net,
- 'bysal':slip.net
- }
- id = advice_line_pool.create(cr, uid, pline)
+ if not slip.employee_id.bank_account_id:
+ raise osv.except_osv(_('Warning'), _("Bank Account not defined for %s !" % (slip.employee_id.name)))
+ else:
+ pline = {
+ 'advice_id':pid,
+ 'name':slip.employee_id.bank_account_id.acc_number,
+ 'employee_id':slip.employee_id.id,
+ 'amount':slip.other_pay + slip.net,
+ 'bysal':slip.net
+ }
+ id = advice_line_pool.create(cr, uid, pline)
- #, 'advice_ids':[(6, 0, [pid])]
self.write(cr, uid, ids, {'state':'confirm'})
return True
@@ -529,7 +496,7 @@ class payment_category(osv.osv):
_name = 'hr.allounce.deduction.categoty'
_description = 'Allowance Deduction Heads'
-
+
_columns = {
'name':fields.char('Categoty Name', size=64, required=True, readonly=False),
'code':fields.char('Categoty Code', size=64, required=True, readonly=False),
@@ -538,13 +505,15 @@ class payment_category(osv.osv):
('deduction','Deduction'),
('other','Others'),
],'Type', select=True),
- 'base':fields.char('Based on', size=64, required=True, readonly=False, help='This will use to computer the % fields values, in general its on basic, but You can use all heads code field in small letter as a variable name i.e. hra, ma, lta, etc...., also you can use, static varible basic'),
+ 'base': fields.text('Based on', required=True, readonly=False, help='This will use to computer the % fields values, in general its on basic, but You can use all heads code field in small letter as a variable name i.e. hra, ma, lta, etc...., also you can use, static varible basic'),
+ #'base':fields.char('Based on', size=64, required=True, readonly=False, help='This will use to computer the % fields values, in general its on basic, but You can use all heads code field in small letter as a variable name i.e. hra, ma, lta, etc...., also you can use, static varible basic'),
'condition':fields.char('Condition', size=1024, required=True, readonly=False, help='Applied this head for calculation if condition is true'),
'sequence': fields.integer('Sequence', required=True, help='Use to arrange calculation sequence'),
'note': fields.text('Description'),
'user_id':fields.char('User', size=64, required=False, readonly=False),
'state':fields.char('Label', size=64, required=False, readonly=False),
'company_id':fields.many2one('res.company', 'Company', required=False),
+ 'contribute_ids':fields.one2many('company.contribution', 'category_id', 'Company Contribution', required=False),
}
_defaults = {
'condition': lambda *a: 'True',
@@ -786,11 +755,7 @@ class hr_payslip(osv.osv):
'other_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Others', digits=(16, 2)),
'total_pay': fields.function(_calculate, method=True, store=True, multi='dc', string='Total Payment', digits=(16, 2)),
'line_ids':fields.one2many('hr.payslip.line', 'slip_id', 'Payslip Line', required=False, readonly=True, states={'draft': [('readonly', False)]}),
- 'move_ids':fields.one2many('hr.payslip.account.move', 'slip_id', 'Accounting vouchers', required=False),
- 'move_line_ids':fields.many2many('account.move.line', 'payslip_lines_rel', 'slip_id', 'line_id', 'Accounting Lines', readonly=True),
- 'move_payment_ids':fields.many2many('account.move.line', 'payslip_payment_rel', 'slip_id', 'payment_id', 'Payment Lines', readonly=True),
'company_id':fields.many2one('res.company', 'Company', required=False),
- 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
'holiday_days': fields.integer('No of Leaves', readonly=True),
'worked_days': fields.integer('Worked Day', readonly=True),
'working_days': fields.integer('Working Days', readonly=True),
@@ -824,185 +789,16 @@ class hr_payslip(osv.osv):
res_id = super(hr_payslip, self).copy(cr, uid, id, default, context)
return res_id
- def create_voucher(self, cr, uid, ids, name, voucher, sequence=5):
- slip_move = self.pool.get('hr.payslip.account.move')
- for slip in ids:
- res = {
- 'slip_id':slip,
- 'move_id':voucher,
- 'sequence':sequence,
- 'name':name
- }
- slip_move.create(cr, uid, res)
-
def set_to_draft(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'draft'})
return True
def cancel_sheet(self, cr, uid, ids, context={}):
- move_pool = self.pool.get('account.move')
-
- for slip in self.browse(cr, uid, ids, context):
- if slip.move_id:
- if slip.move_id.state == 'posted':
- move_pool.button_cancel(cr, uid [slip.move_id.id], context)
- move_pool.unlink(cr, uid, [slip.move_id.id])
-
- if slip.adj_move_id:
- if slip.adj_move_id.state == 'posted':
- move_pool.button_cancel(cr, uid [slip.adj_move_id.id], context)
- move_pool.unlink(cr, uid, [slip.adj_move_id.id])
-
- if slip.other_move_id:
- if slip.other_move_id.state == 'posted':
- move_pool.button_cancel(cr, uid [slip.other_move_id.id], context)
- move_pool.unlink(cr, uid, [slip.other_move_id.id])
-
self.write(cr, uid, ids, {'state':'cancel'})
return True
def process_sheet(self, cr, uid, ids, context={}):
- move_pool = self.pool.get('account.move')
- movel_pool = self.pool.get('account.move.line')
- invoice_pool = self.pool.get('account.invoice')
-
- for slip in self.browse(cr,uid,ids):
- line_ids = []
- partner = False
- partner_id = False
- exp_ids = []
-
- partner = slip.employee_id.address_home_id.partner_id
- partner_id = partner.id
-
- fiscal_year_ids = self.pool.get('account.fiscalyear').search(cr, uid, [])
- if not fiscal_year_ids:
- raise osv.except_osv(_('Warning !'), _('Please define fiscal year for perticular contract'))
- fiscal_year_objs = self.pool.get('account.fiscalyear').read(cr, uid, fiscal_year_ids, ['date_start','date_stop'])
- year_exist = False
- for fiscal_year in fiscal_year_objs:
- if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
- year_exist = True
- if not year_exist:
- raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
- search_period = self.pool.get('account.period').search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)])
- if not search_period:
- raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
- period_id = search_period[0]
- name = 'Payment of Salary to %s' % (slip.employee_id.name)
- move = {
- 'journal_id': slip.bank_journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'type':'bank_pay_voucher',
- 'ref':slip.number,
- 'narration': name
- }
- move_id = move_pool.create(cr, uid, move)
- self.create_voucher(cr, uid, [slip.id], name, move_id)
-
- name = "To %s account" % (slip.employee_id.name)
- ded_rec = {
- 'move_id':move_id,
- 'name': name,
- #'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': slip.employee_id.property_bank_account.id,
- 'debit': 0.0,
- 'credit' : slip.total_pay,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_rec)]
- name = "By %s account" % (slip.employee_id.property_bank_account.name)
- cre_rec = {
- 'move_id':move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': partner.property_account_payable.id,
- 'debit': slip.total_pay,
- 'credit' : 0.0,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, cre_rec)]
-
- other_pay = slip.other_pay
- #Process all Reambuse Entries
- for line in slip.line_ids:
- if line.type == 'otherpay' and line.expanse_id.invoice_id:
- if not line.expanse_id.invoice_id.move_id:
- raise osv.except_osv(_('Warning !'), _('Please Confirm all Expanse Invoice appear for Reimbursement'))
- invids = [line.expanse_id.invoice_id.id]
- amount = line.total
- acc_id = slip.bank_journal_id.default_credit_account_id and slip.bank_journal_id.default_credit_account_id.id
- period_id = slip.period_id.id
- journal_id = slip.bank_journal_id.id
- name = '[%s]-%s' % (slip.number, line.name)
- invoice_pool.pay_and_reconcile(cr, uid, invids, amount, acc_id, period_id, journal_id, False, period_id, False, context, name)
- other_pay -= amount
- #TODO: link this account entries to the Payment Lines also Expanse Entries to Account Lines
- l_ids = movel_pool.search(cr, uid, [('name','=',name)])
- line_ids += l_ids
-
- l_ids = movel_pool.search(cr, uid, [('invoice','=',line.expanse_id.invoice_id.id)])
- exp_ids += l_ids
-
- #Process for Other payment if any
- other_move_id = False
- if slip.other_pay > 0:
- narration = 'Payment of Other Payeble amounts to %s' % (slip.employee_id.name)
- move = {
- 'journal_id': slip.bank_journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'type':'bank_pay_voucher',
- 'ref':slip.number,
- 'narration': narration
- }
- other_move_id = move_pool.create(cr, uid, move)
- self.create_voucher(cr, uid, [slip.id], narration, move_id)
-
- name = "To %s account" % (slip.employee_id.name)
- ded_rec = {
- 'move_id':other_move_id,
- 'name':name,
- 'date':slip.date,
- 'account_id':slip.employee_id.property_bank_account.id,
- 'debit': 0.0,
- 'credit': other_pay,
- 'journal_id':slip.journal_id.id,
- 'period_id':period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_rec)]
- name = "By %s account" % (slip.employee_id.property_bank_account.name)
- cre_rec = {
- 'move_id':other_move_id,
- 'name':name,
- 'partner_id':partner_id,
- 'date':slip.date,
- 'account_id':partner.property_account_payable.id,
- 'debit': other_pay,
- 'credit':0.0,
- 'journal_id':slip.journal_id.id,
- 'period_id':period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, cre_rec)]
-
- rec = {
- 'state':'done',
- 'move_payment_ids':[(6, 0, line_ids)],
- 'paid':True
- }
- self.write(cr, uid, [slip.id], rec)
- for exp_id in exp_ids:
- self.write(cr, uid, [slip.id], {'move_line_ids':[(4, exp_id)]})
-
+ self.write(cr, uid, ids, {'state':'done'})
return True
def account_check_sheet(self, cr, uid, ids, context={}):
@@ -1014,364 +810,22 @@ class hr_payslip(osv.osv):
return True
def verify_sheet(self, cr, uid, ids, context={}):
-
- move_pool = self.pool.get('account.move')
- movel_pool = self.pool.get('account.move.line')
- exp_pool = self.pool.get('hr.expense.expense')
-
- for slip in self.browse(cr,uid,ids):
- total_deduct = 0.0
-
- line_ids = []
- partner = False
- partner_id = False
-
- if not slip.employee_id.address_home_id:
- raise osv.except_osv(_('Integrity Error !'), _('Please defined the Employee Home Address Along with Partners !!'))
-
- if not slip.employee_id.address_home_id.partner_id:
- raise osv.except_osv(_('Integrity Error !'), _('Please defined the Partner in Home Address !!'))
-
- partner = slip.employee_id.address_home_id.partner_id
- partner_id = slip.employee_id.address_home_id.partner_id.id
-
- period_id = False
-
- if slip.period_id:
- period_id = slip.period_id.id
- else:
- fiscal_year_ids = self.pool.get('account.fiscalyear').search(cr, uid, [])
- if not fiscal_year_ids:
- raise osv.except_osv(_('Warning !'), _('Please define fiscal year for perticular contract'))
- fiscal_year_objs = self.pool.get('account.fiscalyear').read(cr, uid, fiscal_year_ids, ['date_start','date_stop'])
- year_exist = False
- for fiscal_year in fiscal_year_objs:
- if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
- year_exist = True
- if not year_exist:
- raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
- search_period = self.pool.get('account.period').search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)])
- if not search_period:
- raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
- period_id = search_period[0]
-
- move = {
- #'name': slip.name,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'ref':slip.number,
- 'narration': slip.name
- }
- move_id = move_pool.create(cr, uid, move)
- self.create_voucher(cr, uid, [slip.id], slip.name, move_id)
-
- line = {
- 'move_id':move_id,
- 'name': "By Basic Salary / " + slip.employee_id.name,
- 'date': slip.date,
- 'account_id': slip.employee_id.salary_account.id,
- 'debit': slip.basic,
- 'credit': 0.0,
- 'quantity':slip.working_days,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'analytic_account_id': False,
- 'ref':slip.number
- }
-
- #Setting Analysis Account for Basic Salary
- if slip.employee_id.analytic_account:
- line['analytic_account_id'] = slip.employee_id.analytic_account.id
-
- move_line_id = movel_pool.create(cr, uid, line)
- line_ids += [move_line_id]
-
- line = {
- 'move_id':move_id,
- 'name': "To Basic Paysble Salary / " + slip.employee_id.name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': slip.employee_id.employee_account.id,
- 'debit': 0.0,
- 'quantity':slip.working_days,
- 'credit': slip.basic,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, line)]
-
- for line in slip.line_ids:
- name = "[%s] - %s / %s" % (line.code, line.name, slip.employee_id.name)
- amount = line.total
-
- if line.type == 'leaves':
- continue
-
- rec = {
- 'move_id':move_id,
- 'name': name,
- 'date': slip.date,
- 'account_id': line.account_id.id,
- 'debit': 0.0,
- 'credit' : 0.0,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'analytic_account_id':False,
- 'ref':slip.number,
- 'quantity':1
- }
-
- #Setting Analysis Account for Salary Slip Lines
- if line.analytic_account_id:
- rec['analytic_account_id'] = line.analytic_account_id.id
- else:
- rec['analytic_account_id'] = slip.deg_id.account_id.id
-
- if line.type == 'allounce' or line.type == 'otherpay':
- rec['debit'] = amount
- if not partner.property_account_payable:
- raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Payable Account!!'))
- ded_rec = {
- 'move_id':move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': partner.property_account_payable.id,
- 'debit': 0.0,
- 'quantity':1,
- 'credit' : amount,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_rec)]
- elif line.type == 'deduction' or line.type == 'otherdeduct':
- if not partner.property_account_receivable:
- raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Receivable Account!!'))
- rec['credit'] = amount
- total_deduct += amount
- ded_rec = {
- 'move_id':move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'quantity':1,
- 'account_id': partner.property_account_receivable.id,
- 'debit': amount,
- 'credit' : 0.0,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_rec)]
-
- line_ids += [movel_pool.create(cr, uid, rec)]
-
- if line.company_contrib > 0:
- company_contrib = line.company_contrib
-# if line.category_id.amount_type == 'per':
-# company_contrib = (amount * line.category_id.contribute_per)
-
- narration = """Company Contribution of %s Encode same as a Company Expanse @ %s""" % (line.name, company_contrib)
- move = {
- #'name': slip.name,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'ref':slip.number,
- 'narration': narration
- }
- company_contrib_move_id = move_pool.create(cr, uid, move)
- name = "[%s] - %s / %s - Company Contribution" % (line.code, line.name, slip.employee_id.name)
- self.create_voucher(cr, uid, [slip.id], name, company_contrib_move_id)
-
- ded_deb = {
- 'move_id':company_contrib_move_id,
- 'name': name,
- 'date': slip.date,
- 'quantity':1,
- 'account_id': line.category_id.account_id.id,
- 'debit': company_contrib,
- 'credit' : 0.0,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_deb)]
- ded_cre = {
- 'move_id':company_contrib_move_id,
- 'name': name,
- 'date': slip.date,
- 'quantity':1,
- 'account_id': line.category_id.register_id.account_id.id,
- 'debit': 0.0,
- 'credit' : company_contrib,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_cre)]
-
- if line.category_id.include_in_salary:
- narration = """Company Contribution of %s Deducted from Employee %s""" % (line.name, company_contrib)
- move = {
- #'name': slip.name,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'ref':slip.number,
- 'narration': narration
- }
- include_in_salary_move_id = move_pool.create(cr, uid, move)
- self.create_voucher(cr, uid, [slip.id], narration, include_in_salary_move_id)
-
- total_deduct += company_contrib
- ded_deb = {
- 'move_id':include_in_salary_move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'quantity':1,
- 'account_id': partner.property_account_receivable.id,
- 'debit': company_contrib,
- 'credit' : 0.0,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_deb)]
- ded_cre = {
- 'move_id':include_in_salary_move_id,
- 'name': name,
- 'date': slip.date,
- 'quantity':1,
- 'account_id': line.category_id.account_id.id,
- 'debit': 0.0,
- 'credit' : company_contrib,
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_cre)]
-
- #make an entry line to contribution register
- if line.category_id.register_id:
- ctr = {
- 'register_id':line.category_id.register_id.id,
- 'name':line.name,
- 'code':line.code,
- 'employee_id':slip.employee_id.id,
- 'period_id':period_id,
- 'emp_deduction':amount,
- }
- if line.category_id.contribute:
- ctr['comp_deduction'] = amount
-
- company = 0.0
- employee = 0.0
- if line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'per':
- new_amount = (amount * (line.category_id.contribute_per / (1+line.category_id.contribute_per)))
- company = new_amount
- employee = amount - company
-
- elif line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'fix':
- company = line.category_id.contribute_per
- employee = amount - company
-
- elif line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'func':
- company = self.pool.get('hr.allounce.deduction.categoty').execute_function(cr, uid, line.category_id.id, line.slip_id.basic, context)
- employee = amount
-
- elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'per':
- company = amount * line.category_id.contribute_per
- employee = amount
-
- elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'fix':
- company = line.category_id.contribute_per
- employee = amount
-
- elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'func':
- company = self.pool.get('hr.allounce.deduction.categoty').execute_function(cr, uid, line.category_id.id, line.slip_id.basic, context)
- employee = amount
-
- ctr['emp_deduction'] = employee
- ctr['comp_deduction'] = company
-
- self.pool.get('hr.contibution.register.line').create(cr, uid, ctr)
-
- adj_move_id = False
- if total_deduct > 0:
- move = {
- 'journal_id': slip.journal_id.id,
- 'period_id': period_id,
- 'date': slip.date,
- 'ref':slip.number,
- 'narration': 'Adjustment : %s' % (slip.name)
- }
- adj_move_id = move_pool.create(cr, uid, move)
- name = "Adjustment Entry - %s" % (slip.employee_id.name)
- self.create_voucher(cr, uid, [slip.id], name, adj_move_id)
-
- ded_rec = {
- 'move_id':adj_move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': partner.property_account_receivable.id,
- 'debit': 0.0,
- 'quantity':1,
- 'credit' : total_deduct,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, ded_rec)]
- cre_rec = {
- 'move_id':adj_move_id,
- 'name': name,
- 'partner_id': partner_id,
- 'date': slip.date,
- 'account_id': partner.property_account_payable.id,
- 'debit': total_deduct,
- 'quantity':1,
- 'credit' : 0.0,
- 'journal_id' : slip.journal_id.id,
- 'period_id' :period_id,
- 'ref':slip.number
- }
- line_ids += [movel_pool.create(cr, uid, cre_rec)]
-
- rec = {
- 'state':'confirm',
- 'move_line_ids':[(6, 0,line_ids)],
- }
- if not slip.period_id:
- rec['period_id'] = period_id
-
- dates = prev_bounds(slip.date)
- exp_ids = exp_pool.search(cr, uid, [('date_valid','>=',dates[0]), ('date_valid','<=',dates[1]), ('state','=','invoiced')])
- if exp_ids:
- acc = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
- for exp in exp_pool.browse(cr, uid, exp_ids):
- exp_res = {
- 'name':exp.name,
- 'amount_type':'fix',
- 'type':'otherpay',
- 'category_id':exp.category_id.id,
- 'amount':exp.amount,
- 'slip_id':slip.id,
- 'expanse_id':exp.id,
- 'account_id':acc
- }
- self.pool.get('hr.payslip.line').create(cr, uid, exp_res)
-
- self.write(cr, uid, [slip.id], rec)
-
+ self.write(cr, uid, ids, {'state':'confirm'})
return True
def get_contract(self, cr, uid, employee, date, context={}):
+ """
+ Compute leaves for an employee
+
+ @param cr: cursor to database
+ @param uid: id of current user
+ @param employee: object of the hr.employee model
+ @param date: date on which pay slip is creating
+ @param context: context arguments, like lang, time zone
+
+ @return: return a current contract from the list of contract
+ """
+
sql_req= '''
SELECT c.id as id, c.wage as wage, struct_id as function
FROM hr_contract c
@@ -1398,7 +852,6 @@ class hr_payslip(osv.osv):
@param slip: object of the hr.payroll.slip model
@param employee: object of the hr.employee model
@param context: context arguments, like lang, time zone
-
@return: return a result
"""
@@ -1434,12 +887,17 @@ class hr_payslip(osv.osv):
if datetime.date(year, month, day).weekday() == calc_day:
count += 1
return count
-
+
+ basic = 0.0
+ contract = False
for slip in self.browse(cr, uid, ids):
+ basic = 0.0
+
contracts = self.get_contract(cr, uid, slip.employee_id, date, context)
- if contracts.get('id', False) == False:
+ if not contracts or contracts.get('id', False) == False:
continue
+
contract = self.pool.get('hr.contract').browse(cr, uid, contracts.get('id'))
sal_type = contract.wage_type_id.type
@@ -1516,7 +974,7 @@ class hr_payslip(osv.osv):
amt = eval(base, obj)
except Exception, e:
raise osv.except_osv(_('Variable Error !'), _('Variable Error : %s ' % (e)))
-
+
if sal_type in ('gross', 'net'):
if line.amount_type == 'per':
percent = line.amount
@@ -1528,7 +986,10 @@ class hr_payslip(osv.osv):
if value > 0:
percent = 0.0
-
+
+ for cline in line.category_id.contribute_ids:
+ pass
+
elif line.amount_type == 'fix':
value = line.amount
@@ -1536,12 +997,16 @@ class hr_payslip(osv.osv):
value = self.pool.get('hr.payslip.line').execute_function(cr, uid, line.id, amt, context)
line.amount = value
else:
- if line.amount_type in ('fix', 'per'):
- value = line.amount
- elif line.amount_type == 'func':
+ if line.amount_type == 'func':
value = self.pool.get('hr.payslip.line').execute_function(cr, uid, line.id, amt, context)
line.amount = value
-
+
+# for cline in line.category_id.contribute_ids:
+# if cline.amount_type == 'fix':
+# contribute = cline.contribute_per
+# elif cline.amount_type == 'func':
+# contribute = func_pool.execute_function(cr, uid, cline.id, line.amount, context)
+
if line.type == 'allowance':
all_per += percent
all_fix += value
@@ -1557,7 +1022,7 @@ class hr_payslip(osv.osv):
'base':base
}
slip_line_pool.copy(cr, uid, line.id, vals, {})
-
+
if sal_type in ('gross', 'net'):
sal = contract.wage
if sal_type == 'net':
@@ -1589,94 +1054,80 @@ class hr_payslip(osv.osv):
})
self.write(cr, uid, [slip.id], update)
-
- for slip in self.browse(cr, uid, ids):
- basic_before_leaves = basic
+ if contract:
+ for slip in self.browse(cr, uid, ids):
+ basic_before_leaves = basic
- working_day = 0
- off_days = 0
- dates = prev_bounds(slip.date)
-
- days_arr = [0, 1, 2, 3, 4, 5, 6]
- for dy in range(contract.working_days_per_week, 7):
- off_days += get_days(1, dates[1].day, dates[1].month, dates[1].year, days_arr[dy])
-
- total_off = off_days
- working_day = dates[1].day - total_off
- perday = slip.net / working_day
-
- total = 0.0
- leave = 0.0
-
- leave_ids = self._get_leaves(cr, uid, slip, slip.employee_id, context)
-
- total_leave = 0.0
- paid_leave = 0.0
- for hday in holiday_pool.browse(cr, uid, leave_ids):
- res = {
- 'slip_id':slip.id,
- 'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
- 'code':hday.holiday_status_id.code,
- 'amount_type':'fix',
- 'category_id':hday.holiday_status_id.head_id.id,
- 'account_id':hday.holiday_status_id.account_id.id,
- 'analytic_account_id':hday.holiday_status_id.analytic_account_id.id
- }
-
- days = hday.number_of_days
- if hday.number_of_days < 0:
- days = hday.number_of_days * -1
-
- total_leave += days
- if hday.holiday_status_id.type == 'paid':
- paid_leave += days
- continue
+ working_day = 0
+ off_days = 0
+ dates = prev_bounds(slip.date)
- elif hday.holiday_status_id.type == 'halfpaid':
- paid_leave += (days / 2)
- res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
- res['amount'] = perday * (days/2)
- total += perday * (days/2)
- leave += days / 2
- res['type'] = 'deduction'
- else:
- res['name'] = hday.holiday_status_id.name + '-%s' % (days)
- res['amount'] = perday * days
- res['type'] = 'deduction'
- leave += days
- total += perday * days
+ days_arr = [0, 1, 2, 3, 4, 5, 6]
+ for dy in range(contract.working_days_per_week, 7):
+ off_days += get_days(1, dates[1].day, dates[1].month, dates[1].year, days_arr[dy])
- slip_line_pool.create(cr, uid, res)
- basic = basic - total
- leaves = total
+ total_off = off_days
+ working_day = dates[1].day - total_off
+ perday = slip.net / working_day
+
+ total = 0.0
+ leave = 0.0
+
+ leave_ids = self._get_leaves(cr, uid, slip, slip.employee_id, context)
+
+ total_leave = 0.0
+ paid_leave = 0.0
+ for hday in holiday_pool.browse(cr, uid, leave_ids):
+ res = {
+ 'slip_id':slip.id,
+ 'name':hday.holiday_status_id.name + '-%s' % (hday.number_of_days),
+ 'code':hday.holiday_status_id.code,
+ 'amount_type':'fix',
+ 'category_id':hday.holiday_status_id.head_id.id,
+ 'account_id':hday.holiday_status_id.account_id.id,
+ 'analytic_account_id':hday.holiday_status_id.analytic_account_id.id
+ }
+
+ days = hday.number_of_days
+ if hday.number_of_days < 0:
+ days = hday.number_of_days * -1
+
+ total_leave += days
+ if hday.holiday_status_id.type == 'paid':
+ paid_leave += days
+ continue
+
+ elif hday.holiday_status_id.type == 'halfpaid':
+ paid_leave += (days / 2)
+ res['name'] = hday.holiday_status_id.name + '-%s/2' % (days)
+ res['amount'] = perday * (days/2)
+ total += perday * (days/2)
+ leave += days / 2
+ res['type'] = 'deduction'
+ else:
+ res['name'] = hday.holiday_status_id.name + '-%s' % (days)
+ res['amount'] = perday * days
+ res['type'] = 'deduction'
+ leave += days
+ total += perday * days
+
+ slip_line_pool.create(cr, uid, res)
+ basic = basic - total
+ leaves = total
- update.update({
- 'basic_before_leaves': round(basic_before_leaves),
- 'leaves':total,
- 'holiday_days':leave,
- 'worked_days':working_day - leave,
- 'working_days':working_day,
- })
- self.write(cr, uid, [slip.id], update)
-
+ update.update({
+ 'basic_before_leaves': round(basic_before_leaves),
+ 'leaves':total,
+ 'holiday_days':leave,
+ 'worked_days':working_day - leave,
+ 'working_days':working_day,
+ })
+ self.write(cr, uid, [slip.id], update)
+
return True
hr_payslip()
-class account_move_link_slip(osv.osv):
- '''
- Account Move Link to Pay Slip
- '''
- _name = 'hr.payslip.account.move'
- _description = 'Account Move Link to Pay Slip'
- _columns = {
- 'name':fields.char('Name', size=256, required=True, readonly=False),
- 'move_id':fields.many2one('account.move', 'Expanse Entries', required=False, readonly=True),
- 'slip_id':fields.many2one('hr.payslip', 'Pay Slip', required=False),
- 'sequence': fields.integer('Sequence'),
- }
-account_move_link_slip()
-
class line_condition(osv.osv):
'''
Line Condition
@@ -1834,7 +1285,7 @@ class hr_employee(osv.osv):
'esi_account':fields.char('ESI Account', size=64, required=False, readonly=False),
'hospital_id':fields.many2one('res.partner.address', 'ESI Hospital', required=False),
'passport_id':fields.many2one('hr.passport', 'Passport', required=False),
- 'otherid':fields.char('Other Id', size=64, required=False),
+ 'bank_account_id':fields.many2one('res.partner.bank', 'Bank Account', required=False),
'line_ids':fields.one2many('hr.payslip.line', 'employee_id', 'Salary Structure', required=False),
'slip_ids':fields.one2many('hr.payslip', 'employee_id', 'Payslips', required=False, readonly=True),
'property_bank_account': fields.property(
@@ -1847,7 +1298,7 @@ class hr_employee(osv.osv):
help="Select Bank Account from where Salary Expanse will be Paid",
required=True),
'salary_account':fields.property(
- 'account.account',
+ 'account.account',
type='many2one',
relation='account.account',
string="Salary Account",
diff --git a/addons/hr_payroll/hr_payroll_view.xml b/addons/hr_payroll/hr_payroll_view.xml
index 0be3793a234..dcc6087ace5 100644
--- a/addons/hr_payroll/hr_payroll_view.xml
+++ b/addons/hr_payroll/hr_payroll_view.xml
@@ -131,7 +131,7 @@
-
+
@@ -458,23 +458,8 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
@@ -484,12 +469,6 @@
-
-
-
-
-
-
@@ -526,14 +505,22 @@
-
-
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_payroll/hr_payroll_workflow.xml b/addons/hr_payroll/hr_payroll_workflow.xml
index 0e5ccfe091f..f494975a1b1 100644
--- a/addons/hr_payroll/hr_payroll_workflow.xml
+++ b/addons/hr_payroll/hr_payroll_workflow.xml
@@ -28,13 +28,6 @@
function
-
-
- account_check
- account_check_sheet()
- function
-
-
confirm
@@ -66,27 +59,13 @@
- basic>=10000
- verify_sheet
-
-
-
-
-
- verify_twice_sheet
-
-
-
-
-
- basic<10000
verify_sheet
-
+
- final_verify_sheet
+ verify_twice_sheet
@@ -107,12 +86,6 @@
cancel_sheet
-
-
-
- cancel_sheet
-
-
diff --git a/addons/hr_payroll_account/__init__.py b/addons/hr_payroll_account/__init__.py
new file mode 100644
index 00000000000..81979b0ae58
--- /dev/null
+++ b/addons/hr_payroll_account/__init__.py
@@ -0,0 +1,23 @@
+#-*- coding:utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# d$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import hr_payroll_account
diff --git a/addons/hr_payroll_account/__openerp__.py b/addons/hr_payroll_account/__openerp__.py
new file mode 100644
index 00000000000..c3c75f6ec8d
--- /dev/null
+++ b/addons/hr_payroll_account/__openerp__.py
@@ -0,0 +1,47 @@
+#-*- coding:utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# d$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+{
+ 'name': 'Human Resource Payroll Accounting',
+ 'version': '1.0',
+ 'category': 'Generic Modules/Human Resources',
+ 'description': """Generic Payroll system Integrated with Accountings
+ * Expanse Encoding
+ * Payment Encoding
+ * Comany Contribution Managemet
+ """,
+ 'author':'Tiny/Axelor',
+ 'website':'http://www.openerp.com',
+ 'depends': [
+ 'hr_payroll',
+ 'account',
+ ],
+ 'init_xml': [
+ ],
+ 'update_xml': [
+ "hr_payroll_account_view.xml",
+ "hr_payroll_account_workflow.xml"
+ ],
+ 'demo_xml': [
+ ],
+ 'installable': True,
+ 'active': False,
+}
diff --git a/addons/hr_payroll_account/hr_payroll_account.py b/addons/hr_payroll_account/hr_payroll_account.py
new file mode 100644
index 00000000000..72ffaf435ca
--- /dev/null
+++ b/addons/hr_payroll_account/hr_payroll_account.py
@@ -0,0 +1,618 @@
+#-*- coding:utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved
+# d$
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+#
+##############################################################################
+
+import time
+import netsvc
+from osv import osv
+from osv import fields
+from tools import config
+from tools.translate import _
+
+from datetime import date
+from datetime import datetime
+from datetime import timedelta
+
+def prev_bounds(cdate=False):
+ when = date.fromtimestamp(time.mktime(time.strptime(cdate,"%Y-%m-%d")))
+ this_first = date(when.year, when.month, 1)
+ month = when.month + 1
+ year = when.year
+ if month > 12:
+ month = 1
+ year += 1
+ next_month = date(year, month, 1)
+ prev_end = next_month - timedelta(days=1)
+ return this_first, prev_end
+
+class hr_payslip(osv.osv):
+ '''
+ Pay Slip
+ '''
+ _inherit = 'hr.payslip'
+ _description = 'Pay Slip'
+
+ _columns = {
+ 'move_ids':fields.one2many('hr.payslip.account.move', 'slip_id', 'Accounting vouchers', required=False),
+ 'move_line_ids':fields.many2many('account.move.line', 'payslip_lines_rel', 'slip_id', 'line_id', 'Accounting Lines', readonly=True),
+ 'move_payment_ids':fields.many2many('account.move.line', 'payslip_payment_rel', 'slip_id', 'payment_id', 'Payment Lines', readonly=True),
+ 'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')], help="Keep empty to use the period of the validation(Payslip) date."),
+ }
+
+ def create_voucher(self, cr, uid, ids, name, voucher, sequence=5):
+ slip_move = self.pool.get('hr.payslip.account.move')
+ for slip in ids:
+ res = {
+ 'slip_id':slip,
+ 'move_id':voucher,
+ 'sequence':sequence,
+ 'name':name
+ }
+ slip_move.create(cr, uid, res)
+
+ def cancel_sheet(self, cr, uid, ids, context={}):
+ move_pool = self.pool.get('account.move')
+
+ for slip in self.browse(cr, uid, ids, context):
+ if slip.move_id:
+ if slip.move_id.state == 'posted':
+ move_pool.button_cancel(cr, uid [slip.move_id.id], context)
+ move_pool.unlink(cr, uid, [slip.move_id.id])
+
+ if slip.adj_move_id:
+ if slip.adj_move_id.state == 'posted':
+ move_pool.button_cancel(cr, uid [slip.adj_move_id.id], context)
+ move_pool.unlink(cr, uid, [slip.adj_move_id.id])
+
+ if slip.other_move_id:
+ if slip.other_move_id.state == 'posted':
+ move_pool.button_cancel(cr, uid [slip.other_move_id.id], context)
+ move_pool.unlink(cr, uid, [slip.other_move_id.id])
+
+ self.write(cr, uid, ids, {'state':'cancel'})
+ return True
+
+ def process_sheet(self, cr, uid, ids, context={}):
+ move_pool = self.pool.get('account.move')
+ movel_pool = self.pool.get('account.move.line')
+ invoice_pool = self.pool.get('account.invoice')
+
+ for slip in self.browse(cr,uid,ids):
+ line_ids = []
+ partner = False
+ partner_id = False
+ exp_ids = []
+
+ partner = slip.employee_id.bank_account_id.partner_id
+ partner_id = partner.id
+
+ fiscal_year_ids = self.pool.get('account.fiscalyear').search(cr, uid, [])
+ if not fiscal_year_ids:
+ raise osv.except_osv(_('Warning !'), _('Please define fiscal year for perticular contract'))
+ fiscal_year_objs = self.pool.get('account.fiscalyear').read(cr, uid, fiscal_year_ids, ['date_start','date_stop'])
+ year_exist = False
+ for fiscal_year in fiscal_year_objs:
+ if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
+ year_exist = True
+ if not year_exist:
+ raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
+ search_period = self.pool.get('account.period').search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)])
+ if not search_period:
+ raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
+ period_id = search_period[0]
+ name = 'Payment of Salary to %s' % (slip.employee_id.name)
+ move = {
+ 'journal_id': slip.bank_journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'type':'bank_pay_voucher',
+ 'ref':slip.number,
+ 'narration': name
+ }
+ move_id = move_pool.create(cr, uid, move)
+ self.create_voucher(cr, uid, [slip.id], name, move_id)
+
+ name = "To %s account" % (slip.employee_id.name)
+ ded_rec = {
+ 'move_id':move_id,
+ 'name': name,
+ #'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': slip.employee_id.property_bank_account.id,
+ 'debit': 0.0,
+ 'credit' : slip.total_pay,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_rec)]
+ name = "By %s account" % (slip.employee_id.property_bank_account.name)
+ cre_rec = {
+ 'move_id':move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': partner.property_account_payable.id,
+ 'debit': slip.total_pay,
+ 'credit' : 0.0,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, cre_rec)]
+
+ other_pay = slip.other_pay
+ #Process all Reambuse Entries
+ for line in slip.line_ids:
+ if line.type == 'otherpay' and line.expanse_id.invoice_id:
+ if not line.expanse_id.invoice_id.move_id:
+ raise osv.except_osv(_('Warning !'), _('Please Confirm all Expanse Invoice appear for Reimbursement'))
+ invids = [line.expanse_id.invoice_id.id]
+ amount = line.total
+ acc_id = slip.bank_journal_id.default_credit_account_id and slip.bank_journal_id.default_credit_account_id.id
+ period_id = slip.period_id.id
+ journal_id = slip.bank_journal_id.id
+ name = '[%s]-%s' % (slip.number, line.name)
+ invoice_pool.pay_and_reconcile(cr, uid, invids, amount, acc_id, period_id, journal_id, False, period_id, False, context, name)
+ other_pay -= amount
+ #TODO: link this account entries to the Payment Lines also Expanse Entries to Account Lines
+ l_ids = movel_pool.search(cr, uid, [('name','=',name)])
+ line_ids += l_ids
+
+ l_ids = movel_pool.search(cr, uid, [('invoice','=',line.expanse_id.invoice_id.id)])
+ exp_ids += l_ids
+
+ #Process for Other payment if any
+ other_move_id = False
+ if slip.other_pay > 0:
+ narration = 'Payment of Other Payeble amounts to %s' % (slip.employee_id.name)
+ move = {
+ 'journal_id': slip.bank_journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'type':'bank_pay_voucher',
+ 'ref':slip.number,
+ 'narration': narration
+ }
+ other_move_id = move_pool.create(cr, uid, move)
+ self.create_voucher(cr, uid, [slip.id], narration, move_id)
+
+ name = "To %s account" % (slip.employee_id.name)
+ ded_rec = {
+ 'move_id':other_move_id,
+ 'name':name,
+ 'date':slip.date,
+ 'account_id':slip.employee_id.property_bank_account.id,
+ 'debit': 0.0,
+ 'credit': other_pay,
+ 'journal_id':slip.journal_id.id,
+ 'period_id':period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_rec)]
+ name = "By %s account" % (slip.employee_id.property_bank_account.name)
+ cre_rec = {
+ 'move_id':other_move_id,
+ 'name':name,
+ 'partner_id':partner_id,
+ 'date':slip.date,
+ 'account_id':partner.property_account_payable.id,
+ 'debit': other_pay,
+ 'credit':0.0,
+ 'journal_id':slip.journal_id.id,
+ 'period_id':period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, cre_rec)]
+
+ rec = {
+ 'state':'done',
+ 'move_payment_ids':[(6, 0, line_ids)],
+ 'paid':True
+ }
+ self.write(cr, uid, [slip.id], rec)
+ for exp_id in exp_ids:
+ self.write(cr, uid, [slip.id], {'move_line_ids':[(4, exp_id)]})
+
+ return True
+
+ def account_check_sheet(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'accont_check'})
+ return True
+
+ def hr_check_sheet(self, cr, uid, ids, context={}):
+ self.write(cr, uid, ids, {'state':'hr_check'})
+ return True
+
+ def verify_sheet(self, cr, uid, ids, context={}):
+
+ move_pool = self.pool.get('account.move')
+ movel_pool = self.pool.get('account.move.line')
+ exp_pool = self.pool.get('hr.expense.expense')
+
+ for slip in self.browse(cr,uid,ids):
+ total_deduct = 0.0
+
+ line_ids = []
+ partner = False
+ partner_id = False
+
+ if not slip.employee_id.bank_account_id:
+ raise osv.except_osv(_('Integrity Error !'), _('Please defined bank account for %s !' % (slip.employee_id.name)))
+
+ if not slip.employee_id.bank_account_id.partner_id:
+ raise osv.except_osv(_('Integrity Error !'), _('Please defined partner in bank account for %s !' % (slip.employee_id.name)))
+
+ partner = slip.employee_id.bank_account_id.partner_id
+ partner_id = slip.employee_id.bank_account_id.partner_id.id
+
+ period_id = False
+
+ if slip.period_id:
+ period_id = slip.period_id.id
+ else:
+ fiscal_year_ids = self.pool.get('account.fiscalyear').search(cr, uid, [])
+ if not fiscal_year_ids:
+ raise osv.except_osv(_('Warning !'), _('Please define fiscal year for perticular contract'))
+ fiscal_year_objs = self.pool.get('account.fiscalyear').read(cr, uid, fiscal_year_ids, ['date_start','date_stop'])
+ year_exist = False
+ for fiscal_year in fiscal_year_objs:
+ if ((fiscal_year['date_start'] <= slip.date) and (fiscal_year['date_stop'] >= slip.date)):
+ year_exist = True
+ if not year_exist:
+ raise osv.except_osv(_('Warning !'), _('Fiscal Year is not defined for slip date %s'%slip.date))
+ search_period = self.pool.get('account.period').search(cr,uid,[('date_start','<=',slip.date),('date_stop','>=',slip.date)])
+ if not search_period:
+ raise osv.except_osv(_('Warning !'), _('Period is not defined for slip date %s'%slip.date))
+ period_id = search_period[0]
+
+ move = {
+ #'name': slip.name,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'ref':slip.number,
+ 'narration': slip.name
+ }
+ move_id = move_pool.create(cr, uid, move)
+ self.create_voucher(cr, uid, [slip.id], slip.name, move_id)
+
+ line = {
+ 'move_id':move_id,
+ 'name': "By Basic Salary / " + slip.employee_id.name,
+ 'date': slip.date,
+ 'account_id': slip.employee_id.salary_account.id,
+ 'debit': slip.basic,
+ 'credit': 0.0,
+ 'quantity':slip.working_days,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'analytic_account_id': False,
+ 'ref':slip.number
+ }
+
+ #Setting Analysis Account for Basic Salary
+ if slip.employee_id.analytic_account:
+ line['analytic_account_id'] = slip.employee_id.analytic_account.id
+
+ move_line_id = movel_pool.create(cr, uid, line)
+ line_ids += [move_line_id]
+
+ line = {
+ 'move_id':move_id,
+ 'name': "To Basic Paysble Salary / " + slip.employee_id.name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': slip.employee_id.employee_account.id,
+ 'debit': 0.0,
+ 'quantity':slip.working_days,
+ 'credit': slip.basic,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, line)]
+
+ for line in slip.line_ids:
+ name = "[%s] - %s / %s" % (line.code, line.name, slip.employee_id.name)
+ amount = line.total
+
+ if line.type == 'leaves':
+ continue
+
+ rec = {
+ 'move_id':move_id,
+ 'name': name,
+ 'date': slip.date,
+ 'account_id': line.account_id.id,
+ 'debit': 0.0,
+ 'credit' : 0.0,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'analytic_account_id':False,
+ 'ref':slip.number,
+ 'quantity':1
+ }
+
+ #Setting Analysis Account for Salary Slip Lines
+ if line.analytic_account_id:
+ rec['analytic_account_id'] = line.analytic_account_id.id
+ else:
+ rec['analytic_account_id'] = slip.deg_id.account_id.id
+
+ if line.type == 'allounce' or line.type == 'otherpay':
+ rec['debit'] = amount
+ if not partner.property_account_payable:
+ raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Payable Account!!'))
+ ded_rec = {
+ 'move_id':move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': partner.property_account_payable.id,
+ 'debit': 0.0,
+ 'quantity':1,
+ 'credit' : amount,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_rec)]
+ elif line.type == 'deduction' or line.type == 'otherdeduct':
+ if not partner.property_account_receivable:
+ raise osv.except_osv(_('Integrity Error !'), _('Please Configure Partners Receivable Account!!'))
+ rec['credit'] = amount
+ total_deduct += amount
+ ded_rec = {
+ 'move_id':move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'quantity':1,
+ 'account_id': partner.property_account_receivable.id,
+ 'debit': amount,
+ 'credit' : 0.0,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_rec)]
+
+ line_ids += [movel_pool.create(cr, uid, rec)]
+
+ if line.company_contrib > 0:
+ company_contrib = line.company_contrib
+# if line.category_id.amount_type == 'per':
+# company_contrib = (amount * line.category_id.contribute_per)
+
+ narration = """Company Contribution of %s Encode same as a Company Expanse @ %s""" % (line.name, company_contrib)
+ move = {
+ #'name': slip.name,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'ref':slip.number,
+ 'narration': narration
+ }
+ company_contrib_move_id = move_pool.create(cr, uid, move)
+ name = "[%s] - %s / %s - Company Contribution" % (line.code, line.name, slip.employee_id.name)
+ self.create_voucher(cr, uid, [slip.id], name, company_contrib_move_id)
+
+ ded_deb = {
+ 'move_id':company_contrib_move_id,
+ 'name': name,
+ 'date': slip.date,
+ 'quantity':1,
+ 'account_id': line.category_id.account_id.id,
+ 'debit': company_contrib,
+ 'credit' : 0.0,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_deb)]
+ ded_cre = {
+ 'move_id':company_contrib_move_id,
+ 'name': name,
+ 'date': slip.date,
+ 'quantity':1,
+ 'account_id': line.category_id.register_id.account_id.id,
+ 'debit': 0.0,
+ 'credit' : company_contrib,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_cre)]
+
+ if line.category_id.include_in_salary:
+ narration = """Company Contribution of %s Deducted from Employee %s""" % (line.name, company_contrib)
+ move = {
+ #'name': slip.name,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'ref':slip.number,
+ 'narration': narration
+ }
+ include_in_salary_move_id = move_pool.create(cr, uid, move)
+ self.create_voucher(cr, uid, [slip.id], narration, include_in_salary_move_id)
+
+ total_deduct += company_contrib
+ ded_deb = {
+ 'move_id':include_in_salary_move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'quantity':1,
+ 'account_id': partner.property_account_receivable.id,
+ 'debit': company_contrib,
+ 'credit' : 0.0,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_deb)]
+ ded_cre = {
+ 'move_id':include_in_salary_move_id,
+ 'name': name,
+ 'date': slip.date,
+ 'quantity':1,
+ 'account_id': line.category_id.account_id.id,
+ 'debit': 0.0,
+ 'credit' : company_contrib,
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_cre)]
+
+ #make an entry line to contribution register
+# if line.category_id.register_id:
+# ctr = {
+# 'register_id':line.category_id.register_id.id,
+# 'name':line.name,
+# 'code':line.code,
+# 'employee_id':slip.employee_id.id,
+# 'period_id':period_id,
+# 'emp_deduction':amount,
+# }
+# if line.category_id.contribute:
+# ctr['comp_deduction'] = amount
+#
+# company = 0.0
+# employee = 0.0
+# if line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'per':
+# new_amount = (amount * (line.category_id.contribute_per / (1+line.category_id.contribute_per)))
+# company = new_amount
+# employee = amount - company
+#
+# elif line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'fix':
+# company = line.category_id.contribute_per
+# employee = amount - company
+
+# elif line.category_id.contribute and line.category_id.include_in_salary and line.category_id.amount_type == 'func':
+# company = self.pool.get('hr.allounce.deduction.categoty').execute_function(cr, uid, line.category_id.id, line.slip_id.basic, context)
+# employee = amount
+#
+# elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'per':
+# company = amount * line.category_id.contribute_per
+# employee = amount
+#
+# elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'fix':
+# company = line.category_id.contribute_per
+# employee = amount
+
+# elif line.category_id.contribute and not line.category_id.include_in_salary and line.category_id.amount_type == 'func':
+# company = self.pool.get('hr.allounce.deduction.categoty').execute_function(cr, uid, line.category_id.id, line.slip_id.basic, context)
+# employee = amount
+#
+# ctr['emp_deduction'] = employee
+# ctr['comp_deduction'] = company
+#
+# self.pool.get('hr.contibution.register.line').create(cr, uid, ctr)
+
+ adj_move_id = False
+ if total_deduct > 0:
+ move = {
+ 'journal_id': slip.journal_id.id,
+ 'period_id': period_id,
+ 'date': slip.date,
+ 'ref':slip.number,
+ 'narration': 'Adjustment : %s' % (slip.name)
+ }
+ adj_move_id = move_pool.create(cr, uid, move)
+ name = "Adjustment Entry - %s" % (slip.employee_id.name)
+ self.create_voucher(cr, uid, [slip.id], name, adj_move_id)
+
+ ded_rec = {
+ 'move_id':adj_move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': partner.property_account_receivable.id,
+ 'debit': 0.0,
+ 'quantity':1,
+ 'credit' : total_deduct,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, ded_rec)]
+ cre_rec = {
+ 'move_id':adj_move_id,
+ 'name': name,
+ 'partner_id': partner_id,
+ 'date': slip.date,
+ 'account_id': partner.property_account_payable.id,
+ 'debit': total_deduct,
+ 'quantity':1,
+ 'credit' : 0.0,
+ 'journal_id' : slip.journal_id.id,
+ 'period_id' :period_id,
+ 'ref':slip.number
+ }
+ line_ids += [movel_pool.create(cr, uid, cre_rec)]
+
+ rec = {
+ 'state':'confirm',
+ 'move_line_ids':[(6, 0,line_ids)],
+ }
+ if not slip.period_id:
+ rec['period_id'] = period_id
+
+ dates = prev_bounds(slip.date)
+ exp_ids = exp_pool.search(cr, uid, [('date_valid','>=',dates[0]), ('date_valid','<=',dates[1]), ('state','=','invoiced')])
+ if exp_ids:
+ acc = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
+ for exp in exp_pool.browse(cr, uid, exp_ids):
+ exp_res = {
+ 'name':exp.name,
+ 'amount_type':'fix',
+ 'type':'otherpay',
+ 'category_id':exp.category_id.id,
+ 'amount':exp.amount,
+ 'slip_id':slip.id,
+ 'expanse_id':exp.id,
+ 'account_id':acc
+ }
+ self.pool.get('hr.payslip.line').create(cr, uid, exp_res)
+
+ self.write(cr, uid, [slip.id], rec)
+
+ return True
+
+hr_payslip()
+
+class account_move_link_slip(osv.osv):
+ '''
+ Account Move Link to Pay Slip
+ '''
+ _name = 'hr.payslip.account.move'
+ _description = 'Account Move Link to Pay Slip'
+ _columns = {
+ 'name':fields.char('Name', size=256, required=True, readonly=False),
+ 'move_id':fields.many2one('account.move', 'Expanse Entries', required=False, readonly=True),
+ 'slip_id':fields.many2one('hr.payslip', 'Pay Slip', required=False),
+ 'sequence': fields.integer('Sequence'),
+ }
+account_move_link_slip()
+
diff --git a/addons/hr_payroll_account/hr_payroll_account_view.xml b/addons/hr_payroll_account/hr_payroll_account_view.xml
new file mode 100644
index 00000000000..6ef6c812c0b
--- /dev/null
+++ b/addons/hr_payroll_account/hr_payroll_account_view.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+ hr.payslip.form
+ hr.payslip
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ hr.payslip.form
+ hr.payslip
+ form
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/addons/hr_payroll_account/hr_payroll_account_workflow.xml b/addons/hr_payroll_account/hr_payroll_account_workflow.xml
new file mode 100644
index 00000000000..80c9848ee39
--- /dev/null
+++ b/addons/hr_payroll_account/hr_payroll_account_workflow.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ account_check
+ account_check_sheet()
+ function
+
+
+
+
+
+ True
+ verify_sheet
+
+
+
+
+
+ True
+ verify_twice_sheet
+
+
+
+
+
+ final_verify_sheet
+
+
+
+
+
+ cancel_sheet
+
+
+
+
diff --git a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
index 1a110d21151..e619df22683 100644
--- a/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
+++ b/addons/hr_timesheet_invoice/wizard/hr_timesheet_invoice_create.py
@@ -72,7 +72,6 @@ class hr_timesheet_invoice_create(osv.osv_memory):
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
res = mod_obj.read(cr, uid, result, ['res_id'])
data = self.read(cr, uid, ids, [], context)[0]
-
account_ids = data['accounts']
for account in analytic_account_obj.browse(cr, uid, account_ids, context):
partner = account.partner_id
diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
index 94d0e912bcf..2eb352974d7 100644
--- a/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
+++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet.py
@@ -151,16 +151,13 @@ class hr_timesheet_sheet(osv.osv):
raise osv.except_osv(_('Error !'), _('You can not duplicate a timesheet !'))
def button_confirm(self, cr, uid, ids, context=None):
-
if context is None:
context = {}
for sheet in self.browse(cr, uid, ids, context=context):
di = sheet.user_id.company_id.timesheet_max_difference
-
if (abs(sheet.total_difference) < di) or not di:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr)
-
else:
raise osv.except_osv(_('Warning !'), _('Please verify that the total difference of the sheet is lower than %.2f !') %(di,))
return True
diff --git a/addons/point_of_sale/report/report_pos_order.py b/addons/point_of_sale/report/report_pos_order.py
index 082ff3f434e..42b2f3e9efb 100644
--- a/addons/point_of_sale/report/report_pos_order.py
+++ b/addons/point_of_sale/report/report_pos_order.py
@@ -41,13 +41,20 @@ class report_pos_order(osv.osv):
('advance','Advance'),
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced'), ('cancel', 'Cancel')],
'State'),
+ 'state_2': fields.function([('to_verify', 'To Verify'), ('accepted', 'Accepted'),
+ ('refused', 'Refused')], string='State'),
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
'price_total':fields.float('Total Price', readonly=True),
+ 'total_discount':fields.float('Total Discount', readonly=True),
+ 'average_price': fields.float('Average Price', readonly=True,group_operator="avg"),
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'product_qty':fields.float('# of Qty', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal'),
+ 'statement_journal_id': fields.many2one('account.journal','Cash Register'),
+ 'delay_validation': fields.integer('Delay Validation'),
+ 'delay_payment': fields.integer('Delay Payment'),
}
_order = 'date desc'
def init(self, cr):
@@ -63,26 +70,32 @@ class report_pos_order(osv.osv):
to_char(po.date_order, 'YYYY') as year,
to_char(po.date_order, 'MM') as month,
to_char(po.date_order, 'YYYY-MM-DD') as day,
+ (date(po.date_order)-date(po.date_validation)) as delay_validation,
+ (date(po.date_order)-date(po.date_payment)) as delay_payment,
po.partner_id as partner_id,
po.state as state,
+ po.state_2 as state_2,
po.user_id as user_id,
po.shop_id as shop_id,
po.company_id as company_id,
- po.sale_journal as journal_id
+ po.sale_journal as journal_id,
+ aj.id as statement_journal_id
from
- pos_order as po,
+ pos_order as po,account_bank_statement_line absl,account_journal as aj,
( select pl.id as id,
pl.product_id as product_id,
pl.qty as product_qty,
sum(pl.qty * pl.price_unit)- sum(pl.qty * pl.price_ded) as price_total,
+ sum(pl.qty * pl.price_ded) as total_discount,
+ ((sum(pl.qty * pl.price_unit)-sum(pl.qty * pl.price_ded))/sum(pl.qty)*count(pl.qty))::decimal(16,2) as average_price,
pl.order_id
from
pos_order_line as pl
left join product_template pt on (pt.id=pl.product_id)
group by
pl.id,pl.order_id, pl.qty,pl.product_id) el
- where po.id = el.order_id
+ where po.id = el.order_id and absl.pos_statement_id = po.id and aj.name = absl.journal_id
)
""")
diff --git a/addons/point_of_sale/report/report_pos_order_view.xml b/addons/point_of_sale/report/report_pos_order_view.xml
index 3efe9548c70..401ce6f8720 100644
--- a/addons/point_of_sale/report/report_pos_order_view.xml
+++ b/addons/point_of_sale/report/report_pos_order_view.xml
@@ -7,7 +7,7 @@
tree
-
+
@@ -18,10 +18,15 @@
+
+
+
+
+
@@ -45,6 +50,7 @@
separator="1"
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="POS ordered created last 7 days"/>
+
-
+
+
-
@@ -73,14 +79,15 @@
-
+
+
+
+
+
+
-
-
-
-
diff --git a/addons/project_long_term/project_long_term_wizard.xml b/addons/project_long_term/project_long_term_wizard.xml
index fa546b9e86f..ea43762653c 100644
--- a/addons/project_long_term/project_long_term_wizard.xml
+++ b/addons/project_long_term/project_long_term_wizard.xml
@@ -6,7 +6,7 @@
-
+