Jean-Baptiste Aubort 2008-09-02 10:54:55 +02:00
commit 9062152fb4
37 changed files with 1122 additions and 2947 deletions

View File

@ -102,8 +102,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."),
'code_from': fields.char('Code From', size=10, help="Gives the range of account code available for this type of account. These fields are given for information and are not used in any constraint."),
'code_to': fields.char('Code To', size=10, help="Gives the range of account code available for this type of account. These fields are just given for information and are not used in any constraint."),
'partner_account': fields.boolean('Partner account'),
'close_method': fields.selection([('none','None'), ('balance','Balance'), ('detail','Detail'),('unreconciled','Unreconciled')], 'Deferral Method', required=True),
}
@ -243,7 +241,6 @@ class account_account(osv.osv):
'debit': fields.function(__compute, digits=(16,2), method=True, string='Debit', multi='balance'),
'reconcile': fields.boolean('Reconcile', help="Check this account if the user can make a reconciliation of the entries in this account."),
'shortcut': fields.char('Shortcut', size=12),
'close_method': fields.selection([('none','None'), ('balance','Balance'), ('detail','Detail'),('unreconciled','Unreconciled')], 'Deferral Method', required=True, help="Tell Tiny ERP how to process the entries of this account when you close a fiscal year. None removes all entries to start with an empty account for the new fiscal year. Balance creates only one entry to keep the balance for the new fiscal year. Detail keeps the detail of all entries of the preceeding years. Unreconciled keeps the detail of unreconciled entries only."),
'tax_ids': fields.many2many('account.tax', 'account_account_tax_default_rel',
'account_id','tax_id', 'Default Taxes'),
'note': fields.text('Note'),
@ -265,7 +262,6 @@ class account_account(osv.osv):
'sign': lambda *a: 1,
'type' : lambda *a :'view',
'reconcile': lambda *a: False,
'close_method': lambda *a: 'balance',
'company_id': _default_company,
'active': lambda *a: True,
}
@ -927,14 +923,15 @@ class account_move_reconcile(osv.osv):
'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'account.reconcile') or '/',
}
def reconcile_partial_check(self, cr, uid, ids, type='auto', context={}):
for rec in self.pool.get('account.move.reconcile').browse(cr, uid, ids):
for rec in self.browse(cr, uid, ids, context):
total = 0.0
for line in rec.line_partial_ids:
total += (line.debit or 0.0) - (line.credit or 0.0)
if not total:
self.write(cr,uid, map(lambda x: x.id, rec.line_partial_ids), {'reconcile_id': rec.id })
for line in rec.line_partial_ids:
total += (line.debit or 0.0) - (line.credit or 0.0)
if not total:
self.pool.get('account.move.line').write(cr, uid,
map(lambda x: x.id, rec.line_partial_ids),
{'reconcile_id': rec.id }
)
return True
def name_get(self, cr, uid, ids, context=None):
result = {}

View File

@ -196,16 +196,18 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice">
<field name="journal_id" select="2"/>
<field name="type" readonly="1" select="2"/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<group colspan="4" col="6">
<field name="journal_id" select="2"/>
<field name="type" readonly="1" select="2"/>
<field name="number" select="1"/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
<field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
<field name="name" select="2"/>
<field name="number" select="1"/>
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
<field colspan="4" name="invoice_line" nolabel="1" widget="one2many_list"/>
<group col="1" colspan="2">

View File

@ -52,9 +52,9 @@ class account_move_line(osv.osv):
if context.get('periods', False):
ids = ','.join([str(x) for x in context['periods']])
return obj+".active AND "+obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s" % (fiscalyear_clause, ids,where_move_state)
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) AND id in (%s)) %s" % (fiscalyear_clause, ids,where_move_state)
else:
return obj+".active AND "+obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s)" % (fiscalyear_clause,where_move_state)
return obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id in (%s) %s)" % (fiscalyear_clause,where_move_state)
def default_get(self, cr, uid, fields, context={}):
data = self._default_get(cr, uid, fields, context)
@ -157,7 +157,7 @@ class account_move_line(osv.osv):
for id in ids:
cr.execute('SELECT date,account_id FROM account_move_line WHERE id=%d', (id,))
dt, acc = cr.fetchone()
cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE account_id=%d AND (date<%s OR (date=%s AND id<=%d)) and active', (acc,dt,dt,id))
cr.execute('SELECT SUM(debit-credit) FROM account_move_line WHERE account_id=%d AND (date<%s OR (date=%s AND id<=%d))', (acc,dt,dt,id))
res[id] = cr.fetchone()[0]
return res
@ -266,7 +266,6 @@ class account_move_line(osv.osv):
'analytic_lines': fields.one2many('account.analytic.line', 'move_id', 'Analytic lines'),
'centralisation': fields.selection([('normal','Normal'),('credit','Credit Centralisation'),('debit','Debit Centralisation')], 'Centralisation', size=6),
'balance': fields.function(_balance, method=True, string='Balance'),
'active': fields.boolean('Active'),
'state': fields.selection([('draft','Draft'), ('valid','Valid')], 'Status', readonly=True),
'tax_code_id': fields.many2one('account.tax.code', 'Tax Account'),
'tax_amount': fields.float('Tax/Base Amount', digits=(16,2), select=True),
@ -296,7 +295,6 @@ class account_move_line(osv.osv):
return dt
_defaults = {
'blocked': lambda *a: False,
'active': lambda *a: True,
'centralisation': lambda *a: 'normal',
'date': _get_date,
'date_created': lambda *a: time.strftime('%Y-%m-%d'),
@ -378,7 +376,8 @@ class account_move_line(osv.osv):
unmerge.append(line.id)
total += (line.debit or 0.0) - (line.credit or 0.0)
if not total:
return self.reconcile(cr, uid, merges+unmerge, context=context)
res = self.reconcile(cr, uid, merges+unmerge, context=context)
return res
r_id = self.pool.get('account.move.reconcile').create(cr, uid, {
'type': type,
'line_partial_ids': map(lambda x: (4,x,False), merges+unmerge)
@ -578,14 +577,12 @@ class account_move_line(osv.osv):
if not context:
context={}
raise_ex=False
account_obj = self.pool.get('account.account')
acc=account_obj.browse(cr,uid,ids)[0]
if ('debit' in vals and 'credit' in vals) and not vals['debit'] and not vals['credit']:
raise_ex=True
if ('debit' in vals and 'credit' not in vals) and not vals['debit'] and not acc.credit:
if ('debit' in vals and 'credit' not in vals) and not vals['debit']:
raise_ex=True
if ('credit' in vals and 'debit' not in vals) and not vals['credit'] and not acc.debit:
if ('credit' in vals and 'debit' not in vals) and not vals['credit']:
raise_ex=True
if raise_ex:

View File

@ -3,8 +3,8 @@
<data>
<!--
Fiscal Year
-->
Fiscal Year
-->
<menuitem id="base.menu_action_currency_form" parent="menu_finance_configuration" sequence="20"/>
@ -58,7 +58,7 @@
</record>
<menuitem id="next_id_23" name="Periods" parent="account.menu_finance_configuration"/><menuitem action="action_account_fiscalyear_form" id="menu_action_account_fiscalyear_form" parent="next_id_23"/>
<!--
<!--
Period
-->
@ -101,9 +101,9 @@
<menuitem action="action_account_period_form" id="menu_action_account_period_form" parent="account.next_id_23"/>
<!--
Accounts
-->
<!--
Accounts
-->
<record id="view_account_form" model="ir.ui.view">
<field name="name">account.account.form</field>
@ -111,21 +111,20 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="type" select="1"/>
<field name="company_id" select="2"/>
<field name="parent_id"/>
<field name="active"/>
</group>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="type" select="1"/>
<field name="company_id" select="2"/>
<field name="parent_id"/>
<field name="active"/>
</group>
<notebook colspan="4">
<page string="General Information">
<newline/>
<field name="sign"/>
<field name="currency_id" select="2"/>
<field name="close_method"/>
<field name="reconcile"/>
<newline/>
<newline/>
@ -174,10 +173,10 @@
<menuitem action="action_account_tree" id="menu_action_account_tree" parent="account.account_account_menu"/>
<!--
Journal
Journal
Account Journal Columns
-->
Account Journal Columns
-->
<record id="view_journal_column_form" model="ir.ui.view">
<field name="name">account.journal.column.form</field>
@ -221,8 +220,8 @@
</record>
<!--
# Account Journal
-->
# Account Journal
-->
<record id="view_account_journal_tree" model="ir.ui.view">
<field name="name">account.journal.tree</field>
@ -276,7 +275,7 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem id="next_id_25" name="Journal" parent="account.menu_finance_configuration"/>
<menuitem action="action_account_journal_form" id="menu_action_account_journal_form" parent="next_id_25"/>
<menuitem action="action_account_journal_form" id="menu_action_account_journal_form" parent="next_id_25"/>
<record id="view_bank_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
@ -410,8 +409,8 @@
</field>
</record>
<!--
Account Types
-->
Account Types
-->
<record id="view_account_type_tree" model="ir.ui.view">
<field name="name">account.account.type.tree</field>
<field name="model">account.account.type</field>
@ -420,8 +419,6 @@
<tree string="Account Type">
<field name="code"/>
<field name="name"/>
<field name="code_from"/>
<field name="code_to"/>
</tree>
</field>
</record>
@ -435,8 +432,6 @@
<field name="code" select="1"/>
<field name="sequence"/>
<field name="close_method"/>
<field name="code_from" select="1"/>
<field name="code_to" select="1"/>
<field name="partner_account"/>
</form>
</field>
@ -449,8 +444,8 @@
</record>
<menuitem action="action_account_type_form" groups="base.group_extended" id="menu_action_account_type_form" parent="account.account_account_menu"/>
<!--
Entries
-->
Entries
-->
<record id="view_account_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
<field name="model">account.move</field>
@ -467,8 +462,8 @@
</record>
<!--
Reconcile
-->
Reconcile
-->
<record id="view_move_reconcile_form" model="ir.ui.view">
<field name="name">account.move.reconcile.form</field>
@ -487,8 +482,8 @@
</record>
<!--
Tax Codes
-->
Tax Codes
-->
<record id="view_tax_code_tree" model="ir.ui.view">
<field name="name">account.tax.code.tree</field>
<field name="model">account.tax.code</field>
@ -530,12 +525,12 @@
<field name="view_id" ref="view_tax_code_tree"/>
</record>
<menuitem id="next_id_27" name="Taxes" parent="account.menu_finance_configuration"/>
<menuitem action="action_tax_code_list" id="menu_action_tax_code_list" parent="next_id_27" sequence="12"/>
<menuitem action="action_tax_code_list" id="menu_action_tax_code_list" parent="next_id_27" sequence="12"/>
<!--
Tax
-->
Tax
-->
<record id="view_tax_tree" model="ir.ui.view">
<field name="name">account.tax.tree</field>
<field name="model">account.tax</field>
@ -612,8 +607,8 @@
<!--
Entries Journal lines
-->
Entries Journal lines
-->
<wizard id="action_move_journal_line_form_select" menu="False" model="account.move.line" name="account.move.journal.select" string="Standard entry"/>
@ -637,8 +632,8 @@
<menuitem action="action_move_journal_period_line_form" id="menu_action_move_journal_period_line_form" parent="account.menu_action_move_journal_line_form"/>
<!--
Entries lines
-->
Entries lines
-->
<record id="view_move_line_tree" model="ir.ui.view">
<field name="name">account.move.line.tree</field>
@ -710,7 +705,6 @@
<field name="period_id"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
<field name="active" select="2"/>
<field name="state" select="2"/>
</page>
<page string="Analytic Lines">
@ -779,8 +773,8 @@
</record>
<!--
Account.Entry Edition
-->
Account.Entry Edition
-->
<record id="view_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
@ -968,9 +962,9 @@
<!--
TODO:
Print Journal (and change state)
Close Journal (and verify that there is no draft move lines)
TODO:
Print Journal (and change state)
Close Journal (and verify that there is no draft move lines)
-->
<record id="view_journal_period_tree" model="ir.ui.view">
@ -1000,8 +994,8 @@
<menuitem action="action_account_budget_post_tree" id="menu_action_account_budget_post_tree" parent="account.menu_finance_reporting"/>
<!--
Budgets
-->
Budgets
-->
<record id="view_budget_post_form" model="ir.ui.view">
<field name="name">account.budget.post.form</field>
<field name="model">account.budget.post</field>
@ -1068,7 +1062,7 @@
<!--
# Account Models
# Account Models
-->
<record id="view_model_line_tree" model="ir.ui.view">
@ -1149,7 +1143,7 @@
<!--
# Payment Terms
# Payment Terms
-->
<record id="view_payment_term_line_tree" model="ir.ui.view">
@ -1210,7 +1204,7 @@
<menuitem id="next_id_33" name="Payment Terms" parent="account.menu_finance_configuration"/><menuitem action="action_payment_term_form" id="menu_action_payment_term_form" parent="next_id_33"/>
<!--
# Account Subscriptions
# Account Subscriptions
-->
<record id="view_subscription_line_form" model="ir.ui.view">
@ -1381,8 +1375,8 @@
<!--
# Admin config
-->
# Admin config
-->
<act_window domain="[('journal_id', '=', active_id)]" id="act_account_journal_2_account_bank_statement" name="Bank statements" res_model="account.bank.statement" src_model="account.journal"/>
@ -1407,8 +1401,8 @@
<field name="code"/>
<field name="date1"/>
<field name="date2"/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<separator string="" colspan="4"/>
<label string="" colspan="2"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Don't Create" name="action_cancel" type="object"/>
<button icon="gtk-ok" name="action_create" string="Create" type="object"/>
@ -1481,9 +1475,9 @@
<field name="state">open</field>
</record>
<!-- Account Templates -->
<!-- Account Templates -->
<record id="view_account_template_form" model="ir.ui.view">
<record id="view_account_template_form" model="ir.ui.view">
<field name="name">account.account.template.form</field>
<field name="model">account.account.template</field>
<field name="type">form</field>
@ -1518,9 +1512,9 @@
<menuitem id="account_account_template_menu" name="Templates" parent="account.menu_finance_configuration"/>
<menuitem action="action_account_template_form" id="menu_action_account_template_form" parent="account_account_template_menu"/>
<!-- Chart of Accounts Templates -->
<!-- Chart of Accounts Templates -->
<record id="view_account_chart_template_form" model="ir.ui.view">
<record id="view_account_chart_template_form" model="ir.ui.view">
<field name="name">account.chart.template.form</field>
<field name="model">account.chart.template</field>
<field name="type">form</field>
@ -1558,9 +1552,9 @@
<menuitem action="action_account_chart_template_form" id="menu_action_account_chart_template_form" parent="account_account_template_menu"/>
<!-- Account Tax Templates -->
<!-- Account Tax Templates -->
<record id="view_account_tax_template_form" model="ir.ui.view">
<record id="view_account_tax_template_form" model="ir.ui.view">
<field name="name">account.tax.template.form</field>
<field name="model">account.tax.template</field>
<field name="type">form</field>
@ -1596,25 +1590,25 @@
<menuitem action="action_account_tax_template_form" id="menu_action_account_tax_template_form" parent="account_account_template_menu"/>
<!-- wizard account duplicate chart -->
<record id="view_wizard_account_duplicate_chart" model="ir.ui.view">
<field name="name">wizard.account.chart.duplicate.form</field>
<field name="model">wizard.account.chart.duplicate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Duplicate Chart of Accounts">
<field name="account_id"/>
<field name="company_id"/>
<newline/>
<group colspan="4">
<button icon="gtk-cancel" special="cancel" type="object" string="Cancel"/>
<button icon="gtk-ok" name="action_create" string="Create" type="object"/>
</group>
</form>
</field>
</record>
<!-- wizard account duplicate chart -->
<record id="view_wizard_account_duplicate_chart" model="ir.ui.view">
<field name="name">wizard.account.chart.duplicate.form</field>
<field name="model">wizard.account.chart.duplicate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Duplicate Chart of Accounts">
<field name="account_id"/>
<field name="company_id"/>
<newline/>
<group colspan="4">
<button icon="gtk-cancel" special="cancel" type="object" string="Cancel"/>
<button icon="gtk-ok" name="action_create" string="Create" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_wizard_account_duplicate_chart_form" model="ir.actions.act_window">
<record id="action_wizard_account_duplicate_chart_form" model="ir.actions.act_window">
<field name="name">Duplicate Chart of Accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.account.chart.duplicate</field>

View File

@ -9,7 +9,6 @@
<record id="minimal_0" model="account.account">
<field name="code">0</field>
<field name="name">Minimal account chart</field>
<field name="close_method">none</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
</record>

View File

@ -37,7 +37,7 @@ class wizard_account_chart(wizard.interface):
<field name="fiscalyear"/>
<field name="target_move"/>
</form>'''
_account_chart_fields = {
'fiscalyear': {
'string': 'Fiscal year',
@ -46,10 +46,10 @@ class wizard_account_chart(wizard.interface):
'help': 'Keep empty for all open fiscal year',
},
'target_move': {
'string': 'Target Moves',
'type': 'selection',
'selection': [('all','All Entries'),('posted_only','All Posted Entries')],
'required': True,
'string': 'Target Moves',
'type': 'selection',
'selection': [('all','All Entries'),('posted_only','All Posted Entries')],
'required': True,
'default': lambda *a:"all",
},
}
@ -68,6 +68,7 @@ class wizard_account_chart(wizard.interface):
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
result = act_obj.read(cr, uid, [id])[0]
result['context'] = str({'fiscalyear': data['form']['fiscalyear'],'target_move':data['form']['target_move']})
result['name']+=':'+pooler.get_pool(cr.dbname).get('account.fiscalyear').read(cr,uid,[data['form']['fiscalyear']])[0]['code']
return result
states = {

View File

@ -73,7 +73,7 @@ _reconcile_fields = {
'type': 'many2many',
'relation': 'account.account',
'domain': [('reconcile','=',1)],
'required': True
'help': 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied',
},
'writeoff_acc_id': {
'string': 'Account',
@ -226,8 +226,8 @@ def _reconcile(self, cr, uid, data, context):
max_amount = form.get('max_amount', 0.0)
power = form['power']
reconciled = unreconciled = 0
if not form['account_ids']:
return {'reconciled':0, 'unreconciled':[0]}
if not form['account_ids'][0][2]:
form['account_ids'][0][2] = pooler.get_pool(cr.dbname).get('account.account').search(cr, uid, [('reconcile','=',True)])
for account_id in form['account_ids'][0][2]:
# reconcile automatically all transactions from partners whose balance is 0
@ -264,6 +264,7 @@ def _reconcile(self, cr, uid, data, context):
"WHERE account_id=%d " \
"AND reconcile_id IS NULL " \
"AND state <> 'draft' " \
"AND partner_id IS NOT NULL " \
"GROUP BY partner_id " \
"HAVING count(*)>1",
(account_id,))

View File

@ -88,11 +88,14 @@ def _data_save(self, cr, uid, data, context):
obj='account_move_line', context={'fiscalyear': fy_id})
cr.execute('select id from account_account WHERE active')
ids = map(lambda x: x[0], cr.fetchall())
accnt_type_obj = pool.get('account.account.type')
for account in pool.get('account.account').browse(cr, uid, ids,
context={'fiscalyear': fy_id}):
if account.close_method=='none' or account.type == 'view':
accnt_type_ids = accnt_type_obj.search(cr, uid, [('code','=',account.type)])
accnt_type_data = accnt_type_obj.browse(cr, uid, accnt_type_ids[0])
if accnt_type_data.close_method=='none' or account.type == 'view':
continue
if account.close_method=='balance':
if accnt_type_data.close_method=='balance':
if abs(account.balance)>0.0001:
pool.get('account.move.line').create(cr, uid, {
'debit': account.balance>0 and account.balance,
@ -103,7 +106,7 @@ def _data_save(self, cr, uid, data, context):
'period_id': period.id,
'account_id': account.id
}, {'journal_id': new_journal.id, 'period_id':period.id})
if account.close_method=='unreconciled':
if accnt_type_data.close_method=='unreconciled':
offset = 0
limit = 100
while True:
@ -130,7 +133,7 @@ def _data_save(self, cr, uid, data, context):
'period_id': period.id,
})
offset += limit
if account.close_method=='detail':
if accnt_type_data.close_method=='detail':
offset = 0
limit = 100
while True:

View File

@ -84,7 +84,7 @@ class account_move_line(osv.osv):
return [('id','=','0')]
return [('id','in',map(lambda x:x[0], res))]
def line2bank(self, cr, uid, ids, payment_type='manual', context=None):
def line2bank(self, cr, uid, ids, payment_type=None, context=None):
"""
Try to return for each account move line a corresponding bank
account according to the payment type. This work using one of
@ -103,12 +103,16 @@ class account_move_line(osv.osv):
if line.invoice and line.invoice.partner_bank:
line2bank[line.id] = line.invoice.partner_bank.id
elif line.partner_id:
if not line.partner_id.bank_ids:
raise osv.except_osv(_('Error !'), _('Partner '+ line.partner_id.name+ ' has no bank account defined'))
for bank in line.partner_id.bank_ids:
if bank.state in bank_type:
line2bank[line.id] = bank.id
break
if line.id not in line2bank and line.partner_id.bank_ids:
line2bank[line.id] = line.partner_id.bank_ids[0].id
else:
raise osv.except_osv(_('Error !'), _('No partner defined on entry line'))
return line2bank
_columns = {

View File

@ -62,16 +62,20 @@ class payment_mode(osv.osv):
'type': fields.many2one('payment.type','Payment type',required=True),
}
def suitable_bank_types(self,cr,uid,payment_code= 'manual',context={}):
def suitable_bank_types(self,cr,uid,payment_code=None,context={}):
"""Return the codes of the bank type that are suitable
for the given payment type code"""
if not payment_code:
return []
cr.execute(""" select t.code
from res_partner_bank_type t
join bank_type_payment_type_rel r on (r.bank_type_id = t.id)
join payment_type pt on (r.pay_type_id = pt.id)
where pt.code = %s """, [payment_code])
join payment_mode pm on (pm.type = pt.id)
where pm.id = %s """, [payment_code])
return [x[0] for x in cr.fetchall()]
payment_mode()
@ -155,15 +159,15 @@ class payment_line(osv.osv):
_name = 'payment.line'
_description = 'Payment Line'
def partner_payable(self, cr, uid, ids, name, args, context={}):
if not ids: return {}
partners= self.read(cr, uid, ids, ['partner_id'], context)
partners= dict(map(lambda x: (x['id'], x['partner_id'][0]), partners))
debit = self.pool.get('res.partner')._debit_get(cr, uid,
partners.values(), name, args, context)
for i in partners:
partners[i] = debit[partners[i]]
return partners
#~ def partner_payable(self, cr, uid, ids, name, args, context={}):
#~ if not ids: return {}
#~ partners= self.read(cr, uid, ids, ['partner_id'], context)
#~ partners= dict(map(lambda x: (x['id'], x['partner_id'][0]), partners))
#~ debit = self.pool.get('res.partner')._debit_get(cr, uid,
#~ partners.values(), name, args, context)
#~ for i in partners:
#~ partners[i] = debit[partners[i]]
#~ return partners
def translate(self, orig):
return {
@ -232,8 +236,6 @@ class payment_line(osv.osv):
where pl.id in (%s)"""%
(self.translate(name), ','.join(map(str,ids))) )
res = dict(cr.fetchall())
print "res: ", res
print "name ", name
if name == 'partner_id':
partner_name = {}
@ -354,9 +356,7 @@ class payment_line(osv.osv):
res={}
for id in self.browse(cr, uid, ids):
res[id.id] = ""
print "test"
if id.move_line_id:
print "blablabl"
res[id.id] = "pas de invoice"
if id.move_line_id.invoice:
res[id.id] = str(id.move_line_id.invoice.number)
@ -387,7 +387,7 @@ class payment_line(osv.osv):
'communication': fields.char('Communication', size=64, required=True),
'communication2': fields.char('Communication 2', size=64),
'move_line_id': fields.many2one('account.move.line','Entry line', domain=[('reconcile_id','=', False), ('account_id.type', '=','payable')]),
'amount_currency': fields.float('Amount', digits=(16,2),
'amount_currency': fields.float('Amount in Partner Currency', digits=(16,2),
required=True, help='Payment amount in the partner currency'),
# 'to_pay_currency': fields.function(_to_pay_currency, string='To Pay',
# method=True, type='float',
@ -400,7 +400,7 @@ class payment_line(osv.osv):
'order_id': fields.many2one('payment.order', 'Order', required=True,
ondelete='cascade', select=True),
'partner_id': fields.many2one('res.partner', string="Partner",required=True),
'amount': fields.function(_amount, string='Amount',
'amount': fields.function(_amount, string='Amount in Company Currency',
method=True, type='float',
help='Payment amount in the company currency'),
# 'to_pay': fields.function(select_by_name, string="To Pay", method=True,
@ -415,11 +415,10 @@ class payment_line(osv.osv):
'ml_inv_ref': fields.function(_get_ml_inv_ref, method=True, type='char', string='Invoice Ref'),
'info_owner': fields.function(info_owner, string="Owner Account", method=True, type="text"),
'info_partner': fields.function(info_partner, string="Destination Account", method=True, type="text"),
'partner_payable': fields.function(partner_payable,
string="Partner payable", method=True, type='float'),
# 'partner_payable': fields.function(partner_payable, string="Partner payable", method=True, type='float'),
# 'value_date': fields.function(_value_date, string='Value Date',
# method=True, type='date'),
'date': fields.date('Payment Date'),
'date': fields.date('Payment Date',help="If no payment date is specified, the bank will treat this payment line direclty"),
'create_date': fields.datetime('Created' ,readonly=True),
'state': fields.selection([('normal','Free'), ('structured','Structured')], 'Communication Type', required=True)
}
@ -434,36 +433,35 @@ class payment_line(osv.osv):
('name_uniq', 'UNIQUE(name)', 'The payment line name must be unique!'),
]
def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,context=None):
def onchange_move_line(self,cr,uid,ids,move_line_id,payment_type,date_prefered,date_planned,context=None):
data={}
data['amount_currency']=data['currency']=data['communication']=data['partner_id']=data['reference']=data['date_created']=data['bank_id']=False
if move_line_id:
line=self.pool.get('account.move.line').browse(cr,uid,move_line_id)
line = self.pool.get('account.move.line').browse(cr,uid,move_line_id)
data['amount_currency']=line.amount_to_pay
data['partner_id']=line.partner_id.id
data['currency']=line.currency_id and line.currency_id.id or False
if not data['currency']:
data['currency']=line.invoice and line.invoice.currency_id.id or False
# calling onchange of partner and updating data dictionary
temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id)
temp_dict=self.onchange_partner(cr,uid,ids,line.partner_id.id,payment_type)
data.update(temp_dict['value'])
data['reference']=line.ref
data['date_created']=line.date_created
data['date_created'] = line.date_created
data['communication']=line.ref
if payment_type:
payment_mode = self.pool.get('payment.mode').browse(cr,uid,payment_type).type.code
else:
payment_mode=False
# data['bank_id']=self.pool.get('account.move.line').line2bank(cr, uid,
# [move_line_id],
# payment_mode or 'manual', context)[move_line_id]
if date_prefered == 'now':
#no payment date => immediate payment
data['date'] = False
elif date_prefered == 'due':
data['date'] = line.date_maturity
elif date_prefered == 'fixed':
data['date'] = date_planned
return {'value': data}
def onchange_partner(self,cr,uid,ids,partner_id,context=None):
def onchange_partner(self,cr,uid,ids,partner_id,payment_type,context=None):
data={}
data['info_partner']=data['bank_id']=False
@ -489,8 +487,12 @@ class payment_line(osv.osv):
data['info_partner']=info
if part_obj.bank_ids and len(part_obj.bank_ids)==1:
data['bank_id']=self.pool.get('res.partner.bank').name_get(cr,uid,[part_obj.bank_ids[0].id])[0][0]
if part_obj.bank_ids and payment_type:
bank_type = self.pool.get('payment.mode').suitable_bank_types(cr, uid, payment_type, context=context)
for bank in part_obj.bank_ids:
if bank.state in bank_type:
data['bank_id'] = bank.id
break
return {'value': data}

View File

@ -88,7 +88,7 @@
<form string="Payment Line">
<notebook>
<page string="Payment">
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode)" select="1"/>
<field name="move_line_id" on_change="onchange_move_line(move_line_id,parent.mode,parent.date_prefered,parent.date_planned)" select="1"/>
<!--domain="[('reconcile_id','=', False), ('credit', '>',0),('amount_to_pay','>',0)] "/>-->
<separator colspan="4" string="Transaction Information"/>
<field name="date"/>
@ -96,7 +96,7 @@
<field name="amount_currency" select="2"/>
<field name="currency" nolabel="1"/>
</group>
<field name="partner_id" on_change="onchange_partner(partner_id)" select="1"/>
<field name="partner_id" on_change="onchange_partner(partner_id,parent.mode)" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="bank_id" required="1"/>
<separator colspan="2" string="Owner Account"/>
<separator colspan="2" string="Desitination Account"/>
@ -112,11 +112,10 @@
<separator colspan="4" string="General Information"/>
<group colspan="2">
<field name="amount" select="1"/>
<!--<field name="currency"/>-->
<field name="amount"/>
<field name="company_currency" nolabel="1"/>
</group>
<field name="partner_payable"/>
<!--<field name="partner_payable"/>-->
<separator colspan="4" string="Entry Information"/>
<field name="create_date" readonly="1"/>
<field name="ml_maturity_date"/>
@ -131,10 +130,10 @@
<field name="partner_id" select="1"/>
<field name="bank_id" domain="[('partner_id', '=', partner_id)]" required="1"/>
<field name="ml_maturity_date"/>
<field name="ml_date_created"/>
<field name="date"/>
<!--<field name="value_date"/>-->
<field name="amount" sum="Amount Total"/>
<field name="amount_currency" sum="Currency Amount Total" select="2"/>
<!--<field name="amount" sum="Amount Total"/>-->
<field name="amount_currency" sum="Currency Amount Total" select="2" string="Amount"/>
<field name="currency"/>
<!--<field name="to_pay_currency"/>
<field name="to_pay"/>-->

View File

@ -63,8 +63,11 @@ def search_entries(self, cr, uid, data, context):
# Search for move line to pay:
line_ids = line_obj.search(cr, uid, [
('reconcile_id', '=', False),
('amount_to_pay', '>', 0),('date_maturity','<=',search_due_date)], context=context)
('reconcile_id', '=', False),
('account_id.type', '=', 'payable'),
('amount_to_pay', '>', 0),
('date_maturity','<=',search_due_date)
], context=context)
FORM.string = '''<?xml version="1.0"?>
@ -84,19 +87,27 @@ def create_payment(self, cr, uid, data, context):
payment = order_obj.browse(cr, uid, data['id'],
context=context)
t = payment.mode and payment.mode.type.code or 'manual'
t = payment.mode and payment.mode.type.code or None
line2bank= pool.get('account.move.line').line2bank(cr, uid,
line_ids, t, context)
## Finally populate the current payment with new lines:
for line in line_obj.browse(cr, uid, line_ids, context=context):
if payment.date_prefered == "now":
#no payment date => immediate payment
date_to_pay = False
elif payment.date_prefered == 'due':
date_to_pay = line.date_maturity
elif payment.date_prefered == 'fixed':
date_to_pay = payment.date_planned
pool.get('payment.line').create(cr,uid,{
'move_line_id': line.id,
'amount_currency': line.amount_to_pay,
'bank_id': line2bank.get(line.id),
'order_id': payment.id,
'partner_id': line.partner_id and line.partner_id.id or False,
'communication': line.ref or '/'
'communication': line.ref or '/',
'date': date_to_pay,
}, context=context)
return {}

View File

@ -2,7 +2,7 @@
<terp>
<data>
<record id="noone" model="res.groups">
<field name="name">No One</field>
<field name="name">No One Association</field>
</record>
<record id="hr.menu_hr_root" model="ir.ui.menu">
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>

File diff suppressed because it is too large Load Diff

View File

@ -6,13 +6,13 @@
Administrator shortcut
Demo user startup menu
-->
<record model="ir.ui.view_sc" id="sc_crm_dash">
<!-- <record model="ir.ui.view_sc" id="sc_crm_dash">
<field name="name">CRM Dashboard</field>
<field name="user_id" ref="base.user_demo"/>
<field name="resource">ir.ui.menu</field>
<field name="sequence">3</field>
<field name="res_id" ref="menu_board_crm"/>
</record>
</record> -->
<record model="res.users" id="base.user_admin">
<field name="action_id" ref="open_board_crm"/>
</record>

View File

@ -15,7 +15,7 @@
<field eval="&quot;terp-sale&quot;" name="icon"/>
<field eval="False" name="parent_id"/>
</record>
<record id="crm_configuration.menu_crm_case_jobs" model="ir.ui.menu">
<record id="crm_configuration.menu_crm_case_job_req_main" model="ir.ui.menu">
<field eval="&quot;terp-hr&quot;" name="icon"/>
<field eval="False" name="parent_id"/>
</record>

View File

@ -93,6 +93,7 @@
<field name="res_model">hr.employee</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" eval="False"/>
</record>
<menuitem
action="open_view_employee_list"
@ -111,9 +112,9 @@
<field name="domain">[('parent_id.user_id','=',uid)]</field>
</record>
<menuitem
action="open_view_employee_list_my"
id="menu_open_view_employee_list_my"
parent="menu_open_view_employee_list"/>
action="open_view_employee_list_my"
id="menu_open_view_employee_list_my"
parent="menu_open_view_employee_list"/>
<record id="open_view_employee_new" model="ir.actions.act_window">
<field name="name">New Employee</field>

View File

@ -28,7 +28,6 @@
#
##############################################################################
import timesheet
import bymonth
import attendance_errors

View File

@ -7,7 +7,7 @@
"website" : "http://tinyerp.com/",
"description": """Human Ressources: Holidays tracking and workflow
This module allows you to manage holidays and holidays requests. For each employee, you can also define a number of available holidays per holiday status.
This module allows you to manage holidays and holidays requests. For each employee, you can also define a number of available holidays per holiday status.
Note that:
- A synchronisation with an internal agenda (use of the crm module) is possible: in order to automaticly create a case when an holiday request is accepted, you have to link the holidays status to a case section. You can set up this info and your color preferencies in
@ -26,10 +26,15 @@
""",
"depends" : ["hr","crm_configuration"],
"init_xml" : [],
"demo_xml" : ["hr_bel_holidays_2008.xml",],
"update_xml" : [
"ir.model.access.csv",
"hr_workflow.xml","hr_view.xml","hr_holidays_report.xml","hr_holidays_wizard.xml",],
"hr_workflow.xml",
"hr_view.xml",
"hr_holidays_report.xml",
"hr_holidays_wizard.xml",
],
# "demo_xml" : ["hr_bel_holidays_2008.xml",],
"demo_xml" : [],
"active": False,
"installable": True
}

View File

@ -46,9 +46,23 @@ def strToDate(dt):
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
return dt_date
class hr_holidays_status(osv.osv):
_name = "hr.holidays.status"
# _inherit = 'hr.holidays.status'
_description = "Holidays Status"
_columns = {
'name' : fields.char('Holiday Status', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Section'),
'color_name' : fields.selection([('red', 'Red'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color of the status', required=True),
}
_defaults = {
'color_name': lambda *args: 'red',
}
hr_holidays_status()
class hr_holidays(osv.osv):
_name = "hr.holidays"
_inherit = 'hr.holidays'
# _inherit = 'hr.holidays'
_description = "Holidays"
_columns = {
'name' : fields.char('Description', required=True, readonly=True, size=64, states={'draft':[('readonly',False)]}),
@ -171,20 +185,6 @@ class hr_holidays(osv.osv):
return True
hr_holidays()
class hr_holidays_status(osv.osv):
_name = "hr.holidays.status"
_inherit = 'hr.holidays.status'
_description = "Holidays Status"
_columns = {
'name' : fields.char('Holiday Status', size=64, required=True, translate=True),
'section_id': fields.many2one('crm.case.section', 'Section'),
'color_name' : fields.selection([('red', 'Red'), ('lightgreen', 'Light Green'), ('lightblue','Light Blue'), ('lightyellow', 'Light Yellow'), ('magenta', 'Magenta'),('lightcyan', 'Light Cyan'),('black', 'Black'),('lightpink', 'Light Pink'),('brown', 'Brown'),('violet', 'Violet'),('lightcoral', 'Light Coral'),('lightsalmon', 'Light Salmon'),('lavender', 'Lavender'),('wheat', 'Wheat'),('ivory', 'Ivory')],'Color of the status', required=True),
}
_defaults = {
'color_name': lambda *args: 'red',
}
hr_holidays_status()
class hr_holidays_per_user(osv.osv):
_name = "hr.holidays.per.user"

View File

@ -31,7 +31,6 @@
<newline />
<field name="number_of_days" colspan="2"/>
</form>
</field>
</field>
</record>
@ -54,7 +53,7 @@
<record model="ir.ui.view" id="view_holiday_2">
<field name="name">hr.holidays.tree</field>
<field name="model">hr.holidays</field>
<field name="inherit_id" ref="hr.view_holiday"/>
<field name="inherit_id" ref="view_holiday"/>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="name" position="after">

View File

@ -11,7 +11,7 @@
<field name="arch" type="xml">
<notebook position="inside">
<page string="Payments">
<field name="move_lines" colspan="4"/>
<field name="move_lines" colspan="4" nolabel="1"/>
</page>
</notebook>
</field>

View File

@ -6642,7 +6642,7 @@
<field name="type">percent</field>
<field name="account_collected_id" ref="vat_refund21"/>
<field name="account_paid_id" ref="vat_payable21"/>
<field name="base_code_id" ref="vat_code_a81"/>
<field name="base_code_id" ref="vat_code_a82"/>
<field name="tax_code_id" ref="vat_code_a59"/>
<field name="ref_base_code_id" ref="vat_code_a85"/>
<field name="ref_tax_code_id" ref="vat_code_a63"/>

View File

@ -17,8 +17,6 @@
<field name="name">Account Chart UK</field>
<field name="close_method">none</field>
<field eval="0" name="parent_id"/>
<field name="type">view</field>
@ -36,8 +34,6 @@
<field name="name">Balance Sheet</field>
<field name="close_method">none</field>
<field ref="chart0" name="parent_id"/>
<field name="type">view</field>
@ -51,8 +47,6 @@
<field name="name">Fixed Assets</field>
<field name="close_method">none</field>
<field ref="bal" name="parent_id"/>
<field name="type">view</field>
@ -66,8 +60,6 @@
<field name="name">Fixed Asset Account</field>
<field name="close_method">balance</field>
<field ref="fas" name="parent_id"/>
<field name="type">asset</field>
@ -81,8 +73,6 @@
<field name="name">Net Current Assets</field>
<field name="close_method">none</field>
<field ref="bal" name="parent_id"/>
<field name="type">view</field>
@ -96,9 +86,7 @@
<field name="name">Current Assets</field>
<field name="close_method">none</field>
<field ref="nca" name="parent_id"/>
<field ref="nca" name="parent_id"/>
<field name="type">view</field>
@ -113,8 +101,6 @@
<field name="name">Purchased Stocks</field>
<field name="close_method">unreconciled</field>
<field ref="cas" name="parent_id"/>
<field name="type">asset</field>
@ -130,8 +116,6 @@
<field name="name">Debtors</field>
<field name="close_method">balance</field>
<field ref="cas" name="parent_id"/>
<field name="type">receivable</field>
@ -153,8 +137,6 @@
<field name="name">Output VAT</field>
<field name="close_method">balance</field>
<field ref="cas" name="parent_id"/>
<field name="type">tax</field>
@ -168,8 +150,6 @@
<field name="name">Bank Current Account</field>
<field name="close_method">balance</field>
<field ref="cas" name="parent_id"/>
<field name="type">cash</field>
@ -185,8 +165,6 @@
<field name="name">Cash</field>
<field name="close_method">balance</field>
<field ref="cas" name="parent_id"/>
<field name="type">cash</field>
@ -200,8 +178,6 @@
<field name="name">Current Liabilities</field>
<field name="close_method">none</field>
<field ref="nca" name="parent_id"/>
<field name="type">view</field>
@ -217,8 +193,6 @@
<field name="name">Creditors</field>
<field name="close_method">balance</field>
<field ref="cli" name="parent_id"/>
<field name="type">payable</field>
@ -240,8 +214,6 @@
<field name="name">Input VAT</field>
<field name="close_method">balance</field>
<field ref="cli" name="parent_id"/>
<field name="type">tax</field>
@ -259,8 +231,6 @@
<field name="name">Profit and Loss</field>
<field name="close_method">none</field>
<field ref="chart0" name="parent_id"/>
<field name="type">view</field>
@ -274,8 +244,6 @@
<field name="name">Revenue</field>
<field name="close_method">none</field>
<field ref="gpf" name="parent_id"/>
<field name="type">view</field>
@ -291,8 +259,6 @@
<field name="name">Product Sales</field>
<field name="close_method">unreconciled</field>
<field ref="rev" name="parent_id"/>
<field name="type">income</field>
@ -312,8 +278,6 @@
<field name="name">Cost of Sales</field>
<field name="close_method">none</field>
<field ref="gpf" name="parent_id"/>
<field name="type">view</field>
@ -329,8 +293,6 @@
<field name="name">Cost of Goods Sold</field>
<field name="close_method">unreconciled</field>
<field ref="cos" name="parent_id"/>
<field name="type">expense</field>
@ -344,8 +306,6 @@
<field name="name">Overheads</field>
<field name="close_method">none</field>
<field ref="gpf" name="parent_id"/>
<field name="type">view</field>
@ -361,8 +321,6 @@
<field name="name">Expenses</field>
<field name="close_method">unreconciled</field>
<field ref="ovr" name="parent_id"/>
<field name="type">expense</field>

File diff suppressed because it is too large Load Diff

View File

@ -3,40 +3,44 @@
<data noupdate="True">
<!--
#
# Plan comptable général pour la France, conforme au
# Plan comptable général pour la France, conforme au
# Règlement n° 99-03 du 29 avril 1999
# Version applicable au 1er janvier 2005.
# Règlement disponible sur http://erp-libre.info
# Mise en forme et paramétrage par http://sisalp.fr et http://nbconseil.net
# version du fichier : 01-01-2007
-->
<!-- Nouveaux types de comptes -->
<record id="account_type_dettes" model="account.account.type">
<field name="name">dettes long terme</field>
<field name="code">dettes</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_immobilisations" model="account.account.type">
<field name="name">immobilisations</field>
<field name="code">immobilisations</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_stocks" model="account.account.type">
<field name="name">stocks</field>
<field name="code">stocks</field>
<field name="close_method">balance</field>
</record>
<record id="account_type_cloture" model="account.account.type">
<field name="name">Cloture</field>
<field name="code">cloture</field>
<field name="close_method">none</field>
</record>
<!-- Journaux de saisie -->
<record id="operations_journal" model="account.journal">
<field name="name">Journal des opérations diverses</field>
@ -55,6 +59,6 @@
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
</record>
</data>
</terp>

View File

@ -51,7 +51,6 @@
<field name="name">membership account</field>
<field name="code">1254</field>
<field name="company_id" ref="base.main_company"/>
<field name="close_method">balance</field>
<field eval="1" name="sign"/>
<field eval="1" name="active"/>
<field name="type">asset</field>

View File

@ -0,0 +1 @@
import product_analytic_default

View File

@ -0,0 +1,19 @@
# -*- encoding: utf-8 -*-
{
"name" : "Product Analytic Default",
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"category" : "Generic Modules/product_analytic_default",
"description": """
- add property field on product object and used this field on sale order line and invoice lines..
""",
"depends" : ['base','account'],
"init_xml" : [],
"demo_xml" : [],
"update_xml" : ["product_analytic_default.xml"],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,66 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2007 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from osv import fields,osv
from osv import orm
class product_product(osv.osv):
_name = 'product.product'
_inherit = 'product.product'
_description = 'Product'
_columns = {
'property_account_analytic': fields.property(
'account.analytic.account',
type='many2one',
relation='account.analytic.account',
string="Analytic Account",
method=True,
view_load=True,
group_name="Accounting Properties",
help="This Analytic Account will be use in sale order line and invoice lines",
),
}
product_product()
class account_invoice_line(osv.osv):
_inherit = 'account.invoice.line'
_description = 'account invoice line'
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, price_unit=False, address_invoice_id=False, context={}):
res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, price_unit, address_invoice_id, context)
if product:
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
res_prod['value'].update({'account_analytic_id':res.property_account_analytic.id})
return res_prod
account_invoice_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>
<terp>
<data>
<record id="view_template_property_analytic_form" model="ir.ui.view">
<field name="name">product.template.property.analytic.form.inherit</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<separator string="Sales" colspan="2" position="before">
<field name="property_account_analytic"/>
<newline/>
</separator>
</field>
</record>
<record id="view_normal_property_analytic_form" model="ir.ui.view">
<field name="name">product.normal.property.analytic.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<separator string="Sales" colspan="2" position="before">
<field name="property_account_analytic"/>
<newline/>
</separator>
</field>
</record>
</data>
</terp>

View File

@ -86,14 +86,25 @@ class purchase_order(osv.osv):
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
return res
def _minimum_planned_date(self, cr, uid, ids, field_name, arg, context):
res={}
purchase_obj=self.browse(cr, uid, ids, context=context)
for purchase in purchase_obj:
if purchase.order_line:
min_date=purchase.order_line[0].date_planned
for line in purchase.order_line:
if line.date_planned < min_date:
min_date=line.date_planned
res[purchase.id]=min_date
return res
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None):
res = {}
for purchase in self.browse(cursor, user, ids, context=context):
tot = 0.0
if purchase.invoice_id.state not in ('draft','cancel'):
if purchase.invoice_id and purchase.invoice_id.state not in ('draft','cancel'):
tot += purchase.invoice_id.amount_untaxed
if tot:
if purchase.amount_untaxed:
res[purchase.id] = tot * 100.0 / purchase.amount_untaxed
else:
res[purchase.id] = 0.0
@ -154,7 +165,7 @@ class purchase_order(osv.osv):
'invoiced':fields.boolean('Invoiced & Paid', readonly=True, select=True),
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoice_method': fields.selection([('manual','Manual'),('order','From order'),('picking','From picking')], 'Invoicing Control', required=True),
'minimum_planned_date':fields.function(_minimum_planned_date, method=True,store=True, string='Minimum Planned Date', type='date', help="Minimum schedule date of all products."),
'amount_untaxed': fields.function(_amount_untaxed, method=True, string='Untaxed Amount'),
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),

View File

@ -3,6 +3,20 @@
<data>
<menuitem icon="terp-purchase" id="menu_purchase_root" name="Purchase Management"/>
<record model="ir.ui.view" id="purchase_order_calendar">
<field name="name">purchase.order.calendar</field>
<field name="model">purchase.order</field>
<field name="type">calendar</field>
<field name="priority" eval="2"/>
<field name="arch" type="xml">
<calendar string="Calendar View" date_start="minimum_planned_date" color="partner_id">
<field name="name"/>
<field name="amount_total"/>
<field name="partner_id"/>
</calendar>
</field>
</record>
<record id="purchase_order_form" model="ir.ui.view">
<field name="name">purchase.order.form</field>
<field name="model">purchase.order</field>
@ -17,6 +31,7 @@
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)"/>
<field name="origin" select="2"/>
<field name="date_order" select="2"/>
<field name="minimum_planned_date"/>
</group>
<notebook colspan="4">
<page string="Purchase Order">
@ -68,7 +83,7 @@
<field name="name">Purchase Orders</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,calendar,form</field>
</record>
<menuitem action="purchase_form_action" id="menu_purchase_form_action" parent="purchase.menu_purchase_root"/>
@ -78,7 +93,7 @@
<field name="res_model">purchase.order</field>
<field name="domain">[('state','=','draft')]</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,calendar,form</field>
</record>
<menuitem action="purchase_form_action2" id="menu_purchase_order_draft" parent="purchase.menu_purchase_form_action"/>
@ -87,7 +102,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,calendar,form</field>
<field name="domain">[('state','=','confirmed')]</field>
</record>
<menuitem action="purchase_form_action3" id="menu_purchase_form_action3" parent="purchase.menu_purchase_form_action"/>
@ -97,7 +112,7 @@
<field name="type">ir.actions.act_window</field>
<field name="res_model">purchase.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,calendar,form</field>
<field name="domain">[('state','=','approved')]</field>
</record>
<menuitem action="purchase_form_action4" id="menu_purchase_form_action4" parent="purchase.menu_purchase_form_action"/>

View File

@ -31,7 +31,7 @@
"version" : "1.0",
"author" : "Tiny",
"website" : "http://tinyerp.com",
"depends" : ["base", "product", "stock", "sale", "purchase"],
"depends" : ["base", "product", "stock", "sale", "purchase", "report_stock"],
"category" : "Generic Modules/Inventory Control",
"description": "A module that adds intrastat reports.",
"init_xml" : ["report_intrastat_data.xml",],

View File

@ -56,7 +56,7 @@
<field name="view_mode">tree,form</field>
</record>
<menuitem name="Configuration" id="menu_definition_journal_configuration" parent="sale_wo_production.menu_sale_wo_inventory"/>
<menuitem name="Configuration" id="menu_definition_journal_configuration"/>
<menuitem name="Packings Journals" id="menu_definition_journal_picking" parent="menu_definition_journal_configuration" action="action_definition_picking_journal"/>
<record model="ir.actions.act_window" id="action_definition_picking_journal_tree">
@ -67,7 +67,7 @@
<field name="domain">[]</field>
</record>
<menuitem name="Packing Lists" id="menu_definition_journal_packing_lists" parent="sale_wo_production.menu_sale_wo_inventory"/>
<menuitem name="Packing Lists" id="menu_definition_journal_packing_lists"/>
<menuitem name="Packings by Journal" id="menu_definition_journal_picking_byjournal" parent="menu_definition_journal_packing_lists" action="action_definition_picking_journal_tree"/>
<record model="ir.actions.act_window" id="action_definition_picking_journal_tree_my">

View File

@ -57,7 +57,7 @@
<field name="domain">[('name','=',time.strftime('%Y-%m-01'))]</field>
</record>
<menuitem name="Reporting" id="menu_definition_journal_reporting" parent="sale_wo_production.menu_sale_wo_inventory"/>
<menuitem name="Reporting" id="menu_definition_journal_reporting"/>
<menuitem name="This Month" id="menu_definition_journal_reporting_this" parent="menu_definition_journal_reporting"/>
<menuitem name="Packings by Invoice Method" id="menu_invoice_type_picking_stats_open_menu" parent="menu_definition_journal_reporting_this" action="action_invoice_type_picking_stats_open_menu_month"/>

View File

@ -783,7 +783,7 @@
</record>
<record id="action_picking_tree" model="ir.actions.act_window">
<field name="name">Sending Goods</field>
<field name="name">Sending Products</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -852,7 +852,7 @@
<menuitem action="action_picking_tree3" id="menu_action_picking_tree3" parent="menu_action_picking_tree"/>
#
# Reception of Goods
# Reception of Products
#
<record id="view_picking_in_tree" model="ir.ui.view">
<field name="name">stock.picking.in.tree</field>
@ -946,7 +946,7 @@
<record id="action_picking_tree4" model="ir.actions.act_window">
<field name="name">Getting Goods</field>
<field name="name">Getting Products</field>
<field name="res_model">stock.picking</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
@ -998,7 +998,6 @@
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="view_picking_in_form"/>
<field name="context">{'contact_display': 'partner'}</field>
<field name="domain">[('type','=','in')]</field>
</record>