bzr revid: nch@tinyerp.com-20081113111959-ow1ys2d8juz8hi6t
This commit is contained in:
Naresh Choksy
2008-11-13 16:49:59 +05:30
44 changed files with 1075 additions and 417 deletions
+2 -2
View File
@@ -925,11 +925,11 @@ class account_move(osv.osv):
if not company_id:
company_id = line.account_id.company_id.id
if not company_id == line.account_id.company_id.id:
raise osv.except_osv(_('Error'), _('Couldn\'t create move between different companies'))
raise osv.except_osv(_('Error'), _("Couldn't create move between different companies"))
if line.account_id.currency_id:
if line.account_id.currency_id.id != line.currency_id.id and (line.account_id.currency_id.id != line.account_id.company_id.currency_id.id or line.currency_id):
raise osv.except_osv(_('Error'), _('Couldn\'t create move with currency different than the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.' % (line.account_id.code, line.account_id.name)))
raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different than the secondary currency of the account "%s - %s". Clear the secondary currency field of the account definition if you want to accept all currencies.""" % (line.account_id.code, line.account_id.name)))
if abs(amount) < 0.0001:
if not len(line_draft_ids):
+2
View File
@@ -492,6 +492,8 @@ class account_move_line(osv.osv):
#TODO: move this check to a constraint in the account_move_reconcile object
if len(r) != 1:
raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! '))
if not unrec_lines:
raise osv.except_osv(_('Error'), _('Entry is already reconciled'))
account = self.pool.get('account.account').browse(cr, uid, account_id, context=context)
if not account.reconcile:
raise osv.except_osv(_('Error'), _('The account is not defined to be reconcile !'))
+1 -1
View File
@@ -989,7 +989,7 @@
<act_window
domain="[('account_id', '=', active_id)]"
id="act_account_acount_move_line_open"
name=""
name="Entries"
context="{'account_id': active_id}"
res_model="account.move.line"
src_model="account.account"/>
+12 -12
View File
@@ -4,16 +4,16 @@
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 4.3.0"
"Report-Msgid-Bugs-To: support@openerp.com"
"POT-Creation-Date: 2008-09-11 15:45:09+0000"
"PO-Revision-Date: 2008-09-11 15:45:09+0000"
"Last-Translator: <>"
"Language-Team: "
"MIME-Version: 1.0"
"Content-Type: text/plain; charset=UTF-8"
"Content-Transfer-Encoding: "
"Plural-Forms: "
"Project-Id-Version: OpenERP Server 4.3.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2008-09-11 15:45:09+0000\n"
"PO-Revision-Date: 2008-09-11 15:45:09+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: account
#, python-format
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr "Días netos"
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr "Dias habiles(netos)"
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
File diff suppressed because it is too large Load Diff
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr "Giorni netti"
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr "Netto Dagen"
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr "Dias"
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+2 -2
View File
@@ -3915,7 +3915,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move between different companies"
msgid "Couldn't create move between different companies"
msgstr ""
#. module: account
@@ -4566,7 +4566,7 @@ msgstr ""
#. module: account
#, python-format
#: code:addons/account/account.py:0
msgid "Couldn\'t create move with currency different than the secondary currency of the account"
msgid "Couldn't create move with currency different than the secondary currency of the account"
msgstr ""
#. module: account
+18 -5
View File
@@ -718,9 +718,15 @@ class account_invoice(osv.osv):
line['invoice_line_tax_id'] = [(6,0, line.get('invoice_line_tax_id', [])) ]
if 'account_analytic_id' in line:
line['account_analytic_id'] = line.get('account_analytic_id', False) and line['account_analytic_id'][0]
if 'tax_code_id' in line :
if isinstance(line['tax_code_id'],tuple) and len(line['tax_code_id']) >0 :
line['tax_code_id'] = line['tax_code_id'][0]
if 'base_code_id' in line :
if isinstance(line['base_code_id'],tuple) and len(line['base_code_id']) >0 :
line['base_code_id'] = line['base_code_id'][0]
return map(lambda x: (0,0,x), lines)
def refund(self, cr, uid, ids):
def refund(self, cr, uid, ids, date=None, period_id=None, description=None):
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
new_ids = []
@@ -741,21 +747,28 @@ class account_invoice(osv.osv):
tax_lines = self.pool.get('account.invoice.tax').read(cr, uid, invoice['tax_line'])
tax_lines = filter(lambda l: l['manual'], tax_lines)
tax_lines = self._refund_cleanup_lines(tax_lines)
if not date :
date = time.strftime('%Y-%m-%d')
invoice.update({
'type': type_dict[invoice['type']],
'date_invoice': time.strftime('%Y-%m-%d'),
'date_invoice': date,
'state': 'draft',
'number': False,
'invoice_line': invoice_lines,
'tax_line': tax_lines
})
if period_id :
invoice.update({
'period_id': period_id,
})
if description :
invoice.update({
'name': description,
})
# take the id part of the tuple returned for many2one fields
for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
'account_id', 'currency_id', 'payment_term', 'journal_id'):
invoice[field] = invoice[field] and invoice[field][0]
# create the new invoice
new_ids.append(self.create(cr, uid, invoice))
return new_ids
+183 -19
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -19,44 +19,208 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import pooler
import osv
import netsvc
import time
sur_form = '''<?xml version="1.0"?>
<form string="Credit Note">
<label string="Are you sure you want to refund this invoice ?"/>
<label string="Are you sure you want to refund this invoice ?" colspan="2"/>
<newline />
<field name="date" />
<field name="period" />
<field name="description" width="150" />
</form>'''
sur_fields = {
}
'date': {'string':'Operation date','type':'date', 'required':'False'},
'period':{'string': 'Force period', 'type': 'many2one',
'relation': 'account.period', 'required': False},
'description':{'string':'Description', 'type':'char', 'required':'True'},
}
class wiz_refund(wizard.interface):
def _invoice_refund(self, cr, uid, data, context):
return self._compute_refund(cr, uid, data, 'refund', context)
def _invoice_cancel(self, cr, uid, data, context):
return self._compute_refund(cr, uid, data, 'cancel', context)
def _invoice_modify(self, cr, uid, data, context):
return self._compute_refund(cr, uid, data, 'modify', context)
def _compute_refund(self, cr, uid, data, mode, context):
form = data['form']
pool = pooler.get_pool(cr.dbname)
ids = pool.get('account.invoice').refund(cr, uid, data['ids'])
return {
'domain': "[('id','in', ["+','.join(map(str,ids))+"])]",
'name': 'Invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'out_refund'}",
'type': 'ir.actions.act_window'
}
reconcile_obj = pool.get('account.move.reconcile')
account_m_line_obj = pool.get('account.move.line')
created_inv = []
date = False
period = False
description = False
for inv in pool.get('account.invoice').browse(cr, uid, data['ids']):
if inv.state == 'draft':
raise wizard.except_wizard(_('Error !'), _('Can not %s draft invoice.') % (mode))
if form['period'] :
period = form['period']
else:
period = inv.period_id.id
if form['date'] :
date = form['date']
if not form['period'] :
try :
#we try in multy company mode
cr.execute("""SELECT id
from account_period where date('%s')
between date_start AND date_stop and company_id = %s limit 1 """%(
form['date'],
pool.get('res.users').browse(cr,uid,uid).company_id.id
)
)
except :
#we try in mono company mode
cr.execute("""SELECT id
from account_period where date('%s')
between date_start AND date_stop limit 1 """%(
form['date'],
)
)
res = cr.fetchone()
if res:
period = res[0]
else:
date = inv.date_invoice
if form['description'] :
description = form['description']
else:
description = inv.name
refund_id = pool.get('account.invoice').refund(cr, uid, [inv.id],date, period, description)
refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
# we compute due date
#!!!due date = date inv date on formdate
pool.get('account.invoice').write(cr, uid, [refund.id],{'date_due':date,'check_total':inv.check_total})
created_inv.append(refund_id[0])
#if inv is paid we unreconcile
if mode in ('cancel','modify'):
movelines = inv.move_id.line_id
#we unreconcile the lines
to_reconcile_ids = {}
for line in movelines :
#if the account of the line is the as the one in the invoice
#we reconcile
if line.account_id.id == inv.account_id.id :
to_reconcile_ids[line.account_id.id] =[line.id]
if type(line.reconcile_id) != osv.orm.browse_null :
reconcile_obj.unlink(cr,uid, line.reconcile_id.id)
#we advance the workflow of the refund to open
wf_service = netsvc.LocalService('workflow')
wf_service.trg_validate(uid, 'account.invoice', refund.id, 'invoice_open', cr)
#we reload the browse record
refund = pool.get('account.invoice').browse(cr, uid, refund_id[0])
#we match the line to reconcile
for tmpline in refund.move_id.line_id :
if tmpline.account_id.id == inv.account_id.id :
to_reconcile_ids[tmpline.account_id.id].append(tmpline.id)
for account in to_reconcile_ids :
account_m_line_obj.reconcile(cr, uid, to_reconcile_ids[account],
writeoff_period_id=period,
writeoff_journal_id=inv.journal_id.id,
writeoff_acc_id=inv.account_id.id
)
#we create a new invoice that is the copy of the original
if mode == 'modify' :
invoice = pool.get('account.invoice').read(cr, uid, [inv.id],
['name', 'type', 'number', 'reference',
'comment', 'date_due', 'partner_id', 'address_contact_id',
'address_invoice_id', 'partner_insite','partner_contact',
'partner_ref', 'payment_term', 'account_id', 'currency_id',
'invoice_line', 'tax_line', 'journal_id','period_id'
]
)
invoice = invoice[0]
del invoice['id']
invoice_lines = pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(invoice_lines)
tax_lines = pool.get('account.invoice.tax').read(
cr, uid, invoice['tax_line'])
tax_lines = pool.get('account.invoice')._refund_cleanup_lines(tax_lines)
invoice.update({
'type': inv.type,
'date_invoice': date,
'state': 'draft',
'number': False,
'invoice_line': invoice_lines,
'tax_line': tax_lines,
'period_id': period,
'name':description
})
#take the id part of the tuple returned for many2one fields
for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
'account_id', 'currency_id', 'payment_term', 'journal_id'):
invoice[field] = invoice[field] and invoice[field][0]
# create the new invoice
inv_id = pool.get('account.invoice').create(cr, uid, invoice,{})
# we compute due date
if inv.payment_term.id:
data = pool.get('account.invoice').onchange_payment_term_date_invoice(cr, uid, [inv_id],inv.payment_term.id,date)
if 'value' in data and data['value']:
pool.get('account.invoice').write(cr, uid, [inv_id],data['value'])
created_inv.append(inv_id)
#we get the view id
mod_obj = pool.get('ir.model.data')
act_obj = pool.get('ir.actions.act_window')
if inv.type == 'out_invoice':
xml_id = 'action_invoice_tree5'
elif inv.type == 'in_invoice':
xml_id = 'action_invoice_tree8'
elif type == 'out_refund':
xml_id = 'action_invoice_tree10'
else:
xml_id = 'action_invoice_tree12'
#we get the model
result = mod_obj._get_id(cr, uid, 'account', xml_id)
id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
# we read the act window
result = act_obj.read(cr, uid, id)
result['res_id'] = created_inv
return result
states = {
'init': {
'actions': [],
'result': {'type':'form', 'arch':sur_form, 'fields':sur_fields, 'state':[('end','Cancel'),('refund','Credit Note')]}
'result': {'type':'form', 'arch':sur_form, 'fields':sur_fields, 'state':[('end','Cancel'),('refund','Refund Invoice'),('cancel_invoice','Cancel Invoice'),('modify_invoice','Modify Invoice')]}
},
'refund': {
'actions': [],
'result': {'type':'action', 'action':_invoice_refund, 'state':'end'}
}
'result': {'type':'action', 'action':_invoice_refund, 'state':'end'},
},
'cancel_invoice': {
'actions': [],
'result': {'type':'action', 'action':_invoice_cancel, 'state':'end'},
},
'modify_invoice': {
'actions': [],
'result': {'type':'action', 'action':_invoice_modify, 'state':'end'},
},
}
wiz_refund('account.invoice.refund')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+1 -1
View File
@@ -41,7 +41,7 @@
""",
"depends" : ["account"],
"init_xml" : [],
"demo_xml" : [],
"demo_xml" : ["crossovered_budget_demo.xml"],
"update_xml" : [
"security/ir.model.access.csv","account_budget_wizard.xml",
"crossovered_budget_view.xml","crossovered_budget_report.xml","crossovered_budget_workflow.xml"
+9 -58
View File
@@ -30,17 +30,17 @@ import datetime
def strToDate(dt):
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
return dt_date
#moved from account/account.py
# ---------------------------------------------------------
# Budgets
# ---------------------------------------------------------
class account_budget_post(osv.osv):
_name = 'account.budget.post'
_description = 'Budget item'
_description = 'Budgetary Position'
_columns = {
'code': fields.char('Code', size=64, required=True),
'name': fields.char('Name', size=256, required=True),
'dotation_ids': fields.one2many('account.budget.post.dotation', 'post_id', 'Expenses'),
'dotation_ids': fields.one2many('account.budget.post.dotation', 'post_id', 'Spreading'),
'account_ids': fields.many2many('account.account', 'account_budget_rel', 'budget_id', 'account_id', 'Accounts'),
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'general_budget_id', 'Budget Lines'),
}
@@ -88,22 +88,20 @@ class account_budget_post_dotation(osv.osv):
return res
_name = 'account.budget.post.dotation'
_description = "Budget item endowment"
_description = "Budget Dotation"
_columns = {
'name': fields.char('Name', size=64),
'post_id': fields.many2one('account.budget.post', 'Item', select=True),
'period_id': fields.many2one('account.period', 'Period'),
# 'quantity': fields.float('Quantity', digits=(16,2)),
'amount': fields.float('Amount', digits=(16,2)),
'tot_planned':fields.function(_tot_planned,method=True, string='Total Planned Amount',type='float',store=True),
}
account_budget_post_dotation()
#===
class crossovered_budget(osv.osv):
_name = "crossovered.budget"
_description = "Crossovered Budget"
_description = "Budget"
_columns = {
'name': fields.char('Name', size=50, required=True,states={'done':[('readonly',True)]}),
@@ -227,11 +225,11 @@ class crossovered_budget_lines(osv.osv):
res[line.id]=0.00
return res
_name="crossovered.budget.lines"
_description = "Crossovered Budget Lines"
_description = "Budget Lines"
_columns = {
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget Ref', ondelete='cascade', select=True, required=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account Ref',required=True),
'general_budget_id': fields.many2one('account.budget.post', 'Master Budget Ref',required=True),
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget', ondelete='cascade', select=True, required=True),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account',required=True),
'general_budget_id': fields.many2one('account.budget.post', 'Budgetary Position',required=True),
'date_from': fields.date('Start Date',required=True),
'date_to': fields.date('End Date',required=True),
'paid_date': fields.date('Paid Date'),
@@ -252,52 +250,5 @@ class account_analytic_account(osv.osv):
account_analytic_account()
#--------------------------------------------------------------
# moved from account/project/project.py
# ---------------------------------------------------------
# Budgets.
# ---------------------------------------------------------
#class account_analytic_budget_post(osv.osv):
# _name = 'account.analytic.budget.post'
# _description = 'Budget item'
# _columns = {
# 'code': fields.char('Code', size=64, required=True),
# 'name': fields.char('Name', size=256, required=True),
# 'sens': fields.selection( [('charge','Charge'), ('produit','Product')], 'Direction', required=True),
# 'dotation_ids': fields.one2many('account.analytic.budget.post.dotation', 'post_id', 'Expenses'),
# 'account_ids': fields.many2many('account.analytic.account', 'account_analytic_budget_rel', 'budget_id', 'account_id', 'Accounts'),
# }
# _defaults = {
# 'sens': lambda *a: 'produit',
# }
#
# def spread(self, cr, uid, ids, fiscalyear_id=False, quantity=0.0, amount=0.0):
#
# dobj = self.pool.get('account.analytic.budget.post.dotation')
# for o in self.browse(cr, uid, ids):
# # delete dotations for this post
# dobj.unlink(cr, uid, dobj.search(cr, uid, [('post_id','=',o.id)]))
#
# # create one dotation per period in the fiscal year, and spread the total amount/quantity over those dotations
# fy = self.pool.get('account.fiscalyear').browse(cr, uid, [fiscalyear_id])[0]
# num = len(fy.period_ids)
# for p in fy.period_ids:
# dobj.create(cr, uid, {'post_id': o.id, 'period_id': p.id, 'quantity': quantity/num, 'amount': amount/num})
# return True
#account_analytic_budget_post()
#
#class account_analytic_budget_post_dotation(osv.osv):
# _name = 'account.analytic.budget.post.dotation'
# _description = "Budget item endowment"
# _columns = {
# 'name': fields.char('Name', size=64),
# 'post_id': fields.many2one('account.analytic.budget.post', 'Item', select=True),
# 'period_id': fields.many2one('account.period', 'Period'),
# 'quantity': fields.float('Quantity', digits=(16,2)),
# 'amount': fields.float('Amount', digits=(16,2)),
# }
#account_analytic_budget_post_dotation()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,338 @@
<?xml version="1.0" ?>
<openerp>
<!-- Budgetary Positions -->
<data noupdate="1">
<record id="account_budget_post_sales0" model="account.budget.post">
<field eval="&quot;&quot;&quot;Sales&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;SAL&quot;&quot;&quot;" name="code"/>
<field eval="[(6,0,[ref('account.a_sale')])]" name="account_ids"/>
</record>
</data>
<data noupdate="1">
<record id="account_budget_post_purchase0" model="account.budget.post">
<field eval="&quot;&quot;&quot;Purchases&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;PUR&quot;&quot;&quot;" name="code"/>
<field eval="[(6,0,[ref('account.a_expense')])]" name="account_ids"/>
</record>
</data>
<!-- Budgetary Dotations -->
<data noupdate="1">
<record id="account_budget_post_dot1" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_1"/>
</record>
<record id="account_budget_post_dot2" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_2"/>
</record>
<record id="account_budget_post_dot3" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_3"/>
</record>
<record id="account_budget_post_dot4" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_4"/>
</record>
<record id="account_budget_post_dot5" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_5"/>
</record>
<record id="account_budget_post_dot6" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_6"/>
</record>
<record id="account_budget_post_dot7" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_7"/>
</record>
<record id="account_budget_post_dot8" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_8"/>
</record>
<record id="account_budget_post_dot9" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_9"/>
</record>
<record id="account_budget_post_dot10" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_10"/>
</record>
<record id="account_budget_post_dot11" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_11"/>
</record>
<record id="account_budget_post_dot12" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="5000" name="amount"/>
<field name="post_id" ref="account_budget_post_sales0"/>
<field name="period_id" ref="account.period_12"/>
</record>
<record id="account_budget_post_dot_pur1" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_1"/>
</record>
<record id="account_budget_post_dot_pur2" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_2"/>
</record>
<record id="account_budget_post_dot_pur3" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_3"/>
</record>
<record id="account_budget_post_dot_pur4" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_4"/>
</record>
<record id="account_budget_post_dot_pur5" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_5"/>
</record>
<record id="account_budget_post_dot_pur6" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_6"/>
</record>
<record id="account_budget_post_dot_pur7" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_7"/>
</record>
<record id="account_budget_post_dot_pur8" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_8"/>
</record>
<record id="account_budget_post_dot_pur9" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_9"/>
</record>
<record id="account_budget_post_dot_pur10" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_10"/>
</record>
<record id="account_budget_post_dot_pur11" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_11"/>
</record>
<record id="account_budget_post_dot_pur12" model="account.budget.post.dotation">
<field eval="&quot;&quot;&quot;/&quot;&quot;&quot;" name="name"/>
<field eval="-2000" name="amount"/>
<field name="post_id" ref="account_budget_post_purchase0"/>
<field name="period_id" ref="account.period_12"/>
</record>
</data>
<!-- Budgets -->
<data noupdate="1">
<record id="crossovered_budget_budgetoptimistic0" model="crossovered.budget">
<field eval="&quot;&quot;&quot;+2008&quot;&quot;&quot;" name="code"/>
<field eval="&quot;&quot;&quot;Budget 2008: Optimistic&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="&quot;&quot;&quot;draft&quot;&quot;&quot;" name="state"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
<field name="creating_user_id" ref="base.user_root"/>
</record>
</data>
<data noupdate="1">
<record id="crossovered_budget_budgetpessimistic0" model="crossovered.budget">
<field eval="&quot;&quot;&quot;-2008&quot;&quot;&quot;" name="code"/>
<field eval="&quot;&quot;&quot;Budget 2008: Pessimistic&quot;&quot;&quot;" name="name"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="&quot;&quot;&quot;draft&quot;&quot;&quot;" name="state"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
<field name="creating_user_id" ref="base.user_root"/>
</record>
</data>
<!-- Budget lines -->
<data noupdate="1">
<record id="crossovered_budget_lines_0" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_consultancy"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-500.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_1" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_consultancy"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-250.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_2" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_consultancy"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="500.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_3" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_consultancy"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-07&quot;&quot;&quot;" name="date_from"/>
<field eval="900.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_4" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_consultancy"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="300.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-06&quot;&quot;&quot;" name="date_to"/>
</record>
</data>
<data noupdate="1">
<record id="crossovered_budget_lines_5" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-09-01&quot;&quot;&quot;" name="date_from"/>
<field eval="375.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-03&quot;&quot;&quot;" name="paid_date"/>
<field eval="&quot;&quot;&quot;2208-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_6" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-09-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-150.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_7" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_super_product_trainings"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-09-01&quot;&quot;&quot;" name="date_from"/>
<field eval="375.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-03&quot;&quot;&quot;" name="paid_date"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
</data>
<data noupdate="1">
<record id="crossovered_budget_lines_8" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2009-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-7500.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2009-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_9" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-5000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_10" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-2000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2009-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_11" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="20000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2010-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_12" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p1"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="20000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2009-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
</data>
<data noupdate="1">
<record id="crossovered_budget_lines_13" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-3000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_14" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
<field name="general_budget_id" ref="account_budget_post_purchase0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="-1000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_15" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="10000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetpessimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
<record id="crossovered_budget_lines_16" model="crossovered.budget.lines">
<field name="analytic_account_id" ref="account.analytic_seagate_p2"/>
<field name="general_budget_id" ref="account_budget_post_sales0"/>
<field eval="&quot;&quot;&quot;2008-01-01&quot;&quot;&quot;" name="date_from"/>
<field eval="10000.0" name="planned_amount"/>
<field name="crossovered_budget_id" ref="crossovered_budget_budgetoptimistic0"/>
<field eval="&quot;&quot;&quot;2008-12-31&quot;&quot;&quot;" name="date_to"/>
</record>
</data>
</openerp>
@@ -12,34 +12,13 @@
<!--
Budgets
-->
<!--<record id="view_budget_post_form" model="ir.ui.view">
<field name="name">account.budget.post.form</field>
<field name="model">account.budget.post</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget">
<notebook>
<page string="Definition">
<field name="code" select="1"/>
<field name="name" select="1"/>
</page>
<page string="Dotations">
<button name="%(wizard_budget_spread)d" string="Spread" type="action"/>
<field colspan="4" name="dotation_ids" nolabel="1"/>
</page>
<page string="Accounts">
<field colspan="4" name="account_ids" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>-->
<record id="view_budget_post_tree" model="ir.ui.view">
<field name="name">account.budget.post.tree</field>
<field name="model">account.budget.post</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Master Budget">
<tree string="Budgetary Position">
<field name="code"/>
<field name="name"/>
</tree>
@@ -50,7 +29,7 @@
<field name="model">account.budget.post.dotation</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget Expenses">
<form string="Budget Dotation">
<field name="period_id"/>
<field name="amount"/>
<field name="tot_planned" />
@@ -62,7 +41,7 @@
<field name="model">account.budget.post.dotation</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Master Budget Expenses">
<tree string="Budget Dotations">
<field name="period_id"/>
<field name="amount"/>
<field name="tot_planned" />
@@ -71,59 +50,34 @@
</record>
<record id="open_budget_post_form" model="ir.actions.act_window">
<field name="name">Master Budgets</field>
<field name="name">Budgetary Positions</field>
<field name="res_model">account.budget.post</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_budget_post_tree"/>
</record>
<menuitem id="next_id_31" name="Budgets" parent="account.menu_finance"/><menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/>
<menuitem id="next_id_31" name="Budgets" parent="account.menu_finance"/>
<menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/>
<!-- ******************************************************************************************************** -->
<!--<record model="ir.ui.view" id="view_budget_post_dotation_form_inherit">
<field name="name">account.budget.post.dotation.form.inherit</field>
<field name="type">form</field>
<field name="model">account.budget.post.dotation</field>
<field name="inherit_id" ref="account.view_budget_post_dotation_form"/>
<field name="arch" type="xml">
<field name="period_id" position="after">
<field name="tot_planned" />
</field>
</field>
</record>-->
<!--<record model="ir.ui.view" id="view_budget_post_dotation_tree_inherit">
<field name="name">account.budget.post.dotation.tree.inherit</field>
<field name="model">account.budget.post.dotation</field>
<field name="type">tree</field>
<field name="inherit_id" ref="account.view_budget_post_dotation_tree"/>
<field name="arch" type="xml">
<field name="amount" position="after">
<field name="tot_planned" />
</field>
</field>
</record>-->
<!--<record model="ir.ui.view" id="account.view_budget_post_form">-->
<record model="ir.ui.view" id="view_budget_post_form">
<field name="name">account.budget.post.form.inherit</field>
<field name="model">account.budget.post</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Master Budget">
<notebook>
<page string="Definition">
<field name="code" select="1"/>
<field name="name" select="1"/>
<form string="Budgetary Position">
<field name="name" select="1"/>
<field name="code" select="1"/>
<notebook colspan="4">
<page string="Accounts">
<field name="account_ids" colspan="4" nolabel="1"/>
</page>
<page string="Dotations">
<button string="Spread" name="%(wizard_budget_spread)d" type="action"/>
<field name="dotation_ids" colspan="4" nolabel="1"/>
</page>
<page string="Accounts">
<field name="account_ids" colspan="4" nolabel="1"/>
</page>
<page string="Budget Lines">
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree,graph">
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="graph,tree">
<graph type="bar" string="Lines">
<field name="analytic_account_id" />
<field name="general_budget_id" operator="+" />
@@ -158,7 +112,7 @@
</form>
</field>
</record>
<!-- =================== -->
<record model="ir.ui.view" id="crossovered_budget_view_form">
<field name="name">crossovered.budget.view.form</field>
<field name="model">crossovered.budget</field>
+1 -1
View File
@@ -208,7 +208,7 @@
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem action="action_payment_order_tree_new" id="menu_action_payment_order_form_new" parent="menu_action_payment_order_form.menu_main" sequence="3"/>
<menuitem action="action_payment_order_tree_new" id="menu_action_payment_order_form_new" parent="menu_main" sequence="3"/>
<record id="view_payment_line_form" model="ir.ui.view">
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -70,6 +70,7 @@ theme.default_font_family = "Helvetica-Bold"
theme.default_font_size = 18
theme.default_line_width = 1.0
import tools
import os
parents = {
@@ -86,11 +87,13 @@ class accounting_report_indicator(report_sxw.rml_parse):
self.ret_list = []
self.localcontext.update({
'time': time,
'test': self.test1,
'getgraph': self.getgraph,
'lines':self.lines,
'getarray':self.getarray,
'gettree':self.gettree,
})
self.count=0
self.treecount=0
self.list=[]
self.header_name=self.header_val=[]
@@ -166,6 +169,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
'code':obj_ind.code,
'expression':obj_ind.expression,
'disp_graph':obj_ind.disp_graph,
'disp_tree':obj_ind.disp_tree,
'note':obj_ind.note,
'type':obj_ind.type,
}
@@ -175,7 +179,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
def getarray(self,data,object):
res={}
result=[]
self.test1(data,object,intercall=True)
self.getgraph(data,object,intercall=True)
self.header_val=[str(x) for x in self.header_val]
temp_dict=zip(self.header_name,self.header_val)
res=dict(temp_dict)
@@ -183,8 +187,62 @@ class accounting_report_indicator(report_sxw.rml_parse):
result.append(res)
return result
def gettree(self,data,object):
pool_history=self.pool.get('account.report.report')
obj_history=pool_history.browse(self.cr,self.uid,object['id'])
result=[]
self.treecount +=1
path=tools.config['addons_path']+"/account_report/tmp_images/tree_image"
def test1(self,data,object,intercall=False):
dirname =tools.config['addons_path']+'/account_report/tmp_images/'
if not os.path.isdir(dirname):
os.mkdir(dirname)
can = canvas.init('tree_image'+str(self.treecount)+".png")
theme.default_font_size = 12
tb = text_box.T(loc=(0,700),line_style=line_style.darkblue,text=str(obj_history.code))
base_x=100
base_y=700
if obj_history.child_ids:
tb.add_arrow((100, 700))
can.line(line_style.black,base_x-30,base_y,base_x-30,base_y-(50*(len(obj_history.child_ids)-1)))
tb.draw()
self.child_dist=0
def draw_tree(obj_his,base_x,base_y,level=0):
self.child_dist=0
for i in range(len(obj_his.child_ids)):
can.line(line_style.black,base_x-30,base_y,base_x-30,base_y-(50*(i+len(obj_his.child_ids[i].child_ids))))
if i<>0:
a = arrow.T(head_style = 1)
if self.child_dist:
diff=self.child_dist
else:
diff=self.child_dist+i
a.draw([(base_x-(30),base_y-(50*diff)), (base_x,base_y-(50*diff))])
if obj_his.child_ids[i].child_ids:
tb12 = text_box.T(loc=(base_x,base_y-(50*(self.child_dist))), text=str(obj_his.child_ids[i].code))
tb12.add_arrow((base_x+(100*(level+1)),base_y-(50*(self.child_dist))))
tb12.draw()
draw_tree(obj_his.child_ids[i],base_x+(100*(level+1)),base_y-(50*(self.child_dist)),level+1)
else:
tb12 = text_box.T(loc=(base_x,base_y-(50*(i+self.child_dist))), text=str(obj_his.child_ids[i].code))
tb12.draw()
self.child_dist=len(obj_his.child_ids[i].child_ids)
#
draw_tree(obj_history,base_x,base_y,0)
can.close()
os.system('cp '+'tree_image'+str(self.treecount)+'.png ' +path+str(self.treecount)+'.png')
os.system('rm '+'tree_image'+str(self.treecount)+'.png')
return path+str(self.treecount)+'.png'
def getgraph(self,data,object,intercall=False):
obj_history=self.pool.get('account.report.history')
if data['select_base']=='year':
@@ -120,7 +120,8 @@
<para style="P3">
<font color="white"> </font>
</para>
<para style="P1">[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':test(data['form'],o)}) or removeParentNode('para') ]]</para>
<para style="P1">[[ o['disp_tree'] and setTag('para','image',{'file':gettree(data['form'],o)}) or removeParentNode('para') ]]</para>
<para style="P1">[[ o['disp_graph'] and setTag('para','image',{'width':'450.00','height':'215.00','file':getgraph(data['form'],o)}) or removeParentNode('para') ]]</para>
<para style="P3">
<font color="white"> </font>
</para>
+38 -37
View File
@@ -26,6 +26,34 @@ import netsvc
import pooler
import string
installed = False
def fnct_call(fnct):
def execute(*args, **argv):
if len(args) >= 6 and isinstance(args[5], dict):
_old_args = args[5].copy()
else:
_old_args = None
res = fnct(*args, **argv)
pool = pooler.get_pool(args[0])
mod = pool.get('ir.module.record')
if mod and mod.recording:
if args[4] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc'):
if _old_args is not None:
args[5].update(_old_args)
mod.recording_data.append(('query', args, argv,res))
return res
return execute
def fnct_call_workflow(fnct):
def exec_workflow(*args, **argv):
res = fnct(*args, **argv)
pool = pooler.get_pool(args[0])
mod = pool.get('ir.module.record')
if mod and mod.recording:
mod.recording_data.append(('workflow', args, argv))
return res
return exec_workflow
class base_module_record(osv.osv):
_name = "ir.module.record"
@@ -33,6 +61,7 @@ class base_module_record(osv.osv):
}
def __init__(self, pool, cr=None):
global installed
if super(base_module_record, self).__init__.func_code.co_argcount ==3:
super(base_module_record, self).__init__(pool,cr)
else:
@@ -40,6 +69,13 @@ class base_module_record(osv.osv):
self.recording = 0
self.recording_data = []
self.depends = {}
if not installed:
obj = netsvc._service['object']
obj.execute = fnct_call(obj.execute)
obj.exportMethod(obj.execute)
obj.exec_workflow = fnct_call_workflow(obj.exec_workflow)
obj.exportMethod(obj.exec_workflow)
installed = True
# To Be Improved
def _create_id(self, cr, uid, model, data):
@@ -56,8 +92,8 @@ class base_module_record(osv.osv):
return val
def _get_id(self, cr, uid, model, id):
# if type(id)==type(()):
# id=id[0]
if type(id)==type(()):
id=id[0]
if (model,id) in self.ids:
return self.ids[(model,id)], False
dt = self.pool.get('ir.model.data')
@@ -270,40 +306,5 @@ class base_module_record(osv.osv):
return doc.toprettyxml(indent="\t").encode('utf8')
base_module_record()
def fnct_call(fnct):
def execute(*args, **argv):
if len(args) >= 6 and isinstance(args[5], dict):
_old_args = args[5].copy()
else:
_old_args = None
db=args[0]
res = fnct(*args, **argv)
pool = pooler.get_pool(args[0])
mod = pool.get('ir.module.record')
if mod and mod.recording:
if args[4] not in ('default_get','read','fields_view_get','fields_get','search','search_count','name_search','name_get','get','request_get', 'get_sc'):
if _old_args is not None:
args[5].update(_old_args)
if args[5]:
mod.recording_data.append(('query', args, argv,res))
return res
return execute
def fnct_call_workflow(fnct):
def exec_workflow(*args, **argv):
res = fnct(*args, **argv)
pool = pooler.get_pool(args[0])
mod = pool.get('ir.module.record')
if mod and mod.recording:
mod.recording_data.append(('workflow', args, argv))
return res
return exec_workflow
obj = netsvc._service['object']
obj.execute = fnct_call(obj.execute)
obj.exportMethod(obj.execute)
obj.exec_workflow = fnct_call_workflow(obj.exec_workflow)
obj.exportMethod(obj.exec_workflow)
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+5 -1
View File
@@ -17,7 +17,11 @@
<group colspan="4" col="4">
<field name="name" string="Title" colspan="2"/>
<field name="section_id" colspan="1"/>
<field name="stage_id" string="Resolution" colspan="2"/>
<label string="Resolution: " align="1.0"/>
<group colspan="1" col="2">
<field name="stage_id" select="1" nolabel="1"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
<field name="date"/>
<field name="email_from" colspan="2"/>
<field name="user_id" />
+5 -1
View File
@@ -35,7 +35,11 @@
<newline/>
<field name="date" string="Date of Claim"/>
<field name="categ_id" string="Type of claim" select="1" on_change="onchange_categ_id(categ_id)"/>
<field name="stage_id"/>
<label string="Stage: " align="1.0"/>
<group colspan="1" col="2">
<field name="stage_id" select="1" nolabel="1"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
</group>
<notebook>
<page string="Claims Info">
+19
View File
@@ -68,6 +68,25 @@ class crm_cases(osv.osv):
'partner_phone': fields.char('Phone', size=16),
'partner_mobile': fields.char('Mobile', size=16),
}
def stage_next(self, cr, uid, ids, context={}):
ok = False
sid = self.pool.get('crm.case.stage').search(cr, uid, [], context=context)
s = {}
previous = {}
for stage in self.pool.get('crm.case.stage').browse(cr, uid, sid, context=context):
section = stage.section_id.id or False
s.setdefault(section, {})
s[section][previous.get(section, False)] = stage.id
previous[section] = stage.id
for case in self.browse(cr, uid, ids, context):
section = (case.section_id.id or False)
if section in s:
st = case.stage_id.id or False
if st in s[section]:
self.write(cr, uid, [case.id], {'stage_id': s[section][st]})
return True
def onchange_case_id(self, cr, uid, ids, case_id, name, partner_id, context={}):
if not case_id: return {}
case = self.browse(cr, uid, case_id, context=context)
+5 -1
View File
@@ -37,7 +37,11 @@
<field name="user_id" string="Responsible" select="2"/>
<button name="set_partner" string="Convert to Partner" icon="terp-sale"/>
<newline/>
<field name="stage_id"/>
<label string="Stage: " align="1.0"/>
<group colspan="1" col="2">
<field name="stage_id" select="1" nolabel="1"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
<field name="date" string="Next Interview"/>
<field name="duration" widget="float_time"/>
<button name="set_meeting" string="Schedule Meeting" icon="terp-crm"/>
+5 -1
View File
@@ -15,7 +15,11 @@
<group colspan="4" col="7">
<field name="name" select="1" string="Lead Subject"/>
<field name="section_id" colspan="1"/>
<field name="stage_id" select="1"/>
<label string="Stage: " align="1.0"/>
<group colspan="1" col="2">
<field name="stage_id" select="1" nolabel="1"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
<button string="Convert to Partner" icon="terp-crm" name="%(wizard_crm_partner_create)d" type="action" attrs="{'invisible':[('partner_id','!=',False)]}"/>
<field name="user_id" select="2"/>
<field name="categ_id" select="1" on_change="onchange_categ_id(categ_id)" string="Lead Source"/>
@@ -16,7 +16,12 @@
<field name="name" select="1" string="Opportunity" colspan="2"/>
<field name="section_id" colspan="1"/>
<field name="user_id" select="2" string="Responsible"/>
<field name="stage_id" select="1" string="Sales Stage"/>
<newline/>
<label string="Sales Stage: " align="1.0"/>
<group colspan="1" col="2">
<field name="stage_id" select="1" nolabel="1"/>
<button icon="gtk-go-forward" string="" name="stage_next" type="object"/>
</group>
<field name="date" string="Next Meeting"/>
<field name="duration"/>
<button string="Schedule Meeting" icon="terp-crm" name="%(wizard_crm_meeting)d" type="action"/>
+21 -18
View File
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@@ -74,28 +74,29 @@ class node_class(object):
if self.object2:
where.append( ('res_model','=',self.object2._name) )
where.append( ('res_id','=',self.object2.id) )
for content in self.object.content_ids:
if self.object2 or not content.include_name:
if content.include_name:
test_nodename = self.object2.name + (content.suffix or '') + (content.extension or '')
else:
test_nodename = (content.suffix or '') + (content.extension or '')
if test_nodename.find('/'):
test_nodename=test_nodename.replace('/', '_')
path = self.path+'/'+test_nodename
#path = self.path+'/'+self.object2.name + (content.suffix or '') + (content.extension or '')
if not nodename:
n = node_class(self.cr, self.uid,path, self.object2, False, content=content, type='content', root=False)
res2.append( n)
else:
if nodename == test_nodename:
n = node_class(self.cr, self.uid, path, self.object2, False, content=content, type='content', root=False)
res2.append(n)
for content in self.object.content_ids:
if self.object2 or not content.include_name:
if content.include_name:
test_nodename = self.object2.name + (content.suffix or '') + (content.extension or '')
else:
test_nodename = (content.suffix or '') + (content.extension or '')
if test_nodename.find('/'):
test_nodename=test_nodename.replace('/', '_')
path = self.path+'/'+test_nodename
#path = self.path+'/'+self.object2.name + (content.suffix or '') + (content.extension or '')
if not nodename:
n = node_class(self.cr, self.uid,path, self.object2, False, content=content, type='content', root=False)
res2.append( n)
else:
if nodename == test_nodename:
n = node_class(self.cr, self.uid, path, self.object2, False, content=content, type='content', root=False)
res2.append(n)
else:
where.append( ('parent_id','=',self.object.id) )
where.append( ('res_id','=',False) )
if nodename:
where.append( (fobj._rec_name,'=',nodename) )
print where+[ ('parent_id','=',self.object and self.object.id or False) ]
ids = fobj.search(self.cr, self.uid, where+[ ('parent_id','=',self.object and self.object.id or False) ], context=self.context)
if self.object and self.root and (self.object.type=='ressource'):
ids += fobj.search(self.cr, self.uid, where+[ ('parent_id','=',False) ], context=self.context)
@@ -560,6 +561,7 @@ class document_file(osv.osv):
if not self._check_duplication(cr,uid,vals):
raise except_orm('ValidateError', 'File name must be unique!')
result = super(document_file,self).write(cr,uid,ids,vals,context=context)
cr.commit()
try:
for f in self.browse(cr, uid, ids, context=context):
if 'datas' not in vals:
@@ -568,6 +570,7 @@ class document_file(osv.osv):
super(document_file,self).write(cr, uid, ids, {
'index_content': res
})
cr.commit()
except:
pass
return result
+11 -10
View File
@@ -15,15 +15,15 @@
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
</pageTemplate>
</template>
<stylesheet>
<paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="center" />
<paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="left" />
<paraStyle name="normal-title" fontName="Helvetica" fontSize="6" />
<paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
<paraStyle name="employee" fontName="Helvetica-Oblique" fontSize="10" textColor="blue" />
<paraStyle name="glande" textColor="red" />
<paraStyle name="normal_people" textColor="green" />
<paraStyle name="esclave" textColor="purple" />
<paraStyle name="glande" textColor="red" fontSize="7" fontName="Helvetica"/>
<paraStyle name="normal_people" textColor="green" fontSize="7" fontName="Helvetica"/>
<paraStyle name="esclave" textColor="purple" fontSize="7" fontName="Helvetica"/>
<blockTableStyle id="month">
<blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
<blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/>
@@ -90,7 +90,7 @@
<xsl:for-each select="report/days/day">
<xsl:variable name="today" select="attribute::number" />
<td>
<para>
<para style="normal">
<xsl:choose>
<xsl:when test="sum(//time-element[@date=$today]) &lt; 7.5">
<xsl:attribute name="style">glande</xsl:attribute>
@@ -102,12 +102,12 @@
<xsl:attribute name="style">esclave</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="sum(//time-element[@date=$today])" />
<xsl:value-of select="format-number(sum(//time-element[@date=$today]),'##.##')" />
</para>
</td>
</xsl:for-each>
<td>
<xsl:value-of select="sum(//time-element)" />
<xsl:value-of select="format-number(sum(//time-element),'##.##')" />
</td>
</tr>
</blockTable>
@@ -115,6 +115,7 @@
<xsl:template match="account">
<xsl:variable name="aid" select="attribute::id" />
<tr>
<td>
<para style="normal-title"><xsl:value-of select="attribute::name" /></para>
@@ -126,8 +127,8 @@
</td>
</xsl:for-each>
<td>
<para style="normal"><xsl:value-of select="sum(//account[@id=$aid]/time-element)" /></para>
<para style="normal"><xsl:value-of select="format-number(sum(//account[@id=$aid]/time-element),'##.##')" /></para>
</td>
</tr>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
@@ -15,15 +15,15 @@
<frame id="col1" x1="2.0cm" y1="2.5cm" width="24.7cm" height="17cm"/>
</pageTemplate>
</template>
<stylesheet>
<paraStyle name="normal" fontName="Helvetica" fontSize="6" alignment="center" />
<paraStyle name="normal-title" fontName="Helvetica" fontSize="6" />
<paraStyle name="title" fontName="Helvetica" fontSize="18" alignment="center" />
<paraStyle name="employee" fontName="Helvetica-Oblique" fontSize="10" textColor="blue" />
<paraStyle name="glande" textColor="red" />
<paraStyle name="normal_people" textColor="green" />
<paraStyle name="esclave" textColor="purple" />
<paraStyle name="glande" textColor="red" fontSize="7" fontName="Helvetica"/>
<paraStyle name="normal_people" textColor="green" fontSize="7" fontName="Helvetica"/>
<paraStyle name="esclave" textColor="purple" fontSize="7" fontName="Helvetica"/>
<blockTableStyle id="month">
<blockAlignment value="CENTER" start="1,0" stop="-1,-1" />
<blockFont name="Helvetica" size="8" start="0,0" stop="-1,1"/>
@@ -102,12 +102,12 @@
<xsl:attribute name="style">esclave</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:value-of select="format-number(//employee[@id=$id]/time-element[@date=$today], '#.#')" />
<xsl:value-of select="format-number(//employee[@id=$id]/time-element[@date=$today], '##.##')" />
</para>
</td>
</xsl:for-each>
<td>
<xsl:value-of select="sum(//employee[@id=$id]/time-element)"/>
<xsl:value-of select="format-number(sum(//employee[@id=$id]/time-element),'##.##')"/>
</td>
</tr>
</xsl:for-each>
@@ -115,10 +115,10 @@
<td>Total</td>
<xsl:for-each select="report/days/day">
<xsl:variable name="today" select="attribute::number"/>
<td t="1"><xsl:value-of select="sum(//time-element[@date=$today])"/></td>
<td t="1"><xsl:value-of select="format-number(sum(//time-element[@date=$today]),'##.##')"/></td>
</xsl:for-each>
<td t="1"><xsl:value-of select="sum(//time-element)"/></td>
<td t="1"><xsl:value-of select="format-number(sum(//time-element),'##.##')"/></td>
</tr>
</blockTable>
</xsl:template>
</xsl:stylesheet>
</xsl:stylesheet>
+8 -1
View File
@@ -410,7 +410,13 @@
</graph>
</field>
</record>
<wizard
string="Change Product Qty."
model="mrp.production"
name="change_production_qty"
id="mrp.wizard_change_production_qty"
keyword="client_action_multi"
multi="True"/>
<record id="mrp_production_form_view" model="ir.ui.view">
<field name="name">mrp.production.form</field>
<field name="model">mrp.production</field>
@@ -424,6 +430,7 @@
<newline/>
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
<field name="product_qty"/>
<button type="action" name="%(wizard_change_production_qty)d" string="Change Qty"/>
<field name="product_uom"/>
<newline/>
<label string="" colspan="2"/>
+1
View File
@@ -26,6 +26,7 @@ import wizard_schedulers_all
import wizard_price
import wizard_workcenter_load
import wizard_track_prod
import wizard_change_production_qty
import make_procurement
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,116 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import wizard
import ir
import pooler
from osv.osv import except_osv
from osv import fields,osv
import netsvc
form1 = '''<?xml version="1.0"?>
<form string="Change Product Qty">
<field name="product_qty"/>
</form>'''
form1_fields={
'product_qty': {'string': 'Product Qty', 'type':'float', 'required':True},
}
def _get_qty(self,cr,uid, data, state):
prod_obj = pooler.get_pool(cr.dbname).get('mrp.production')
prod = prod_obj.browse(cr, uid,data['ids'])[0]
form1_fields['product_qty']['default']=prod.product_qty
return {}
def _get_states(self, cr, uid, data, context):
prod_obj = pooler.get_pool(cr.dbname).get('mrp.production')
prod = prod_obj.browse(cr, uid,data['ids'])[0]
if prod.state in ('cancel', 'done'):
raise wizard.except_wizard('Warning !', 'The production is in "%s" state. You can not change the production quantity anymore' % (prod.state).upper() )
return 'end'
if prod.state in ('draft'):
#raise wizard.except_wizard('Warning !', 'The production is in "%s" state. You can change the production quantity directly...!!!' % (prod.state).upper() )
return 'end'
else:
return 'confirm'
def _change_prod_qty(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
prod_obj = pool.get('mrp.production')
prod = prod_obj.browse(cr, uid,data['ids'])[0]
prod_obj.write(cr, uid,prod.id, {'product_qty' : data['form']['product_qty']})
prod_obj.action_compute(cr, uid, [prod.id])
move_lines_obj = pool.get('stock.move')
for move in prod.move_lines:
bom_point = prod.bom_id
bom_id = prod.bom_id.id
if not bom_point:
bom_id = pool.get('mrp.bom')._bom_find(cr, uid, prod.product_id.id, prod.product_uom.id, properties)
if not bom_id:
raise osv.except_osv('Error', "Couldn't find bill of material for product")
self.write(cr, uid, [prod.id], {'bom_id': bom_id})
bom_point = pool.get('mrp.bom').browse(cr, uid, [bom_id])[0]
if not bom_id:
raise osv.except_osv('Error', "Couldn't find bill of material for product")
factor = prod.product_qty * prod.product_uom.factor / bom_point.product_uom.factor
res = pool.get('mrp.bom')._bom_explode(cr, uid, bom_point, factor / bom_point.product_qty, [])
for r in res[0]:
if r['product_id']== move.product_id.id:
move_lines_obj.write(cr, uid,move.id, {'product_qty' : r['product_qty']})
product_lines_obj = pool.get('mrp.production.product.line')
for m in prod.move_created_ids:
move_lines_obj.write(cr, uid,m.id, {'product_qty' : data['form']['product_qty']})
return {}
class change_production_qty(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'choice', 'next_state' : _get_states}
},
'confirm' : {
'actions' : [_get_qty],
'result': {'type': 'form', 'arch':form1, 'fields':form1_fields, 'state':[('end','Cancel'),('validate','Validate')]}
},
'validate': {
'actions': [],
'result': {'type':'action', 'action':_change_prod_qty, 'state':'end'}
},
'end' : {
'actions' : [],
'result': {'type': 'state', 'state': 'end'},
},
}
change_production_qty('change_production_qty')
+1 -1
View File
@@ -275,7 +275,7 @@
<para style="terp_default_9">[[ ', '.join(map(lambda x: x.name, line.taxes_id)) ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line.date_planned]]</para>
<para style="terp_default_Centre_9">[[ time.strftime('%m/%d/%Y', time.strptime( line.date_planned, '%Y-%m-%d %H:%M:%S')) ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ line.product_qty ]] </para>
+8 -8
View File
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Futur Stock Forecast"/>
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Future Stock Forecast"/>
<!-- <report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Packing list" xml="stock/report/picking.xml" xsl="stock/report/picking.xsl"/>-->
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Packing list" rml="stock/report/picking.rml"/>
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Print Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
<report id="report_location_overview" model="stock.location" name="stock.location.overview" string="Location Overview" xml="stock/report/lot_overview.xml" xsl="stock/report/lot_overview.xsl"/>
<report auto="False" id="report_lot_location" model="stock.location" name="lot.location" rml="stock/report/lot_location.rml" string="Lots by location"/>
<report id="report_location_overview_all" model="stock.location" name="stock.location.overview.all" string="Location Content (With childs)" xml="stock/report/lot_overview_all.xml" xsl="stock/report/lot_overview_all.xsl"/>
</data>
</openerp>
+3 -2
View File
@@ -817,6 +817,7 @@
<field groups="base.group_extended" name="product_packaging"/>
<field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
<field groups="base.group_extended" name="tracking_id" select="1"/>
<button name="%(track_line)d" string="Split in production lots" type="action"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<group>
@@ -1154,11 +1155,11 @@
<menuitem action="action_picking_tree8" id="menu_action_picking_tree8" parent="menu_action_picking_tree6"/>
<record id="action_picking_tree9" model="ir.actions.act_window">
<field name="name">Draft Internal Packings</field>
<field name="name">New Internal Packings</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar</field>
<field name="view_mode">form,tree,calendar</field>
<field name="domain">[('state','=','draft'),('type','=','internal')]</field>
<field name="context">{'contact_display': 'partner'}</field>
</record>