merging from the trunk addon

bzr revid: mga@tinyerp.com-20081114070741-y398s9tt9ja2nvzz
This commit is contained in:
Mantavya Gajjar 2008-11-14 12:37:41 +05:30
commit d2b444f0c9
74 changed files with 1544 additions and 676 deletions

View File

@ -498,6 +498,17 @@ class account_fiscalyear(osv.osv):
'state': lambda *a: 'draft',
}
_order = "date_start"
def _check_duration(self,cr,uid,ids):
obj_fy=self.browse(cr,uid,ids[0])
if obj_fy.date_stop < obj_fy.date_start:
return False
return True
_constraints = [
(_check_duration, 'Error ! The date duration of the Fiscal Year is invalid. ', ['date_stop'])
]
def create_period3(self,cr, uid, ids, context={}):
return self.create_period(cr, uid, ids, context, 3)
@ -507,6 +518,10 @@ class account_fiscalyear(osv.osv):
ds = mx.DateTime.strptime(fy.date_start, '%Y-%m-%d')
while ds.strftime('%Y-%m-%d')<fy.date_stop:
de = ds + RelativeDateTime(months=interval, days=-1)
if de.strftime('%Y-%m-%d')>fy.date_stop:
de=mx.DateTime.strptime(fy.date_stop, '%Y-%m-%d')
self.pool.get('account.period').create(cr, uid, {
'name': ds.strftime('%m/%Y'),
'code': ds.strftime('%m/%Y'),
@ -544,6 +559,24 @@ class account_period(osv.osv):
'state': lambda *a: 'draft',
}
_order = "date_start"
def _check_duration(self,cr,uid,ids):
obj_period=self.browse(cr,uid,ids[0])
if obj_period.date_stop < obj_period.date_start:
return False
return True
def _check_year_limit(self,cr,uid,ids):
obj_period=self.browse(cr,uid,ids[0])
if obj_period.fiscalyear_id.date_stop < obj_period.date_stop or obj_period.fiscalyear_id.date_stop < obj_period.date_start or obj_period.fiscalyear_id.date_start > obj_period.date_start or obj_period.fiscalyear_id.date_start > obj_period.date_stop:
return False
return True
_constraints = [
(_check_duration, 'Error ! The date duration of the Period(s) is invalid. ', ['date_stop']),
(_check_year_limit, 'Error ! The date duration of the Period(s) should be within the limit of the Fiscal year. ', ['date_stop'])
]
def next(self, cr, uid, period, step, context={}):
ids = self.search(cr, uid, [('date_start','>',period.date_start)])
if len(ids)>=step:
@ -648,7 +681,7 @@ class account_move(osv.osv):
data_move = self.pool.get('account.move').browse(cursor,user,ids)
for move in data_move:
if move.state=='draft':
name = '*' + move.name
name = '*' + str(move.id)
else:
name = move.name
res.append((move.id, name))
@ -671,7 +704,7 @@ class account_move(osv.osv):
return result
_columns = {
'name': fields.char('Entry Name', size=64, required=True),
'name': fields.char('Entry Number', size=64, required=True),
'ref': fields.char('Ref', size=64),
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}),
@ -692,6 +725,7 @@ class account_move(osv.osv):
],'Type', readonly=True, select=True, states={'draft':[('readonly',False)]}),
}
_defaults = {
'name': lambda *a: '/',
'state': lambda *a: 'draft',
'period_id': _get_period,
'type' : lambda *a : 'journal_voucher',
@ -727,6 +761,17 @@ class account_move(osv.osv):
]
def post(self, cr, uid, ids, context=None):
if self.validate(cr, uid, ids, context) and len(ids):
for move in self.browse(cr, uid, ids):
if move.name =='/':
new_name = False
journal = move.journal_id
if journal.sequence_id:
new_name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
if new_name:
self.write(cr, uid, [move.id], {'name':new_name})
cr.execute('update account_move set state=%s where id in ('+','.join(map(str,ids))+')', ('posted',))
else:
raise osv.except_osv(_('Integrity Error !'), _('You can not validate a non balanced entry !'))
@ -772,12 +817,6 @@ class account_move(osv.osv):
l[2]['period_id'] = default_period
context['period_id'] = default_period
if not 'name' in vals:
journal = self.pool.get('account.journal').browse(cr, uid, context.get('journal_id', vals.get('journal_id', False)))
if journal.sequence_id:
vals['name'] = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'])
if 'line_id' in vals:
c = context.copy()
@ -788,6 +827,13 @@ class account_move(osv.osv):
result = super(account_move, self).create(cr, uid, vals, context)
return result
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default = default.copy()
default.update({'state':'draft', 'name':'/',})
return super(account_move, self).copy(cr, uid, id, default, context)
def unlink(self, cr, uid, ids, context={}, check=True):
toremove = []
for move in self.browse(cr, uid, ids, context):
@ -879,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):
@ -1059,13 +1105,13 @@ class account_tax_code(osv.osv):
return res
def _sum_period(self, cr, uid, ids, name, args, context):
if not 'period_id' in context:
if 'period_id' in context and context['period_id']:
period_id = context['period_id']
else:
period_id = self.pool.get('account.period').find(cr, uid)
if not len(period_id):
return dict.fromkeys(ids, 0.0)
period_id = period_id[0]
else:
period_id = context['period_id']
return self._sum(cr, uid, ids, name, args, context,
where=' and line.period_id='+str(period_id))

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 !'))

View File

@ -797,7 +797,8 @@
<field name="name"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="line_id"/>
<field name="state"/>
</tree>
@ -810,19 +811,15 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Entry">
<separator colspan="4" string="General Information"/>
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="name" select="1" readonly="True"/>
<field name="period_id" select="2"/>
<field name="journal_id" select="1"/>
<field name="partner_id" select="2"/>
<field name="amount" select="2"/>
<field name="ref" select="1" groups="base.group_extended"/>
<field name="to_check" select="2" groups="base.group_extended"/>
<field name="type" select="1" groups="base.group_extended"/>
</group>
<separator colspan="4" string="Entry Lines"/>
<field colspan="4" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
@ -855,12 +852,13 @@
<field name="account_id"/>
<field name="date_maturity"/>
<field name="ref"/>
<field name="debit"/>
<field name="credit"/>
<field name="debit" sum="Total Debit"/>
<field name="credit" sum="Total Credit"/>
<field name="state"/>
</tree>
</field>
<separator colspan="4" string="State"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<button name="button_validate" states="draft" string="Validate" type="object"/>
@ -991,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"/>

View File

@ -286,6 +286,16 @@
<field name="code">account.journal</field>
<field name="prefix"/>
</record>
<record id="sequence_sale_journal" model="ir.sequence">
<field name="name">Sale Journal</field>
<field name="code">account.journal</field>
<field name="prefix"/>
</record>
<record id="sequence_purchase_journal" model="ir.sequence">
<field name="name">Purchase Journal</field>
<field name="code">account.journal</field>
<field name="prefix"/>
</record>
<!--
Account Statement Sequences

View File

@ -166,7 +166,7 @@ your own chart of account.
<field name="code">SAJ</field>
<field name="type">sale</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_journal"/>
<field name="sequence_id" ref="sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" search="[('type','=','receivable')]"/>
<field model="account.account" name="default_debit_account_id" search="[('type','=','receivable')]"/>
<field name="user_id" ref="base.user_root"/>
@ -176,7 +176,7 @@ your own chart of account.
<field name="code">EXJ</field>
<field name="type">purchase</field>
<field name="view_id" ref="account_journal_view"/>
<field name="sequence_id" ref="sequence_journal"/>
<field name="sequence_id" ref="sequence_purchase_journal"/>
<field model="account.account" name="default_debit_account_id" search="[('type','=','payable')]"/>
<field model="account.account" name="default_credit_account_id" search="[('type','=','payable')]"/>
<field name="user_id" ref="base.user_root"/>

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

View File

@ -191,6 +191,7 @@ class account_invoice(osv.osv):
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'),
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual', store=True, help="Remaining amount due."),
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
'move_name': fields.char('Account Move', size=64),
}
_defaults = {
'type': _get_type,
@ -323,7 +324,7 @@ class account_invoice(osv.osv):
if default is None:
default = {}
default = default.copy()
default.update({'state':'draft', 'number':False, 'move_id':False})
default.update({'state':'draft', 'number':False, 'move_id':False, 'move_name':False,})
if 'date_invoice' not in default:
default['date_invoice'] = False
if 'date_due' not in default:
@ -568,8 +569,10 @@ class account_invoice(osv.osv):
journal_id = inv.journal_id.id #self._get_journal(cr, uid, {'type': inv['type']})
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
if journal.sequence_id:
if journal.sequence_id and not inv.move_name:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
name = inv.move_name
if journal.centralisation:
raise osv.except_osv(_('UserError'),
_('Can not create invoice move on centralized journal'))
@ -585,8 +588,9 @@ class account_invoice(osv.osv):
for i in line:
i[2]['period_id'] = period_id
move_id = self.pool.get('account.move').create(cr, uid, move)
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id})
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
self.pool.get('account.move').post(cr, uid, [move_id])
self._log_event(cr, uid, ids)
return True
@ -714,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 = []
@ -737,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

View File

@ -161,7 +161,7 @@ class account_balance(report_sxw.rml_parse):
if not account.child_id:
return bool(account.credit or account.debit)
for c in account.child_id:
if not _check_rec(c):
if not _check_rec(c) or _check_rec(c):
return True
return False
if not _check_rec(account) :
@ -169,10 +169,10 @@ class account_balance(report_sxw.rml_parse):
if form['display_account'] == 'bal_mouvement':
if res['credit'] >= 0 or res['debit'] >= 0 or res['balance'] >= 0 :
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
result_acc.append(res)
elif form['display_account'] == 'bal_solde':
if res['balance'] >= 0:
if res['balance'] > 0:
result_acc.append(res)
else:
result_acc.append(res)
@ -184,6 +184,7 @@ class account_balance(report_sxw.rml_parse):
a_id = self.cr.fetchall()
a_id.sort()
ids2 = [x[1] for x in a_id]
result_acc += self.lines(form, ids2, done, level+1)
return result_acc

View File

@ -63,8 +63,8 @@ period_fields = {
'help':'Keep empty for all open fiscal year'
},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With Movements'),('bal_solde','With Balance != 0'),('bal_all','All')]},
'date_from': {'string':" Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
}

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:

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"

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:

View File

@ -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>

View File

@ -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>

View File

@ -180,7 +180,7 @@
<field name="name">Payment order</field>
<field name="res_model">payment.order</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="account_payment.menu_main" sequence="3"/>
@ -202,6 +202,15 @@
</record>
<menuitem action="action_payment_order_open" id="menu_action_payment_order_open" parent="account_payment.menu_action_payment_order_form" sequence="2"/>
<record id="action_payment_order_tree_new" model="ir.actions.act_window">
<field name="name">New Payment Order</field>
<field name="res_model">payment.order</field>
<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_main" sequence="3"/>
<record id="view_payment_line_form" model="ir.ui.view">
<field name="name">Payment Line</field>
<field name="model">payment.line</field>

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$
#
@ -53,22 +53,58 @@ class account_report(osv.osv):
# ]
def _amount_get(self, cr, uid, ids, field_name, arg, context={}):
def _calc_credit(*code):
obj_fy=self.pool.get('account.fiscalyear')
obj_period=self.pool.get('account.period')
def _calc_context(key,obj):
if key==0:
return obj.find(cr,uid)
else:
obj_key=obj.browse(cr,uid,obj.find(cr,uid))
if isinstance(obj_key,list):
obj_key=obj_key[0]
key_ids=obj.search(cr,uid,[('date_stop','<',obj_key.date_start)])
if len(key_ids)<abs(key):
return False
return key_ids[key]
def _calc_credit(code,year=0):
context['fiscalyear']=_calc_context(year,obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.credit+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_debit(*code):
def _calc_debit(code,year=0):
context['fiscalyear']=_calc_context(year,obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.debit+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_balance(*code):
def _calc_balance(code,year=0):
context['fiscalyear']=_calc_context(year,obj_fy)
if not context['fiscalyear']:
del context['fiscalyear']
acc = self.pool.get('account.account')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.balance+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_report(*code):
acc = self.pool.get('account.report.report')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.amount+y, acc.browse(cr, uid, acc_id, context),0)
def _calc_tax_code(code,period=0):
context['period_id']=_calc_context(period,obj_period)
if not context['period_id']:
return 0.00
context['period_id']=context['period_id'][0]
acc = self.pool.get('account.tax.code')
acc_id = acc.search(cr, uid, [('code','in',code)])
return reduce(lambda y,x=0: x.sum_period+y, acc.browse(cr, uid, acc_id, context),0)
result = {}
for rep in self.browse(cr, uid, ids, context):
objdict = {
@ -76,6 +112,7 @@ class account_report(osv.osv):
'credit': _calc_credit,
'balance': _calc_balance,
'report': _calc_report,
'tax_code': _calc_tax_code,
}
# if field_name=='status':
# fld_name = 'expression_status'

View File

@ -27,29 +27,37 @@
<field name="disp_graph"/>
<!-- <field colspan="4" name="expression_status"/>-->
<separator colspan="4" string="Legend of operators"/>
<label align="1.0" string="Account debit:"/>
<label align="0.0" string="debit('ACCOUNT_CODE')"/>
<label align="1.0" string="Account credit:"/>
<label align="0.0" string="credit('ACCOUNT_CODE')"/>
<label align="1.0" string="Account balance:"/>
<label align="0.0" string="balance('ACCOUNT_CODE')"/>
<label align="1.0" string="Report amount:"/>
<label align="1.0" string="Account Debit:"/>
<label align="0.0" string="debit(['ACCOUNT_CODE',],fiscalyear)"/>
<label align="1.0" string="Account Credit:"/>
<label align="0.0" string="credit(['ACCOUNT_CODE',],fiscalyear)"/>
<label align="1.0" string="Account Balance:"/>
<label align="0.0" string="balance(['ACCOUNT_CODE',],fiscalyear)"/>
<label align="1.0" string="Account Tax Code:"/>
<label align="0.0" string="tax_code(['ACCOUNT_TAX_CODE',],period)"/>
<label align="1.0" string="Report Amount:"/>
<label align="0.0" string="report('REPORT_CODE')"/>
<newline/>
<label align="1.0" string="Operators:"/>
<label align="0.0" string="+ - * / ( )"/>
<label colspan="4" string="Example: (balance('6','45') - credit('7')) / report('RPT1')"/>
<label colspan="4" string="Example: (balance(['6','45'],-1) - credit(['7'])) / report('RPT1')"/>
<label colspan="4" string="Note: The second arguement 'fiscalyear' and 'period' are optional arguements.If the value is -1,previous fiscalyear or period is considered."/>
<separator colspan="4" string="Return value for status"/>
<group col="2" colspan="2">
<label align="1.0" string="&lt; Badness Indicator Limit:"/>
<label align="0.0" string="Very bad"/>
<newline/>
<label align="1.0" string="= Badness Indicator Limit:"/>
<label align="0.0" string="Bad"/>
<newline/>
<!--<label align="1.0" string="0:"/>
<label align="0.0" string="Normal"/>-->
<label align="1.0" string="= Goodness Indicator Limit:"/>
<label align="0.0" string="Good"/>
<newline/>
<label align="1.0" string="&gt; Goodness Indicator Limit:"/>
<label align="0.0" string="Very Good"/>
<newline/>
</group>
<group col="2" colspan="2">
</group>

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$
#
@ -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':

View File

@ -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>

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$
#
@ -22,12 +22,13 @@
{
"name" : "Auction module",
"version" : "1.0",
"category" : "Generic Modules/Others",
"depends" : ["base","account","l10n_be","hr_attendance"],
"update_xml" : [
# FIXME: review security rules...
"security/ir.model.access.csv",
"auction_view.xml",
"auction_report.xml",
"auction_view.xml",
"auction_report.xml",
"auction_wizard.xml",
],
"demo_xml" : [

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$
#
@ -24,16 +24,16 @@
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"category" : "Generic Modules/Base Contact",
"category" : "Generic Modules/Base",
"description": """
This module allows you to manage entirely your contacts.
This module allows you to manage entirely your contacts.
It lets you define
It lets you define
*contacts unrelated to a partner,
*contacts working at several adresses (possibly for different partners),
*contacts working at several adresses (possibly for different partners),
*contacts with possibly different functions for each of its job's addresses
It also add new menuitems located in
It also add new menuitems located in
Partners \ Contacts
Partners \ Functions

View File

@ -26,12 +26,43 @@ 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"
_columns = {
}
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:
@ -39,6 +70,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):
@ -166,6 +204,7 @@ class base_module_record(osv.osv):
self.ids[(rec[3],result)] = id
record_list += record
return record_list,noupdate
def _generate_assert_xml(self, rec, doc):
pass
def generate_xml(self, cr, uid):
@ -202,39 +241,5 @@ class base_module_record(osv.osv):
res = doc.toprettyxml(indent="\t")
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
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
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:

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$
#
@ -23,7 +23,7 @@
"name":"Board for Auction",
"version":"1.0",
"author":"Tiny",
"category":"Board",
"category":"Board/Auction",
"depends":[
"board",
"auction",

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$
#
@ -23,7 +23,7 @@
"name":"Dashboard for CRM Configuration",
"version":"1.0",
"author":"Tiny",
"category":"Board",
"category":"Board/CRM",
"depends":["board","crm_configuration"],
"demo_xml":["board_crm_demo.xml"],
"update_xml":["board_crm_statistical_view.xml",

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$
#
@ -23,7 +23,7 @@
"name":"Board for manufacturing",
"version":"1.0",
"author":"Tiny",
"category":"Board",
"category":"Board/Manufacturing",
"depends":[
"board",
"mrp",

View File

@ -347,8 +347,8 @@ class crm_case(osv.osv):
'date_closed': fields.datetime('Closed', readonly=True),
'canal_id': fields.many2one('res.partner.canal', 'Channel'),
'user_id': fields.many2one('res.users', 'Responsible'),
'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication'),
'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History'),
'history_line': fields.one2many('crm.case.history', 'case_id', 'Communication', readonly=1),
'log_ids': fields.one2many('crm.case.log', 'case_id', 'Logs History', readonly=1),
'state': fields.selection(AVAILABLE_STATES, 'Status', size=16, readonly=True),
'ref' : fields.reference('Reference', selection=_links_get, size=128),
'ref2' : fields.reference('Reference 2', selection=_links_get, size=128),

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" />

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">

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)

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"/>

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"/>

View File

@ -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"/>

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$
#
@ -25,19 +25,19 @@
"depends" : ["base", "crm"],
"author" : "Tiny",
"description": """
This module allow users to perform segmentation within partners.
This module allow users to perform segmentation within partners.
It use the profiles criteria from the earlier segmentation module and improve it thanks to the new concept of questionnaire. You can now regroup questions into a questionnaire and directly use it on a partner.
It also has been merged with the earlier CRM & SRM segmentation tool because they were overlapping.
It also has been merged with the earlier CRM & SRM segmentation tool because they were overlapping.
The menu items related are in "CRM & SRM\Configuration\Segmentations\"
* Note: this module is not compatible with the module segmentation, since it's the same which has been renamed.
""",
"website" : "http://tinyerp.com/",
"category" : "Generic Modules/Project & Services",
"category" : "Generic Modules/CRM & SRM",
"init_xml" : [],
"demo_xml" : ["crm_profiling_demo.xml"],
"update_xml" : [

View File

@ -84,7 +84,7 @@ class make_delivery(wizard.interface):
states = {
'init' : {
'actions' : [_delivery_default],
'result' : {'type' : 'form', 'arch' : delivery_form, 'fields' : delivery_fields, 'state' : [('end', 'Cancel'),('delivery', 'Create delivery line') ]}
'result' : {'type' : 'form', 'arch' : delivery_form, 'fields' : delivery_fields, 'state' : [('end', 'Cancel', 'gtk-cancel'),('delivery', 'Add Delivery Costs', 'gtk-ok') ]}
},
'delivery' : {
'actions' : [_delivery_set],

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)
@ -470,7 +471,7 @@ def random_name():
def create_directory(path):
dir_name = random_name()
path = os.path.join(path,dir_name)
os.mkdir(path)
os.makedirs(path)
return dir_name
class document_file(osv.osv):
@ -483,7 +484,7 @@ class document_file(osv.osv):
result[id] = d
elif m=='fs':
try:
path = os.path.join(os.getcwd(),'filestore')
path = os.path.join(os.getcwd(), 'filestore', cr.dbname)
value = file(os.path.join(path,r), 'rb').read()
result[id] = base64.encodestring(value)
except:
@ -499,9 +500,9 @@ class document_file(osv.osv):
if not value:
return True
if (not context) or context.get('store_method','fs')=='fs':
path = os.path.join(os.getcwd(), "filestore")
path = os.path.join(os.getcwd(), "filestore", cr.dbname)
if not os.path.isdir(path):
os.mkdir(path)
os.makedirs(path)
flag = None
# This can be improved
for dirs in os.listdir(path):
@ -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
@ -617,7 +620,7 @@ class document_file(osv.osv):
for f in self.browse(cr, uid, ids, context):
if f.store_method=='fs':
try:
path = os.path.join(os.getcwd(),'filestore',f.store_fname)
path = os.path.join(os.getcwd(), cr.dbname, 'filestore',f.store_fname)
os.unlink(path)
except:
pass

View File

@ -120,7 +120,6 @@ class document_directory_content(osv.osv):
if type(value)==type(obj):
value=value.name
value = value or ''
print value
event.add(field.name).value = value and value.decode('utf8') or ''
elif ICS_TAGS[field.name]=='date':
dt = value or time.strftime('%Y-%m-%d %H:%M:%S')

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$
#
@ -24,7 +24,7 @@
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"category" : "Generic Modules",
"category" : "Generic Modules/Others",
"description": """The module adds google map field in partner address
so that we can directly open google map from the
url widget.""",

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$
#

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>

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-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>

View File

@ -1,11 +1,11 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
<!--
Process Node
-->
-->
<record id="process_node_timesheettask0" model="process.node">
<field name="menu_id" ref="hr_timesheet.menu_act_hr_timesheet_line_evry1_today_form"/>
<field name="model_id" ref="hr.model_hr_timesheet"/>
@ -16,7 +16,7 @@
<field eval="&quot;&quot;&quot;object.state=='draft'&quot;&quot;&quot;" name="model_states"/>
<field eval="0" name="flow_start"/>
</record>
<record id="process_node_workontask0" model="process.node">
<field name="menu_id" ref="project.menu_action_view_task"/>
<field name="model_id" ref="project.model_project_task"/>
@ -27,9 +27,9 @@
<field eval="&quot;&quot;&quot;object.state in ('open', pending', 'done', 'cancelled')&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_taskwork0" model="process.node">
<field name="menu_id" ref="project.menu_action_view_task6"/>
<field name="menu_id" ref="project.menu_action_view_task6_prog"/>
<field name="model_id" ref="project.model_project_task_work"/>
<field eval="&quot;&quot;&quot;state&quot;&quot;&quot;" name="kind"/>
<field eval="&quot;&quot;&quot;Task Work&quot;&quot;&quot;" name="name"/>
@ -38,11 +38,11 @@
<field eval="&quot;&quot;&quot;object.state=='open'&quot;&quot;&quot;" name="model_states"/>
<field eval="1" name="flow_start"/>
</record>
<!--
<!--
Process Transition
-->
<record id="process_transition_filltimesheet0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
@ -51,7 +51,7 @@
<field model="process.node" name="target_node_id" ref="process_node_timesheettask0"/>
<field model="process.node" name="source_node_id" ref="project.process_node_opentask0"/>
</record>
<record id="process_transition_taskencoding0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
@ -60,7 +60,7 @@
<field model="process.node" name="target_node_id" ref="hr_timesheet_sheet.process_node_timesheetline0"/>
<field model="process.node" name="source_node_id" ref="process_node_taskwork0"/>
</record>
<record id="process_transition_tasktimesheet0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
@ -69,7 +69,7 @@
<field model="process.node" name="target_node_id" ref="process_node_timesheettask0"/>
<field model="process.node" name="source_node_id" ref="process_node_workontask0"/>
</record>
</data>
</openerp>

View File

@ -1,21 +1,21 @@
"expression","note","parent_id","sequence","badness_limit","goodness_limit","type","code","name"
0,,,,0,1,"indicator","BILAN","Bilan"
"report('BIMMO','BSTOCK','BREAL','BDISPO')",,"BILAN",,0,1,"fiscal","Actif","Actif"
"balance('2')",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
"balance('3')",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
"balance('4')",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
"balance('5')",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
"balance(][2'])",,"Actif",,0,1,"indicator","BIMMO","Valeurs immobilisées"
"balance(['3']",,"Actif",2,0,1,"indicator","BSTOCK","Stocks"
"balance(['4'])",,"Actif",3,0,1,"indicator","BREAL","Réalisable"
"balance(['5'])",,"Actif",4,0,1,"fiscal","BDISPO","Disponible"
"report('BCAP') + report('BRESNET')",,"BILAN",1,0,1,"fiscal","PASSIF","Passif"
"balance('1')",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
"-balance('7')+balance('6')",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
"balance(['1'])",,"PASSIF",1,0,1,"indicator","BCAP","Capitaux propores"
"-balance(['7'])+balance(['6'])",,"PASSIF",,0,1,"fiscal","BRESNET","Résultat net"
0,,,,0,1,"fiscal","CRES","Compte des résultats"
"report('CCHAR','CBENEF')",,"CRES",,0,1,"fiscal","CRESACTIF","Résultat Actif"
"balance('6')",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
"balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CCHAR","Total des charges"
"report('CRESPROD')",,"CRES",,0,1,"fiscal","CRESPASSIF","Résultat Passif"
"-balance('7')",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
"-balance('7')+balance('6')",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
"-balance(['7'])",,"CRESPASSIF",,0,1,"fiscal","CRESPROD","Total des produits"
"-balance(['7'])+balance(['6'])",,"CRESACTIF",,0,1,"fiscal","CBENEF","Résultat (Bénéfice)"
0,,,,0,1,"indicator","IIMMO","Immobilisations"
"balance('1')/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
"balance(['1'])/balance(map(str(range(21,29))))","Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité.","IIMMO",,0,1,"indicator","CIMMO","Couverture des immobilisations"
0,,,,0,1,"indicator","ITRE","Trésorerie"
"balance('3','4','5') / balance('101','13','15','16','17','18')","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
"balance('4','5') / balance('101','13','15','16','17','18')",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"
"balance(['3','4','5']) / balance(['101','13','15','16','17','18'])","Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme","ITRE",,0,1,"indicator","IFR","Indice du fond de roulement"
"balance(['4','5']) / balance(['101','13','15','16','17','18'])",,"ITRE",,0,1,"indicator","RTRE","Ratio de trésorerie"

1 expression note parent_id sequence badness_limit goodness_limit type code name
2 0 0 1 indicator BILAN Bilan
3 report('BIMMO','BSTOCK','BREAL','BDISPO') BILAN 0 1 fiscal Actif Actif
4 balance('2') balance(][2']) Actif 0 1 indicator BIMMO Valeurs immobilisées
5 balance('3') balance(['3'] Actif 2 0 1 indicator BSTOCK Stocks
6 balance('4') balance(['4']) Actif 3 0 1 indicator BREAL Réalisable
7 balance('5') balance(['5']) Actif 4 0 1 fiscal BDISPO Disponible
8 report('BCAP') + report('BRESNET') BILAN 1 0 1 fiscal PASSIF Passif
9 balance('1') balance(['1']) PASSIF 1 0 1 indicator BCAP Capitaux propores
10 -balance('7')+balance('6') -balance(['7'])+balance(['6']) PASSIF 0 1 fiscal BRESNET Résultat net
11 0 0 1 fiscal CRES Compte des résultats
12 report('CCHAR','CBENEF') CRES 0 1 fiscal CRESACTIF Résultat Actif
13 balance('6') balance(['6']) CRESACTIF 0 1 fiscal CCHAR Total des charges
14 report('CRESPROD') CRES 0 1 fiscal CRESPASSIF Résultat Passif
15 -balance('7') -balance(['7']) CRESPASSIF 0 1 fiscal CRESPROD Total des produits
16 -balance('7')+balance('6') -balance(['7'])+balance(['6']) CRESACTIF 0 1 fiscal CBENEF Résultat (Bénéfice)
17 0 0 1 indicator IIMMO Immobilisations
18 balance('1')/balance(map(str(range(21,29)))) balance(['1'])/balance(map(str(range(21,29)))) Dans une entreprise normalement équilibrée, les valeurs immobilisées sont couvertes en premier lieu par les capitaux propres et, en second lieu, par tout ou partie du passif à long terme. Idéalement, ce ratio (rapport entre capitaux permanents et les valeurs immobilisées) doit être suppérieur à l'unité. IIMMO 0 1 indicator CIMMO Couverture des immobilisations
19 0 0 1 indicator ITRE Trésorerie
20 balance('3','4','5') / balance('101','13','15','16','17','18') balance(['3','4','5']) / balance(['101','13','15','16','17','18']) Détermine si l'entreprise a la possibilité de s'acquitter de ses dettes à court terme dans des conditions normales. Calculé comme suit: (Stocks + Réalisable + Disponible ) / Passif exigible à court terme ITRE 0 1 indicator IFR Indice du fond de roulement
21 balance('4','5') / balance('101','13','15','16','17','18') balance(['4','5']) / balance(['101','13','15','16','17','18']) ITRE 0 1 indicator RTRE Ratio de trésorerie

View File

@ -15,7 +15,7 @@ import tools
from report.render import render
from report.interface import report_int
import os
import pdf_ext
_tax_form = """<?xml version="1.0"?>
<form string="VAT Legal Declaration">
@ -69,7 +69,7 @@ class report_custom(report_int):
result['info_address'] = partner.address[0].street
result['info_address2'] = str(partner.address[0].zip) + ' ' + str(partner.address[0].city)
pdf_ext.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result)
tools.pdf_utils.fill_pdf(tools.config['addons_path']+'/l10n_lu/wizard/2008_DECL_F_M10.pdf', '/tmp/output.pdf', result)
self.obj = external_pdf(file('/tmp/output.pdf').read())
self.obj.render()
return (self.obj.pdf, 'pdf')

View File

@ -410,6 +410,15 @@ class mrp_production(osv.osv):
'name': lambda x,y,z,c: x.pool.get('ir.sequence').get(y,z,'mrp.production') or '/',
}
_order = 'date_planned asc, priority desc';
def unlink(self, cr, uid, ids):
productions = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in productions:
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Production Order(s) which are in %s State!' % s['state']))
return osv.osv.unlink(self, cr, uid, unlink_ids)
def location_id_change(self, cr, uid, ids, src, dest, context={}):
if dest:
@ -466,7 +475,7 @@ class mrp_production(osv.osv):
if production.move_created_ids:
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_created_ids])
self.pool.get('stock.move').action_cancel(cr, uid, [x.id for x in production.move_lines])
self.write(cr, uid, ids, {'state':'cancel','move_lines':[(6,0,[])]})
self.write(cr, uid, ids, {'state':'cancel'}) #,'move_lines':[(6,0,[])]})
return True
#XXX: may be a bug here; lot_lines are unreserved for a few seconds;
@ -771,6 +780,17 @@ class mrp_procurement(osv.osv):
'close_move': lambda *a: 0,
'procure_method': lambda *a: 'make_to_order',
}
def unlink(self, cr, uid, ids):
procurements = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in procurements:
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Procurement Order(s) which are in %s State!' % s['state']))
return osv.osv.unlink(self, cr, uid, unlink_ids)
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
if product_id:
w=self.pool.get('product.product').browse(cr,uid,product_id, context)
@ -1034,10 +1054,10 @@ class mrp_procurement(osv.osv):
def action_cancel(self, cr, uid, ids):
todo = []
for proc in self.browse(cr, uid, ids):
if proc.move_id:
if proc.move_id and proc.move_id.state=='waiting':
todo.append(proc.move_id.id)
if len(todo):
self.pool.get('stock.move').action_cancel(cr, uid, [proc.move_id.id])
self.pool.get('stock.move').write(cr, uid, todo, {'state':'assigned'})
self.write(cr, uid, ids, {'state':'cancel'})
wf_service = netsvc.LocalService("workflow")

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"/>

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:

View File

@ -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')

View File

@ -198,7 +198,17 @@ class purchase_order(osv.osv):
_name = "purchase.order"
_description = "Purchase order"
_order = "name desc"
def unlink(self, cr, uid, ids):
purchase_orders = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in purchase_orders:
if s['state'] in ['draft','cancel']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state']))
return osv.osv.unlink(self, cr, uid, unlink_ids)
def button_dummy(self, cr, uid, ids, context={}):
return True
@ -328,19 +338,17 @@ class purchase_order(osv.osv):
raise osv.except_osv(
_('Could not cancel purchase order !'),
_('You must first cancel all packings attached to this purchase order.'))
for r in self.read(cr,uid,ids,['picking_ids']):
for pick in r['picking_ids']:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pick, 'button_cancel', cr)
for inv in purchase.invoice_ids:
if inv.state not in ('draft','cancel'):
raise osv.except_osv(
_('Could not cancel this purchase order !'),
_('You must first cancel all invoices attached to this purchase order.'))
for r in self.read(cr,uid,ids,['invoice_ids']):
for inv in r['invoice_ids']:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.invoice', inv, 'invoice_cancel', cr)
for pick in purchase.picking_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pick.id, 'button_cancel', cr)
inv = purchase.invoice_id
if inv and inv.state not in ('cancel','draft'):
raise osv.except_osv(
_('Could not cancel this purchase order !'),
_('You must first cancel all invoices attached to this purchase order.'))
if inv:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.invoice', inv.id, 'invoice_cancel', cr)
self.write(cr,uid,ids,{'state':'cancel'})
return True

View File

@ -58,17 +58,17 @@
<field name="amount_total" sum="Total amount"/>
<button name="button_dummy" states="draft" string="Compute" type="object"/>
</group>
<group col="9" colspan="4">
<group col="11" colspan="4">
<field name="state" readonly="1"/>
<button name="purchase_confirm" states="draft" string="Confirm Purchase Order"/>
<button name="purchase_appbuyer" states="wait_auth" string="Approve Purchase"/>
<button name="purchase_approve" states="confirmed" string="Approved by Supplier"/>
<button name="purchase_cancel" states="draft,confirmed,wait_auth" string="Cancel Purchase Order"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_cancel" states="approved" string="Cancel Purchase Order" type="object"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
<button name="action_cancel" states="approved,except_picking,except_invoice" string="Cancel Purchase Order" type="object"/>
<button name="shipping_ok" states="except_shipping" string="Shipping Done"/>
<button name="invoice_ok" states="except_invoice" string="Invoice Done"/>
<button name="picking_ok" states="except_picking" string="Manually Corrected"/>
<button name="invoice_ok" states="except_invoice" string="Manually Corrected"/>
</group>
</page>
<page string="Delivery &amp; Invoices">

View File

@ -23,6 +23,7 @@
<field name="wkf_id" ref="purchase_order"/>
<field name="name">cancel</field>
<field name="kind">function</field>
<field name="flow_stop">True</field>
<field name="action">write({'state':'cancel'})</field>
</record>
<record id="act_except_invoice" model="workflow.activity">
@ -54,7 +55,7 @@
<record id="act_invoice_done" model="workflow.activity">
<field name="wkf_id" ref="purchase_order"/>
<field name="name">invoice_done</field>
<field name="action">write({'invoiced':1})</field>
<field name="action">write({'invoiced':1,'state':'approved'})</field>
<field name="kind">function</field>
</record>
<record id="act_invoice_end" model="workflow.activity">
@ -71,7 +72,7 @@
<record id="act_picking_done" model="workflow.activity">
<field name="wkf_id" ref="purchase_order"/>
<field name="name">picking_done</field>
<field name="action">write({'shipped':1})</field>
<field name="action">write({'shipped':1,'state':'approved'})</field>
<field name="kind">function</field>
<field name="signal_send">subflow.delivery_done</field>
</record>

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>

View File

@ -1,21 +1,21 @@
<?xml version="1.0" ?>
<openerp>
<data>
<!--
<!--
Process
-->
<record id="process_process_salesworkflow0" model="process.process">
<field eval="1" name="active"/>
<field eval="'From the quotation to the delivery and invoices.'" name="note"/>
<field eval="'Sales Workflow'" name="name"/>
</record>
<!--
Process Node
<!--
Process Node
-->
<record id="process_node_order0" model="process.node">
<field name="menu_id" ref="sale.menu_sale_order"/>
<field name="model_id" ref="sale.model_sale_order"/>
@ -27,7 +27,7 @@
<field name="model_states">object.state=='draft'</field>
<field eval="1" name="flow_start"/>
</record>
<record id="process_node_saleorderprocurement0" model="process.node">
<field name="menu_id" ref="sale.menu_sale_order"/>
<field name="model_id" ref="sale.model_sale_order"/>
@ -99,8 +99,8 @@
<field name="subflow_id" ref="account.process_process_invoiceworkflow0"/>
<field eval="0" name="flow_start"/>
</record>
<!--
<!--
Process Condition
-->
@ -110,23 +110,23 @@
<field name="model_states">object.order_policy=='postpaid'</field>
<field eval="'condition_after_delivery'" name="name"/>
</record>
<!--
<!--
Process Transition
-->
<record id="res_roles_salesman0" model="res.roles">
<field eval="'Salesman'" name="name"/>
</record>
<record id="sale.trans_draft_router" model="workflow.transition">
<field name="role_id" ref="res_roles_salesman0"/>
</record>
<record id="sale.trans_wait_invoice_invoice_manual" model="workflow.transition">
<field name="role_id" ref="res_roles_salesman0"/>
</record>
<record id="process_transition_confirmquotation0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="'Confirm Quotation'" name="name"/>
@ -143,7 +143,7 @@
<field model="process.node" name="target_node_id" ref="process_node_packinglist0"/>
<field model="process.node" name="source_node_id" ref="process_node_saleorder0"/>
</record>
<record id="process_transition_deliver0" model="process.transition">
<field eval="[(6,0,[])]" name="transition_ids"/>
<field eval="'Deliver'" name="name"/>
@ -168,7 +168,7 @@
<field model="process.node" name="target_node_id" ref="process_node_invoiceafterdelivery0"/>
<field model="process.node" name="source_node_id" ref="process_node_deliveryorder0"/>
</record>
<record id="process_transition_saleprocurement0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
@ -177,7 +177,7 @@
<field model="process.node" name="target_node_id" ref="mrp.process_node_procureproducts0"/>
<field model="process.node" name="source_node_id" ref="process_node_saleorderprocurement0"/>
</record>
<record id="process_transition_saleinvoice0" model="process.transition">
<field eval="[(6,0,[])]" name="role_ids"/>
<field eval="[(6,0,[])]" name="transition_ids"/>
@ -186,11 +186,11 @@
<field model="process.node" name="target_node_id" ref="account.process_node_draftinvoices0"/>
<field model="process.node" name="source_node_id" ref="process_node_order0"/>
</record>
<!--
<!--
Process Action
-->
<record id="process_transition_action_confirm0" model="process.transition.action">
<field eval="'action_wait'" name="action"/>
<field eval="'object'" name="state"/>
@ -204,7 +204,7 @@
<field eval="'Cancel'" name="name"/>
<field name="transition_id" ref="process_transition_confirmquotation0"/>
</record>
<record id="process_transition_action_assign0" model="process.transition.action">
<field eval="'action_assign'" name="action"/>
<field eval="'object'" name="state"/>
@ -225,7 +225,7 @@
<field eval="'Cancel'" name="name"/>
<field name="transition_id" ref="process_transition_packing0"/>
</record>
<record id="process_transition_action_cancelassignation0" model="process.transition.action">
<field eval="'cancel_assign'" name="action"/>
<field eval="'object'" name="state"/>
@ -246,20 +246,20 @@
<field eval="'Cancel'" name="name"/>
<field name="transition_id" ref="process_transition_deliver0"/>
</record>
<record id="process_transition_action_createinvoice0" model="process.transition.action">
<field eval="'action_invoice_create'" name="action"/>
<field eval="'object'" name="state"/>
<field eval="'Create Invoice'" name="name"/>
<field name="transition_id" ref="process_transition_invoice0"/>
</record>
<record id="process_transition_action_cancelorder0" model="process.transition.action">
<field eval="'action_cancel'" name="action"/>
<field eval="'object'" name="state"/>
<field eval="'Cancel Order'" name="name"/>
<field name="transition_id" ref="process_transition_invoice0"/>
</record>
</data>
</openerp>

View File

@ -220,7 +220,7 @@ class sale_order(osv.osv):
- The 'Invoice after delivery' choice will generate the draft invoice after the packing list have been finished.
- The 'Invoice from the packings' choice is used to create an invoice during the packing process."""),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'project_id':fields.many2one('account.analytic.account', 'Analytic account', readonly=True, states={'draft':[('readonly', False)]}),
'project_id':fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft':[('readonly', False)]}),
'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft':[('readonly',False)]}),
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."),
@ -253,6 +253,16 @@ class sale_order(osv.osv):
_order = 'name desc'
# Form filling
def unlink(self, cr, uid, ids):
sale_orders = self.read(cr, uid, ids, ['state'])
unlink_ids = []
for s in sale_orders:
if s['state'] in ['draft','canceled']:
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Sale Order(s) which are already confirmed !'))
return osv.osv.unlink(self, cr, uid, unlink_ids)
def onchange_shop_id(self, cr, uid, ids, shop_id):
v={}
if shop_id:
@ -421,7 +431,7 @@ class sale_order(osv.osv):
'user_id': (o.user_id and o.user_id.id) or uid,\
'partner_type': 'customer', 'probability': 1.0,\
'planned_revenue': o.amount_untaxed})
if (o.order_policy == 'manual') and (not o.invoice_ids):
if (o.order_policy == 'manual'):
self.write(cr, uid, [o.id], {'state': 'manual'})
else:
self.write(cr, uid, [o.id], {'state': 'progress'})
@ -894,7 +904,6 @@ class sale_order_line(osv.osv):
}
else:
result.update({'price_unit': price})
print result
return {'value': result, 'domain': domain,'warning':warning}
def product_uom_change(self, cursor, user, ids, pricelist, product, qty=0,

View File

@ -46,6 +46,13 @@ class stock_picking(osv.osv):
return picking.sale_id.pricelist_id.currency_id.id
return False
def _get_payment_term(self, cursor, user, picking):
res = {}
if picking.sale_id and picking.sale_id.payment_term:
return picking.sale_id.payment_term.id
return super(stock_picking, self)._get_payment_term(cursor,
user, picking)
def _get_address_invoice(self, cursor, user, picking):
res = {}
if picking.sale_id:
@ -106,6 +113,76 @@ class stock_picking(osv.osv):
return super(stock_picking, self)._invoice_hook(cursor, user,
picking, invoice_id)
def action_invoice_create(self, cursor, user, ids, journal_id=False,
group=False, type='out_invoice', context=None):
invoice_obj = self.pool.get('account.invoice')
picking_obj = self.pool.get('stock.picking')
invoice_line_obj = self.pool.get('account.invoice.line')
result = super(stock_picking, self).action_invoice_create(cursor, user,
ids, journal_id=journal_id, group=group, type=type,
context=context)
picking_ids = result.keys()
invoice_ids = result.values()
invoices = {}
for invoice in invoice_obj.browse(cursor, user, invoice_ids,
context=context):
invoices[invoice.id] = invoice
for picking in picking_obj.browse(cursor, user, picking_ids,
context=context):
if not picking.sale_id:
continue
sale_lines = picking.sale_id.order_line
for sale_line in sale_lines:
if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
if group:
name = picking.name + '-' + sale_line.name
else:
name = sale_line.name
if type in ('out_invoice', 'out_refund'):
account_id = sale_line.product_id.product_tmpl_id.\
property_account_income.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
property_account_income_categ.id
else:
account_id = sale_line.product_id.product_tmpl_id.\
property_account_expense.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
property_account_expense_categ.id
price_unit = sale_line.price_unit
discount = sale_line.discount
tax_ids = sale_line.tax_id
account_analytic_id = self._get_account_analytic_invoice(cursor,
user, picking, sale_line)
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, picking.sale_id.partner_id, account_id)
invoice = invoices[result[picking.id]]
invoice_line_id = invoice_line_obj.create(cursor, user, {
'name': name,
'invoice_id': invoice.id,
'uos_id': sale_line.product_uos.id or sale_line.product_uom.id,
'product_id': sale_line.product_id.id,
'account_id': account_id,
'price_unit': price_unit,
'discount': discount,
'quantity': sale_line.product_uos_qty,
'invoice_line_tax_id': [(6, 0, tax_ids)],
'account_analytic_id': account_analytic_id,
}, context=context)
self.pool.get('sale.order.line').write(cursor, user, [sale_line.id], {'invoiced':True,
'invoice_lines': [(6, 0, [invoice_line_id])],
})
return result
stock_picking()

View File

@ -41,7 +41,7 @@ fields = {
form_msg = """<?xml version="1.0"?>
<form string="Invoices">
<label string="Invoice Created"/>
<label string="You invoice has been successfully created !"/>
</form>
"""
fields_msg = {}
@ -63,15 +63,15 @@ def _createInvoices(self, cr, uid, data, context={}):
_('You cannot make an advance on a sale order that is defined as \'Automatic Invoice after delivery\'.'))
val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id)
line_id =obj_lines.create(cr, uid, {
'name': val['value']['name'],
'account_id':val['value']['account_id'],
'price_unit': data['form']['amount'],
'quantity': data['form']['qtty'],
'discount': False,
'uos_id': val['value']['uos_id'],
'product_id':data['form']['product_id'],
'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
'note':'',
'name': val['value']['name'],
'account_id':val['value']['account_id'],
'price_unit': data['form']['amount'],
'quantity': data['form']['qtty'],
'discount': False,
'uos_id': val['value']['uos_id'],
'product_id':data['form']['product_id'],
'invoice_line_tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
'note':'',
})
create_ids.append(line_id)
inv = {
@ -96,6 +96,23 @@ def _createInvoices(self, cr, uid, data, context={}):
ids_inv.append(inv_id)
obj_sale.write(cr,uid,sale.id,{'invoice_ids':[(6,0,ids_inv)]})
list_inv.append(inv_id)
#
# If invoice on picking: add the cost on the SO
# If not, the advance will be deduced when generating the final invoice
#
if sale.order_policy=='picking':
pool_obj.get('sale.order.line').create(cr, uid, {
'order_id': sale.id,
'name': val['value']['name'],
'price_unit': -data['form']['amount'],
'product_uom_qty': data['form']['qtty'],
'product_uos_qty': data['form']['qtty'],
'product_uos': val['value']['uos_id'],
'product_uom': val['value']['uos_id'],
'product_id':data['form']['product_id'],
'discount': False,
'tax_id': [(6,0,val['value']['invoice_line_tax_id'])],
}, context)
return {'invoice_ids':list_inv}
class sale_advance_payment(wizard.interface):
@ -117,11 +134,11 @@ class sale_advance_payment(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel'),('create','Make Invoice')]}
'result' : {'type' : 'form' , 'arch' : form,'fields' : fields,'state' : [('end','Cancel','gtk-cancel'),('create','Create Advance Invoice','gtk-ok')]}
},
'create': {
'actions': [_createInvoices],
'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Ok'),('open','Open Invoice')]}
'result': {'type' : 'form' ,'arch' : form_msg,'fields' : fields_msg, 'state':[('end','Close','gtk-close'),('open','Open Advance Invoice','gtk-open')]}
},
'open': {
'actions': [],

View File

@ -382,7 +382,7 @@ class stock_picking(osv.osv):
('draft','Draft'),
('auto','Waiting'),
('confirmed','Confirmed'),
('assigned','Assigned'),
('assigned','Available'),
('done','Done'),
('cancel','Cancel'),
], 'Status', readonly=True, select=True),
@ -542,6 +542,12 @@ class stock_picking(osv.osv):
def get_currency_id(self, cursor, user, picking):
return False
def _get_payment_term(self, cursor, user, picking):
'''Return {'contact': address, 'invoice': address} for invoice'''
partner_obj = self.pool.get('res.partner')
partner = picking.address_id.partner_id
return partner.property_payment_term and partner.property_payment_term.id or False
def _get_address_invoice(self, cursor, user, picking):
'''Return {'contact': address, 'invoice': address} for invoice'''
partner_obj = self.pool.get('res.partner')
@ -595,13 +601,11 @@ class stock_picking(osv.osv):
def action_invoice_create(self, cursor, user, ids, journal_id=False,
group=False, type='out_invoice', context=None):
print "WW"*12,context
'''Return ids of created invoices for the pickings'''
invoice_obj = self.pool.get('account.invoice')
invoice_line_obj = self.pool.get('account.invoice.line')
invoices_group = {}
res = {}
sale_line_obj = self.pool.get('sale.order.line')
for picking in self.browse(cursor, user, ids, context=context):
if picking.invoice_state != '2binvoiced':
@ -614,8 +618,7 @@ class stock_picking(osv.osv):
if type in ('out_invoice', 'out_refund'):
account_id = partner.property_account_receivable.id
if picking.sale_id and picking.sale_id.payment_term:
payment_term_id= picking.sale_id.payment_term.id
payment_term_id=self._get_payment_term(cursor, user, picking)
else:
account_id = partner.property_account_payable.id
@ -647,51 +650,6 @@ class stock_picking(osv.osv):
context=context)
invoices_group[partner.id] = invoice_id
res[picking.id] = invoice_id
sale_line_ids = sale_line_obj.search(cursor, user, [('order_id','=',picking.sale_id.id)])
sale_lines = sale_line_obj.browse(cursor, user, sale_line_ids, context=context)
for sale_line in sale_lines:
if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
if group:
name = picking.name + '-' + sale_line.name
else:
name = sale_line.name
if type in ('out_invoice', 'out_refund'):
account_id = sale_line.product_id.product_tmpl_id.\
property_account_income.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
property_account_income_categ.id
else:
account_id = sale_line.product_id.product_tmpl_id.\
property_account_expense.id
if not account_id:
account_id = sale_line.product_id.categ_id.\
property_account_expense_categ.id
price_unit = self._get_price_unit_invoice(cursor, user,
sale_line, type)
discount = self._get_discount_invoice(cursor, user, sale_line)
tax_ids = self._get_taxes_invoice(cursor, user, sale_line, type)
account_analytic_id = self._get_account_analytic_invoice(cursor,
user, picking, sale_line)
account_id = self.pool.get('account.fiscal.position').map_account(cursor, user, partner, account_id)
invoice_line_id = invoice_line_obj.create(cursor, user, {
'name': name,
'invoice_id': invoice_id,
'uos_id': sale_line.product_uos.id or sale_line.product_uom.id,
'product_id': sale_line.product_id.id,
'account_id': account_id,
'price_unit': price_unit,
'discount': discount,
'quantity': sale_line.product_uos_qty,
'invoice_line_tax_id': [(6, 0, tax_ids)],
'account_analytic_id': account_analytic_id,
}, context=context)
sale_line_obj.write(cursor, user, [sale_line.id], {'invoiced':True,
'invoice_lines': [(6, 0, [invoice_line_id])],
})
for move_line in picking.move_lines:
if group:
name = picking.name + '-' + move_line.name
@ -894,7 +852,7 @@ class stock_move(osv.osv):
'note': fields.text('Notes'),
'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Assigned'),('done','Done'),('cancel','cancel')], 'Status', readonly=True, select=True),
'state': fields.selection([('draft','Draft'),('waiting','Waiting'),('confirmed','Confirmed'),('assigned','Available'),('done','Done'),('cancel','Canceled')], 'Status', readonly=True, select=True),
'price_unit': fields.float('Unit Price',
digits=(16, int(config['price_accuracy']))),
}
@ -1090,20 +1048,25 @@ class stock_move(osv.osv):
if move.state in ('confirmed','waiting','assigned','draft'):
if move.picking_id:
pickings[move.picking_id.id] = True
self.write(cr, uid, ids, {'state':'cancel'})
if move.move_dest_id and move.move_dest_id.state=='waiting':
self.write(cr, uid, [move.move_dest_id.id], {'state':'assigned'})
if move.move_dest_id.picking_id:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr)
self.write(cr, uid, ids, {'state':'cancel', 'move_dest_id': False})
for pick_id in pickings:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr)
ids2 = []
for res in self.read(cr, uid, ids, ['move_dest_id']):
if res['move_dest_id']:
ids2.append(res['move_dest_id'][0])
#for pick_id in pickings:
# wf_service = netsvc.LocalService("workflow")
# wf_service.trg_validate(uid, 'stock.picking', pick_id, 'button_cancel', cr)
#ids2 = []
#for res in self.read(cr, uid, ids, ['move_dest_id']):
# if res['move_dest_id']:
# ids2.append(res['move_dest_id'][0])
wf_service = netsvc.LocalService("workflow")
for id in ids:
wf_service.trg_trigger(uid, 'stock.move', id, cr)
self.action_cancel(cr,uid, ids2, context)
#self.action_cancel(cr,uid, ids2, context)
return True
def action_done(self, cr, uid, ids, context=None):

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>

View File

@ -517,7 +517,7 @@
<field name="date"/>
<field name="min_date" select="2"/>
</group>
<notebook>
<notebook colspan="4">
<page string="General Information">
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
<form string="Stock Moves">
@ -542,8 +542,8 @@
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<group>
<button name="force_assign" states="confirmed" string="Force assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/>
</group>
</form>
</field>
@ -555,9 +555,8 @@
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/>
</group>
@ -633,8 +632,8 @@
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<group>
<button name="force_assign" states="confirmed" string="Force assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/>
</group>
</form>
</field>
@ -646,10 +645,9 @@
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Products Sent" type="action"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/>
</group>
</page>
@ -728,7 +726,7 @@
<menuitem action="action_picking_tree2_delivery" id="menu_picking_waiting_delivery" parent="menu_action_picking_tree_delivery"/>
<record id="action_picking_tree3_delivery" model="ir.actions.act_window">
<field name="name">Waiting Delivery Orders</field>
<field name="name">Futur Delivery Orders</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -819,11 +817,12 @@
<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>
<button name="force_assign" states="confirmed" string="Force assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/>
</group>
</form>
</field>
@ -835,10 +834,9 @@
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object" groups="base.group_extended"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Packing Done" type="action"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/>
</group>
</page>
@ -887,7 +885,7 @@
<menuitem action="action_picking_tree" id="menu_action_picking_tree" parent="menu_stock_root" sequence="19"/>
<record id="action_picking_tree2" model="ir.actions.act_window">
<field name="name">Assigned Packings</field>
<field name="name">Available Packings</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -915,7 +913,7 @@
<menuitem action="action_picking_tree2" id="menu_picking_waiting" parent="menu_action_picking_tree"/>
<record id="action_picking_tree3" model="ir.actions.act_window">
<field name="name">Confirmed Packings Waiting Assignation</field>
<field name="name">Confirmed Packings Waiting Availability</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -1009,8 +1007,8 @@
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<group>
<button name="force_assign" states="confirmed" string="Force assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel assignation" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Availability" type="object"/>
</group>
</form>
</field>
@ -1022,10 +1020,9 @@
<field name="state" readonly="1"/>
<button name="draft_force_assign" states="draft" string="Process Later" type="object"/>
<button name="draft_validate" states="draft" string="Process Now" type="object"/>
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
<button name="force_assign" states="confirmed" string="Force Assignation" type="object"/>
<button name="cancel_assign" states="assigned" string="Cancel Assignation" type="object"/>
<button name="%(partial_picking)d" states="assigned" string="Validate" type="action"/>
<button name="action_assign" states="confirmed" string="Check Availability" type="object"/>
<button name="force_assign" states="confirmed" string="Force Availability" type="object" groups="base.group_extended"/>
<button name="%(partial_picking)d" states="assigned" string="Products Received" type="action"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel"/>
</group>
</page>
@ -1136,7 +1133,7 @@
<record id="action_picking_tree7" model="ir.actions.act_window">
<field name="name">Assigned Packings</field>
<field name="name">Available Packings</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -1147,7 +1144,7 @@
<menuitem action="action_picking_tree7" id="menu_action_picking_tree7" parent="menu_action_picking_tree6"/>
<record id="action_picking_tree8" model="ir.actions.act_window">
<field name="name">Confirmed Packings Waiting Assignation</field>
<field name="name">Confirmed Packings Waiting Availability</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -1158,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>
@ -1226,7 +1223,7 @@
<field name="state" select="1"/>
<group col="4" colspan="2">
<button name="action_confirm" states="draft" string="Confirm" type="object"/>
<button name="action_assign" states="confirmed" string="Assign" type="object"/>
<button name="action_assign" states="confirmed" string="Set Available" type="object"/>
<button name="action_cancel" states="assigned" string="Cancel" type="object"/>
<button name="action_done" states="assigned" string="Make Parcel" type="object"/>
</group>
@ -1253,7 +1250,7 @@
<menuitem action="action_move_form3" id="menu_action_move_form3" parent="menu_action_move_form2"/>
<record id="action_move_form4" model="ir.actions.act_window">
<field name="name">Assigned Moves</field>
<field name="name">Available Moves</field>
<field name="res_model">stock.move</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>

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$
#
@ -48,8 +48,10 @@ class sale_order(osv.osv):
message=False
partner = self.pool.get('res.partner').browse(cr, uid, part)
if partner.sale_warn:
title= "Message",
message=partner.sale_warn_msg
warning={
'title': "Message",
'message': partner.sale_warn_msg
}
result = super(sale_order, self).onchange_partner_id(cr, uid, ids, part)['value']
if result.get('warning',False):
@ -127,7 +129,7 @@ class product_product(osv.osv):
'sale_line_warn_msg' : fields.text('Message for Sale Order Line'),
'purchase_line_warn' : fields.boolean('Purchase Order Line'),
'purchase_line_warn_msg' : fields.text('Message for Purchase Order Line'),
}
}
product_product()
class sale_order_line(osv.osv):