[MERGE] merge with trunk addons
bzr revid: mra@mra-laptop-20100708035052-1v2k9wb5o3dcm27j
This commit is contained in:
commit
a06aad9a9e
|
@ -136,7 +136,6 @@ class account_account_type(osv.osv):
|
|||
'name': fields.char('Acc. Type Name', size=64, required=True, translate=True),
|
||||
'code': fields.char('Code', size=32, required=True),
|
||||
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of account types."),
|
||||
'partner_account': fields.boolean('Partner account'),
|
||||
'close_method': fields.selection([('none', 'None'), ('balance', 'Balance'), ('detail', 'Detail'), ('unreconciled', 'Unreconciled')], 'Deferral Method', required=True),
|
||||
'sign': fields.selection([(-1, 'Negative'), (1, 'Positive')], 'Sign on Reports', required=True, help='Allows you to change the sign of the balance amount displayed in the reports, so that you can see positive figures instead of negative ones in expenses accounts.'),
|
||||
'report_type':fields.selection([
|
||||
|
@ -366,11 +365,11 @@ class account_account(osv.osv):
|
|||
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
|
||||
'code': fields.char('Code', size=64, required=True),
|
||||
'type': fields.selection([
|
||||
('view', 'View'),
|
||||
('other', 'Regular'),
|
||||
('receivable', 'Receivable'),
|
||||
('payable', 'Payable'),
|
||||
('view', 'View'),
|
||||
('consolidation', 'Consolidation'),
|
||||
('other', 'Others'),
|
||||
('closed', 'Closed'),
|
||||
], 'Internal Type', required=True, help="This type is used to differentiate types with "\
|
||||
"special effects in Open ERP: view can not have entries, consolidation are accounts that "\
|
||||
|
@ -1203,9 +1202,11 @@ class account_move(osv.osv):
|
|||
def validate(self, cr, uid, ids, context={}):
|
||||
if context and ('__last_update' in context):
|
||||
del context['__last_update']
|
||||
ok = True
|
||||
|
||||
valid_moves = [] #Maintains a list of moves which can be responsible to create analytic entries
|
||||
|
||||
for move in self.browse(cr, uid, ids, context):
|
||||
#unlink analytic lines on move_lines
|
||||
# Unlink old analytic lines on move_lines
|
||||
for obj_line in move.line_id:
|
||||
for obj in obj_line.analytic_lines:
|
||||
self.pool.get('account.analytic.line').unlink(cr,uid,obj.id)
|
||||
|
@ -1231,19 +1232,27 @@ class account_move(osv.osv):
|
|||
raise osv.except_osv(_('Error'), _("""Couldn't create move with currency different from 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) < 10 ** -4:
|
||||
# If the move is balanced
|
||||
# Add to the list of valid moves
|
||||
# (analytic lines will be created later for valid moves)
|
||||
valid_moves.append(move)
|
||||
|
||||
# Check whether the move lines are confirmed
|
||||
|
||||
if not len(line_draft_ids):
|
||||
continue
|
||||
# Update the move lines (set them as valid)
|
||||
|
||||
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
|
||||
'journal_id': move.journal_id.id,
|
||||
'period_id': move.period_id.id,
|
||||
'state': 'valid'
|
||||
}, context, check=False)
|
||||
todo = []
|
||||
|
||||
account = {}
|
||||
account2 = {}
|
||||
if journal.type not in ('purchase','sale'):
|
||||
continue
|
||||
|
||||
if journal.type in ('purchase','sale'):
|
||||
for line in move.line_id:
|
||||
code = amount = 0
|
||||
key = (line.account_id.id, line.tax_code_id.id)
|
||||
|
@ -1258,18 +1267,24 @@ class account_move(osv.osv):
|
|||
'tax_code_id': code,
|
||||
'tax_amount': amount
|
||||
}, context, check=False)
|
||||
elif journal.centralisation:
|
||||
# If the move is not balanced, it must be centralised...
|
||||
|
||||
# Add to the list of valid moves
|
||||
# (analytic lines will be created later for valid moves)
|
||||
valid_moves.append(move)
|
||||
|
||||
#
|
||||
# Compute VAT
|
||||
# Update the move lines (set them as valid)
|
||||
#
|
||||
continue
|
||||
if journal.centralisation:
|
||||
self._centralise(cr, uid, move, 'debit', context=context)
|
||||
self._centralise(cr, uid, move, 'credit', context=context)
|
||||
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
|
||||
'state': 'valid'
|
||||
}, context, check=False)
|
||||
continue
|
||||
else:
|
||||
# We can't validate it (it's unbalanced)
|
||||
# Setting the lines as draft
|
||||
self.pool.get('account.move.line').write(cr, uid, line_ids, {
|
||||
'journal_id': move.journal_id.id,
|
||||
'period_id': move.period_id.id,
|
||||
|
@ -1277,13 +1292,12 @@ class account_move(osv.osv):
|
|||
#'tax_amount': False,
|
||||
'state': 'draft'
|
||||
}, context, check=False)
|
||||
ok = False
|
||||
if ok:
|
||||
list_ids = []
|
||||
for tmp in move.line_id:
|
||||
list_ids.append(tmp.id)
|
||||
self.pool.get('account.move.line').create_analytic_lines(cr, uid, list_ids, context)
|
||||
return ok
|
||||
# Create analytic lines for the valid moves
|
||||
for record in valid_moves:
|
||||
self.pool.get('account.move.line').create_analytic_lines(cr, uid, [line.id for line in record.line_id], context)
|
||||
|
||||
return len(valid_moves) > 0
|
||||
|
||||
account_move()
|
||||
|
||||
class account_move_reconcile(osv.osv):
|
||||
|
|
|
@ -135,7 +135,6 @@
|
|||
<!--
|
||||
Accounts
|
||||
-->
|
||||
|
||||
<record id="view_account_form" model="ir.ui.view">
|
||||
<field name="name">account.account.form</field>
|
||||
<field name="model">account.account</field>
|
||||
|
@ -143,21 +142,21 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Account">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="parent_id"/>
|
||||
<field name="type" select="1"/>
|
||||
<field name="user_type" select="1"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<newline/>
|
||||
<field name="currency_id"/>
|
||||
<field name="active"/>
|
||||
<field name="currency_mode"/>
|
||||
<field name="reconcile"/>
|
||||
<field name="active"/>
|
||||
<field name="check_history"/>
|
||||
<field name="type" select="1"/>
|
||||
<newline/>
|
||||
<separator string="Default Taxes" colspan="4"/>
|
||||
<field colspan="4" name="tax_ids" nolabel="1" domain="[('parent_id','=',False)]"/>
|
||||
|
@ -596,11 +595,10 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Account Type">
|
||||
<group col="6" colspan="4">
|
||||
<field name="name" select="1" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="sequence"/>
|
||||
<field name="parent_id"/>
|
||||
<field name="partner_account"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Reporting Configuration" colspan="4"/>
|
||||
|
@ -1196,7 +1194,7 @@
|
|||
<!-- <menuitem id="next_id_29" name="Search Entries" parent="account.menu_finance_entries" sequence="40"/>-->
|
||||
<!-- <menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>-->
|
||||
|
||||
<record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
|
||||
<!-- <record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
|
||||
<field name="name">Journal Entries</field>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="view_type">form</field>
|
||||
|
@ -1205,7 +1203,7 @@
|
|||
<field name="search_view_id" ref="view_account_move_filter"/>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_move_line_form_encode_by_move" id="menu_encode_entries_by_move" parent="menu_finance_entries"/>
|
||||
<menuitem action="action_move_line_form_encode_by_move" id="menu_encode_entries_by_move" parent="menu_finance_entries"/>-->
|
||||
|
||||
<record id="action_account_moves_sale" model="ir.actions.act_window">
|
||||
<field name="name">Journal Items</field>
|
||||
|
@ -2239,22 +2237,6 @@
|
|||
id="menu_action_account_fiscal_position_form_template"
|
||||
parent="account_template_folder" sequence="20"/>
|
||||
|
||||
<record id="action_move_journal_line" model="ir.actions.act_window">
|
||||
<field name="name">Journal Entries</field>
|
||||
<field name="res_model">account.move</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_move_tree"/>
|
||||
<field name="search_view_id" ref="view_account_move_filter"/>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
icon="STOCK_JUSTIFY_FILL"
|
||||
action="action_move_journal_line"
|
||||
id="menu_action_move_journal_line_form"
|
||||
parent="account.menu_finance_entries"
|
||||
sequence="5"/>
|
||||
|
||||
<record id="action_account_moves_all" model="ir.actions.act_window">
|
||||
<field name="name">Journal Items</field>
|
||||
<field name="res_model">account.move.line</field>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Currency" icon="terp-dolar" context="{'group_by':'currency_id'}"/>
|
||||
<filter string="Company" icon="terp-go-home" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
|
||||
|
|
|
@ -78,9 +78,6 @@
|
|||
icon="terp-check"
|
||||
domain="[('state','=','proforma'),('state','=','proforma2')]"
|
||||
help = "Pro-forma Invoices"/>
|
||||
<filter string="Current"
|
||||
domain="[('state', '=' ,'open')]"
|
||||
help = "open Invoices"/>
|
||||
<filter string="Done"
|
||||
icon="terp-dialog-close"
|
||||
domain="[('state','=','paid')]"
|
||||
|
@ -95,7 +92,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="Salesman" name='user' icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id','set_visible':True}"/>
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Journal Select">
|
||||
<label string="Are you sure you want to open Journal Entries!" colspan="4"/>
|
||||
<label string="Are you sure you want to open Journal Entries?" colspan="4"/>
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="6">
|
||||
<button icon="terp-gtk-stop" special="cancel" string="Cancel"/>
|
||||
|
|
|
@ -20,14 +20,17 @@
|
|||
##############################################################################
|
||||
|
||||
import time
|
||||
import netsvc
|
||||
from osv import fields
|
||||
from osv import osv
|
||||
import ir
|
||||
import pooler
|
||||
import mx.DateTime
|
||||
from mx.DateTime import RelativeDateTime
|
||||
from tools import config
|
||||
|
||||
journal2type = {
|
||||
'cash':'rec_voucher',
|
||||
'bank':'bank_rec_voucher',
|
||||
'cash':'pay_voucher',
|
||||
'sale':'journal_sale_vou',
|
||||
'purchase':'journal_pur_voucher',
|
||||
'general':'journal_voucher'
|
||||
}
|
||||
|
||||
type2journal = {
|
||||
'rec_voucher': 'cash',
|
||||
|
@ -68,8 +71,9 @@ class account_voucher(osv.osv):
|
|||
return False
|
||||
|
||||
def _get_type(self, cr, uid, context={}):
|
||||
type = context.get('type', 'bank_rec_voucher')
|
||||
return type
|
||||
vtype = context.get('type', 'bank')
|
||||
voucher_type = journal2type.get(vtype)
|
||||
return voucher_type
|
||||
|
||||
def _get_reference_type(self, cursor, user, context=None):
|
||||
return [('none', 'Free Reference')]
|
||||
|
@ -91,15 +95,15 @@ class account_voucher(osv.osv):
|
|||
return False
|
||||
|
||||
def _get_currency(self, cr, uid, context):
|
||||
user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid)
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid)
|
||||
if user.company_id:
|
||||
return user.company_id.currency_id.id
|
||||
else:
|
||||
return pooler.get_pool(cr.dbname).get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
|
||||
return self.pool.get('res.currency').search(cr, uid, [('rate','=',1.0)])[0]
|
||||
|
||||
_name = 'account.voucher'
|
||||
_description = 'Accounting Voucher'
|
||||
_order = "number"
|
||||
_order = "id desc"
|
||||
_columns = {
|
||||
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'type': fields.selection([
|
||||
|
@ -107,7 +111,7 @@ class account_voucher(osv.osv):
|
|||
('bank_pay_voucher','Bank Payment'),
|
||||
('rec_voucher','Cash Receipt'),
|
||||
('bank_rec_voucher','Bank Receipt'),
|
||||
('cont_voucher','Contra'),
|
||||
# ('cont_voucher','Contra'),
|
||||
('journal_sale_vou','Journal Sale'),
|
||||
('journal_pur_voucher','Journal Purchase'),
|
||||
('journal_voucher','Journal Voucher'),
|
||||
|
@ -117,7 +121,7 @@ class account_voucher(osv.osv):
|
|||
'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}, domain=[('type','<>','view')]),
|
||||
'payment_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=False, states={'proforma':[('readonly',True)]}),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'posted':[('readonly',True)]}),
|
||||
'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}, required=True),
|
||||
'narration':fields.text('Narration', readonly=True, states={'draft':[('readonly',False)]}, required=False),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'company_id': fields.many2one('res.company', 'Company', required=True),
|
||||
'state':fields.selection(
|
||||
|
@ -133,10 +137,10 @@ class account_voucher(osv.osv):
|
|||
\n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
|
||||
\n* The \'Cancelled\' state is used when user cancel voucher.'),
|
||||
'amount':fields.float('Amount', readonly=True),
|
||||
'number':fields.char('Number', size=32, readonly=True),
|
||||
'reference': fields.char('Voucher Reference', size=64),
|
||||
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
|
||||
required=True),
|
||||
'number': fields.related('move_id', 'name', type="char", readonly=True, string='Number'),
|
||||
'move_id':fields.many2one('account.move', 'Account Entry'),
|
||||
'move_ids':fields.many2many('account.move.line', 'voucher_id', 'account_id', 'rel_account_move', 'Real Entry'),
|
||||
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]})
|
||||
|
@ -147,24 +151,17 @@ class account_voucher(osv.osv):
|
|||
'type': _get_type,
|
||||
'journal_id':_get_journal,
|
||||
'currency_id': _get_currency,
|
||||
|
||||
'state': lambda *a: 'draft',
|
||||
'date' : lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'reference_type': lambda *a: "none",
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
|
||||
}
|
||||
|
||||
# def _get_analityc_lines(self, cr, uid, id):
|
||||
# inv = self.browse(cr, uid, [id])[0]
|
||||
# cur_obj = self.pool.get('res.currency')
|
||||
|
||||
def onchange_account(self, cr, uid, ids, account_id):
|
||||
|
||||
if not account_id:
|
||||
return {
|
||||
'value':{'amount':False}
|
||||
}
|
||||
|
||||
account = self.pool.get('account.account').browse(cr, uid, account_id)
|
||||
balance=account.balance
|
||||
return {
|
||||
|
@ -176,7 +173,6 @@ class account_voucher(osv.osv):
|
|||
return {
|
||||
'value':{'account_id':False}
|
||||
}
|
||||
|
||||
journal = self.pool.get('account.journal')
|
||||
|
||||
if journal_id and (type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher')):
|
||||
|
@ -196,31 +192,46 @@ class account_voucher(osv.osv):
|
|||
}
|
||||
|
||||
def open_voucher(self, cr, uid, ids, context={}):
|
||||
obj = self.pool.get('account.voucher').browse(cr, uid, ids)
|
||||
voucher = self.pool.get('account.voucher').browse(cr, uid, ids)[0]
|
||||
total = 0
|
||||
for i in obj[0].payment_ids:
|
||||
total += i.amount
|
||||
for line in voucher.payment_ids:
|
||||
total += line.amount
|
||||
|
||||
if total != 0:
|
||||
self.write(cr, uid, ids, {'amount':total, 'state':'proforma'})
|
||||
res = {
|
||||
'amount':total,
|
||||
'state':'proforma'
|
||||
}
|
||||
self.write(cr, uid, ids, res)
|
||||
else:
|
||||
raise osv.except_osv('Invalid action !', 'You cannot post to Pro-Forma a voucher with Total amount = 0 !')
|
||||
return True
|
||||
|
||||
def proforma_voucher(self, cr, uid, ids, context={}):
|
||||
self.action_number(cr, uid, ids)
|
||||
self.action_move_line_create(cr, uid, ids)
|
||||
self.write(cr, uid, ids, {'state':'posted'})
|
||||
return True
|
||||
|
||||
def cancel_voucher(self, cr, uid, ids, context={}):
|
||||
self.action_cancel(cr, uid, ids)
|
||||
self.write(cr, uid, ids, {'state':'cancel'})
|
||||
return True
|
||||
|
||||
def action_cancel_draft(self, cr, uid, ids, *args):
|
||||
self.write(cr, uid, ids, {'state':'draft'})
|
||||
return True
|
||||
|
||||
def cancel_voucher(self, cr, uid, ids, context={}):
|
||||
move_pool = self.pool.get('account.move')
|
||||
|
||||
for voucher in self.browse(cr, uid, ids):
|
||||
if voucher.move_id:
|
||||
move_pool.button_cancel(cr, uid, [voucher.move_id.id])
|
||||
move_pool.unlink(cr, uid, [voucher.move_id.id])
|
||||
|
||||
res = {
|
||||
'state':'cancel',
|
||||
'move_id':False,
|
||||
'move_ids':[(6, 0,[])]
|
||||
}
|
||||
self.write(cr, uid, ids, res)
|
||||
return True
|
||||
|
||||
def unlink(self, cr, uid, ids, context=None):
|
||||
vouchers = self.read(cr, uid, ids, ['state'])
|
||||
unlink_ids = []
|
||||
|
@ -231,237 +242,126 @@ class account_voucher(osv.osv):
|
|||
raise osv.except_osv('Invalid action !', 'Cannot delete Voucher(s) which are already opened or paid !')
|
||||
return super(account_voucher, self).unlink(cr, uid, unlink_ids, context=context)
|
||||
|
||||
def _get_analytic_lines(self, cr, uid, id):
|
||||
inv = self.browse(cr, uid, [id])[0]
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
if inv.type in ('rec_voucher'):
|
||||
sign = 1
|
||||
else:
|
||||
sign = -1
|
||||
|
||||
iml = self.pool.get('account.voucher.line').move_line_get(cr, uid, inv.id)
|
||||
|
||||
for il in iml:
|
||||
if il['account_analytic_id']:
|
||||
if inv.type in ('pay_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
|
||||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
|
||||
il['analytic_lines'] = [(0, 0, {
|
||||
'name': il['name'],
|
||||
'date': inv['date'],
|
||||
'account_id': il['account_analytic_id'],
|
||||
'amount': inv['amount'] * sign,
|
||||
'general_account_id': il['account_id'] or False,
|
||||
'journal_id': self.pool.get('account.voucher').browse(cr, uid, id).journal_id.analytic_journal_id.id or False,
|
||||
'ref': ref,
|
||||
})]
|
||||
return iml
|
||||
|
||||
def action_move_line_create(self, cr, uid, ids, *args):
|
||||
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
sequence_pool = self.pool.get('ir.sequence')
|
||||
move_pool = self.pool.get('account.move')
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
analytic_pool = self.pool.get('account.analytic.line')
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
|
||||
if inv.move_id:
|
||||
continue
|
||||
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
|
||||
line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
|
||||
ils = self.pool.get('account.voucher.line').read(cr, uid, line_ids)
|
||||
|
||||
iml = self._get_analytic_lines(cr, uid, inv.id)
|
||||
|
||||
diff_currency_p = inv.currency_id.id <> company_currency
|
||||
|
||||
total = 0
|
||||
if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
|
||||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
|
||||
acc_id = None
|
||||
date = inv.date
|
||||
total_currency = 0
|
||||
acc_id = None
|
||||
for i in iml:
|
||||
partner_id=i['partner_id']
|
||||
acc_id = i['account_id']
|
||||
if inv.currency_id.id != company_currency:
|
||||
i['currency_id'] = inv.currency_id.id
|
||||
i['amount_currency'] = i['amount']
|
||||
else:
|
||||
i['amount_currency'] = False
|
||||
i['currency_id'] = False
|
||||
if inv.type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher'):
|
||||
total += i['amount']
|
||||
total_currency += i['amount_currency'] or i['amount']
|
||||
i['amount'] = - i['amount']
|
||||
else:
|
||||
total -= i['amount']
|
||||
total_currency -= i['amount_currency'] or i['amount']
|
||||
|
||||
name = inv['name'] or '/'
|
||||
totlines = False
|
||||
|
||||
iml.append({
|
||||
'type': 'dest',
|
||||
'name': name,
|
||||
'amount': total or False,
|
||||
'account_id': acc_id,
|
||||
'amount_currency': diff_currency_p \
|
||||
and total_currency or False,
|
||||
'currency_id': diff_currency_p \
|
||||
and inv.currency_id.id or False,
|
||||
'ref': ref,
|
||||
'partner_id':partner_id or False,
|
||||
})
|
||||
|
||||
date = inv.date
|
||||
inv.amount=total
|
||||
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x,date, context={})) ,iml)
|
||||
an_journal_id=inv.journal_id.analytic_journal_id.id
|
||||
journal_id = inv.journal_id.id
|
||||
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
|
||||
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
|
||||
if journal.sequence_id:
|
||||
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
|
||||
|
||||
move = {
|
||||
'name' : name,
|
||||
'journal_id': journal_id,
|
||||
'journal_id': journal.id,
|
||||
'type' : inv.type,
|
||||
'narration' : inv.narration,
|
||||
'narration' : inv.narration and inv.narration or inv.name,
|
||||
'date':inv.date
|
||||
}
|
||||
if inv.period_id:
|
||||
move['period_id'] = inv.period_id.id
|
||||
for i in line:
|
||||
i[2]['period_id'] = inv.period_id.id
|
||||
move_id = self.pool.get('account.move').create(cr, uid, move)
|
||||
ref = move['name']
|
||||
amount=0.0
|
||||
|
||||
#create the first line our self
|
||||
if inv.period_id:
|
||||
move.update({
|
||||
'period_id': inv.period_id.id
|
||||
})
|
||||
|
||||
move_id = move_pool.create(cr, uid, move)
|
||||
|
||||
#create the first line manually
|
||||
move_line = {
|
||||
'name': inv.name,
|
||||
'debit': False,
|
||||
'credit':False,
|
||||
'account_id': inv.account_id.id or False,
|
||||
'move_id': move_id ,
|
||||
'journal_id':journal_id ,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'partner_id': False,
|
||||
'ref': ref,
|
||||
'date': inv.date
|
||||
}
|
||||
if diff_currency_p:
|
||||
amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
|
||||
inv.amount = amount_currency
|
||||
move_line.update({
|
||||
'amount_currency':amount_currency,
|
||||
'currency_id':inv.currency_id.id
|
||||
})
|
||||
|
||||
if inv.type in ('rec_voucher', 'bank_rec_voucher', 'journal_pur_voucher', 'journal_voucher'):
|
||||
move_line['debit'] = inv.amount
|
||||
else:
|
||||
move_line['credit'] = inv.amount * (-1)
|
||||
self.pool.get('account.move.line').create(cr, uid, move_line)
|
||||
move_line['credit'] = inv.amount
|
||||
|
||||
line_ids = []
|
||||
line_ids += [move_line_pool.create(cr, uid, move_line)]
|
||||
for line in inv.payment_ids:
|
||||
|
||||
amount=0.0
|
||||
move_line = {
|
||||
'name': line.name,
|
||||
'debit': False,
|
||||
'credit': False,
|
||||
'account_id': line.account_id.id or False,
|
||||
'move_id': move_id ,
|
||||
'journal_id':journal_id ,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'partner_id': line.partner_id.id or False,
|
||||
'ref': ref,
|
||||
'date':inv.date
|
||||
'date': inv.date,
|
||||
'analytic_account_id': False
|
||||
}
|
||||
|
||||
if line.type == 'dr':
|
||||
move_line['debit'] = line.amount or False
|
||||
amount=line.amount
|
||||
elif line.type == 'cr':
|
||||
move_line['credit'] = line.amount or False
|
||||
amount=line.amount * (-1)
|
||||
|
||||
move_line['analytic_account_id'] = line.account_analytic_id.id or False
|
||||
ml_id=self.pool.get('account.move.line').create(cr, uid, move_line)
|
||||
|
||||
if inv.narration:
|
||||
line.name = inv.narration
|
||||
else:
|
||||
line.name = line.name
|
||||
if diff_currency_p:
|
||||
amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
|
||||
line.amount = amount_currency
|
||||
move_line.update({
|
||||
'amount_currency':amount_currency,
|
||||
'currency_id':inv.currency_id.id
|
||||
})
|
||||
|
||||
if line.account_analytic_id:
|
||||
an_line = {
|
||||
'name':line.name,
|
||||
'date':inv.date,
|
||||
'amount':amount,
|
||||
'account_id':line.account_analytic_id.id or False,
|
||||
'move_id':ml_id,
|
||||
'journal_id':an_journal_id ,
|
||||
'general_account_id':line.account_id.id,
|
||||
'ref':ref
|
||||
move_line.update({
|
||||
'analytic_account_id':line.account_analytic_id.id
|
||||
})
|
||||
|
||||
if line.type == 'dr':
|
||||
move_line.update({
|
||||
'debit': line.amount or False
|
||||
})
|
||||
amount = line.amount
|
||||
|
||||
elif line.type == 'cr':
|
||||
move_line.update({
|
||||
'credit': line.amount or False
|
||||
})
|
||||
amount = line.amount * (-1)
|
||||
|
||||
move_line_id = move_line_pool.create(cr, uid, move_line)
|
||||
line_ids += [move_line_id]
|
||||
|
||||
rec = {
|
||||
'move_id': move_id,
|
||||
'move_ids':[(6, 0,line_ids)]
|
||||
}
|
||||
self.pool.get('account.analytic.line').create(cr, uid, an_line)
|
||||
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
obj=self.pool.get('account.move').browse(cr, uid, move_id)
|
||||
|
||||
for line in obj.line_id :
|
||||
cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id)))
|
||||
self.write(cr, uid, [inv.id], rec)
|
||||
|
||||
return True
|
||||
|
||||
|
||||
def line_get_convert(self, cr, uid, x, date, context={}):
|
||||
return {
|
||||
'date':date,
|
||||
'date_maturity': x.get('date_maturity', False),
|
||||
'partner_id':x.get('partner_id',False),
|
||||
'name':x['name'][:64],
|
||||
'debit':x['amount']>0 and x['amount'],
|
||||
'credit':x['amount']<0 and -x['amount'],
|
||||
'account_id':x['account_id'],
|
||||
'analytic_lines':x.get('analytic_lines', []),
|
||||
'amount_currency':x.get('amount_currency', False),
|
||||
'currency_id':x.get('currency_id', False),
|
||||
'tax_code_id': x.get('tax_code_id', False),
|
||||
'tax_amount': x.get('tax_amount', False),
|
||||
'ref':x.get('ref',False)
|
||||
}
|
||||
|
||||
def _convert_ref(self, cr, uid, ref):
|
||||
return (ref or '').replace('/','')
|
||||
|
||||
def action_number(self, cr, uid, ids, *args):
|
||||
cr.execute('SELECT id, type, number, move_id, reference ' \
|
||||
'FROM account_voucher ' \
|
||||
'WHERE id IN %s',(tuple(ids),))
|
||||
for (id, invtype, number, move_id, reference) in cr.fetchall():
|
||||
if not number:
|
||||
number = self.pool.get('ir.sequence').get(cr, uid, invtype)
|
||||
|
||||
if type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_vou','journal_pur_voucher'):
|
||||
ref = reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, number)
|
||||
|
||||
cr.execute('UPDATE account_voucher SET number=%s ' \
|
||||
'WHERE id=%s', (number, id))
|
||||
cr.execute('UPDATE account_move_line SET ref=%s ' \
|
||||
'WHERE move_id=%s AND (ref is null OR ref = \'\')',
|
||||
(ref, move_id))
|
||||
cr.execute('UPDATE account_analytic_line SET ref=%s ' \
|
||||
'FROM account_move_line ' \
|
||||
'WHERE account_move_line.move_id = %s ' \
|
||||
'AND account_analytic_line.move_id = account_move_line.id',
|
||||
(ref, move_id))
|
||||
return True
|
||||
|
||||
def name_get(self, cr, uid, ids, context={}):
|
||||
if not len(ids):
|
||||
return []
|
||||
|
@ -498,19 +398,6 @@ class account_voucher(osv.osv):
|
|||
default['date'] = time.strftime('%Y-%m-%d')
|
||||
return super(account_voucher, self).copy(cr, uid, id, default, context)
|
||||
|
||||
def action_cancel(self, cr, uid, ids, *args):
|
||||
account_move_obj = self.pool.get('account.move')
|
||||
voucher = self.read(cr, uid, ids, ['move_id'])
|
||||
for i in voucher:
|
||||
if i['move_id']:
|
||||
account_move_obj.button_cancel(cr, uid, [i['move_id'][0]])
|
||||
# delete the move this invoice was pointing to
|
||||
# Note that the corresponding move_lines and move_reconciles
|
||||
# will be automatically deleted too
|
||||
account_move_obj.unlink(cr, uid, [i['move_id'][0]])
|
||||
self.write(cr, uid, ids, {'state':'cancel', 'move_id':False})
|
||||
return True
|
||||
|
||||
account_voucher()
|
||||
|
||||
class account_voucher_line(osv.osv):
|
||||
|
@ -530,176 +417,52 @@ class account_voucher_line(osv.osv):
|
|||
'type': lambda *a: 'cr'
|
||||
}
|
||||
|
||||
def move_line_get(self, cr, uid, voucher_id, context={}):
|
||||
res = []
|
||||
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
inv = self.pool.get('account.voucher').browse(cr, uid, voucher_id)
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
cur = inv.currency_id
|
||||
|
||||
for line in inv.payment_ids:
|
||||
res.append(self.move_line_get_item(cr, uid, line, context))
|
||||
return res
|
||||
|
||||
def onchange_partner(self, cr, uid, ids, partner_id, ttype ,type1):
|
||||
vals = {}
|
||||
|
||||
if not partner_id:
|
||||
return {'value' : {'account_id' : False, 'type' : False ,'amount':False}}
|
||||
obj = self.pool.get('res.partner')
|
||||
vals.update({
|
||||
'account_id': False,
|
||||
'type': False ,
|
||||
'amount': False
|
||||
})
|
||||
return {
|
||||
'value' : vals
|
||||
}
|
||||
|
||||
partner_pool = self.pool.get('res.partner')
|
||||
account_id = False
|
||||
|
||||
partner = partner_pool.browse(cr, uid, partner_id)
|
||||
|
||||
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
balance = obj.browse(cr,uid,partner_id).credit
|
||||
ttype = 'cr'
|
||||
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
balance = obj.browse(cr,uid,partner_id).debit
|
||||
ttype = 'dr'
|
||||
elif type1 in ('journal_sale_vou') :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
balance = obj.browse(cr,uid,partner_id).credit
|
||||
ttype = 'dr'
|
||||
elif type1 in ('journal_pur_voucher') :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
balance = obj.browse(cr,uid,partner_id).debit
|
||||
account_id = partner.property_account_receivable.id
|
||||
balance = partner.credit
|
||||
ttype = 'cr'
|
||||
|
||||
return {
|
||||
'value' : {'account_id' : account_id.id, 'type' : ttype, 'amount':balance}
|
||||
}
|
||||
|
||||
def onchange_amount(self, cr, uid, ids, partner_id, amount, type, type1):
|
||||
if not amount:
|
||||
return {'value' : {}}
|
||||
if partner_id:
|
||||
obj = self.pool.get('res.partner')
|
||||
if type1 in ('rec_voucher', 'bank_rec_voucher', 'journal_voucher'):
|
||||
if amount < 0 :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
type = 'dr'
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
type = 'cr'
|
||||
|
||||
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
|
||||
if amount < 0 :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
type = 'cr'
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
type = 'dr'
|
||||
account_id = partner.property_account_payable.id
|
||||
balance = partner.debit
|
||||
ttype = 'dr'
|
||||
|
||||
elif type1 in ('journal_sale_vou') :
|
||||
if amount < 0 :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
type = 'cr'
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
type = 'dr'
|
||||
account_id = partner.property_account_receivable.id
|
||||
balance = partner.credit
|
||||
ttype = 'dr'
|
||||
|
||||
elif type1 in ('journal_pur_voucher') :
|
||||
if amount< 0 :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
type = 'dr'
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
type = 'cr'
|
||||
else:
|
||||
if type1 in ('rec_voucher', 'bank_rec_voucher', 'journal_voucher'):
|
||||
if amount < 0 :
|
||||
type = 'dr'
|
||||
else:
|
||||
type = 'cr'
|
||||
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
|
||||
if amount < 0 :
|
||||
type = 'cr'
|
||||
else:
|
||||
type = 'dr'
|
||||
elif type1 in ('journal_sale_vou') :
|
||||
if amount < 0 :
|
||||
type = 'cr'
|
||||
else:
|
||||
type = 'dr'
|
||||
elif type1 in ('journal_pur_voucher') :
|
||||
if amount< 0 :
|
||||
type = 'dr'
|
||||
else:
|
||||
type = 'cr'
|
||||
account_id = partner.property_account_payable.id
|
||||
balance = partner.debit
|
||||
ttype = 'cr'
|
||||
|
||||
vals.update({
|
||||
'account_id': account_id,
|
||||
'type': ttype,
|
||||
'amount':balance
|
||||
})
|
||||
|
||||
return {
|
||||
'value' : { 'type' : type , 'amount':amount}
|
||||
}
|
||||
|
||||
def onchange_type(self, cr, uid, ids, partner_id, amount, type, type1):
|
||||
if partner_id:
|
||||
obj = self.pool.get('res.partner')
|
||||
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
|
||||
if type == 'dr' :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
total=amount*(-1)
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
total=amount*(-1)
|
||||
|
||||
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
|
||||
if type == 'cr' :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
total=amount*(-1)
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
total=amount*(-1)
|
||||
|
||||
elif type1 in ('journal_sale_vou') :
|
||||
if type == 'cr' :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
total=amount*(-1)
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
total=amount*(-1)
|
||||
elif type1 in ('journal_pur_voucher') :
|
||||
if type == 'dr' :
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_receivable
|
||||
total=amount*(-1)
|
||||
else:
|
||||
account_id = obj.browse(cr, uid, partner_id).property_account_payable
|
||||
total=amount*(-1)
|
||||
else:
|
||||
if type1 in ('rec_voucher','bank_rec_voucher', 'journal_voucher'):
|
||||
if type == 'dr' :
|
||||
total=amount*(-1)
|
||||
else:
|
||||
total=amount*(-1)
|
||||
|
||||
elif type1 in ('pay_voucher','bank_pay_voucher','cont_voucher') :
|
||||
if type == 'cr' :
|
||||
total=amount*(-1)
|
||||
else:
|
||||
total=amount*(-1)
|
||||
|
||||
elif type1 in ('journal_sale_vou') :
|
||||
if type == 'cr' :
|
||||
total=amount*(-1)
|
||||
else:
|
||||
total=amount*(-1)
|
||||
elif type1 in ('journal_pur_voucher') :
|
||||
if type == 'dr' :
|
||||
total=amount*(-1)
|
||||
else:
|
||||
total=amount*(-1)
|
||||
|
||||
return {
|
||||
'value' : {'type' : type , 'amount':total}
|
||||
}
|
||||
|
||||
def move_line_get_item(self, cr, uid, line, context={}):
|
||||
return {
|
||||
'type':'src',
|
||||
'name': line.name[:64],
|
||||
'amount':line.amount,
|
||||
'account_id':line.account_id.id,
|
||||
'partner_id':line.partner_id.id or False ,
|
||||
'account_analytic_id':line.account_analytic_id.id or False,
|
||||
'ref' : line.ref
|
||||
'value' : vals
|
||||
}
|
||||
|
||||
account_voucher_line()
|
||||
|
|
|
@ -35,32 +35,19 @@
|
|||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Journal Entries">
|
||||
<field name="payment_ids" colspan="4" nolabel="1" height="260">
|
||||
<field name="payment_ids" colspan="4" nolabel="1" height="250">
|
||||
<tree string="Voucher Lines" editable="top">
|
||||
<field name="account_analytic_id"/>
|
||||
<field name="partner_id" on_change="onchange_partner(partner_id,type,parent.type)"/>
|
||||
<field name="account_id"/>
|
||||
<field name="name"/>
|
||||
<field name="type"/>
|
||||
<field name="amount"/>
|
||||
<field name="account_analytic_id"/>
|
||||
<field name="ref"/>
|
||||
</tree>
|
||||
</field>
|
||||
<separator string="Narration" colspan="4"/>
|
||||
<field name="narration" colspan="4" nolabel="1" height="50"/>
|
||||
<group col="6" colspan="6">
|
||||
<group col="2" colspan="2">
|
||||
<field name="state"/>
|
||||
</group>
|
||||
<group col="8" colspan="4">
|
||||
<button name="open_voucher" string="Pro-forma" states="draft" icon="terp-check"/>
|
||||
<button name="proforma_voucher" string="Create" states="proforma" icon="terp-document-new"/>
|
||||
<button name="recheck_voucher" string="Validate" states="recheck" icon="terp-check"/>
|
||||
<button name="audit_complete" string="Audit Pass" states="posted" icon="terp-check"/>
|
||||
<button name="cancel_voucher" string="Cancel" states="proforma,recheck,posted" icon="gtk-cancel"/>
|
||||
<button name="cancel_to_draft" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Other Info">
|
||||
<field name="company_id" select="1" widget="selection" groups="base.group_multi_company"/>
|
||||
|
@ -71,6 +58,15 @@
|
|||
<field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
<group col="8" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="open_voucher" string="Pro-forma" states="draft" icon="terp-check"/>
|
||||
<button name="proforma_voucher" string="Create" states="proforma" icon="terp-document-new"/>
|
||||
<button name="recheck_voucher" string="Validate" states="recheck" icon="terp-check"/>
|
||||
<button name="audit_complete" string="Audit Pass" states="posted" icon="terp-check"/>
|
||||
<button name="cancel_voucher" string="Cancel" states="proforma,recheck,posted" icon="gtk-cancel"/>
|
||||
<button name="cancel_to_draft" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -144,6 +140,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" eval="view_voucher_tree"/>
|
||||
<field name="domain">[('journal_id.type','=','sale')]</field>
|
||||
<field name="context">{'type':'sale'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_new"/>
|
||||
</record>
|
||||
<menuitem id="menu_action_receipt_vou_voucher_list"
|
||||
|
@ -157,6 +154,7 @@
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" eval="view_voucher_tree"/>
|
||||
<field name="domain">[('journal_id.type','=','purchase')]</field>
|
||||
<field name="context">{'type':'purchase'}</field>
|
||||
<field name="search_view_id" ref="view_voucher_filter_new"/>
|
||||
</record>
|
||||
<menuitem id="menu_action_pay_vou_voucher_list"
|
||||
|
@ -168,6 +166,7 @@
|
|||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="context">{'type':'general'}</field>
|
||||
<field name="view_id" eval="view_voucher_tree"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter"/>
|
||||
</record>
|
||||
|
@ -179,10 +178,12 @@
|
|||
<field name="res_model">account.voucher</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
|
||||
<field name="context">{'type':'bank'}</field>
|
||||
<field name="view_id" ref="view_voucher_tree"/>
|
||||
<field name="search_view_id" ref="view_voucher_filter_new"/>
|
||||
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
|
||||
</record>
|
||||
|
||||
<menuitem action="action_cheque_register" id="menu_action_cheque_register" parent="account.menu_finance_bank_and_cash"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_account_journal_form_inherit">
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
<record id="act_cancel" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">cancel</field>
|
||||
<field name="action">write({'state':'cancel'})</field>
|
||||
<field name="action">cancel_voucher()</field>
|
||||
<field name="kind">function</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -38,168 +38,125 @@ class account_voucher(osv.osv):
|
|||
|
||||
def action_move_line_create(self, cr, uid, ids, *args):
|
||||
|
||||
journal_pool = self.pool.get('account.journal')
|
||||
sequence_pool = self.pool.get('ir.sequence')
|
||||
move_pool = self.pool.get('account.move')
|
||||
move_line_pool = self.pool.get('account.move.line')
|
||||
analytic_pool = self.pool.get('account.analytic.line')
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
|
||||
for inv in self.browse(cr, uid, ids):
|
||||
|
||||
if inv.move_id:
|
||||
continue
|
||||
|
||||
company_currency = inv.company_id.currency_id.id
|
||||
|
||||
line_ids = self.read(cr, uid, [inv.id], ['payment_ids'])[0]['payment_ids']
|
||||
ils = self.pool.get('account.voucher.line').read(cr, uid, line_ids)
|
||||
|
||||
iml = self._get_analytic_lines(cr, uid, inv.id)
|
||||
|
||||
diff_currency_p = inv.currency_id.id <> company_currency
|
||||
|
||||
total = 0
|
||||
if inv.type in ('pay_voucher', 'journal_voucher', 'rec_voucher','cont_voucher','bank_pay_voucher','bank_rec_voucher','journal_sale_voucher','journal_pur_voucher'):
|
||||
ref = inv.reference
|
||||
else:
|
||||
ref = self._convert_ref(cr, uid, inv.number)
|
||||
|
||||
date = inv.date
|
||||
total_currency = 0
|
||||
for i in iml:
|
||||
partner_id=i['partner_id']
|
||||
acc_id = i['account_id']
|
||||
if inv.currency_id.id != company_currency:
|
||||
i['currency_id'] = inv.currency_id.id
|
||||
i['amount_currency'] = i['amount']
|
||||
else:
|
||||
i['amount_currency'] = False
|
||||
i['currency_id'] = False
|
||||
if inv.type in ('rec_voucher','bank_rec_voucher','journal_pur_voucher','journal_voucher'):
|
||||
total += i['amount']
|
||||
total_currency += i['amount_currency'] or i['amount']
|
||||
i['amount'] = - i['amount']
|
||||
else:
|
||||
total -= i['amount']
|
||||
total_currency -= i['amount_currency'] or i['amount']
|
||||
|
||||
name = inv['name'] or '/'
|
||||
totlines = False
|
||||
|
||||
iml.append({
|
||||
'type': 'dest',
|
||||
'name': name,
|
||||
'amount': total or False,
|
||||
'account_id': acc_id,
|
||||
'amount_currency': diff_currency_p \
|
||||
and total_currency or False,
|
||||
'currency_id': diff_currency_p \
|
||||
and inv.currency_id.id or False,
|
||||
'ref': ref,
|
||||
'partner_id':partner_id or False,
|
||||
})
|
||||
|
||||
date = inv.date
|
||||
inv.amount=total
|
||||
|
||||
line = map(lambda x:(0,0,self.line_get_convert(cr, uid, x,date, context={})) ,iml)
|
||||
an_journal_id=inv.journal_id.analytic_journal_id.id
|
||||
journal_id = inv.journal_id.id
|
||||
|
||||
journal = self.pool.get('account.journal').browse(cr, uid, journal_id)
|
||||
journal = journal_pool.browse(cr, uid, inv.journal_id.id)
|
||||
if journal.sequence_id:
|
||||
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
name = sequence_pool.get_id(cr, uid, journal.sequence_id.id)
|
||||
|
||||
move = {
|
||||
'name' : name,
|
||||
'journal_id': journal_id,
|
||||
'voucher_type':inv.type,
|
||||
'narration' : inv.narration,
|
||||
'data':date
|
||||
'journal_id': journal.id,
|
||||
'type' : inv.type,
|
||||
'narration' : inv.narration and inv.narration or inv.name,
|
||||
'date':inv.date
|
||||
}
|
||||
|
||||
if inv.period_id:
|
||||
move['period_id'] = inv.period_id.id
|
||||
for i in line:
|
||||
i[2]['period_id'] = inv.period_id.id
|
||||
move_id = self.pool.get('account.move').create(cr, uid, move)
|
||||
ref=move['name']
|
||||
amount=0.0
|
||||
#create the first line our self
|
||||
move.update({
|
||||
'period_id': inv.period_id.id
|
||||
})
|
||||
|
||||
move_id = move_pool.create(cr, uid, move)
|
||||
|
||||
#create the first line manually
|
||||
move_line = {
|
||||
'name': inv.name,
|
||||
'voucher_invoice' : iml and iml[0]['invoice'] and iml[0]['invoice'].id or False,
|
||||
'debit': False,
|
||||
'credit':False,
|
||||
'account_id': inv.account_id.id or False,
|
||||
'move_id': move_id ,
|
||||
'journal_id':journal_id ,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'partner_id': False,
|
||||
'ref': ref,
|
||||
'date': date
|
||||
'date': inv.date
|
||||
}
|
||||
if diff_currency_p:
|
||||
amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
|
||||
inv.amount = amount_currency
|
||||
move_line.update({
|
||||
'amount_currency':amount_currency,
|
||||
'currency_id':inv.currency_id.id
|
||||
})
|
||||
|
||||
if inv.type in ('rec_voucher', 'bank_rec_voucher', 'journal_pur_voucher', 'journal_voucher'):
|
||||
move_line['debit'] = inv.amount
|
||||
else:
|
||||
move_line['credit'] = inv.amount * (-1)
|
||||
self.pool.get('account.move.line').create(cr, uid, move_line)
|
||||
id_mapping_dict = {}
|
||||
mline_ids = []
|
||||
for line in inv.voucher_line_ids:
|
||||
move_line['credit'] = inv.amount
|
||||
|
||||
line_ids = []
|
||||
line_ids += [move_line_pool.create(cr, uid, move_line)]
|
||||
for line in inv.payment_ids:
|
||||
amount=0.0
|
||||
move_line = {
|
||||
'name': line.name,
|
||||
'voucher_invoice' : iml and iml[0]['invoice'] and iml[0]['invoice'].id or False,
|
||||
'debit': False,
|
||||
'credit': False,
|
||||
'move_id':move_id,
|
||||
'account_id': line.account_id.id or False,
|
||||
'journal_id':journal_id ,
|
||||
'move_id': move_id ,
|
||||
'journal_id': inv.journal_id.id,
|
||||
'period_id': inv.period_id.id,
|
||||
'partner_id': line.partner_id.id or False,
|
||||
'ref': ref,
|
||||
'date':date
|
||||
'date': inv.date,
|
||||
'analytic_account_id': False
|
||||
}
|
||||
|
||||
if line.type == 'dr':
|
||||
move_line['debit'] = line.amount or False
|
||||
amount=line.amount
|
||||
elif line.type == 'cr':
|
||||
move_line['credit'] = line.amount or False
|
||||
amount=line.amount * (-1)
|
||||
ml_id=self.pool.get('account.move.line').create(cr, uid, move_line)
|
||||
id_mapping_dict[line.id] = ml_id
|
||||
|
||||
total = 0.0
|
||||
mline = self.pool.get('account.move.line')
|
||||
if line.invoice_id.id:
|
||||
invoice = self.pool.get('account.invoice').browse(cr, uid, line.invoice_id.id)
|
||||
src_account_id = invoice.account_id.id
|
||||
cr.execute('select id from account_move_line where move_id in ('+str(invoice.move_id.id)+')')
|
||||
temp_ids = map(lambda x: x[0], cr.fetchall())
|
||||
temp_ids.append(ml_id)
|
||||
mlines = mline.browse(cr, uid, temp_ids)
|
||||
for ml in mlines:
|
||||
if ml.account_id.id==src_account_id:
|
||||
mline_ids.append(ml.id)
|
||||
total += (ml.debit or 0.0) - (ml.credit or 0.0)
|
||||
#end if line.invoice_id.id:
|
||||
if inv.narration:
|
||||
line.name=inv.narration
|
||||
else:
|
||||
line.name=line.name
|
||||
if diff_currency_p:
|
||||
amount_currency = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
|
||||
line.amount = amount_currency
|
||||
move_line.update({
|
||||
'amount_currency':amount_currency,
|
||||
'currency_id':inv.currency_id.id
|
||||
})
|
||||
|
||||
if line.account_analytic_id:
|
||||
an_line = {
|
||||
'name':line.name,
|
||||
'date':date,
|
||||
'amount':amount,
|
||||
'account_id':line.account_analytic_id.id or False,
|
||||
'move_id':ml_id,
|
||||
'journal_id':an_journal_id ,
|
||||
'general_account_id':line.account_id.id,
|
||||
'ref':ref
|
||||
}
|
||||
self.pool.get('account.analytic.line').create(cr, uid, an_line)
|
||||
if mline_ids:
|
||||
self.pool.get('account.move.line').reconcile_partial(cr, uid, mline_ids, 'manual', context={})
|
||||
self.write(cr, uid, [inv.id], {'move_id': move_id})
|
||||
obj=self.pool.get('account.move').browse(cr, uid, move_id)
|
||||
move_line.update({
|
||||
'analytic_account_id':line.account_analytic_id.id
|
||||
})
|
||||
|
||||
for line in obj.line_id :
|
||||
cr.execute('insert into voucher_id (account_id,rel_account_move) values (%d, %d)',(int(ids[0]),int(line.id)))
|
||||
if line.type == 'dr':
|
||||
move_line.update({
|
||||
'debit': line.amount or False
|
||||
})
|
||||
amount = line.amount
|
||||
|
||||
elif line.type == 'cr':
|
||||
move_line.update({
|
||||
'credit': line.amount or False
|
||||
})
|
||||
amount = line.amount
|
||||
|
||||
if line.invoice_id:
|
||||
move_line.update({
|
||||
'invoice_id':line.invoice_id.id
|
||||
})
|
||||
invoice_pool.pay_and_reconcile(cr, uid, [line.invoice_id.id], amount, inv.account_id.id, inv.period_id.id, inv.journal_id.id, False, False, False)
|
||||
|
||||
move_line_id = move_line_pool.create(cr, uid, move_line)
|
||||
line_ids += [move_line_id]
|
||||
|
||||
rec = {
|
||||
'move_id': move_id,
|
||||
'move_ids':[(6, 0,line_ids)]
|
||||
}
|
||||
self.write(cr, uid, [inv.id], rec)
|
||||
|
||||
return True
|
||||
|
||||
|
@ -222,18 +179,29 @@ class account_voucher_line(osv.osv):
|
|||
res['invoice'] = line.invoice_id or False
|
||||
return res
|
||||
|
||||
def onchange_invoice_id(self, cr, uid, ids, invoice_id, context={}):
|
||||
lines = []
|
||||
if 'lines' in self.voucher_context:
|
||||
lines = [x[2] for x in self.voucher_context['lines']]
|
||||
def onchange_invoice_id(self, cr, uid, ids, invoice_id, currency_id):
|
||||
currency_pool = self.pool.get('res.currency')
|
||||
invoice_pool = self.pool.get('account.invoice')
|
||||
res = {
|
||||
'amount':0.0
|
||||
}
|
||||
if not invoice_id:
|
||||
return {'value':{}}
|
||||
return {
|
||||
'value':res
|
||||
}
|
||||
else:
|
||||
invoice_obj = self.pool.get('account.invoice').browse(cr, uid, invoice_id, context)
|
||||
residual = invoice_obj.residual
|
||||
same_invoice_amounts = [x['amount'] for x in lines if x['invoice_id']==invoice_id]
|
||||
residual -= sum(same_invoice_amounts)
|
||||
return {'value' : {'amount':residual}}
|
||||
invoice = invoice_pool.browse(cr, uid, invoice_id)
|
||||
residual = invoice.residual
|
||||
if invoice.currency_id.id != currency_id:
|
||||
residual = currency_pool.compute(cr, uid, invoice.currency_id.id, currency_id, invoice.residual)
|
||||
|
||||
res.update({
|
||||
'amount': residual
|
||||
})
|
||||
|
||||
return {
|
||||
'value':res
|
||||
}
|
||||
|
||||
def onchange_line_account(self, cr, uid, ids, account_id, type, type1):
|
||||
if not account_id:
|
||||
|
|
|
@ -1,21 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--
|
||||
Voucher line extension
|
||||
-->
|
||||
<record id="view_voucher_form" model="ir.ui.view">
|
||||
<field name="name">account.voucher.line.form.inherit</field>
|
||||
<field name="model">account.voucher.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="account_voucher.view_voucher_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="name" position="after">
|
||||
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id)" domain="[('partner_id','=',partner_id),('state','=','open')]"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="view_voucher_form" model="ir.ui.view">
|
||||
<field name="name">account.voucher.form.inherit</field>
|
||||
<field name="model">account.voucher</field>
|
||||
|
@ -25,13 +10,13 @@
|
|||
<field name="payment_ids" position="replace">
|
||||
<field name="voucher_line_ids" default_get="{'lines': voucher_line_ids}" colspan="4" nolabel="1" height="275">
|
||||
<tree string="Voucher Lines" editable="top">
|
||||
<field name="account_analytic_id"/>
|
||||
<field name="partner_id" on_change="onchange_partner(partner_id, type, parent.type)"/>
|
||||
<field name="account_id" on_change="onchange_line_account(account_id, type, parent.type)"/>
|
||||
<field name="name"/>
|
||||
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id)" domain="[('partner_id','=',partner_id),('state','=','open'),('residual','>',0.0)]"/>
|
||||
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id, parent.currency_id)" domain="[('partner_id','=',partner_id),('state','=','open'),('residual','>',0.0)]"/>
|
||||
<field name="type"/>
|
||||
<field name="amount"/>
|
||||
<field name="account_analytic_id"/>
|
||||
<field name="ref"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
|
@ -27,8 +27,8 @@ class account_voucher_unreconcile(osv.osv_memory):
|
|||
def trans_unrec(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
obj_voucher = self.pool.get('account.voucher')
|
||||
obj_reconcile = self.pool.get('account.move.reconcile')
|
||||
voucher_pool = self.pool.get('account.voucher')
|
||||
reconcile_pool = self.pool.get('account.move.reconcile')
|
||||
if context.get('active_id'):
|
||||
voucher = obj_voucher.browse(cr, uid, context.get('active_id'), context=context)
|
||||
recs = []
|
||||
|
|
|
@ -16,14 +16,22 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_view_account_voucher_unreconcile">
|
||||
<field name="name">Unreconcile entries</field>
|
||||
<field name="res_model">account.voucher.unreconcile</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="view_id" ref="view_account_voucher_unreconcile"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<act_window name="Unreconcile entries"
|
||||
res_model="account.voucher.unreconcile"
|
||||
src_model="account.voucher"
|
||||
view_mode="form"
|
||||
target="new"
|
||||
key2="client_action_multi"
|
||||
id="action_view_account_voucher_unreconcile"/>
|
||||
<!-- <act_window name="Unreconcile entries" -->
|
||||
<!-- res_model="account.voucher.unreconcile"-->
|
||||
<!-- src_model="account.voucher"-->
|
||||
<!-- view_mode="form"-->
|
||||
<!-- target="new" -->
|
||||
<!-- key2="client_action_multi" -->
|
||||
<!-- id="action_view_account_voucher_unreconcile"/>-->
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -146,7 +146,7 @@ class crm_lead_report(osv.osv):
|
|||
0 as avg_answers,
|
||||
0.0 as perc_done,
|
||||
0.0 as perc_cancel,
|
||||
(SELECT count(id) FROM mailgate_message WHERE model='crm.lead' AND res_id=c.id) AS email,
|
||||
(SELECT count(id) FROM mailgate_message WHERE model='crm.lead' AND res_id=c.id AND history=True) AS email,
|
||||
date_trunc('day',c.create_date) as create_date,
|
||||
extract('epoch' from (c.date_closed-c.create_date))/(3600*24) as delay_close,
|
||||
extract('epoch' from (c.date_deadline - c.date_closed))/(3600*24) as delay_expected,
|
||||
|
|
|
@ -56,15 +56,6 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Leads Analysis">
|
||||
<group col="20" colspan="8">
|
||||
<filter icon="terp-check"
|
||||
string="Opportunities"
|
||||
name="opportunity"
|
||||
domain="[('type','=','opportunity')]"/>
|
||||
<filter icon="terp-check"
|
||||
string="Leads"
|
||||
name="lead"
|
||||
domain="[('type','=','lead')]"/>
|
||||
<separator orientation="vertical" />
|
||||
<filter string="Last 365 Days" icon="terp-go-year"
|
||||
domain="[('create_date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"/>
|
||||
<filter string="Last 30 Days" icon="terp-go-month" name="this_month"
|
||||
|
@ -74,7 +65,7 @@
|
|||
<separator orientation="vertical" />
|
||||
<filter icon="terp-check"
|
||||
string="Current"
|
||||
domain="[('state','in',('draft','open')]"/>
|
||||
domain="[('state','in',('draft','open'))]"/>
|
||||
<filter icon="terp-check"
|
||||
string="Pending"
|
||||
domain="[('state','=','pending')]"/>
|
||||
|
@ -96,7 +87,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="user" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}" />
|
||||
|
@ -149,7 +140,7 @@
|
|||
<field name="model">crm.lead.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Leads Analysis">
|
||||
<tree string="Opportunities Analysis">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="section_id" invisible="1" groups="base.group_extended"/>
|
||||
|
@ -181,7 +172,7 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="context">{'search_default_lead':1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="domain">[('type', '=', 'lead')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_lead_tree">
|
||||
|
@ -204,7 +195,7 @@
|
|||
<field name="view_type">form</field>
|
||||
<field name="context">{"search_default_opportunity": 1, "search_default_user":1,"search_default_this_month":1,'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="domain">[('type', '=', 'opportunity')]</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window.view" id="action_report_crm_opportunity_tree">
|
||||
|
|
|
@ -114,7 +114,7 @@
|
|||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="User" icon="terp-personal"
|
||||
domain="[]" context="{'group_by':'user_id'}" />
|
||||
<filter string="Partner" icon="terp-personal" context="{'group_by':'partner_id'}" />
|
||||
|
|
|
@ -38,6 +38,7 @@ class hr_expense_report(osv.osv):
|
|||
'product_id':fields.many2one('product.product', 'Product', readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Force Journal', readonly=True),
|
||||
'product_qty':fields.float('Qty', readonly=True),
|
||||
'invoiced':fields.integer('# of Invoiced Lines', readonly=True),
|
||||
'employee_id': fields.many2one('hr.employee', "Employee's Name", readonly=True),
|
||||
'date_confirm': fields.date('Confirmation Date', readonly=True),
|
||||
'date_valid': fields.date('Validation Date', readonly=True),
|
||||
|
@ -77,6 +78,7 @@ class hr_expense_report(osv.osv):
|
|||
to_date(to_char(s.date_confirm, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_confirm,
|
||||
to_date(to_char(s.date_valid, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_valid,
|
||||
s.invoice_id,
|
||||
count(s.invoice_id) as invoiced,
|
||||
s.user_valid as user_id,
|
||||
s.department_id,
|
||||
to_char(date_trunc('day',s.create_date), 'YYYY') as year,
|
||||
|
|
|
@ -17,17 +17,17 @@
|
|||
<field name="analytic_account" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="company_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="currency_id" invisible="1"/>
|
||||
<field name="product_id" invisible="1"/>
|
||||
<field name="product_qty" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="invoiced" sum="Total Invoiced Lines"/>
|
||||
<field name="nbr" sum="# of Lines"/>
|
||||
<field name="no_of_products" sum="# of Products"/>
|
||||
<field name="delay_valid"/>
|
||||
<field name="delay_confirm"/>
|
||||
<field name="price_average" avg="Average Price"/>
|
||||
<field name="price_total" sum="Total Price"/>
|
||||
<field name="delay_confirm"/>
|
||||
<field name="delay_valid"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -67,10 +67,9 @@
|
|||
help = "Confirm Expenses"/>
|
||||
<filter string="Accepted" icon="terp-camera_test" domain="[('state','=','accepted')]"
|
||||
help = "Accepted Expenses"/>
|
||||
<filter string="Cancelled" icon="terp-dialog-close" domain="[('state','=','cancelled')]"
|
||||
help = "Cancelled Expenses"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By...">
|
||||
|
@ -80,7 +79,6 @@
|
|||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Analytic account" icon="terp-folder-green" context="{'group_by':'analytic_account'}"/>
|
||||
<filter string="Force Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
@ -96,10 +94,6 @@
|
|||
<group expand="0" string="Extended filters..." groups="base.group_extended">
|
||||
<field name="product_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="journal_id" widget="selection"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="department_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="user_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
|
|
|
@ -10,18 +10,17 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Available Holidays">
|
||||
<field name="employee_id"/>
|
||||
<field name="category_id"/>
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<field name="category_id" invisible="1"/>
|
||||
<field name="holiday_status_id" invisible="1"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="max_leave" sum="Allocated Leaves"/>
|
||||
<field name="taken_leaves" sum="Taken Leaves"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="remaining_leave" sum="Remaining Leaves"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="max_leave" sum="Allocated Leaves"/>
|
||||
<field name="taken_leaves" sum="Taken Leaves"/>
|
||||
<field name="remaining_leave" sum="Remaining Leaves"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -48,11 +47,6 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Leaves">
|
||||
<group>
|
||||
<filter icon="terp-personal" string="Employee" domain="[('category_id', '=', False)]"
|
||||
help="Leaves by empolyee"/>
|
||||
<filter icon="terp-stock_symbol-selection" string="Category"
|
||||
domain="[('employee_id', '=', False)]" help="Leaves by category"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-go-year" string="This Year"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Leaves in this year"/>
|
||||
|
@ -62,26 +56,25 @@
|
|||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Leaves during last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="user_id" widget="selection">
|
||||
<filter icon="terp-personal" string="My Leaves" domain="[('user_id','=',uid)]"/>
|
||||
</field>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
<filter icon="terp-personal" string="Employee"
|
||||
name="user" context="{'group_by':'employee_id'}"
|
||||
help="Leaves by employee"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'holiday_status_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." colspan="10" col="12">
|
||||
<field name="holiday_status_id" widget="selection"/>
|
||||
<field name="department_id" widget="selection"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="10" col="12">
|
||||
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'holiday_status_id'}"/>
|
||||
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -91,7 +84,7 @@
|
|||
<field name="res_model">available.holidays.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="context">{'search_default_month':1,'search_default_User':1,'group_by':[], "search_default_user_id": uid}</field>
|
||||
<field name="context">{'search_default_month':1,'search_default_user':1,'group_by':[], "search_default_user_id": uid, 'group_by_no_leaf':1}</field>
|
||||
<field name="view_id" ref="view_hr_available_holidays_report_search"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<tree string="Leaves Statistics">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="category_id"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<field name="category_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="date_from" invisible="1"/>
|
||||
<field name="date_to" invisible="1"/>
|
||||
|
@ -45,11 +45,6 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Leaves">
|
||||
<group>
|
||||
<filter icon="terp-personal" string="Employee" domain="[('category_id', '=', False)]"
|
||||
help="Leaves by empolyee"/>
|
||||
<filter icon="terp-stock_symbol-selection" string="Category" domain="[('employee_id', '=', False)]"
|
||||
help="Leaves by category"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-go-year" string="This Year"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]" help="Leaves in this year"/>
|
||||
<filter icon="terp-go-month" string="This Month" name="month"
|
||||
|
@ -57,43 +52,42 @@
|
|||
<filter icon="terp-go-week" string=" 7 Days " separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Leaves during last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]"
|
||||
help = "Draft Leaves"/>
|
||||
<filter string="Waiting Validation" icon="terp-gtk-media-pause" domain="[('state', '=' ,'confirm')]"
|
||||
help = "In progress Leaves"/>
|
||||
<filter string="Future Leaves" icon="terp-gtk-media-pause" domain="[('state', 'in' ,('draft','confirm'))]"
|
||||
help = "Draft and Confirmed leaves"/>
|
||||
<filter string="Validated" icon="terp-camera_test" domain="[('state','=','validate')]"
|
||||
help = "Pending Leaves"/>
|
||||
<filter icon="terp-gtk-stop" string="Cancelled" domain="[('state','=','cancel')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="employee_id" widget="selection"/>
|
||||
<field name="user_id" widget="selection">
|
||||
</field>
|
||||
<field name="department_id"/>
|
||||
<field name="employee_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By..." colspan="10" col="12">
|
||||
<group expand="1" string="Group By..." colspan="10" col="12">
|
||||
<filter string="Department" name="department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-personal" string="Employee" name="Employee" context="{'group_by':'employee_id'}"
|
||||
help="Leaves by empolyee"/>
|
||||
<filter string="User" name="User" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-stock_symbol-selection" string="Category" context="{'group_by':'category_id'}"
|
||||
help="Leaves by category"/>
|
||||
<filter string="Type" icon="terp-stock_symbol-selection" context="{'group_by':'holiday_status_id'}"/>
|
||||
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Day" icon="terp-go-today" context="{'group_by':'day'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'date'}"/>
|
||||
<filter string="Month" icon="terp-go-month" context="{'group_by':'month'}"/>
|
||||
<filter string="Year" icon="terp-go-year" context="{'group_by':'year'}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Extended options..." colspan="10" col="12">
|
||||
<filter icon="terp-gtk-stop" string="Refused" name="done"
|
||||
domain="[('state','=','refuse')]"/>
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="category_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date_from"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="holiday_status_id" widget="selection"/>
|
||||
<field name="user_id"/>
|
||||
<newline/>
|
||||
<filter icon="terp-gtk-stop" string="Cancelled" domain="[('state','=','cancel')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="date_from"/>
|
||||
<field name="date_to"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="department_id" widget="selection"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
@ -104,7 +98,7 @@
|
|||
<field name="res_model">hr.holidays.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="context">{"search_default_user_id": uid, 'search_default_month':1, 'search_default_Employee':1, 'group_by':[]} </field>
|
||||
<field name="context">{"search_default_user_id": uid, 'search_default_month':1, 'search_default_department':1, 'group_by':[], 'group_by_no_leaf':1} </field>
|
||||
<field name="search_view_id" ref="view_hr_holidays_report_search"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -522,7 +522,7 @@ class company_contribution(osv.osv):
|
|||
'category_id':fields.many2one('hr.allounce.deduction.categoty', 'Heads', required=False),
|
||||
'name':fields.char('Name', size=256, required=True, readonly=False),
|
||||
'code':fields.char('Code', size=64, required=True, readonly=False),
|
||||
'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
|
||||
# 'include_in_salary':fields.boolean('Included in Salary ?', help='If company contribute on this deduction then should company contribution is also deducted from Employee Salary'),
|
||||
'gratuity':fields.boolean('Use for Gratuity ?', required=False),
|
||||
'line_ids':fields.one2many('company.contribution.line', 'contribution_id', 'Calculations', required=False),
|
||||
'register_id':fields.property(
|
||||
|
@ -537,19 +537,20 @@ class company_contribution(osv.osv):
|
|||
),
|
||||
'amount_type':fields.selection([
|
||||
('fix','Fixed Amount'),
|
||||
('per','Percentage'),
|
||||
('func','Function Calculation'),
|
||||
],'Amount Type', select=True),
|
||||
'contribute_per':fields.float('Contribution', digits=(16, 4), help='Define Company contribution ratio 1.00=100% contribution, If Employee Contribute 5% then company will and here 0.50 defined then company will contribute 50% on employee 5% contribution'),
|
||||
'account_id':fields.property(
|
||||
'account.account',
|
||||
type='many2one',
|
||||
relation='account.account',
|
||||
string="Account",
|
||||
method=True,
|
||||
view_load=True,
|
||||
help="Expanse account where company expanse will be encoded",
|
||||
required=False
|
||||
),
|
||||
# 'account_id':fields.property(
|
||||
# 'account.account',
|
||||
# type='many2one',
|
||||
# relation='account.account',
|
||||
# string="Account",
|
||||
# method=True,
|
||||
# view_load=True,
|
||||
# help="Expanse account where company expanse will be encoded",
|
||||
# required=False
|
||||
# ),
|
||||
'company_id':fields.many2one('res.company', 'Company', required=False),
|
||||
'active':fields.boolean('Active', required=False),
|
||||
'note': fields.text('Description'),
|
||||
|
|
|
@ -644,8 +644,6 @@
|
|||
<field name="name" select="1"/>
|
||||
<field name="code" select="1"/>
|
||||
<field name="category_id"/>
|
||||
<field name="company_id" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Contributions"/>
|
||||
|
@ -654,9 +652,11 @@
|
|||
<field name="register_id" attrs="{'required': [('contribute','=',True)]}"/>
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator colspan="2" string="Accounts"/>
|
||||
<field name="include_in_salary" />
|
||||
<field name="account_id" attrs="{'required': [('include_in_salary','=',True)]}"/>
|
||||
<separator colspan="2" string="Other Information"/>
|
||||
<field name="company_id" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
<!-- <field name="include_in_salary" />-->
|
||||
<!-- <field name="account_id" attrs="{'required': [('include_in_salary','=',True)]}"/>-->
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Function" attrs="{'readonly': [('amount_type','!=','func')]}">
|
||||
|
|
|
@ -393,6 +393,11 @@ class hr_payslip(osv.osv):
|
|||
|
||||
line_ids += [movel_pool.create(cr, uid, rec)]
|
||||
|
||||
for contrub in line.category_id.contribute_ids:
|
||||
print contrib.name, contrub.code, contrub.amount_type, contrib.contribute_per, line.total
|
||||
|
||||
|
||||
|
||||
# if line.company_contrib > 0:
|
||||
# company_contrib = line.company_contrib
|
||||
## if line.category_id.amount_type == 'per':
|
||||
|
|
|
@ -48,7 +48,6 @@ to set up a management by affair.
|
|||
'wizard/hr_timesheet_print_employee_view.xml',
|
||||
'wizard/hr_timesheet_print_users_view.xml',
|
||||
'wizard/hr_timesheet_sign_in_out_view.xml',
|
||||
'report/hr_timesheet_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_demo.xml'],
|
||||
'test': ['test/test_hr_timesheet.yml'],
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
|
||||
import hr_timesheet_report
|
||||
import user_timesheet
|
||||
import users_timesheet
|
||||
|
||||
|
|
|
@ -2,4 +2,3 @@
|
|||
"access_hr_analytic_timesheet","hr.analytic.timesheet","model_hr_analytic_timesheet","hr.group_hr_user",1,1,1,1
|
||||
"access_hr_account_analytic_line","account.account.analytic.line","account.model_account_analytic_line","hr.group_hr_user",1,1,1,0
|
||||
"access_account_analytic_journal","account.account.analytic.journal","account.model_account_analytic_journal","hr.group_hr_user",1,0,0,0
|
||||
"access_hr_timesheet_report","hr.timesheet.report","model_hr_timesheet_report","hr.group_hr_manager",1,0,0,0
|
||||
|
|
|
|
@ -55,6 +55,7 @@ The validation can be configured in the company:
|
|||
'process/hr_timesheet_sheet_process.xml',
|
||||
'report/timesheet_report_view.xml',
|
||||
'board_hr_timesheet_view.xml',
|
||||
'report/hr_timesheet_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['hr_timesheet_sheet_demo.xml',
|
||||
|
||||
|
|
|
@ -20,6 +20,6 @@
|
|||
##############################################################################
|
||||
|
||||
import timesheet_report
|
||||
|
||||
import hr_timesheet_report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -56,10 +56,9 @@
|
|||
<separator orientation="vertical"/>
|
||||
<field name="account_id"/>
|
||||
<field name="user_id" />
|
||||
<field name="date" />
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<group expand="1" string="Group By...">
|
||||
<filter string="User" name="group_user_id" icon="terp-personal" context="{'group_by':'user_id'}"/>
|
||||
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
@ -79,6 +78,8 @@
|
|||
<field name="journal_id"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="date" />
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
@ -94,6 +95,6 @@
|
|||
<menuitem
|
||||
action="action_hr_timesheet_report_stat_all"
|
||||
id="menu_hr_timesheet_report_all"
|
||||
parent="menu_hr_reporting_timesheet" sequence="0"/>
|
||||
parent="hr_timesheet.menu_hr_reporting_timesheet" sequence="0"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -49,18 +49,18 @@
|
|||
<field name="arch" type="xml">
|
||||
<search string="Timesheet">
|
||||
<group col="10" colspan="12">
|
||||
<filter icon="terp-go-year" string="This Year"
|
||||
domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')),('date_current','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Timesheet in this year"/>
|
||||
<filter icon="terp-go-month" string="This Month"
|
||||
name="month"
|
||||
domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')), ('date_current','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Timesheet in this month"/>
|
||||
<filter icon="terp-go-week"
|
||||
string=" 7 Days "
|
||||
separator="1"
|
||||
domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')), ('date_current','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Timesheet during last 7 days"/>
|
||||
<filter icon="terp-go-month" string="This Month"
|
||||
name="month"
|
||||
domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')), ('date_current','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Timesheet in this month"/>
|
||||
<filter icon="terp-go-year" string="This Year"
|
||||
domain="[('date_current','<=', time.strftime('%%Y-%%m-%%d')),('date_current','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Timesheet in this year"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new"
|
||||
string="Draft"
|
||||
|
|
|
@ -2,3 +2,4 @@
|
|||
"access_hr_timesheet_sheet_sheet","hr_timesheet_sheet.sheet","model_hr_timesheet_sheet_sheet","hr.group_hr_user",1,1,1,1
|
||||
"access_hr_timesheet_sheet_sheet_day","hr_timesheet_sheet.sheet.day","model_hr_timesheet_sheet_sheet_day","hr.group_hr_user",1,1,1,1
|
||||
"access_hr_timesheet_sheet_sheet_account","hr_timesheet_sheet.sheet.account","model_hr_timesheet_sheet_sheet_account","hr.group_hr_user",1,1,1,1
|
||||
"access_hr_timesheet_report","hr.timesheet.report","model_hr_timesheet_report","hr.group_hr_manager",1,0,0,0
|
||||
|
|
|
|
@ -27,6 +27,7 @@ import ir
|
|||
import netsvc
|
||||
import time
|
||||
|
||||
|
||||
#----------------------------------------------------------
|
||||
# Work Centers
|
||||
#----------------------------------------------------------
|
||||
|
|
|
@ -885,7 +885,6 @@
|
|||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window
|
||||
id="action_product_bom_structure"
|
||||
name="Product BoM Structure"
|
||||
|
|
|
@ -31,6 +31,7 @@ class procurement_order(osv.osv):
|
|||
_inherit = 'procurement.order'
|
||||
_columns = {
|
||||
'bom_id': fields.many2one('mrp.bom', 'BoM', ondelete='cascade', select=True),
|
||||
'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||
}
|
||||
|
||||
def check_produce_product(self, cr, uid, procurement, context=[]):
|
||||
|
|
|
@ -25,6 +25,12 @@ from tools.translate import _
|
|||
import netsvc
|
||||
import time
|
||||
|
||||
# Procurement
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
# Produce, Buy or Find products and place a move
|
||||
# then wizard for picking lists & move
|
||||
#
|
||||
|
||||
class mrp_property_group(osv.osv):
|
||||
"""
|
||||
|
@ -54,14 +60,6 @@ class mrp_property(osv.osv):
|
|||
'composition': lambda *a: 'min',
|
||||
}
|
||||
mrp_property()
|
||||
|
||||
# ------------------------------------------------------------------
|
||||
# Procurement
|
||||
# ------------------------------------------------------------------
|
||||
#
|
||||
# Produce, Buy or Find products and place a move
|
||||
# then wizard for picking lists & move
|
||||
#
|
||||
class procurement_order(osv.osv):
|
||||
"""
|
||||
Procurement Orders
|
||||
|
@ -91,9 +89,6 @@ class procurement_order(osv.osv):
|
|||
" a make to order method."),
|
||||
|
||||
'note': fields.text('Note'),
|
||||
|
||||
'property_ids': fields.many2many('mrp.property', 'procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||
|
||||
'message': fields.char('Latest error', size=64, help="Exception occurred while computing procurement orders."),
|
||||
'state': fields.selection([
|
||||
('draft','Draft'),
|
||||
|
@ -477,7 +472,7 @@ class stock_warehouse_orderpoint(osv.osv):
|
|||
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
|
||||
"a procurement to bring the virtual stock to the Max Quantity."),
|
||||
'product_max_qty': fields.float('Max Quantity', required=True,
|
||||
help="When the virtual stock goes belong the Min Quantity, Open ERP generates "\
|
||||
help="When the virtual stock goes belong the Mix Quantity, Open ERP generates "\
|
||||
"a procurement to bring the virtual stock to the Max Quantity."),
|
||||
'qty_multiple': fields.integer('Qty Multiple', required=True,
|
||||
help="The procurement quantity will by rounded up to this multiple."),
|
||||
|
|
|
@ -183,6 +183,8 @@
|
|||
<field name="act_from" ref="act_make_done"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
<field name="condition">action_check_finnished()</field>
|
||||
<field name="trigger_model">stock.move</field>
|
||||
<field name="trigger_expr_id">[move_id.id]</field>
|
||||
</record>
|
||||
<record id="trans_make_done_confirm" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_done"/>
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",stock.group_stock_manager,1,1,1,1
|
||||
"access_mrp_property","mrp.property","model_mrp_property",stock.group_stock_manager,1,1,1,1
|
||||
"access_mrp_property_group","mrp.property.group","model_mrp_property_group",,1,0,0,0
|
||||
"access_mrp_property","mrp.property","model_mrp_property",base.group_user,1,0,0,0
|
||||
"access_procurement","procurement.order","model_procurement_order",base.group_user,1,0,0,0
|
||||
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint",stock.group_stock_manager,1,1,1,1
|
||||
"access_procurement","procurement.order","model_procurement_order","base.group_user",1,0,0,0
|
||||
"access_stock_warehouse_orderpoint","stock.warehouse.orderpoint","model_stock_warehouse_orderpoint","stock.group_stock_manager",1,1,1,1
|
||||
"access_mrp_property_group","mrp.property.group","model_mrp_property_group","stock.group_stock_manager",1,1,1,1
|
||||
"access_mrp_property","mrp.property","model_mrp_property","stock.group_stock_manager",1,1,1,1
|
||||
"access_mrp_property_group","mrp.property.group","model_mrp_property_group","base.group_user",1,0,0,0
|
||||
"access_mrp_property","mrp.property","model_mrp_property","base.group_user",1,0,0,0
|
||||
|
||||
|
|
|
|
@ -71,33 +71,34 @@ class product_uom(osv.osv):
|
|||
_columns = {
|
||||
'name': fields.char('Name', size=64, required=True, translate=True),
|
||||
'category_id': fields.many2one('product.uom.categ', 'UoM Category', required=True, ondelete='cascade',
|
||||
help="Unit of Measure of a category can be converted between each others in the same category."),
|
||||
help="Quantity conversions may happen automatically between Units of Measure in the same category, according to their respective ratios."),
|
||||
'factor': fields.float('Ratio', digits=(12, 6), required=True,
|
||||
help='The coefficient for the formula:\n' \
|
||||
'1 (base unit) = coeff (this unit). Ratio = 1 / Factor.'),
|
||||
help='How many times this UoM is smaller than the reference UoM in this category:\n'\
|
||||
'1 * (reference unit) = ratio * (this unit)'),
|
||||
'factor_inv': fields.function(_factor_inv, digits=(12, 6),
|
||||
fnct_inv=_factor_inv_write,
|
||||
method=True, string='Ratio',
|
||||
help='The coefficient for the formula:\n' \
|
||||
'coeff (base unit) = 1 (this unit). Factor = 1 / Rate.'),
|
||||
help='How many times this UoM is bigger than the reference UoM in this category:\n'\
|
||||
'1 * (this unit) = ratio * (reference unit)', required=True),
|
||||
'rounding': fields.float('Rounding Precision', digits=(16, 3), required=True,
|
||||
help="The computed quantity will be a multiple of this value. Use 1.0 for products that can not be split."),
|
||||
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the unit of measure without removing it."),
|
||||
'uom_factor': fields.selection([('bigger','Bigger than the default'),
|
||||
('smaller','Smaller than the default'),
|
||||
('default','Default UoM for the category')],'Type of Unit', required=1),
|
||||
help="The computed quantity will be a multiple of this value. "\
|
||||
"Use 1.0 for a UoM that cannot be further split, such as a piece."),
|
||||
'active': fields.boolean('Active', help="By unchecking the active field you can disable a unit of measure without deleting it."),
|
||||
'uom_type': fields.selection([('bigger','Bigger than the reference UoM'),
|
||||
('reference','Reference UoM for this category (ratio=1)'),
|
||||
('smaller','Smaller than the reference UoM')],'UoM Type', required=1),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'factor': lambda *a: 1.0,
|
||||
'factor_inv': lambda *a: 1.0,
|
||||
'active': lambda *a: 1,
|
||||
'rounding': lambda *a: 0.01,
|
||||
'uom_factor': lambda *a: 'default',
|
||||
'factor': 1.0,
|
||||
'factor_inv': 1.0,
|
||||
'active': 1,
|
||||
'rounding': 0.01,
|
||||
'uom_type': 'reference',
|
||||
}
|
||||
|
||||
_sql_constraints = [
|
||||
('factor_gt_zero', 'CHECK (factor!=0)', 'Value of the factor can never be 0 !'),
|
||||
('factor_gt_zero', 'CHECK (factor!=0)', 'The conversion ratio for a unit of measure cannot be 0!'),
|
||||
]
|
||||
|
||||
def _compute_qty(self, cr, uid, from_uom_id, qty, to_uom_id=False):
|
||||
|
@ -133,8 +134,8 @@ class product_uom(osv.osv):
|
|||
amount = amount / to_unit.factor
|
||||
return amount
|
||||
|
||||
def onchange_factor(self, cursor, user, ids, value):
|
||||
if value == 'default':
|
||||
def onchange_type(self, cursor, user, ids, value):
|
||||
if value == 'reference':
|
||||
return {'value': {'factor': 1, 'factor_inv': 1}}
|
||||
return {}
|
||||
|
||||
|
|
|
@ -24,38 +24,55 @@
|
|||
<record id="product_uom_unit" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_unit"/>
|
||||
<field name="name">PCE</field>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="rounding">1.0</field>
|
||||
<field name="factor" eval="1.0"/>
|
||||
<field name="rounding" eval="1.0"/>
|
||||
</record>
|
||||
<record id="product_uom_kgm" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||
<field name="name">KGM</field>
|
||||
<field name="factor">1</field>
|
||||
<field name="name">kg</field>
|
||||
<field name="factor" eval="1"/>
|
||||
</record>
|
||||
<record id="product_uom_gram" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||
<field name="name">g</field>
|
||||
<field name="factor" eval="1000"/>
|
||||
<field name="uom_type">smaller</field>
|
||||
</record>
|
||||
<record id="uom_hour" model="product.uom">
|
||||
<field name="name">Hour</field>
|
||||
<field name="name">hour</field>
|
||||
<field eval="uom_categ_wtime" name="category_id"/>
|
||||
<field name="factor">8.0</field>
|
||||
<field name="factor" eval="8.0"/>
|
||||
<field name="uom_type">smaller</field>
|
||||
</record>
|
||||
<record id="uom_day" model="product.uom">
|
||||
<field name="name">Day</field>
|
||||
<field name="name">day</field>
|
||||
<field eval="uom_categ_wtime" name="category_id"/>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="factor" eval="1.0"/>
|
||||
</record>
|
||||
<record id="product_uom_ton" model="product.uom">
|
||||
<field name="category_id" ref="product_uom_categ_kgm"/>
|
||||
<field name="name">TON</field>
|
||||
<field name="factor">0.001</field>
|
||||
<!-- 'tonne' is the most common spelling in english-speaking countries,
|
||||
the alternative is 'metric ton' in the US, abbreviated as 'mt' -->
|
||||
<field name="name">tonne</field>
|
||||
<field name="factor" eval="0.001"/>
|
||||
<field name="uom_type">bigger</field>
|
||||
</record>
|
||||
<record id="product_uom_meter" model="product.uom">
|
||||
<field name="category_id" ref="uom_categ_length"/>
|
||||
<field name="name">Meter</field>
|
||||
<field name="factor">1.0</field>
|
||||
<field name="name">m</field>
|
||||
<field name="factor" eval="1.0"/>
|
||||
</record>
|
||||
<record id="product_uom_km" model="product.uom">
|
||||
<field name="category_id" ref="uom_categ_length"/>
|
||||
<field name="name">Kilometer</field>
|
||||
<field name="factor">0.001</field>
|
||||
<field name="name">km</field>
|
||||
<field name="factor" eval="0.001"/>
|
||||
<field name="uom_type">bigger</field>
|
||||
</record>
|
||||
<record id="product_uom_cm" model="product.uom">
|
||||
<field name="category_id" ref="uom_categ_length"/>
|
||||
<field name="name">cm</field>
|
||||
<field name="factor" eval="100"/>
|
||||
<field name="uom_type">smaller</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
|
|
@ -310,17 +310,30 @@
|
|||
<field name="arch" type="xml">
|
||||
<form string="Units of Measure">
|
||||
<group col="6" colspan="4">
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Unit of Measure Properties" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1" widget="selection"/>
|
||||
<field name="active"/>
|
||||
<field name="uom_factor" on_change="onchange_factor(uom_factor)"/>
|
||||
<group colspan="2" col="2">
|
||||
<field name="factor" attrs="{'invisible':[('uom_factor','<>','smaller')]}"/>
|
||||
<field name="factor_inv" string="Factor Data" attrs="{'invisible':[('uom_factor','<>','bigger')]}"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group col="4" colspan="4">
|
||||
<separator string="Ratio & Precision" colspan="4"/>
|
||||
<group colspan="2" col="2">
|
||||
<field name="uom_type" on_change="onchange_type(uom_type)"/>
|
||||
<field name="rounding"/>
|
||||
</group>
|
||||
<group colspan="2" col="2">
|
||||
<group col="2" colspan="2" attrs="{'invisible':[('uom_type','!=','smaller')]}">
|
||||
<field name="factor"/>
|
||||
<label colspan="2" string=" e.g: 1 * (reference unit) = ratio * (this unit)"/>
|
||||
</group>
|
||||
<group col="2" colspan="2" attrs="{'invisible':[('uom_type','!=','bigger')]}">
|
||||
<field name="factor_inv"/>
|
||||
<label colspan="2" string=" e.g: 1 * (this unit) = ratio * (reference unit)"/>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
|
|
@ -170,8 +170,8 @@ class product_product(osv.osv):
|
|||
context = {}
|
||||
res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
|
||||
if res: return res
|
||||
if (context.get('location', False)):
|
||||
return _('Products: ')+self.pool.get('stock.location').browse(cr, user, context['location'], context).name
|
||||
if (context.get('active_id', False)) and (context.get('active_model') == 'stock.location'):
|
||||
return _('Products: ')+self.pool.get('stock.location').browse(cr, user, context['active_id'], context).name
|
||||
return res
|
||||
|
||||
def get_product_available(self, cr, uid, ids, context=None):
|
||||
|
|
|
@ -208,7 +208,7 @@
|
|||
<para style="terp_default_Centre_8">[[ formatLang(picking.min_date,date_time = True) ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Centre_8">[[ picking.weight or '']] </para>
|
||||
<para style="terp_default_Centre_8">[[ 'weight' in picking._columns.keys() and picking.weight or '']] </para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
|
|
@ -72,6 +72,7 @@ class report_stock_picking(osv.osv):
|
|||
sp.address_id as partner_id,
|
||||
to_date(to_char(sp.create_date, 'MM-dd-YYYY'),'MM-dd-YYYY') as date,
|
||||
count(sm.id) as nbr,
|
||||
count(sp.id) as nbp,
|
||||
sum(sm.product_qty*u.factor) as product_qty,
|
||||
sum(sm.product_uos_qty) as product_uos_qty,
|
||||
sm.product_id as product_id,
|
||||
|
|
|
@ -22,3 +22,4 @@
|
|||
"access_report_delivery_products_planned","report.delivery.products.planned","model_report_delivery_products_planned","stock.group_stock_user",1,1,1,1
|
||||
"access_report_stock_move","report.stock.move","model_report_stock_move","stock.group_stock_user",1,1,1,1
|
||||
"access_report_stock_inventory","report.stock.inventory","model_report_stock_inventory","stock.group_stock_user",1,1,1,1
|
||||
"access_report_stock_picking","report.stock.picking","model_report_stock_picking","stock.group_stock_user",1,1,1,1
|
||||
|
|
|
|
@ -1008,6 +1008,9 @@ class stock_picking(osv.osv):
|
|||
return res
|
||||
|
||||
def test_done(self, cr, uid, ids, context=None):
|
||||
""" Test whether the move lines are done or not.
|
||||
@return: True or False
|
||||
"""
|
||||
ok = False
|
||||
for pick in self.browse(cr, uid, ids, context=context):
|
||||
if not pick.move_lines:
|
||||
|
|
|
@ -1630,9 +1630,6 @@
|
|||
icon="terp-stock_effects-object-colorize"
|
||||
states="draft,assigned,confirmed,done"/>
|
||||
<label/>
|
||||
<button name="%(track_line)d" string="Split in production lots"
|
||||
groups="base.group_extended"
|
||||
type="action" icon="terp-stock_effects-object-colorize"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state"/>
|
||||
<group col="5" colspan="2">
|
||||
|
|
|
@ -44,7 +44,7 @@ class stock_inventory_line_split(osv.osv_memory):
|
|||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
record_id = context and context.get('active_id',False)
|
||||
res = super(stock_inventory_line_split, self).default_get(cr, uid, fields, context=context)
|
||||
res = {}
|
||||
line = self.pool.get('stock.inventory.line').browse(cr, uid, record_id)
|
||||
if 'product_id' in fields:
|
||||
res.update({'product_id':line.product_id.id})
|
||||
|
|
|
@ -50,7 +50,7 @@ class thunderbird_installer(osv.osv_memory):
|
|||
'thunderbird' : True,
|
||||
'name' : 'tiny_plugin-2.0.xpi',
|
||||
'pdf_name' : 'Installation Guide to OpenERP Thunderbid Plug-in.pdf',
|
||||
'description' : """ * Save The thunderbird plugin Follow the following step to install thunderbird plugin. \n -> 1. From Menu Bar, Open Tools > Add ons. \n -> 2. Now click on install button and a browser window will appear. \n -> 3. Just select the (.xpi) file from thunderbird/plugin directory and click ok, a new software installation window will appear and within a short time Install Now button will be enabled. \n -> 4. Click on Install Now and restart Thunderbird. \n -> 5. Now Thunderbird plugin is installed."""
|
||||
'description' : """ * Save the Thunderbird plugin. \n * Follow the following step to install Thunderbird plugin. \n -> 1.From Menu Bar of Thunderbird, open Tools > Add ons. \n -> 2. Click on install button and a browser window appears. \n -> 3. Select the plug-in(.xpi file) and click Ok. \n -> 4. Software installation window appears and within a short time “Install Now” button will be enabled -> 5. Click "Install Now". \n -> 6. Restart Thunderbird."""
|
||||
}
|
||||
|
||||
thunderbird_installer()
|
||||
|
|
Binary file not shown.
|
@ -15,7 +15,7 @@
|
|||
<attribute name="string">Thunderbird</attribute>
|
||||
</separator>
|
||||
<xpath expr="//label[@string='description']" position="attributes">
|
||||
<attribute name="string">This module is required for the thuderbird plug-in to work properly.This allows you to select an object that you had like to add to your email and its attachments. You can select a partner, a task, a project, an analytical account, or any other object and attach selected mail as .eml file in attachment of selected record.</attribute>
|
||||
<attribute name="string">This module allows you to archive an e-mail on one or more objects of OpenERP. You can attach an email to a partner, a task, an analytic account or any other object. You can also create a new object like a lead, a phone call, claim and many more.</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//button[@string='Install Modules']" position="attributes">
|
||||
<attribute name="string">Configure</attribute>
|
||||
|
@ -25,8 +25,8 @@
|
|||
<attribute name='rowspan'>15</attribute>
|
||||
</xpath>
|
||||
<group colspan="8" position="replace">
|
||||
<group colspan="8" height="400" width="700">
|
||||
<field name="thunderbird"/>
|
||||
<group colspan="8" height="450" width="750">
|
||||
<field name="thunderbird" invisible="1" />
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="pdf_name" invisible="1"/>
|
||||
<newline/>
|
||||
|
@ -72,10 +72,10 @@
|
|||
<group colspan="2">
|
||||
<image name="gtk-dialog-info"/>
|
||||
<newline/>
|
||||
<label align="0.0" string="This module is required for the thuderbird plug-in to work properly.This allows you to select an object that you had like to add to your email and its attachments. You can select a partner, a task, a project, an analytical account, or any other object and attach selected mail as .eml file in attachment of selected record." width="200"/>
|
||||
<label align="0.0" string="This module allows you to archive an e-mail on one or more objects of OpenERP. You can attach an email to a partner, a task, an analytic account or any other object. You can also create a new object like a lead, a phone call, claim and many more." width="200"/>
|
||||
</group>
|
||||
<group colspan="8">
|
||||
<field name="thunderbird"/>
|
||||
<field name="thunderbird" invisible="1"/>
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="pdf_name" invisible="1"/>
|
||||
<newline/>
|
||||
|
|
Loading…
Reference in New Issue