[MERGE]: Merge with lp:openobject-addons
bzr revid: ysa@tinyerp.co.in-20100422052025-ied35d7m67qg4mmf
This commit is contained in:
@@ -70,6 +70,8 @@ module named account_voucherss
|
||||
'wizard/account_pay_invoice_view.xml',
|
||||
'wizard/account_unreconcile_view.xml',
|
||||
'wizard/account_invoice_state_view.xml',
|
||||
'wizard/account_use_model_view.xml',
|
||||
'wizard/account_partner_balance_report_view.xml',
|
||||
'project/wizard/project_account_analytic_line_view.xml',
|
||||
'account_view.xml',
|
||||
'account_end_fy.xml',
|
||||
|
||||
@@ -1176,7 +1176,7 @@
|
||||
<separator string="Legend" colspan="4"/>
|
||||
<field name="legend" colspan="4" nolabel="1"/>
|
||||
<group col="1" colspan="4">
|
||||
<button name="%(wizard_account_use_model)d" string="Create entries" type="action" icon="gtk-execute"/>
|
||||
<button name="%(action_account_use_model_create_entry)d" string="Create entries" type="action" icon="gtk-execute"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -76,8 +76,8 @@
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_aged_trial_balance" id="menu_aged_trial_balance" parent="next_id_22" type="wizard"/>
|
||||
|
||||
<!-- report-related wizards -->
|
||||
<wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/>
|
||||
<!-- <wizard id="wizard_partner_balance_report" menu="False" model="res.partner" name="account.partner.balance.report" string="Partner Balance"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_partner_balance_report" id="menu_partner_balance" parent="account.next_id_22" type="wizard"/> -->
|
||||
|
||||
<wizard id="wizard_third_party_ledger" menu="False" model="res.partner" name="account.third_party_ledger.report" string="Partner Ledger"/>
|
||||
<menuitem icon="STOCK_PRINT" action="wizard_third_party_ledger" id="menu_third_party_ledger" parent="account.next_id_22" type="wizard"/>
|
||||
@@ -96,10 +96,10 @@
|
||||
<wizard id="wizard_validate_account_moves_line" menu="True" model="account.move.line" name="account.move_line.validate" string="Validate Ledger Postings"/>-->
|
||||
|
||||
<!-- Use Models -->
|
||||
<wizard string="Create Entries From Models" model="account.model" name="account_use_models" menu="False" id="wizard_account_use_model"/>
|
||||
<menuitem action="wizard_account_use_model" type="wizard" parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
<!-- <wizard string="Create Entries From Models" model="account.model" name="account_use_models" menu="False" id="wizard_account_use_model"/>-->
|
||||
<!-- <menuitem action="wizard_account_use_model" type="wizard" parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>-->
|
||||
|
||||
<wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>
|
||||
<!-- <wizard string="Create Entries From Models" model="account.move.line" name="account_use_models" menu="True" id="wizard_line_account_use_model"/>-->
|
||||
|
||||
<!-- account.invoice -->
|
||||
<!-- <wizard string="Open State" model="account.invoice" name="account.wizard_paid_open" menu="False" id="wizard_paid_open" groups="base.group_user"/> -->
|
||||
|
||||
@@ -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-03-24 14:33+0000\n"
|
||||
"Last-Translator: Anders Eriksson (Mobila System) <ae@mobilasystem.se>\n"
|
||||
"PO-Revision-Date: 2010-04-21 15:12+0000\n"
|
||||
"Last-Translator: djn (XCLUDE) <Unknown>\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:08+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: account
|
||||
@@ -26,12 +26,6 @@ msgstr "Internt namn"
|
||||
msgid "Account Tax Code"
|
||||
msgstr "Konto, skattekod"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.actions.act_window,name:account.action_invoice_tree9
|
||||
#: model:ir.ui.menu,name:account.menu_action_invoice_tree9
|
||||
msgid "Unpaid Supplier Invoices"
|
||||
msgstr "Obetalda leverantörsfakturor"
|
||||
|
||||
#. module: account
|
||||
#: model:ir.ui.menu,name:account.menu_finance_entries
|
||||
msgid "Entries Encoding"
|
||||
@@ -1593,7 +1587,7 @@ msgstr "Moms"
|
||||
#. module: account
|
||||
#: rml:account.analytic.account.journal:0
|
||||
msgid "Account n°"
|
||||
msgstr ""
|
||||
msgstr "Konto Nr"
|
||||
|
||||
#. module: account
|
||||
#: view:account.tax:0
|
||||
|
||||
@@ -67,10 +67,10 @@ class partner_balance(report_sxw.rml_parse):
|
||||
## Get All Period Date
|
||||
#
|
||||
# If we have no period we will take all perdio in the FiscalYear.
|
||||
if not data['form']['periods'][0][2] :
|
||||
if not data['form']['periods']:
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['form']['periods'][0][2]
|
||||
periods_id = data['form']['periods']
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
@@ -85,35 +85,38 @@ class partner_balance(report_sxw.rml_parse):
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_both_into_date_array(self,data):
|
||||
if not data['form']['periods'][0][2] :
|
||||
final_date_array = []
|
||||
date_start_date = data['form']['date1']
|
||||
date_stop_date = data['form']['date2']
|
||||
if not data['form']['periods']:
|
||||
periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
else:
|
||||
periods_id = data['form']['periods'][0][2]
|
||||
periods_id = data['form']['periods']
|
||||
date_array = []
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
if periods_id:
|
||||
for period_id in periods_id:
|
||||
period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
|
||||
date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
|
||||
period_start_date = date_array[0]
|
||||
period_stop_date = date_array[-1]
|
||||
|
||||
period_start_date = date_array[0]
|
||||
date_start_date = data['form']['date1']
|
||||
period_stop_date = date_array[-1]
|
||||
date_stop_date = data['form']['date2']
|
||||
if period_start_date<date_start_date:
|
||||
start_date = period_start_date
|
||||
else :
|
||||
start_date = date_start_date
|
||||
|
||||
if period_start_date<date_start_date:
|
||||
start_date = period_start_date
|
||||
if date_stop_date<period_stop_date:
|
||||
stop_date = period_stop_date
|
||||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
final_date_array = final_date_array + self.date_range(start_date,stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
else :
|
||||
start_date = date_start_date
|
||||
|
||||
if date_stop_date<period_stop_date:
|
||||
stop_date = period_stop_date
|
||||
else :
|
||||
stop_date = date_stop_date
|
||||
|
||||
|
||||
final_date_array = []
|
||||
final_date_array = final_date_array + self.date_range(start_date,stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
final_date_array = final_date_array + self.date_range(date_start_date,date_stop_date)
|
||||
self.date_lst = final_date_array
|
||||
self.date_lst.sort()
|
||||
|
||||
def transform_none_into_date_array(self,data):
|
||||
|
||||
|
||||
@@ -33,8 +33,7 @@ import account_subscription_generate
|
||||
import wizard_aged_trial_balance
|
||||
import wizard_general_ledger_report
|
||||
import wizard_third_party_ledger
|
||||
import wizard_account_balance_report
|
||||
import wizard_partner_balance_report
|
||||
import account_partner_balance_report
|
||||
import account_period_close
|
||||
import account_fiscalyear_close
|
||||
import account_fiscalyear_close_state
|
||||
@@ -48,7 +47,7 @@ import account_chart
|
||||
import wizard_move_line_select
|
||||
|
||||
import account_validate_account_move
|
||||
import wizard_use_model
|
||||
import account_use_model
|
||||
|
||||
import account_state_open
|
||||
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
from osv import fields, osv
|
||||
|
||||
class account_partner_balance(osv.osv_memory):
|
||||
"""
|
||||
This wizard will provide the partner balance report by periods, between any two dates.
|
||||
"""
|
||||
_name = 'account.partner.balance'
|
||||
_description = 'Account Partner Balance'
|
||||
_columns = {
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'state': fields.selection([('bydate','By Date'),
|
||||
('byperiod','By Period'),
|
||||
('all','By Date and Period'),
|
||||
('none','No Filter')
|
||||
],'Date/Period Filter'),
|
||||
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal year', help='Keep empty for all open fiscal year'),
|
||||
'periods': fields.many2many('account.period', 'period_report_rel', 'report_id', 'period_id', 'Periods', help='All periods if empty'),
|
||||
'result_selection': fields.selection([('customer','Receivable Accounts'),
|
||||
('supplier','Payable Accounts'),
|
||||
('all','Receivable and Payable Accounts')],
|
||||
'Partner', required=True),
|
||||
'soldeinit': fields.boolean('Include initial balances'),
|
||||
'date1': fields.date('Start date', required=True),
|
||||
'date2': fields.date('End date', required=True),
|
||||
}
|
||||
|
||||
def _get_company(self, cr, uid, ids, context=None):
|
||||
user_obj = self.pool.get('res.users')
|
||||
company_obj = self.pool.get('res.company')
|
||||
user = user_obj.browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
return user.company_id.id
|
||||
else:
|
||||
return company_obj.search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
_defaults={
|
||||
'state' : 'none',
|
||||
'date1' : lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'result_selection' : lambda *a: 'all',
|
||||
'soldeinit' : True,
|
||||
'company_id' : _get_company,
|
||||
'fiscalyear' : False,
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
data = {
|
||||
'ids':[],
|
||||
'model': 'res.partner',
|
||||
'form': self.read(cr, uid, ids, [])[0],
|
||||
}
|
||||
|
||||
if data['form']['state'] == 'bydate' :
|
||||
return self._check_date(cr, uid, data, context)
|
||||
if data['form']['state'] == 'byperiod':
|
||||
if not data['form']['periods']:
|
||||
raise osv.except_osv(_('Warning'),_('Please Enter Periods ! '))
|
||||
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
}
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
|
||||
cr.execute(sql,(data['form']['date1'],))
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
|
||||
raise osv.except_osv(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
|
||||
else:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'account.partner.balance',
|
||||
'datas': data,
|
||||
}
|
||||
else:
|
||||
raise osv.except_osv(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
||||
account_partner_balance()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="account_partner_balance_view" model="ir.ui.view">
|
||||
<field name="name">Select period</field>
|
||||
<field name="model">account.partner.balance</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Date-Period">
|
||||
<field name="company_id"/>
|
||||
<field name="result_selection" required = "True"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
<newline/>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button name="check_state" string="Print" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_partner_balance" model="ir.actions.act_window">
|
||||
<field name="name">Select Period</field>
|
||||
<field name="res_model">account.partner.balance</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="account_partner_balance_view"/>
|
||||
<field name="context">{'record_id':active_id}</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem icon="STOCK_PRINT"
|
||||
name="Partner Balance"
|
||||
action="action_account_partner_balance"
|
||||
id="menu_account_partner_balance_report"
|
||||
parent="account.next_id_22"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,116 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
import datetime
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
|
||||
class account_use_model(osv.osv_memory):
|
||||
|
||||
_name = 'account.use.model'
|
||||
_description = 'Use model'
|
||||
_columns = {
|
||||
'model': fields.many2many('account.model', 'account_use_model_relation','account_id','model_id','Account Model'),
|
||||
}
|
||||
|
||||
def create_entries(self, cr, uid, ids, context=None):
|
||||
account_model_obj = self.pool.get('account.model')
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
data = self.read(cr, uid, ids,context=context)[0]
|
||||
record_id = context and context.get('model_line', False) or False
|
||||
if record_id:
|
||||
data_model = account_model_obj.browse(cr,uid,data['model'])
|
||||
else:
|
||||
data_model = account_model_obj.browse(cr,uid,context['active_ids'])
|
||||
move_ids = []
|
||||
for model in data_model:
|
||||
period_id = account_period_obj.find(cr, uid, context=context)
|
||||
if not period_id:
|
||||
raise osv.except_osv(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
move_id = account_move_obj.create(cr, uid, {
|
||||
'ref': model.ref,
|
||||
'period_id': period_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
})
|
||||
move_ids.append(move_id)
|
||||
for line in model.lines_id:
|
||||
val = {
|
||||
'move_id': move_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
'period_id': period_id
|
||||
}
|
||||
val.update({
|
||||
'name': line.name,
|
||||
'quantity': line.quantity,
|
||||
'debit': line.debit,
|
||||
'credit': line.credit,
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'ref': line.ref,
|
||||
'partner_id': line.partner_id.id,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_maturity': time.strftime('%Y-%m-%d')
|
||||
})
|
||||
c = context.copy()
|
||||
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
|
||||
id_line = account_move_line_obj.create(cr, uid, val, context=c)
|
||||
context.update({'move_ids':move_ids})
|
||||
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_account_use_model_open_entry')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'name': _('Use Model'),
|
||||
'context': context,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'account.use.model',
|
||||
'views': [(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new',
|
||||
}
|
||||
|
||||
def open_moves(self, cr, uid, ids, context=None):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
if context is None:
|
||||
context = {}
|
||||
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_move_form')], context=context)
|
||||
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,context['move_ids']))+"])]",
|
||||
'name': 'Entries',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
account_use_model()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_account_use_model" model="ir.ui.view">
|
||||
<field name="name">account.use.model.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Create Entries From Models">
|
||||
<group colspan="4" >
|
||||
<field name="model"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Create Entries" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_use_model" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'model_line':'model_line'}</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="action_account_use_model_values">
|
||||
<field name="model_id" ref="account.model_account_move_line" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="key2">client_action_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_view_account_use_model'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.move.line</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_view_account_use_model" name="Create Entries From Models"
|
||||
parent="account.menu_finance_recurrent_entries" id="menu_account_use_model"/>
|
||||
|
||||
<record id="view_account_use_model_open_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.open.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Entry Lines Created." colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Ok"/>
|
||||
<button icon="gtk-execute" string="Open" name="open_moves" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_use_model_create_entry" model="ir.ui.view">
|
||||
<field name="name">account.use.model.create.entry.form</field>
|
||||
<field name="model">account.use.model</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Use Model">
|
||||
<group colspan="4" col="6">
|
||||
<label string = "Are you sure you want to create entries?" colspan="2"/>
|
||||
<newline/>
|
||||
<button icon="gtk-ok" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="create_entries" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_account_use_model_create_entry" model="ir.actions.act_window">
|
||||
<field name="name">Create Entries From Models</field>
|
||||
<field name="res_model">account.use.model</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_use_model_create_entry"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,127 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import wizard
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
period_form = '''<?xml version="1.0"?>
|
||||
<form string="Select Date-Period">
|
||||
<field name="company_id"/>
|
||||
<field name="result_selection"/>
|
||||
<newline/>
|
||||
<field name="fiscalyear"/>
|
||||
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
|
||||
<newline/>
|
||||
<separator string="Filters" colspan="4"/>
|
||||
<field name="state" required="True"/>
|
||||
<newline/>
|
||||
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
|
||||
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
|
||||
<separator string="Date Filter" colspan="4"/>
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
|
||||
<separator string="Filter on Periods" colspan="4"/>
|
||||
<field name="periods" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
</group>
|
||||
</form>'''
|
||||
|
||||
period_fields = {
|
||||
'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
|
||||
'state':{
|
||||
'string':"Date/Period Filter",
|
||||
'type':'selection',
|
||||
'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
|
||||
'default': lambda *a:'none'
|
||||
},
|
||||
'fiscalyear': {
|
||||
'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
|
||||
'default': lambda *a:False,
|
||||
'help': 'Keep empty for all open fiscal year'
|
||||
},
|
||||
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||
'result_selection':{
|
||||
'string':"Partner",
|
||||
'type':'selection',
|
||||
'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
|
||||
'required':True
|
||||
},
|
||||
'soldeinit':{'string':"Include initial balances",'type':'boolean'},
|
||||
'date1': {'string':' Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
|
||||
def _get_defaults(self,cr,uid,data,context):
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
|
||||
if user.company_id:
|
||||
company_id = user.company_id.id
|
||||
else:
|
||||
company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
|
||||
|
||||
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||
periods_obj=pooler.get_pool(cr.dbname).get('account.period')
|
||||
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||
data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
|
||||
data['form']['company_id'] = company_id
|
||||
data['form']['soldeinit'] = True
|
||||
data['form']['fiscalyear'] = False
|
||||
data['form']['result_selection'] = 'all'
|
||||
return data['form']
|
||||
|
||||
def _check_state(self, cr, uid, data, context):
|
||||
|
||||
if data['form']['state'] == 'bydate' :
|
||||
self._check_date(cr, uid, data, context)
|
||||
return data['form']
|
||||
|
||||
def _check_date(self, cr, uid, data, context):
|
||||
sql = """
|
||||
SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where %s between f.date_start and f.date_stop """
|
||||
cr.execute(sql,(data['form']['date1'],))
|
||||
res = cr.dictfetchall()
|
||||
if res:
|
||||
if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
|
||||
raise wizard.except_wizard(_('UserError'),_('Date to must be set between %s and %s') % (str(res[0]['date_start']), str(res[0]['date_stop'])))
|
||||
else:
|
||||
return 'report'
|
||||
|
||||
else:
|
||||
raise wizard.except_wizard(_('UserError'),_('Date not in a defined fiscal year'))
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [_get_defaults],
|
||||
'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel','gtk-cancel'),('report','Print','gtk-print')]}
|
||||
},
|
||||
|
||||
'report': {
|
||||
'actions': [_check_state],
|
||||
'result': {'type':'print', 'report':'account.partner.balance', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('account.partner.balance.report')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,131 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import datetime
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
model_form = """<?xml version="1.0"?>
|
||||
<form string="Create entries from models">
|
||||
<field name="model"/>
|
||||
</form>"""
|
||||
|
||||
model_fields = {
|
||||
'model': {'string': 'Account Model', 'type': 'many2many', 'relation': 'account.model', 'required': True},
|
||||
}
|
||||
|
||||
form = """<?xml version="1.0"?>
|
||||
<form string="Use Model">
|
||||
<label string="Entry Lines Created."/>
|
||||
</form>
|
||||
"""
|
||||
fields = {
|
||||
}
|
||||
def _create_entries(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
|
||||
model_ids = data['form']['model'][0][2]
|
||||
data_model = pool_obj.get('account.model').browse(cr,uid,model_ids)
|
||||
else:
|
||||
data_model = pool_obj.get('account.model').browse(cr,uid,data['ids'])
|
||||
move_ids = []
|
||||
for model in data_model:
|
||||
|
||||
period_id = pool_obj.get('account.period').find(cr,uid, context=context)
|
||||
if not period_id:
|
||||
raise wizard.except_wizard(_('No period found !'), _('Unable to find a valid period !'))
|
||||
period_id = period_id[0]
|
||||
move_id = pool_obj.get('account.move').create(cr, uid, {
|
||||
'ref': model.ref,
|
||||
'period_id': period_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
})
|
||||
move_ids.append(move_id)
|
||||
for line in model.lines_id:
|
||||
val = {
|
||||
'move_id': move_id,
|
||||
'journal_id': model.journal_id.id,
|
||||
'period_id': period_id
|
||||
}
|
||||
val.update({
|
||||
'name': line.name,
|
||||
'quantity': line.quantity,
|
||||
'debit': line.debit,
|
||||
'credit': line.credit,
|
||||
'account_id': line.account_id.id,
|
||||
'move_id': move_id,
|
||||
'ref': line.ref,
|
||||
'partner_id': line.partner_id.id,
|
||||
'date': time.strftime('%Y-%m-%d'),
|
||||
'date_maturity': time.strftime('%Y-%m-%d')
|
||||
})
|
||||
c = context.copy()
|
||||
c.update({'journal_id': model.journal_id.id,'period_id': period_id})
|
||||
id_line = pool_obj.get('account.move.line').create(cr, uid, val, context=c)
|
||||
data['form']['move_ids']=move_ids
|
||||
return data['form']
|
||||
|
||||
class use_model(wizard.interface):
|
||||
|
||||
def _open_moves(self, cr, uid, data, context):
|
||||
pool_obj = pooler.get_pool(cr.dbname)
|
||||
model_data_ids = pool_obj.get('ir.model.data').search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_move_form')])
|
||||
resource_id = pool_obj.get('ir.model.data').read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'domain': "[('id','in', ["+','.join(map(str,data['form']['move_ids']))+"])]",
|
||||
'name': 'Entries',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'account.move',
|
||||
'views': [(False,'tree'),(resource_id,'form')],
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
if data['model']=='ir.ui.menu' or data['model']=='account.move.line':
|
||||
return 'init_form'
|
||||
return 'create'
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'choice','next_state':_check}
|
||||
},
|
||||
'init_form': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':model_form, 'fields':model_fields, 'state':[('end','Cancel', 'gtk-cancel'),('create','Create', 'gtk-ok')]},
|
||||
},
|
||||
'create': {
|
||||
'actions': [_create_entries],
|
||||
'result': {'type': 'form','arch':form, 'fields':fields, 'state':[('end','Ok'),('open_move','Open')]},
|
||||
},
|
||||
'open_move': {
|
||||
'actions': [],
|
||||
'result': {'type':'action', 'action':_open_moves, 'state':'end'}
|
||||
}
|
||||
}
|
||||
|
||||
use_model("account_use_models")# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -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-03-09 21:10+0000\n"
|
||||
"Last-Translator: Anders Eriksson (Mobila System) <ae@mobilasystem.se>\n"
|
||||
"PO-Revision-Date: 2010-04-21 15:10+0000\n"
|
||||
"Last-Translator: djn (XCLUDE) <Unknown>\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:16+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-22 03:43+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: hr
|
||||
@@ -189,7 +189,7 @@ msgstr "Medlemmar"
|
||||
#. module: hr
|
||||
#: field:hr.employee,ssnid:0
|
||||
msgid "SSN No"
|
||||
msgstr ""
|
||||
msgstr "Personnummer"
|
||||
|
||||
#. module: hr
|
||||
#: model:process.transition,note:hr.process_transition_contactofemployee0
|
||||
@@ -315,7 +315,7 @@ msgstr "Aktiv"
|
||||
#. module: hr
|
||||
#: constraint:hr.employee:0
|
||||
msgid "Error ! You cannot create recursive Hierarchy of Employees."
|
||||
msgstr ""
|
||||
msgstr "Fel! Du kan inte skapa omvänd rangordning av anställda."
|
||||
|
||||
#. module: hr
|
||||
#: model:process.process,name:hr.process_process_employeecontractprocess0
|
||||
|
||||
@@ -46,7 +46,8 @@ to set up a management by affair.
|
||||
'hr_timesheet_wizard.xml',
|
||||
'process/hr_timesheet_process.xml',
|
||||
'wizard/hr_timesheet_print_employee_view.xml',
|
||||
'wizard/hr_timesheet_print_users_view.xml'
|
||||
'wizard/hr_timesheet_print_users_view.xml',
|
||||
'wizard/hr_timesheet_sign_in_out_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data><!--
|
||||
<wizard id="si_so" name="hr_timesheet.si_so" string="Sign in / Sign out by project"/>
|
||||
<menuitem action="si_so" id="menu_si_so" parent="hr_attendance.menu_hr_time_tracking" type="wizard"/>
|
||||
|
||||
-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sign_in_out
|
||||
import hr_timesheet_sign_in_out
|
||||
import hr_timesheet_print_employee
|
||||
import hr_timesheet_print_users
|
||||
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class hr_so_project(osv.osv_memory):
|
||||
_name = 'hr.sign.out.project'
|
||||
_description = 'Sign Out By Project'
|
||||
_columns = {
|
||||
'account_id': fields.many2one('account.analytic.account', 'Analytic Account', required=True, domain=[('type','=','normal')]),
|
||||
'info': fields.char('Work Description', size=256, required=True),
|
||||
'date_start': fields.datetime('Starting Date', readonly=True),
|
||||
'date': fields.datetime('Closing Date'),
|
||||
'analytic_amount': fields.float('Minimum Analytic Amount'),
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=256, required=False),
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, context):
|
||||
res = self._get_empid(cr, uid, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
return res
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_so_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid2(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context=None):
|
||||
timesheet_obj = self.pool.get('hr.analytic.timesheet')
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise osv.except_osv(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['info']
|
||||
res['account_id'] = data['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context=context)
|
||||
|
||||
def sign_out_result_end(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
def sign_out_result(self, cr, uid, ids, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [])[0]
|
||||
emp_id = data['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action', dt=data['date'])
|
||||
self._write(cr, uid, data, emp_id, context=context)
|
||||
return {}
|
||||
|
||||
hr_so_project()
|
||||
|
||||
class hr_si_project(osv.osv_memory):
|
||||
_name = 'hr.sign.in.project'
|
||||
_description = 'Sign In By Project'
|
||||
_columns = {
|
||||
'name': fields.char('Employees name', size=32, required=True, readonly=True),
|
||||
'state': fields.char('Current state', size=32, required=True, readonly=True),
|
||||
'date': fields.datetime('Starting Date'),
|
||||
'server_date': fields.datetime('Current Date', required=True, readonly=True),
|
||||
'emp_id': fields.char('Employee ID', size=512, required=False),
|
||||
}
|
||||
|
||||
def check_state(self, cr, uid, ids, context=None):
|
||||
obj_model = self.pool.get('ir.model.data')
|
||||
emp_id = self._get_empid(cr, uid, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
if res == 'sign_out':
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_in')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.in.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
else:
|
||||
model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'),('name','=','view_hr_timesheet_sign_out')])
|
||||
resource_id = obj_model.read(cr,uid,model_data_ids,fields=['res_id'])[0]['res_id']
|
||||
return {
|
||||
'name': 'Sign in / Sign out',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'tree,form',
|
||||
'res_model': 'hr.sign.out.project',
|
||||
'views': [(False,'tree'), (resource_id,'form')],
|
||||
'type': 'ir.actions.act_window',
|
||||
'target': 'new'
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, context=None):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise osv.except_osv(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def sign_in_result(self, cr, uid, ids, context):
|
||||
emp_obj = self.pool.get('hr.employee')
|
||||
data = self.read(cr, uid, ids, [], context)[0]
|
||||
emp_id = data['emp_id']
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['date'] or False)
|
||||
except except_osv, e:
|
||||
raise osv.except_osv(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields_list, context=None):
|
||||
res = super(hr_si_project, self).default_get(cr, uid, fields_list, context=context)
|
||||
res.update(self._get_empid(cr, uid, context=context))
|
||||
return res
|
||||
|
||||
hr_si_project()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,95 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_hr_timesheet_sign_in_message" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.message.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="This Wizard will make Sign In/Out By Project" colspan="4"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Sign in / Sign out" name="check_state" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_hr_timesheet_sign_in" model="ir.ui.view">
|
||||
<field name="name">hr.sign.in.project.form</field>
|
||||
<field name="model">hr.sign.in.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Start Working" name="sign_in_result" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_in" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.in.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_in_message"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_hr_timesheet_sign_in"
|
||||
id="menu_hr_timesheet_sign_in"
|
||||
parent="hr_attendance.menu_hr_time_tracking"
|
||||
/>
|
||||
|
||||
<record id="view_hr_timesheet_sign_out" model="ir.ui.view">
|
||||
<field name="name">hr.sign.out.project.form</field>
|
||||
<field name="model">hr.sign.out.project</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Sign In/Out By Project">
|
||||
<group colspan="4" >
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/> </group>
|
||||
<group colspan="4" col="6">
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-ok" string="Change Work" name="sign_out_result" type="object"/>
|
||||
<button icon="gtk-ok" string="Stop Working" name="sign_out_result_end" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sign_out" model="ir.actions.act_window">
|
||||
<field name="name">Sign in / Sign out by project</field>
|
||||
<field name="res_model">hr.sign.out.project</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_hr_timesheet_sign_out"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,174 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import wizard
|
||||
import time
|
||||
import pooler
|
||||
from tools.translate import _
|
||||
|
||||
si_form ='''<?xml version="1.0"?>
|
||||
<form string="Sign in / Sign out">
|
||||
<separator string="Sign in" colspan="4"/>
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="server_date"/>
|
||||
<label string="(local time on the server side)" colspan="2"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current time)" colspan="2"/>
|
||||
</form>'''
|
||||
|
||||
si_fields = {
|
||||
'name': {'string': "Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string': "Current state", 'type' : 'char', 'required' : True, 'readonly': True},
|
||||
'date': {'string':"Starting Date", 'type':'datetime'},
|
||||
'server_date': {'string':"Current Date", 'type':'datetime', 'readonly':True},
|
||||
}
|
||||
|
||||
so_form = '''<?xml version="1.0" ?>
|
||||
<form string="Sign in status">
|
||||
<separator string="General Information" colspan="4" />
|
||||
<field name="name" readonly="True" />
|
||||
<field name="state" readonly="True" />
|
||||
<field name="date_start"/>
|
||||
<field name="server_date"/>
|
||||
<separator string="Work done in the last period" colspan="4" />
|
||||
<field name="account_id" colspan="3"/>
|
||||
<field name="info" colspan="3"/>
|
||||
<field name="date"/>
|
||||
<label string="(Keep empty for current_time)" colspan="2"/>
|
||||
<field name="analytic_amount"/>
|
||||
</form>'''
|
||||
|
||||
so_fields = {
|
||||
'name': {'string':"Employee's name", 'type':'char', 'required':True, 'readonly':True},
|
||||
'state': {'string':"Current state", 'type':'char', 'required':True, 'readonly':True},
|
||||
'account_id': {'string':"Analytic Account", 'type':'many2one', 'relation':'account.analytic.account', 'required':True, 'domain':"[('type','=','normal')]"},
|
||||
'info': {'string':"Work Description", 'type':'char', 'size':256, 'required':True},
|
||||
'date': {'string':"Closing Date", 'type':'datetime'},
|
||||
'date_start': {'string':"Starting Date", 'type':'datetime', 'readonly':True},
|
||||
'server_date': {'string':"Current Server Date", 'type':'datetime', 'readonly':True},
|
||||
'analytic_amount': {'string':"Minimum Analytic Amount", 'type':'float'},
|
||||
}
|
||||
|
||||
def _get_empid(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = emp_obj.search(cr, uid, [('user_id', '=', uid)])
|
||||
if emp_id:
|
||||
employee = emp_obj.read(cr, uid, emp_id)[0]
|
||||
return {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0], 'date':False, 'server_date':time.strftime('%Y-%m-%d %H:%M:%S')}
|
||||
raise wizard.except_wizard(_('UserError'), _('No employee defined for your user !'))
|
||||
|
||||
def _get_empid2(self, cr, uid, data, context):
|
||||
res = _get_empid(self,cr, uid, data, context)
|
||||
cr.execute('select name,action from hr_attendance where employee_id=%s order by name desc limit 1', (res['emp_id'],))
|
||||
res['server_date'] = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
res['date_start'] = cr.fetchone()[0]
|
||||
res['info'] = ''
|
||||
res['account_id'] = False
|
||||
return res
|
||||
|
||||
def _sign_in_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
from osv.osv import except_osv
|
||||
try:
|
||||
success = emp_obj.attendance_action_change(cr, uid, [emp_id], type = 'sign_in' ,dt=data['form']['date'] or False)
|
||||
except except_osv, e:
|
||||
raise wizard.except_wizard(e.name, e.value)
|
||||
return {}
|
||||
|
||||
def _write(self, cr, uid, data, emp_id, context):
|
||||
timesheet_obj = pooler.get_pool(cr.dbname).get('hr.analytic.timesheet')
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
hour = (time.mktime(time.strptime(data['form']['date'] or time.strftime('%Y-%m-%d %H:%M:%S'), '%Y-%m-%d %H:%M:%S')) -
|
||||
time.mktime(time.strptime(data['form']['date_start'], '%Y-%m-%d %H:%M:%S'))) / 3600.0
|
||||
minimum = data['form']['analytic_amount']
|
||||
if minimum:
|
||||
hour = round(round((hour + minimum / 2) / minimum) * minimum, 2)
|
||||
res = timesheet_obj.default_get(cr, uid, ['product_id','product_uom_id'])
|
||||
if not res['product_uom_id']:
|
||||
raise wizard.except_wizard(_('UserError'), _('No cost unit defined for this employee !'))
|
||||
up = timesheet_obj.on_change_unit_amount(cr, uid, False, res['product_id'], hour, res['product_uom_id'])['value']
|
||||
res['name'] = data['form']['info']
|
||||
res['account_id'] = data['form']['account_id']
|
||||
res['unit_amount'] = hour
|
||||
emp_journal = emp_obj.browse(cr, uid, emp_id, context).journal_id
|
||||
res['journal_id'] = emp_journal and emp_journal.id or False
|
||||
res.update(up)
|
||||
up = timesheet_obj.on_change_account_id(cr, uid, [], res['account_id']).get('value', {})
|
||||
res.update(up)
|
||||
return timesheet_obj.create(cr, uid, res, context)
|
||||
|
||||
def _sign_out_result_end(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='sign_out',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _sign_out_result(self, cr, uid, data, context):
|
||||
emp_obj = pooler.get_pool(cr.dbname).get('hr.employee')
|
||||
emp_id = data['form']['emp_id']
|
||||
emp_obj.attendance_action_change(cr, uid, [emp_id], type='action',dt=data['form']['date'])
|
||||
_write(self, cr, uid, data, emp_id, context)
|
||||
return {}
|
||||
|
||||
def _state_check(self, cr, uid, data, context):
|
||||
emp_id = _get_empid(self, cr, uid, data, context)['emp_id']
|
||||
# get the latest action (sign_in or out) for this employee
|
||||
cr.execute('select action from hr_attendance where employee_id=%s and action in (\'sign_in\',\'sign_out\') order by name desc limit 1', (emp_id,))
|
||||
res = (cr.fetchone() or ('sign_out',))[0]
|
||||
#TODO: invert sign_in et sign_out
|
||||
return res
|
||||
|
||||
class wiz_si_so(wizard.interface):
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type' : 'choice', 'next_state': _state_check}
|
||||
},
|
||||
'sign_out' : { # this means sign_in...
|
||||
'actions' : [_get_empid],
|
||||
'result' : {'type':'form', 'arch':si_form, 'fields' : si_fields, 'state':[('end', 'Cancel'),('si_result', 'Start Working') ] }
|
||||
},
|
||||
'si_result' : {
|
||||
'actions' : [_sign_in_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'sign_in' : { # this means sign_out...
|
||||
'actions' : [_get_empid2],
|
||||
'result' : {'type':'form', 'arch':so_form, 'fields':so_fields, 'state':[('end', 'Cancel'),('so_result', 'Change Work'),('so_result_end', 'Stop Working') ] }
|
||||
},
|
||||
'so_result' : {
|
||||
'actions' : [_sign_out_result],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
'so_result_end' : {
|
||||
'actions' : [_sign_out_result_end],
|
||||
'result' : {'type':'state', 'state':'end'}
|
||||
},
|
||||
}
|
||||
wiz_si_so('hr_timesheet.si_so')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -39,6 +39,7 @@ reports, eso.""",
|
||||
'hr_timesheet_invoice_report.xml',
|
||||
'report/report_analytic_view.xml',
|
||||
'report/hr_timesheet_invoice_report_view.xml',
|
||||
'wizard/hr_timesheet_invoice_analytic_cost_ledger_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_invoice_demo.xml'],
|
||||
'installable': True,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
sequence="2" />
|
||||
<report auto="False" id="account_analytic_account_cost_ledger" menu="False" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger" rml="account/project/report/cost_ledger.rml" string="Cost Ledger"/>
|
||||
|
||||
<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report" string="Cost Ledger"/>
|
||||
<!--<wizard id="account_analytic_account_cost_ledger_report" keyword="client_print_multi" model="account.analytic.account" name="hr.timesheet.invoice.account.analytic.account.cost_ledger.report" string="Cost Ledger"/>-->
|
||||
|
||||
<report
|
||||
auto="False"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,14 +15,14 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import hr_timesheet_invoice_create
|
||||
import account_analytic_profit
|
||||
import hr_timesheet_final_invoice_create
|
||||
import wizard_account_analytic_cost_ledger_report
|
||||
import hr_timesheet_analytic_cost_ledger_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class hr_timesheet_analytic_cost_ledger(osv.osv_memory):
|
||||
_name = 'hr.timesheet.analytic.cost.ledger'
|
||||
_description = 'hr.timesheet.analytic.cost.ledger'
|
||||
_columns = {
|
||||
'date1': fields.date('Start of period', required=True),
|
||||
'date2': fields.date('End of period', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'date1': lambda *a: time.strftime('%Y-01-01'),
|
||||
'date2': lambda *a: time.strftime('%Y-%m-%d')
|
||||
}
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
datas = {
|
||||
'ids': 'active_ids' in context and context['active_ids'] or [],
|
||||
'model': 'account.analytic.account',
|
||||
'form': self.read(cr, uid, ids)[0]
|
||||
}
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'hr.timesheet.invoice.account.analytic.account.cost_ledger',
|
||||
'datas': datas,
|
||||
}
|
||||
|
||||
hr_timesheet_analytic_cost_ledger()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,44 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_hr_timesheet_invoice_cost_ledger" model="ir.ui.view">
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="model">hr.timesheet.analytic.cost.ledger</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Period">
|
||||
<group col="4" colspan="6">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</group>
|
||||
<separator colspan="4"/>
|
||||
<group col="2" colspan="4">
|
||||
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
|
||||
<button name="print_report" string="Print" colspan="1" type="object" icon="gtk-print"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_invoice_cost_ledger" model="ir.actions.act_window">
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr.timesheet.analytic.cost.ledger</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.values" id="hr_timesheet_invoice_cost_ledger_values">
|
||||
<field name="model_id" ref="model_account_analytic_account" />
|
||||
<field name="object" eval="1" />
|
||||
<field name="name">Cost Ledger</field>
|
||||
<field name="key2">client_print_multi</field>
|
||||
<field name="value" eval="'ir.actions.act_window,' + str(ref('action_hr_timesheet_invoice_cost_ledger'))" />
|
||||
<field name="key">action</field>
|
||||
<field name="model">account.analytic.account</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,52 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import wizard
|
||||
|
||||
dates_form = '''<?xml version="1.0"?>
|
||||
<form string="Select period">
|
||||
<field name="date1"/>
|
||||
<field name="date2"/>
|
||||
</form>'''
|
||||
|
||||
dates_fields = {
|
||||
'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||
'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||
}
|
||||
|
||||
class wizard_report(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||
},
|
||||
'report': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'hr.timesheet.invoice.account.analytic.account.cost_ledger', 'state':'end'}
|
||||
}
|
||||
}
|
||||
wizard_report('hr.timesheet.invoice.account.analytic.account.cost_ledger.report')
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -84,7 +84,7 @@ class project_issue(osv.osv):
|
||||
resource_id = False
|
||||
if issue.user_id:
|
||||
resource_ids = res_obj.search(cr, uid, [('user_id','=',issue.user_id.id)])
|
||||
resource_id = len(resource_ids) or resource_ids[0]
|
||||
resource_id = len(resource_ids) and resource_ids[0] or False
|
||||
|
||||
duration = float(ans.days)
|
||||
if issue.section_id.resource_calendar_id:
|
||||
|
||||
@@ -17,12 +17,12 @@
|
||||
|
||||
|
||||
<!--Inventory control-->
|
||||
<menuitem id="menu_procurement_management_nventory" name="Inventory Control"
|
||||
<menuitem id="menu_procurement_management_inventory" name="Inventory Control"
|
||||
parent="base.menu_purchase_root" sequence="4"/>
|
||||
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_nventory"
|
||||
<menuitem action="stock.action_picking_tree4" id="menu_action_picking_tree4" parent="menu_procurement_management_inventory"
|
||||
name="Incoming Shipments" sequence="9"/>
|
||||
<menuitem action="stock.action_reception_picking_move" id="menu_action_reception_picking_move"
|
||||
name="Incoming Products" parent="menu_procurement_management_nventory" sequence="10"/>
|
||||
name="Incoming Products" parent="menu_procurement_management_inventory" sequence="10"/>
|
||||
|
||||
<!--Invoice control-->
|
||||
<menuitem id="menu_procurement_management_invoice" name="Invoice Control"
|
||||
@@ -300,28 +300,9 @@
|
||||
<field name="model">purchase.order</field>
|
||||
</record>
|
||||
-->
|
||||
<record id="purchase_line_form_action" model="ir.actions.act_window">
|
||||
<field name="name">Purchase Order Lines</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_tree" model="ir.actions.act_window.view">
|
||||
<field eval="1" name="sequence"/>
|
||||
<field name="view_mode">tree</field>
|
||||
<field name="view_id" ref="purchase_order_line_tree"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action"/>
|
||||
</record>
|
||||
<record id="purchase_line_form_action_form" model="ir.actions.act_window.view">
|
||||
<field eval="2" name="sequence"/>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action"/>
|
||||
</record>
|
||||
<menuitem action="purchase_line_form_action" id="menu_purchase_line_form_action" parent="base.menu_purchase_root"/>
|
||||
|
||||
<record id="purchase_line_form_action2" model="ir.actions.act_window">
|
||||
<field name="name">Uninvoiced Purchase Order Lines</field>
|
||||
<field name="name">Lines To Invoices</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">purchase.order.line</field>
|
||||
<field name="domain">[('state','in',('confirmed','done')), ('invoiced','=',False)]</field>
|
||||
@@ -340,7 +321,7 @@
|
||||
<field name="view_id" ref="purchase_order_line_form"/>
|
||||
<field name="act_window_id" ref="purchase_line_form_action2"/>
|
||||
</record>
|
||||
<menuitem action="purchase_line_form_action2" id="menu_purchase_line_order_draft" parent="menu_purchase_line_form_action"/>
|
||||
<menuitem action="purchase_line_form_action2" id="menu_purchase_line_order_draft" parent="menu_procurement_management_invoice"/>
|
||||
|
||||
|
||||
</data>
|
||||
|
||||
@@ -8,16 +8,21 @@
|
||||
<field name="inherit_id" ref="base.res_config_installer"/>
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Purchase Modules Installation</attribute>
|
||||
</form>
|
||||
<xpath expr="//label[@string='description']"
|
||||
position="attributes">
|
||||
<attribute name="string"> This module allows you to manage your Purchase Requisition.</attribute>
|
||||
</xpath>
|
||||
<separator string="title" position="replace"/>
|
||||
<form position="attributes">
|
||||
<attribute name="string">Purchase Modules Installation</attribute>
|
||||
</form>
|
||||
|
||||
<separator string="title" position="attributes">
|
||||
<attribute name="string"
|
||||
>Configure Your Purchase System</attribute>
|
||||
</separator>
|
||||
<xpath expr="//label[@string='description']"
|
||||
position="attributes">
|
||||
<attribute name="string">After having installed the core purchase application, you can extend it with more modules on needs of your organization</attribute>
|
||||
</xpath>
|
||||
|
||||
<group colspan="8">
|
||||
<separator string="Purchase Requisition" colspan="4"/>
|
||||
<separator string="Purchase Application" colspan="4"/>
|
||||
<field name="purchase_requisition"/>
|
||||
</group>
|
||||
</data>
|
||||
|
||||
@@ -39,24 +39,18 @@ class purchase_requisition(osv.osv):
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'purchase_ids' : fields.one2many('purchase.order','requisition_id','Purchase Orders'),
|
||||
'line_ids' : fields.one2many('purchase.requisition.line','requisition_id','Products to Purchase'),
|
||||
'state': fields.selection([('draft','Draft'),('open','Open'),('cancel','Cancelled'),('close','Close'),('done','Done')], 'State', required=True)
|
||||
'state': fields.selection([('draft','Draft'),('in_progress','In Progress'),('cancel','Cancelled'),('done','Done')], 'State', required=True)
|
||||
}
|
||||
_defaults = {
|
||||
'date_start': lambda *args: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'state': lambda *args: 'open',
|
||||
'state': lambda *args: 'draft',
|
||||
'exclusive': lambda *args: 'multiple',
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
|
||||
'user_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).id ,
|
||||
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'purchase.order.requisition'),
|
||||
}
|
||||
|
||||
def tender_close(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'done', 'date_end': time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
return True
|
||||
|
||||
def tender_open(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'open'}, context=context)
|
||||
return True
|
||||
|
||||
def tender_cancel(self, cr, uid, ids, context={}):
|
||||
purchase_order_obj = self.pool.get('purchase.order')
|
||||
for purchase in self.browse(cr, uid, ids):
|
||||
@@ -65,14 +59,14 @@ class purchase_requisition(osv.osv):
|
||||
purchase_order_obj.action_cancel(cr,uid,[purchase_id.id])
|
||||
self.write(cr, uid, ids, {'state': 'cancel'})
|
||||
return True
|
||||
def tender_confirm(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'done','date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||
def tender_in_progress(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'in_progress'} ,context=context)
|
||||
return True
|
||||
def tender_reset(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state': 'draft'})
|
||||
return True
|
||||
def tender_done(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'done'}, context=context)
|
||||
self.write(cr, uid, ids, {'state':'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
|
||||
return True
|
||||
|
||||
|
||||
@@ -84,7 +78,7 @@ class purchase_requisition_line(osv.osv):
|
||||
_description="Purchase Requisition Line"
|
||||
_rec_name = 'product_id'
|
||||
_columns = {
|
||||
'product_id': fields.many2one('product.product', 'Product'),
|
||||
'product_id': fields.many2one('product.product', 'Product' , domain=[('purchase_requisition', '=', True)]),
|
||||
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
|
||||
'product_qty': fields.float('Quantity', digits=(16,2)),
|
||||
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
|
||||
@@ -156,10 +150,10 @@ class mrp_procurement(osv.osv):
|
||||
procurement = self.browse(cr, uid, proc_id)
|
||||
if procurement.product_id.purchase_requisition:
|
||||
self.pool.get('purchase.requisition').create(cr, uid, {
|
||||
'name': procurement.name,
|
||||
'name': sequence_obj.get(cr, uid, 'purchase.order.requisition'),
|
||||
'origin': procurement.name,
|
||||
'date_end': procurement.date_planned,
|
||||
'lines_ids': [(0,0,{
|
||||
'line_ids': [(0,0,{
|
||||
'product_id': procurement.product_id.id,
|
||||
'product_uom_id': procurement.product_uom.id,
|
||||
'product_qty': procurement.product_qty
|
||||
|
||||
@@ -73,11 +73,10 @@
|
||||
<separator colspan="4"/>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state" select="1" readonly ="1"/>
|
||||
<button name="tender_close" states="open,draft" string="Close" type="object" icon="gtk-close" />
|
||||
<button name="tender_open" states="draft,in_progress" string="Open" type="object" icon="gtk-go-forward" />
|
||||
<button name="tender_cancel" states="draft,open," string="Cancel" type="object" icon="gtk-cancel" />
|
||||
<button name="tender_confirm" states="open" string="Confirm" type="object" icon="gtk-go-up" />
|
||||
<button name="tender_in_progress" states="draft" string="Confirm" type="object" icon="gtk-apply" />
|
||||
<button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" icon="gtk-cancel" />
|
||||
<button name="tender_reset" states="done,cancel" string="Reset to Draft" type="object" icon="gtk-convert" />
|
||||
<button name="tender_done" states="in_progress" string="Done" type="object" icon="gtk-jump-to" />
|
||||
</group>
|
||||
|
||||
|
||||
@@ -107,8 +106,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Purchase Requisition">
|
||||
<group col='10' colspan='4'>
|
||||
<filter icon="terp-purchase" string="Quotations" domain="[('state','=','draft')]" separator="1"/>
|
||||
<filter icon="terp-purchase" string="Approved" domain="[('state','=','open')]" separator="1"/>
|
||||
<filter icon="terp-purchase" string=" Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1" string="Requisition Reference"/>
|
||||
<field name="purchase_ids" select="1"/>
|
||||
|
||||
@@ -31,7 +31,7 @@ class purchase_requisition_partner(osv.osv_memory):
|
||||
_name = "purchase.requisition.partner"
|
||||
_description = "Purchase Requisition Partner"
|
||||
_columns = {
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', required=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Partner', required=True,domain=[('supplier', '=', True)]),
|
||||
'partner_address_id':fields.many2one('res.partner.address', 'Address', required=True),
|
||||
}
|
||||
|
||||
|
||||
@@ -52,10 +52,7 @@ Thanks to the double entry management, the inventory controlling is powerful and
|
||||
"wizard/stock_location_product_view.xml",
|
||||
"wizard/stock_inventory_line_split_view.xml",
|
||||
"wizard/stock_change_standard_price_view.xml",
|
||||
"wizard/stock_picking_make_view.xml",
|
||||
"wizard/stock_traceability_view.xml",
|
||||
"wizard/stock_picking_make_view.xml",
|
||||
"wizard/stock_return_picking_view.xml",
|
||||
"stock_workflow.xml",
|
||||
"stock_incoterms.xml",
|
||||
"stock_wizard.xml",
|
||||
|
||||
@@ -42,6 +42,5 @@
|
||||
"access_stock_traceability_lot_downstream","stock.traceability.lot.downstream","model_stock_traceability_lot_downstream","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_partial_picking",stock.partial.picking","model_stock_partial_picking","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_partial_move","stock.partial.move","model_stock_partial_move","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_picking_make","stock.picking.make","model_stock_picking_make","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_inventory_merge","stock.inventory.merge","model_stock_inventory_merge","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_change_standard_price","stock.change.standard.price","model_stock_change_standard_price","stock.group_stock_user",1,0,0,0
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 43 and column 53.
|
@@ -1339,8 +1339,11 @@ class stock_move(osv.osv):
|
||||
new_moves = []
|
||||
for picking, todo in self._chain_compute(cr, uid, moves, context).items():
|
||||
ptype = self.pool.get('stock.location').picking_type_get(cr, uid, todo[0][0].location_dest_id, todo[0][1][0])
|
||||
pick_name = ''
|
||||
if ptype == 'delivery':
|
||||
pick_name = self.pool.get('ir.sequence').get(cr, uid, 'stock.picking.delivery')
|
||||
pickid = self.pool.get('stock.picking').create(cr, uid, {
|
||||
'name': picking.name,
|
||||
'name': pick_name or picking.name,
|
||||
'origin': str(picking.origin or ''),
|
||||
'type': ptype,
|
||||
'note': picking.note,
|
||||
|
||||
@@ -601,18 +601,6 @@
|
||||
<field name="min_date" select="1"/>
|
||||
<field name="type"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="confirmed,assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
icon="gtk-go-forward"
|
||||
help="Make Picking" colspan="2"/>
|
||||
<button name="%(act_stock_return_picking)d"
|
||||
states="done"
|
||||
string="Return Picking"
|
||||
type="action"
|
||||
icon="gtk-go-back"
|
||||
help="Return Picking" colspan="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
@@ -763,18 +751,6 @@
|
||||
<field name="date" />
|
||||
<field name="min_date" select="1"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
icon="gtk-go-forward"
|
||||
help="Make Picking" colspan="2"/>
|
||||
<button name="%(act_stock_return_picking)d"
|
||||
states="done"
|
||||
string="Return Picking"
|
||||
type="action"
|
||||
icon="gtk-go-back"
|
||||
help="Return Picking" colspan="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
@@ -953,18 +929,6 @@
|
||||
<field name="backorder_id" readonly="1"/>
|
||||
<field name="origin" readonly="1"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
icon="gtk-go-forward"
|
||||
help="Make Picking" colspan="2"/>
|
||||
<button name="%(act_stock_return_picking)d"
|
||||
states="done"
|
||||
string="Return Picking"
|
||||
type="action"
|
||||
icon="gtk-go-back"
|
||||
help="Return Picking" colspan="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
@@ -1140,18 +1104,6 @@
|
||||
<field name="min_date" readonly="1"/>
|
||||
<field name="invoice_state" string="Invoice Control"/>
|
||||
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
|
||||
<button name="%(act_stock_make_picking_wizard)d"
|
||||
states="confirmed,assigned"
|
||||
string="Make Picking"
|
||||
type="action"
|
||||
icon="gtk-go-forward"
|
||||
help="Make Picking" colspan="2"/>
|
||||
<button name="%(act_stock_return_picking)d"
|
||||
states="done"
|
||||
string="Return Picking"
|
||||
type="action"
|
||||
icon="gtk-go-back"
|
||||
help="Return Picking" colspan="2"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
|
||||
@@ -23,9 +23,7 @@ import stock_traceability
|
||||
import stock_move
|
||||
import stock_partial_picking
|
||||
import stock_partial_move
|
||||
import stock_picking_make
|
||||
import wizard_replacement
|
||||
import stock_return_picking
|
||||
import wizard_ups
|
||||
import stock_inventory_merge
|
||||
import stock_inventory_set_stock_zero
|
||||
|
||||
@@ -1,80 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import netsvc
|
||||
|
||||
class stock_picking_make(osv.osv_memory):
|
||||
_name = 'stock.picking.make'
|
||||
_description = "Make Picking"
|
||||
|
||||
_columns = {
|
||||
'picking_ids': fields.many2many('stock.picking', 'stock_picking_ids', 'parent_id', 'child_id', 'Pickings'),
|
||||
}
|
||||
|
||||
def default_get(self, cursor, user, fields, context):
|
||||
"""
|
||||
To get default values for the object.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(stock_picking_make, self).default_get(cursor, user, fields, context=context)
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
if record_ids:
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
picking_ids = picking_obj.search(cursor, user, [
|
||||
('id', 'in', record_ids),
|
||||
('state', '<>', 'done'),
|
||||
('state', '<>', 'cancel')], context=context)
|
||||
res['picking_ids'] = picking_ids
|
||||
return res
|
||||
|
||||
def make_packing(self, cursor, user, ids, context):
|
||||
"""
|
||||
Make Picking.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
record_ids = context and context.get('active_ids',False) or False
|
||||
wkf_service = netsvc.LocalService('workflow')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
data = self.read(cursor, user, ids[0])
|
||||
pick_ids = data['picking_ids']
|
||||
picking_obj.force_assign(cursor, user, pick_ids)
|
||||
picking_obj.action_move(cursor, user, pick_ids)
|
||||
for picking_id in ids:
|
||||
wkf_service.trg_validate(user, 'stock.picking', picking_id,
|
||||
'button_done', cursor)
|
||||
return {}
|
||||
|
||||
stock_picking_make()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="view_stock_make_picking_wizard" model="ir.ui.view">
|
||||
<field name="name">Make Picking</field>
|
||||
<field name="model">stock.picking.make</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Make Picking">
|
||||
<field name="picking_ids" nolabel="1" colspan="4"
|
||||
width="600" height="300"/>
|
||||
<separator string="" colspan="4" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button name="make_packing" string="Ok"
|
||||
type="object" icon="gtk-apply" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="act_stock_make_picking_wizard" model="ir.actions.act_window">
|
||||
<field name="name">Make Picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.picking.make</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -1,221 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import netsvc
|
||||
import time
|
||||
|
||||
from osv import osv,fields
|
||||
from tools.translate import _
|
||||
|
||||
class stock_return_picking(osv.osv_memory):
|
||||
_name = 'stock.return.picking'
|
||||
_description = 'Return Picking'
|
||||
|
||||
def default_get(self, cr, uid, fields, context):
|
||||
"""
|
||||
To get default values for the object.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param fields: List of fields for which we want default values
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(stock_return_picking, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick = pick_obj.browse(cr, uid, record_id)
|
||||
for m in [line for line in pick.move_lines]:
|
||||
res['return%s'%(m.id)] = m.product_qty
|
||||
if pick.invoice_state=='invoiced':
|
||||
res['invoice_state'] = '2binvoiced'
|
||||
else:
|
||||
res['invoice_state'] = 'none'
|
||||
return res
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
"""
|
||||
Creates view dynamically and adding fields at runtime.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view with new columns.
|
||||
"""
|
||||
res = super(stock_return_picking, self).view_init(cr, uid, fields_list, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
if record_id:
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
try:
|
||||
pick = pick_obj.browse(cr, uid, record_id)
|
||||
for m in [line for line in pick.move_lines]:
|
||||
if 'return%s'%(m.id) not in self._columns:
|
||||
self._columns['return%s'%(m.id)] = fields.float(string=m.name, required=True)
|
||||
if 'invoice_state' not in self._columns:
|
||||
self._columns['invoice_state'] = fields.selection([('2binvoiced', 'To be Invoiced'), ('none', 'None')], string='Invoice State', required=True)
|
||||
except Exception, e:
|
||||
return res
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form',
|
||||
context=None, toolbar=False, submenu=False):
|
||||
"""
|
||||
Changes the view dynamically
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return: New arch of view.
|
||||
"""
|
||||
res = super(stock_return_picking, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
assert record_id,'Active ID not found'
|
||||
if record_id:
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
pick = pick_obj.browse(cr, uid, record_id)
|
||||
|
||||
try:
|
||||
if pick.state != 'done':
|
||||
raise osv.except_osv(_('Warning !'), _("The Picking is not completed yet!\nYou cannot return picking which is not in 'Done' state!"))
|
||||
|
||||
return_history = {}
|
||||
for m_line in pick.move_lines:
|
||||
return_history[m_line.id] = 0
|
||||
for rec in m_line.move_stock_return_history:
|
||||
return_history[m_line.id] += rec.product_qty
|
||||
|
||||
res['fields'].clear()
|
||||
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Provide the quantities of the returned products.')]
|
||||
for m in [line for line in pick.move_lines]:
|
||||
quantity = m.product_qty
|
||||
if quantity > return_history[m.id] and (quantity - return_history[m.id])>0:
|
||||
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
|
||||
res['fields']['return%s' % m.id]={'string':m.name, 'type':'float', 'required':True}
|
||||
res.setdefault('returns', []).append(m.id)
|
||||
if not res.get('returns',False):
|
||||
raise osv.except_osv(_('Warning!'),_('There is no product to return!'))
|
||||
|
||||
arch_lst.append('<field name="invoice_state"/>\n<newline/>')
|
||||
if pick.invoice_state=='invoiced':
|
||||
new_invoice_state='2binvoiced'
|
||||
else:
|
||||
new_invoice_state=pick.invoice_state
|
||||
res['fields']['invoice_state']={'string':_('Invoice state'), 'type':'selection','required':True, 'selection':[('2binvoiced', _('To Be Invoiced')), ('none', _('None'))]}
|
||||
arch_lst.append('<group col="2" colspan="4">')
|
||||
arch_lst.append('<button icon="gtk-cancel" special="cancel" string="Cancel" />')
|
||||
arch_lst.append('<button name="action_open_window" string="Return" colspan="1" type="object" icon="gtk-apply" />')
|
||||
arch_lst.append('</group>')
|
||||
arch_lst.append('</form>')
|
||||
res['arch'] = '\n'.join(arch_lst)
|
||||
except Exception,e:
|
||||
return res
|
||||
return res
|
||||
|
||||
def _create_returns(self, cr, uid, ids, context):
|
||||
"""
|
||||
Creates return picking.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of ids selected
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
move_obj = self.pool.get('stock.move')
|
||||
pick_obj = self.pool.get('stock.picking')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
|
||||
pick = pick_obj.browse(cr, uid, record_id)
|
||||
data = self.read(cr, uid, ids[0])
|
||||
new_picking = None
|
||||
date_cur = time.strftime('%Y-%m-%d %H:%M:%S')
|
||||
|
||||
move_ids = [m.id for m in [line for line in pick.move_lines]]
|
||||
set_invoice_state_to_none = True
|
||||
for move in move_obj.browse(cr, uid, move_ids):
|
||||
if not new_picking:
|
||||
if pick.type=='out':
|
||||
new_type = 'in'
|
||||
elif pick.type=='in':
|
||||
new_type = 'out'
|
||||
else:
|
||||
new_type = 'internal'
|
||||
new_picking = pick_obj.copy(cr, uid, pick.id, {'name':'%s (return)' % pick.name,
|
||||
'move_lines':[], 'state':'draft', 'type':new_type,
|
||||
'date':date_cur, 'invoice_state':data['invoice_state'],})
|
||||
new_location=move.location_dest_id.id
|
||||
|
||||
new_qty = data['return%s' % move.id]
|
||||
returned_qty = move.product_qty
|
||||
|
||||
for rec in move.move_stock_return_history:
|
||||
returned_qty -= rec.product_qty
|
||||
|
||||
if returned_qty != new_qty:
|
||||
set_invoice_state_to_none = False
|
||||
|
||||
new_move=move_obj.copy(cr, uid, move.id, {
|
||||
'product_qty': new_qty,
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid, move.product_uom.id,
|
||||
new_qty, move.product_uos.id),
|
||||
'picking_id':new_picking, 'state':'draft',
|
||||
'location_id':new_location, 'location_dest_id':move.location_id.id,
|
||||
'date':date_cur, 'date_planned':date_cur,})
|
||||
move_obj.write(cr, uid, [move.id], {'move_stock_return_history':[(4,new_move)]})
|
||||
|
||||
if set_invoice_state_to_none:
|
||||
pick_obj.write(cr, uid, [pick.id], {'invoice_state':'none'})
|
||||
|
||||
if new_picking:
|
||||
if new_picking:
|
||||
wf_service.trg_validate(uid, 'stock.picking', new_picking, 'button_confirm', cr)
|
||||
pick_obj.force_assign(cr, uid, [new_picking], context)
|
||||
return new_picking
|
||||
|
||||
def action_open_window(self, cr, uid, ids, context):
|
||||
"""
|
||||
Opens return picking list.
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param ids: List of ids selected
|
||||
@param context: A standard dictionary
|
||||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = self._create_returns(cr, uid, ids, context)
|
||||
if not res:
|
||||
return {}
|
||||
return {
|
||||
'domain': "[('id', 'in', ["+str(res)+"])]",
|
||||
'name': 'Picking List',
|
||||
'view_type':'form',
|
||||
'view_mode':'tree,form',
|
||||
'res_model':'stock.picking',
|
||||
'view_id':False,
|
||||
'type':'ir.actions.act_window',
|
||||
}
|
||||
|
||||
stock_return_picking()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Return Picking -->
|
||||
|
||||
<record id="act_stock_return_picking" model="ir.actions.act_window">
|
||||
<field name="name">Return Picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.return.picking</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -3,7 +3,7 @@
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved.
|
||||
#
|
||||
# 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
|
||||
@@ -19,54 +19,27 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2004 Axelor SPRL. (http://www.axelor.com) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# 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 2
|
||||
# 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, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Thunderbird Interface",
|
||||
"version" : "1.0",
|
||||
"author" : "Axelor",
|
||||
"website" : "http://www.axelor.com/",
|
||||
"depends" : ["base","crm"],
|
||||
"category" : "Generic Modules/Thunderbird interface",
|
||||
"description": '''
|
||||
This module is required for the thuderbird plug-in to work
|
||||
properly.
|
||||
"name" : "Thunderbird Interface",
|
||||
"version" : "1.0",
|
||||
"author" : "Axelor",
|
||||
"website" : "http://www.axelor.com/",
|
||||
"depends" : ["base","crm"],
|
||||
"category" : "Generic Modules/Thunderbird interface",
|
||||
"description": '''
|
||||
This module is required for the thuderbird plug-in to work
|
||||
properly.
|
||||
|
||||
This allows you to select an object that you’d like to add
|
||||
to your email and its attachments. You can select a partner, a task,
|
||||
a project, an analytical account, or any other object and attach selected
|
||||
mail as .eml file in attachment of selected record.
|
||||
This allows you to select an object that you’d like to add
|
||||
to your email and its attachments. You can select a partner, a task,
|
||||
a project, an analytical account, or any other object and attach selected
|
||||
mail as .eml file in attachment of selected record.
|
||||
|
||||
You can create new case in crm using Create Case button.
|
||||
Select a section for which you want to create case.''',
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ['security/ir.model.access.csv'],
|
||||
"active": False,
|
||||
"installable": True
|
||||
You can create new case in crm using Create Case button.
|
||||
Select a section for which you want to create case.''',
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ['security/ir.model.access.csv'],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user