bzr revid: mra@mra-laptop-20100726044534-w60552uyuiouo4he
This commit is contained in:
Mustufa Rangwala
2010-07-26 10:15:34 +05:30
105 changed files with 3856 additions and 2514 deletions
+92 -75
View File
@@ -248,59 +248,59 @@ class account_account(osv.osv):
def __compute(self, cr, uid, ids, field_names, arg=None, context=None,
query='', query_params=()):
""" compute the balance, debit and/or credit for the provided
account ids
Arguments:
`ids`: account ids
`field_names`: the fields to compute (a list of any of
'balance', 'debit' and 'credit')
`arg`: unused fields.function stuff
`query`: additional query filter (as a string)
`query_params`: parameters for the provided query string
(__compute will handle their escaping) as a
tuple
"""
mapping = {
'balance': "COALESCE(SUM(l.debit),0) " \
"- COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit"
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)
#compute for each account the balance/debit/credit from the move lines
accounts = {}
if children_and_consolidated:
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
""" compute the balance, debit and/or credit for the provided
account ids
Arguments:
`ids`: account ids
`field_names`: the fields to compute (a list of any of
'balance', 'debit' and 'credit')
`arg`: unused fields.function stuff
`query`: additional query filter (as a string)
`query_params`: parameters for the provided query string
(__compute will handle their escaping) as a
tuple
"""
mapping = {
'balance': "COALESCE(SUM(l.debit),0) " \
"- COALESCE(SUM(l.credit), 0) as balance",
'debit': "COALESCE(SUM(l.debit), 0) as debit",
'credit': "COALESCE(SUM(l.credit), 0) as credit"
}
#get all the necessary accounts
children_and_consolidated = self._get_children_and_consol(cr, uid, ids, context=context)
#compute for each account the balance/debit/credit from the move lines
accounts = {}
if children_and_consolidated:
aml_query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
wheres = [""]
if query.strip():
wheres.append(query.strip())
if aml_query.strip():
wheres.append(aml_query.strip())
filters = " AND ".join(wheres)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Filters: %s'%filters)
# IN might not work ideally in case there are too many
# children_and_consolidated, in that case join on a
# values() e.g.:
# SELECT l.account_id as id FROM account_move_line l
# INNER JOIN (VALUES (id1), (id2), (id3), ...) AS tmp (id)
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
' , '.join(map(mapping.__getitem__, field_names)) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
" GROUP BY l.account_id")
params = (tuple(children_and_consolidated),) + query_params
cr.execute(request, params)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Status: %s'%cr.statusmessage)
wheres = [""]
if query.strip():
wheres.append(query.strip())
if aml_query.strip():
wheres.append(aml_query.strip())
filters = " AND ".join(wheres)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Filters: %s'%filters)
# IN might not work ideally in case there are too many
# children_and_consolidated, in that case join on a
# values() e.g.:
# SELECT l.account_id as id FROM account_move_line l
# INNER JOIN (VALUES (id1), (id2), (id3), ...) AS tmp (id)
# ON l.account_id = tmp.id
# or make _get_children_and_consol return a query and join on that
request = ("SELECT l.account_id as id, " +\
' , '.join(map(mapping.__getitem__, field_names)) +
" FROM account_move_line l" \
" WHERE l.account_id IN %s " \
+ filters +
" GROUP BY l.account_id")
params = (tuple(children_and_consolidated),) + query_params
cr.execute(request, params)
self.logger.notifyChannel('addons.'+self._name, netsvc.LOG_DEBUG,
'Status: %s'%cr.statusmessage)
for res in cr.dictfetchall():
accounts[res['id']] = res
for res in cr.dictfetchall():
accounts[res['id']] = res
# consolidate accounts with direct children
children_and_consolidated.reverse()
@@ -656,9 +656,18 @@ class account_journal(osv.osv):
@param context: context arguments, like lang, time zone
@return: return a result
"""
journal_type = ('sale', 'sale_refund', 'purchase', 'purchase_refund')
journal_seq = {
'sale':'seq_out_invoice',
'purchase':'seq_in_invoice',
'purchase_refund':'seq_out_refund',
'sale_refund':'seq_in_refund'
}
seq_pool = self.pool.get('ir.sequence')
seq_typ_pool = self.pool.get('ir.sequence.type')
date_pool = self.pool.get('ir.model.data')
result = True
@@ -685,10 +694,13 @@ class account_journal(osv.osv):
res.update({
'sequence_id':seq_id
})
if not journal.invoice_sequence_id:
if journal.type in journal_type and not journal.invoice_sequence_id:
res_ids = date_pool.search(cr, uid, [('model','=','ir.sequence'), ('name','=',journal_seq.get(journal.type, 'sale'))])
inv_seq_id = date_pool.browse(cr, uid, res_ids[0]).res_id
inv_seq_id
res.update({
'invoice_sequence_id':seq_id
'invoice_sequence_id':inv_seq_id
})
result = self.write(cr, uid, [journal.id], res)
@@ -1066,24 +1078,13 @@ class account_move(osv.osv):
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
'amount': fields.function(_amount_compute, method=True, string='Amount', digits_compute=dp.get_precision('Account'), type='float', fnct_search=_search_amount),
'date': fields.date('Date', required=True, states={'posted':[('readonly',True)]}),
'type': fields.selection([
('pay_voucher','Cash Payment'),
('bank_pay_voucher','Bank Payment'),
('rec_voucher','Cash Receipt'),
('bank_rec_voucher','Bank Receipt'),
('cont_voucher','Contra'),
('journal_sale_vou','Journal Sale'),
('journal_pur_voucher','Journal Purchase'),
('journal_voucher','Journal Voucher'),
],'Entry Type', select=True , size=128, readonly=True, states={'draft':[('readonly',False)]}),
'narration':fields.text('Narration', readonly=True, select=True, states={'draft':[('readonly',False)]}),
'narration':fields.text('Narration', select=True),
'company_id': fields.related('journal_id','company_id',type='many2one',relation='res.company',string='Company',store=True),
}
_defaults = {
'name': lambda *a: '/',
'state': lambda *a: 'draft',
'period_id': _get_period,
'type' : lambda *a : 'journal_voucher',
'date': lambda *a:time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
@@ -1162,8 +1163,20 @@ class account_move(osv.osv):
# TODO: Check if period is closed !
#
def create(self, cr, uid, vals, context={}):
if 'line_id' in vals:
if 'journal_id' in vals:
if 'line_id' in vals and context.get('copy'):
for l in vals['line_id']:
if not l[0]:
l[2].update({
'reconcile_id':False,
'reconcil_partial_id':False,
'analytic_lines':False,
'invoice':False,
'ref':False,
'balance':False,
'account_tax_id':False,
})
if 'journal_id' in vals and vals.get('journal_id', False):
for l in vals['line_id']:
if not l[0]:
l[2]['journal_id'] = vals['journal_id']
@@ -1189,11 +1202,14 @@ class account_move(osv.osv):
result = super(account_move, self).create(cr, uid, vals, context)
return result
def copy(self, cr, uid, id, default=None, context=None):
if default is None:
default = {}
default = default.copy()
default.update({'state':'draft', 'name':'/',})
def copy(self, cr, uid, id, default={}, context={}):
default.update({
'state':'draft',
'name':'/',
})
context.update({
'copy':True
})
return super(account_move, self).copy(cr, uid, id, default, context)
def unlink(self, cr, uid, ids, context={}, check=True):
@@ -2527,9 +2543,9 @@ class wizard_multi_charts_accounts(osv.osv_memory):
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals
# Creating Journals Sales and Purchase
vals_journal={}
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_view')])
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id = data.res_id
@@ -2561,6 +2577,7 @@ class wizard_multi_charts_accounts(osv.osv_memory):
vals_journal['type'] = 'purchase'
vals_journal['code'] = _('EXJ')
vals_journal['sequence_id'] = seq_id_purchase
vals_journal['view_id'] = view_id
if obj_multi.chart_template_id.property_account_payable:
vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id]
+1
View File
@@ -335,6 +335,7 @@ class account_bank_statement(osv.osv):
if st.journal_id.entry_posted:
account_move_obj.write(cr, uid, [move_id], {'state':'posted'})
self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name)
done.append(st.id)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
return True
+14 -3
View File
@@ -135,6 +135,12 @@
<field name="amount_untaxed" sum="Untaxed Amount"/>
<field name="amount_total" sum="Total Amount"/>
<field name="state"/>
<button name="invoice_open" states="draft,proforma2" string="Approve" icon="terp-camera_test"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="terp-gtk-stop"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="terp-stock_effects-object-colorize"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='open,paid' icon="gtk-execute"/>
</tree>
</field>
</record>
@@ -151,7 +157,7 @@
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}"/>
<newline/>
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" context="{'default_customer': 0}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
@@ -260,7 +266,7 @@
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change"/>
<button name="%(action_account_change_currency)d" type="action" icon="terp-stock_effects-object-colorize" string="Change" attrs="{'invisible':[('state','!=','draft')]}"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank_id,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
@@ -365,6 +371,11 @@
<field name="amount_total"/>
</group>
<newline/>
<group col="10" colspan="4">
<field name="journal_id" widget="selection" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By...">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
@@ -424,7 +435,7 @@
<field name="domain">[('type','=','out_invoice')]</field>
<field name="context">{'type':'out_invoice'}</field>
<field name="search_view_id" ref="view_account_invoice_filter"/>
<field name="help">Most of customer invoices are automatically generate in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund yours customers invoices here. A manual invoice can be created here.</field>
<field name="help">Most of customer invoices are automatically generated in draft mode by OpenERP flows, following a purchase order for instance. Review, confirm or cancel, pay or refund your customers' invoices here. A manual invoice can be created here.</field>
</record>
<record id="action_invoice_tree1_view1" model="ir.actions.act_window.view">
+25 -16
View File
@@ -8,24 +8,23 @@
<menuitem id="menu_finance_bank_and_cash" name="Bank and Cash" parent="menu_finance" sequence="3"/>
<!-- <menuitem id="menu_accounting" name="Accounting" parent="menu_finance" sequence="5"/>-->
<menuitem id="menu_finance_periodical_processing" name="Periodical Processing" parent="menu_finance" sequence="8" groups="group_account_user"/>
<menuitem id="periodical_processing_journal_entries_validation" name="Entries to Review" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_journal_entries_validation" name="Entries to Review" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_reconciliation" name="Reconciliation" parent="menu_finance_periodical_processing"/>
<!-- <menuitem id="periodical_processing_recurrent_entries" name="Recurrent Entries" parent="menu_finance_periodical_processing"/>-->
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
<menuitem id="periodical_processing_invoicing" name="Invoicing" parent="menu_finance_periodical_processing"/>
<!-- <menuitem id="periodical_processing_end_of_period" name="End of Period" parent="menu_finance_periodical_processing"/>-->
<menuitem id="menu_finance_charts" name="Charts" parent="menu_finance" sequence="5"/>
<menuitem id="menu_finance_reporting" name="Reporting" parent="account.menu_finance" sequence="12"/>
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
<menuitem id="menu_generic_report" name="Management Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_reporting_budgets" name="Budgets" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_legal_statement" name="Legal Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_management_belgian_reports" name="Belgian Reports" parent="menu_finance_reporting"/>
<menuitem id="menu_finance_configuration" name="Configuration" parent="menu_finance" sequence="13"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<menuitem id="menu_finance_accounting" name="Financial Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic_accounting" name="Analytic Accounting" parent="menu_finance_configuration"/>
<menuitem id="menu_analytic" parent="menu_analytic_accounting" name="Accounts"/>
<menuitem id="menu_low_level" name="Low Level" parent="menu_finance_accounting"/>
<menuitem id="menu_configuration_misc" name="Miscelleanous" parent="menu_finance_configuration"/>
<menuitem id="base.menu_action_currency_form" parent="menu_configuration_misc" sequence="20"/>
<!-- <menuitem id="menu_finance_configuration1" name="Configuration" parent="menu_finance" sequence="80"/>-->
<!-- <menuitem id="base.menu_action_currency_form" parent="menu_finance_configuration" sequence="20"/>-->
<!-- <menuitem id="menu_finance_accounting1" name="Financial Accounting" parent="menu_finance_configuration" sequence="80"/>-->
@@ -34,10 +33,9 @@
<!-- <menuitem id="menu_finance_reporting11" name="Reporting" parent="account.menu_finance" sequence="80"/>-->
<menuitem id="menu_finance_generic_reporting" name="Generic Reporting" parent="menu_finance_reporting" sequence="100"/>
<!-- <menuitem id="menu_finance_legal_statement1" name="Legal Statements" parent="account.menu_finance_reporting" sequence="200"/>-->
<!-- <menuitem id="menu_generic_report" name="Generic Reports" parent="account.menu_finance_legal_statement" sequence="8"/>-->
<menuitem id="menu_finance_entries" name="Accounting" parent="menu_finance" sequence="4"
groups="group_account_user"/>
groups="group_account_user"/>
<menuitem id="account.menu_finance_recurrent_entries" name="Recurring Entries" parent="menu_finance_periodical_processing" sequence="15"/>
<!-- <menuitem id="menu_finance_periodical_processing11" name="Periodical Processing" parent="account.menu_finance"-->
@@ -45,7 +43,18 @@
<!-- groups="group_account_user"/>-->
<menuitem id="menu_account_end_year_treatments" name="End of Period" parent="menu_finance_periodical_processing"/>
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<menuitem id="menu_finance_statistic_report_statement" name="Statistic Reports" parent="menu_finance_reporting" sequence="300"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem
parent="account.menu_finance_legal_statement"
id="menu_journals_report"
name="Journals"/>
</data>
</openerp>
+36 -7
View File
@@ -20,7 +20,6 @@
##############################################################################
import time
from datetime import datetime
import netsvc
from osv import fields, osv
from tools.translate import _
@@ -183,7 +182,7 @@ class account_move_line(osv.osv):
# Compute the current move
move_id = False
partner_id = False
if context.get('journal_id',False) and context.get('period_id',False):
if context.get('journal_id', False) and context.get('period_id', False):
if 'move_id' in fields:
cr.execute('select move_id \
from \
@@ -199,6 +198,7 @@ class account_move_line(osv.osv):
return data
else:
data['move_id'] = move_id
if 'date' in fields:
cr.execute('select date \
from \
@@ -214,7 +214,6 @@ class account_move_line(osv.osv):
period = period_obj.browse(cr, uid, context['period_id'],
context=context)
data['date'] = period.date_start
if not move_id:
return data
@@ -454,6 +453,7 @@ class account_move_line(osv.osv):
context=context)
dt = period.date_start
return dt
def _get_currency(self, cr, uid, context={}):
if not context.get('journal_id', False):
return False
@@ -786,6 +786,31 @@ class account_move_line(osv.osv):
return j+(p and (':'+p) or '')
return False
# def onchange_date(self, cr, user, ids, date, context={}):
# """
# Returns a dict that contains new values and context
# @param cr: A database cursor
# @param user: ID of the user currently logged in
# @param date: latest value from user input for field date
# @param args: other arguments
# @param context: context arguments, like lang, time zone
# @return: Returns a dict which contains new values, and context
# """
# res = {}
# period_pool = self.pool.get('account.period')
# pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
# if pids:
# res.update({
# 'period_id':pids[0]
# })
# context.update({
# 'period_id':pids[0]
# })
# return {
# 'value':res,
# 'context':context,
# }
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False):
result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu)
if view_type != 'tree':
@@ -848,11 +873,14 @@ class account_move_line(osv.osv):
elif field == 'credit':
attrs.append('sum="Total credit"')
elif field == 'account_tax_id':
attrs.append('domain="[(\'parent_id\',\'=\',False)]"')
attrs.append('domain="[(\'parent_id\',\'=\',False), (\'type_tax_use\',\'=\',context.get(journal_id.type, \'sale\'))]"')
elif field == 'account_id' and journal.id:
attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'&lt;&gt;\',\'view\'), (\'type\',\'&lt;&gt;\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"')
elif field == 'partner_id':
attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"')
# elif field == 'date':
# attrs.append('on_change="onchange_date(date)"')
# if field.readonly:
# attrs.append('readonly="1"')
# if field.required:
@@ -898,6 +926,7 @@ class account_move_line(osv.osv):
def _check_date(self, cr, uid, vals, context=None, check=True):
if context is None:
context = {}
journal_id = False
if 'date' in vals.keys():
if 'journal_id' in vals and 'journal_id' not in context:
journal_id = vals['journal_id']
@@ -1082,10 +1111,10 @@ class account_move_line(osv.osv):
#if not 'currency_id' in vals:
# vals['currency_id'] = account.company_id.currency_id.id
result = super(osv.osv, self).create(cr, uid, vals, context)
# CREATE Taxes
if vals.get('account_tax_id',False):
if vals.get('account_tax_id', False):
tax_id = tax_obj.browse(cr, uid, vals['account_tax_id'])
total = vals['debit'] - vals['credit']
if journal.refund_journal:
@@ -1158,7 +1187,7 @@ class account_move_line(osv.osv):
if check and ((not context.get('no_store_function')) or journal.entry_posted):
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
if journal.entry_posted and tmp:
self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
rs = self.pool.get('account.move').button_validate(cr,uid, [vals['move_id']],context)
return result
account_move_line()
+189 -105
View File
@@ -266,12 +266,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Journal Column">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="name" select="1"/><field name="name"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="state"/>
<field name="field" select="1"/>
<field name="sequence"/>
<newline/>
<field name="readonly"/>
<field name="required"/>
<!-- <newline/>-->
<!-- <field name="readonly"/>-->
<!-- <field name="required"/>-->
</form>
</field>
</record>
@@ -283,8 +290,8 @@
<tree string="Journal Column">
<field name="sequence"/>
<field name="name"/>
<field name="required"/>
<field name="readonly"/>
<!-- <field name="required"/>-->
<!-- <field name="readonly"/>-->
</tree>
</field>
</record>
@@ -295,11 +302,18 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Journal View">
<field colspan="4" name="name" select="1"/>
<field name="name" select="1"/>
<field colspan="4" name="columns_id" nolabel="1" widget="one2many_list"/>
</form>
</field>
</record>
<record id="action_account_journal_view" model="ir.actions.act_window">
<field name="name">Journal Views</field>
<field name="res_model">account.journal.view</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<menuitem action="action_account_journal_view" id="menu_action_account_journal_view" parent="account.menu_low_level"/>
<!--
# Account Journal
@@ -414,18 +428,20 @@
<field name="model">account.bank.statement</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Statement">
<group col="10" colspan="4">
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Statement"/>
<filter icon="terp-check" string="Posted" domain="[('state','=','confirm')]" help="Confirm confirm"/>
<search string="Search Bank Statements">
<group col="8" colspan="4">
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirm" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
</group>
<group expand="0" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
<newline/>
<group expand="0" string="Group By...">
<filter string="Journal" context="{'group_by': 'journal_id'}" icon="terp-folder-orange"/>
<filter string="Period" context="{'group_by': 'period_id'}" icon="terp-go-month"/>
<filter string="State" context="{'group_by': 'state'}" icon="terp-stock_effects-object-colorize"/>
</group>
</search>
</field>
@@ -437,10 +453,10 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end and state=='draft';blue:state=='draft' and (balance_end_real==balance_end);black:state=='confirm'" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
@@ -457,7 +473,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Bank Statements">
<group>
<group col="8" colspan="4">
<filter string="Draft" domain="[('state','=','draft')]" icon="terp-document-new"/>
<filter string="Confirm" domain="[('state','=','confirm')]" icon="terp-camera_test"/>
<separator orientation="vertical"/>
@@ -536,7 +552,7 @@
<field name="name">Bank Statements</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_tree_bank">
@@ -663,7 +679,7 @@
<field name="period_id"/>
<field name="journal_id"/>
<field name="partner_id"/>
<field name="amount"/>
<field name="amount" sum="Total Amount"/>
<field name="state"/>
</tree>
</field>
@@ -899,43 +915,69 @@
<field eval="2" name="priority"/>
<field name="arch" type="xml">
<form string="Account Entry Line">
<notebook>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="ref"/>
<field name="partner_id" select="1" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
</group>
<notebook colspan="4">
<page string="Information">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
<field name="date" select="1"/>
<field name="ref"/>
<field name="invoice"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="partner_id" select="1" on_change="onchange_partner_id(False,partner_id,account_id,debit,credit,date)"/>
<group col="2" colspan="2">
<separator colspan="2" string="Amount"/>
<field name="account_id" select="1" domain="[('type','&lt;&gt;','view'),('type','&lt;&gt;','consolidation')]"/>
<field name="debit"/>
<field name="credit"/>
<field name="quantity"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Accounting Documents"/>
<field name="invoice"/>
<field name="move_id" required="False"/>
<field name="statement_id"/>
</group>
<field name="debit"/>
<field name="credit"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<group col="2" colspan="2">
<separator colspan="2" string="Dates"/>
<field name="date" select="1"/>
<field name="date_maturity"/>
<field name="date_created"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Taxes"/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Currency"/>
<field name="currency_id"/>
<field name="amount_currency"/>
</group>
<separator colspan="4" string="Optional Information"/>
<field name="currency_id"/>
<field name="amount_currency"/>
<field name="quantity"/>
<field name="move_id" required="False"/>
<newline/>
<field name="statement_id"/>
<field name="blocked"/>
<field name="date_maturity"/>
<field name="date_created"/>
<newline/>
<field name="tax_code_id"/>
<field name="tax_amount"/>
<newline/>
<field name="account_tax_id" domain="[('parent_id','=',False)]"/>
<field name="analytic_account_id"/>
<group col="2" colspan="2">
<separator colspan="2" string="Reconciliation"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="States"/>
<field name="state"/>
<field name="blocked"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Analytic"/>
<field name="analytic_account_id"/>
</group>
<separator colspan="4" string="State"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="reconcile_id"/>
<field name="reconcile_partial_id"/>
<field name="state"/>
</page>
<page string="Analytic Lines">
<field colspan="4" name="analytic_lines" nolabel="1" context="{'default_general_account_id':account_id, 'default_name': name, 'default_date':date, 'amount': (debit or 0.0)-(credit or 0.0)}"/>
@@ -945,7 +987,6 @@
</field>
</record>
<record id="view_move_line_form2" model="ir.ui.view">
<field name="name">account.move.line.form2</field>
<field name="model">account.move.line</field>
@@ -953,7 +994,7 @@
<field eval="9" name="priority"/>
<field name="arch" type="xml">
<form string="Account Entry Line">
<notebook>
<notebook colspan="4">
<page string="Information">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
@@ -993,6 +1034,19 @@
</field>
</record>
<record id="account_move_line_graph" model="ir.ui.view">
<field name="name">account.move.line.graph</field>
<field name="model">account.move.line</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="account_id"/>
<field name="debit" operator="+"/>
<field name="credit" operator="+"/>
</graph>
</field>
</record>
<record id="view_account_move_line_filter" model="ir.ui.view">
<field name="name">Entry Lines</field>
<field name="model">account.move.line</field>
@@ -1001,8 +1055,11 @@
<search string="Search Entry Lines">
<group col='10' colspan='4'>
<filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Entry Lines"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','valid')]" help="Posted Entry Lines"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','valid')]" help="Posted Entry Lines"/>
<filter icon="terp-stock_symbol-selection" string="Unposted" domain="[('move_id.state','=','draft')]" help="Unposted Entry Lines"/>
<separator orientation="vertical"/>
<filter icon="terp-stock_symbol-selection" string="Unreconciled" domain="[('reconcile_id','=',False), ('account_id.type','in',['receivable', 'payable'])]" help="Unreconciled Entry Lines"/>
<field name="date" select='1'/>
<field name="account_id" select='1'/>
<field name="partner_id" select='1'>
@@ -1012,8 +1069,8 @@
</group>
<newline/>
<group col="10" colspan="4">
<field name="journal_id" widget="selection" context="{'journal_id':self, 'visible_id':self or 0, 'normal_view':False}"/>
<field name="period_id" widget="selection" context="{'period_id':self}"/>
<field name="journal_id" required="1" widget="selection" context="{'journal_id':self, 'visible_id':self or 0, 'normal_view':False}"/>
<field name="period_id" required="1" widget="selection" context="{'period_id':self}"/>
</group>
</search>
</field>
@@ -1043,6 +1100,17 @@
Account.Entry Edition
-->
<record id="account_move_graph" model="ir.ui.view">
<field name="name">account.move.graph</field>
<field name="model">account.move</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="period_id"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<record id="view_move_tree" model="ir.ui.view">
<field name="name">account.move.tree</field>
<field name="model">account.move</field>
@@ -1054,11 +1122,10 @@
<field name="ref"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="partner_id"/>
<field name="line_id"/>
<field name="to_check" groups="base.group_extended"/>
<field name="amount"/>
<field name="amount" sum="Total Amount"/>
<field name="state"/>
<button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/>
</tree>
@@ -1072,15 +1139,18 @@
<form string="Journal Entries">
<group colspan="4" col="6">
<field name="name" select="1" readonly="True"/>
<field name="ref" select="1"/>
<field name="to_check" groups="base.group_extended"/>
<field name="journal_id" select="1"/>
<field name="period_id"/>
<field name="type"/>
<field name="ref" select="1"/>
<field name="date" select="1"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
</group>
<notebook colspan="4">
<page string="Journal Entries Lines">
<field colspan="4" height="200" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<field colspan="4" name="line_id" nolabel="1" height="250" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
@@ -1125,20 +1195,13 @@
</tree>
</field>
<separator colspan="4" string="Narration"/>
<field name="narration" colspan="4" nolabel="1"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<field name="narration" colspan="4" nolabel="1" height="50"/>
<group col="4" colspan="4">
<field name="state" select="1"/>
<button name="button_validate" states="draft" string="Approve" type="object" icon="terp-camera_test"/>
<button name="button_cancel" states="posted" string="Cancel" type="object" icon="terp-gtk-stop"/>
</group>
</page>
<page string="Other Information">
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1" groups="base.group_extended"/>
<field name="to_check" groups="base.group_extended"/>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
</page>
</notebook>
</form>
</field>
@@ -1155,28 +1218,34 @@
<filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Entries"/>
<separator orientation="vertical"/>
<filter icon="terp-camera_test" string="To Review" domain="[('to_check','=',True)]" groups="base.group_extended" help="To Review"/>
<separator orientation="vertical"/>
<field name="date" select='1'/>
<field name="name" select='1'/>
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
</group>
<newline/>
<group col='8' colspan='4'>
<field name="journal_id" widget="selection" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-stock_symbol-selection" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<filter string="Partner" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Date" icon="terp-go-month" domain="[]" context="{'group_by':'date'}"/>
</group>
</search>
</field>
</record>
<record id="action_move_journal_line" model="ir.actions.act_window">
<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_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
</record>
@@ -1205,21 +1274,20 @@
res_model="account.move.line"
src_model="account.move"/>
<record id="action_move_to_review" model="ir.actions.act_window">
<field name="name">Journal Entries</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_move_tree"/>
<field name="search_view_id" ref="view_account_move_filter"/>
<field name="domain">[('to_check','=',True), ('state','=','draft')]</field>
</record>
<menuitem
action="action_move_to_review"
id="menu_action_move_to_review"
parent="periodical_processing_journal_entries_validation"
/>
<!-- <record id="action_move_to_review" model="ir.actions.act_window">-->
<!-- <field name="name">Journal Entries</field>-->
<!-- <field name="type">ir.actions.act_window</field>-->
<!-- <field name="res_model">account.move</field>-->
<!-- <field name="view_type">form</field>-->
<!-- <field name="view_id" ref="view_move_tree"/>-->
<!-- <field name="search_view_id" ref="view_account_move_filter"/>-->
<!-- <field name="domain">[('to_check','=',True), ('state','=','draft')]</field>-->
<!-- </record>-->
<!-- <menuitem-->
<!-- action="action_move_to_review"-->
<!-- id="menu_action_move_to_review"-->
<!-- parent="periodical_processing_journal_entries_validation"-->
<!-- />-->
<!-- <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"/>-->
@@ -1239,7 +1307,7 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="domain">[('journal_id.type', 'in', ['sale', 'purchase_refund'])]</field>
@@ -1251,11 +1319,10 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
<field name="domain">[('journal_id.type', 'in', ['purchase', 'sale_refund'])]</field>
<field name="context">{'journal_id':1}</field>
</record>
<menuitem action="action_account_moves_purchase" id="menu_eaction_account_moves_purchase" parent="menu_finance_payables"/>
@@ -2272,7 +2339,7 @@
<field name="name">Journal Items</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_move_line_tree"/>
<field name="search_view_id" ref="view_account_move_line_filter"/>
</record>
@@ -2286,23 +2353,22 @@
/>
<!-- Cash Statement -->
<record id="view_bank_statement_tree" model="ir.ui.view">
<record id="view_cash_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
<field name="model">account.bank.statement</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end);black:state in ('open')" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="date"/>
<field name="period_id"/>
<field name="journal_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="user_id" select="1"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/>
<button type="object" string="Confirm" name="button_confirm_cash" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Confirm" name="button_confirm_bank" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
</tree>
</field>
@@ -2412,20 +2478,32 @@
</form>
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.bank.statement.graph</field>
<field name="model">account.bank.statement</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Account Statistics" type="bar">
<field name="date"/>
<field name="balance_start" operator="+"/>
<field name="balance_end" operator="+"/>
</graph>
</field>
</record>
<record id="action_view_bank_statement_tree" model="ir.actions.act_window">
<field name="name">Cash Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" ref="view_cash_statement_tree"/>
<field name="search_view_id" ref="view_account_bank_statement_filter"/>
<field name="domain">[('journal_id.type', '=', 'cash')]</field>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement1_all">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="view_id" ref="view_cash_statement_tree"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement2_all">
@@ -2434,6 +2512,12 @@
<field name="view_id" ref="view_bank_statement_form2"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement3_all">
<field name="sequence" eval="1"/>
<field name="view_mode">graph</field>
<field name="view_id" ref="account_cash_statement_graph"/>
<field name="act_window_id" ref="action_view_bank_statement_tree"/>
</record>
<menuitem action="action_view_bank_statement_tree" id="journal_cash_move_lines" parent="menu_finance_bank_and_cash"/>
</data>
+12 -12
View File
@@ -385,18 +385,18 @@
Product income and expense accounts, default parameters
-->
<record id="property_account_expense_prd" model="ir.property">
<field name="name">property_account_expense</field>
<field name="fields_id" search="[('model','=','product.template'),('name','=','property_account_expense')]"/>
<field eval="'account.account,'+str(ref('account.a_expense'))" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
<record id="property_account_income_prd" model="ir.property">
<field name="name">property_account_income</field>
<field name="fields_id" search="[('model','=','product.template'),('name','=','property_account_income')]"/>
<field eval="'account.account,'+str(ref('account.a_sale'))" name="value"/>
<field name="company_id" ref="base.main_company"/>
</record>
<!-- <record id="property_account_expense_prd" model="ir.property">-->
<!-- <field name="name">property_account_expense</field>-->
<!-- <field name="fields_id" search="[('model','=','product.template'),('name','=','property_account_expense')]"/>-->
<!-- <field eval="'account.account,'+str(ref('account.a_expense'))" name="value"/>-->
<!-- <field name="company_id" ref="base.main_company"/>-->
<!-- </record>-->
<!-- <record id="property_account_income_prd" model="ir.property">-->
<!-- <field name="name">property_account_income</field>-->
<!-- <field name="fields_id" search="[('model','=','product.template'),('name','=','property_account_income')]"/>-->
<!-- <field eval="'account.account,'+str(ref('account.a_sale'))" name="value"/>-->
<!-- <field name="company_id" ref="base.main_company"/>-->
<!-- </record>-->
<record id="property_account_expense_categ" model="ir.property">
<field name="name">property_account_expense_categ</field>
<field name="fields_id" search="[('model','=','product.category'),('name','=','property_account_expense_categ')]"/>
+556 -261
View File
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+11 -11
View File
@@ -13,7 +13,7 @@ msgstr ""
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-22 03:56+0000\n"
"X-Launchpad-Export-Date: 2010-07-23 04:08+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -215,7 +215,7 @@ msgstr "明细"
#. module: account
#: wizard_view:account.aged.trial.balance,init:0
msgid "Aged Trial Balance"
msgstr "账龄试算平衡表"
msgstr "旧的试算表"
#. module: account
#: model:ir.ui.menu,name:account.menu_finance_recurrent_entries
@@ -239,7 +239,7 @@ msgstr "金额"
#: model:ir.actions.wizard,name:account.wizard_third_party_ledger
#: model:ir.ui.menu,name:account.menu_third_party_ledger
msgid "Partner Ledger"
msgstr "业务伙伴总帐"
msgstr "业务伙伴分类账"
#. module: account
#: field:product.template,supplier_taxes_id:0
@@ -460,7 +460,7 @@ msgstr "从草稿确认, 与对/ 不对账"
#: model:ir.actions.wizard,name:account.action_account_bank_reconcile_tree
#: model:ir.ui.menu,name:account.menu_action_account_bank_reconcile_check_tree
msgid "Bank reconciliation"
msgstr "银行对账"
msgstr "银行对帐单"
#. module: account
#: rml:account.invoice:0
@@ -680,7 +680,7 @@ msgstr "月"
#. module: account
#: field:account.analytic.account,partner_id:0
msgid "Associated Partner"
msgstr "相关业务伙伴"
msgstr "相关的业务伙伴"
#. module: account
#: view:account.invoice:0
@@ -795,7 +795,7 @@ msgstr "之前生成的记录:"
#: model:ir.actions.report.xml,name:account.account_analytic_account_cost_ledger
#: model:ir.actions.wizard,name:account.account_analytic_account_cost_ledger_report
msgid "Cost Ledger"
msgstr "成本分类帐"
msgstr "成本分类账"
#. module: account
#: wizard_view:account.account.balance.report,checktype:0
@@ -888,7 +888,7 @@ msgstr "补差额集合"
#: field:account.model.line,amount_currency:0
#: field:account.move.line,amount_currency:0
msgid "Amount Currency"
msgstr "货币金额"
msgstr "另一货币金额"
#. module: account
#: field:account.chart.template,property_account_expense_categ:0
@@ -1897,7 +1897,7 @@ msgstr "支付发票"
#. module: account
#: constraint:account.invoice:0
msgid "Error: Invalid Bvr Number (wrong checksum)."
msgstr "错误:无效的Bvr号(错误的检验和)"
msgstr "错误:无效的Bvr号(校验错误)"
#. module: account
#: model:ir.actions.act_window,name:account.action_invoice_tree5
@@ -4212,7 +4212,7 @@ msgstr "这序列提供记录集合列表的显示顺序"
#. module: account
#: field:account.journal,type_control_ids:0
msgid "Type Controls"
msgstr "类型控制"
msgstr "控制类型"
#. module: account
#: field:account.analytic.account,name:0
@@ -5182,7 +5182,7 @@ msgstr "从手动转为草稿"
#. module: account
#: model:ir.ui.menu,name:account.next_id_43
msgid "This Month"
msgstr "本月"
msgstr "这月"
#. module: account
#: field:account.account.type,sign:0
@@ -5209,7 +5209,7 @@ msgstr "在确认对帐单产生的会计分录"
#. module: account
#: wizard_view:account_use_models,create:0
msgid "Use Model"
msgstr "使用模型"
msgstr "使用模式"
#. module: account
#: wizard_button:account.wizard_paid_open,init,end:0
+8 -4
View File
@@ -33,8 +33,9 @@ class account_installer(osv.osv_memory):
_inherit = 'res.config.installer'
def _get_default_accounts(self, cr, uid, context=None):
accounts = [{'acc_name':'Current','account_type':'cash'},
{'acc_name':'Deposit','account_type':'cash'}]
accounts = [{'acc_name':'Current','account_type':'bank'},
{'acc_name':'Deposit','account_type':'bank'},
{'acc_name':'Cash','account_type':'cash'}]
return accounts
def _get_charts(self, cr, uid, context=None):
@@ -295,9 +296,12 @@ class account_installer(osv.osv_memory):
'account_paid_id': acc_template_ref[value['account_paid_id']],
})
# Creating Journals
# Creating Journals Sales and Purchase
vals_journal={}
view_id = self.pool.get('account.journal.view').search(cr,uid,[('name','=','Journal View')])[0]
data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')])
data = data_pool.browse(cr, uid, data_id[0])
view_id = data.res_id
seq_id = obj_sequence.search(cr,uid,[('name','=','Account Journal')])[0]
if seq_journal:
+1 -1
View File
@@ -235,7 +235,7 @@ class account_invoice(osv.osv):
'reference': fields.char('Invoice Reference', size=64, help="The partner reference of this invoice."),
'reference_type': fields.selection(_get_reference_type, 'Reference Type',
required=True, readonly=True, states={'draft':[('readonly',False)]}),
'comment': fields.text('Additional Information', translate=True),
'comment': fields.text('Additional Information'),
'state': fields.selection([
('draft','Draft'),
@@ -29,15 +29,15 @@ class account_automatic_reconcile(osv.osv_memory):
_description = 'Automatic Reconcile'
_columns = {
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Account to reconcile', domain = [('reconcile','=',1)], \
'account_ids': fields.many2many('account.account', 'reconcile_account_rel', 'reconcile_id', 'account_id', 'Accounts to Reconcile', domain = [('reconcile','=',1)], \
help = 'If no account is specified, the reconciliation will be made using every accounts that can be reconcilied'),
'writeoff_acc_id': fields.many2one('account.account', 'Account'),
'journal_id': fields.many2one('account.journal', 'Journal'),
'period_id': fields.many2one('account.period', 'Period'),
'max_amount': fields.float('Maximum write-off amount'),
'power': fields.selection([(p, str(p)) for p in range(2, 10)], 'Power', required=True, help='Number of partial amounts that can be combined to find a balance point can be chosen as the power of the automatic reconciliation'),
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
'date1': fields.date('Starting Date', required=True),
'date2': fields.date('Ending Date', required=True),
'reconciled': fields.integer('Reconciled transactions', readonly=True),
'unreconciled': fields.integer('Not reconciled transactions', readonly=True),
'allow_write_off': fields.boolean('Allow write off')
@@ -54,6 +54,7 @@ class account_automatic_reconcile(osv.osv_memory):
'date2': time.strftime('%Y-%m-%d'),
'reconciled': _get_reconciled,
'unreconciled': _get_unreconciled,
'power':2
}
#TODO: cleanup and comment this code... For now, it is awfulllll
@@ -245,4 +246,4 @@ class account_automatic_reconcile(osv.osv_memory):
account_automatic_reconcile()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -7,33 +7,33 @@
<field name="model">account.automatic.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation">
<group width="660" height="430">
<separator string="Options" colspan="4"/>
<group>
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
<field name="date1"/>
<field name="date2"/>
<field name="power"/>
<field name="allow_write_off"/>
</group>
<newline/>
<group attrs="{'readonly':[('allow_write_off', '!=', True)]}">
<separator string="Write-Off Move" colspan="4"/>
<field name="max_amount"/>
<field name="writeoff_acc_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="journal_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="period_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
</group>
<separator string ="" colspan="4"/>
<group colspan="2" col="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="reconcile" string="Reconcile" type="object" icon="terp-stock_effects-object-colorize"/>
</group>
</group>
</form>
<form string="Reconciliation">
<group width="660" height="430">
<separator string="Options" colspan="4"/>
<group>
<field name="account_ids" colspan="4" domain="[('reconcile','=',1)]"/>
<field name="date1"/>
<field name="date2"/>
<field name="power"/>
<field name="allow_write_off"/>
</group>
<newline/>
<group attrs="{'readonly':[('allow_write_off', '!=', True)]}">
<separator string="Write-Off Move" colspan="4"/>
<field name="max_amount"/>
<field name="writeoff_acc_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="journal_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
<field name="period_id" attrs="{ 'required':[('allow_write_off', '=', True)]}"/>
</group>
<separator string ="" colspan="4"/>
<group colspan="2" col="4">
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="reconcile" string="Reconcile" type="object" icon="terp-stock_effects-object-colorize"/>
</group>
</group>
</form>
</field>
</record>
</record>
<record id="action_account_automatic_reconcile" model="ir.actions.act_window">
<field name="name">Account Automatic Reconcile</field>
@@ -47,29 +47,29 @@
<field name="help">For an invoice to be considered as paid, the invoice entries must be reconciled with counterparts, usually payments. With the automatic reconciliation functionality, OpenERP make its own search for entries to reconcile in a series of accounts. It tries to find entries for each partner where the amounts correspond.</field>
</record>
<menuitem
icon="STOCK_EXECUTE"
name="Automatic Reconciliation"
action="action_account_automatic_reconcile"
id="menu_automatic_reconcile"
parent="periodical_processing_reconciliation"/>
<menuitem
icon="STOCK_EXECUTE"
name="Automatic Reconciliation"
action="action_account_automatic_reconcile"
id="menu_automatic_reconcile"
parent="periodical_processing_reconciliation"/>
<record id="account_automatic_reconcile_view1" model="ir.ui.view">
<field name="name">Automatic reconcile unreconcile</field>
<field name="model">account.automatic.reconcile</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Reconciliation result">
<field name="reconciled"/>
<newline/>
<field name="unreconciled"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Ok" icon="terp-dialog-close" default_focus="1"/>
</group>
</form>
<form string="Reconciliation result">
<field name="reconciled"/>
<newline/>
<field name="unreconciled"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Ok" icon="terp-dialog-close" default_focus="1"/>
</group>
</form>
</field>
</record>
</record>
</data>
</data>
</openerp>
@@ -7,41 +7,41 @@
<field name="model">account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select period">
<group width="650" height="200">
<field name="company_id" groups="base.group_multi_company"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<separator colspan="4"/>
<newline/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</group>
</form>
<form string="Select period">
<group width="650" height="200">
<field name="company_id" groups="base.group_multi_company"/>
<field name="display_account" required = "True"/>
<newline/>
<field name="fiscalyear"/>
<label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
<newline/>
<separator string="Filters" colspan="4"/>
<field name="state" required="True"/>
<newline/>
<group attrs="{'invisible':[('state','=','none')]}" colspan="4">
<group attrs="{'invisible':[('state','=','byperiod')]}" colspan="4">
<separator string="Date Filter" colspan="4"/>
<field name="date_from"/>
<field name="date_to"/>
</group>
<group attrs="{'invisible':[('state','=','bydate')]}" colspan="4">
<separator string="Filter on Periods" colspan="4"/>
<field name="periods" colspan="4" nolabel="1"/>
</group>
</group>
<newline/>
<group colspan="4" col="6">
<separator colspan="4"/>
<newline/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="check_state" string="Print" type="object" icon="gtk-print" default_focus="1"/>
</group>
</group>
</form>
</field>
</record>
</record>
<record id="action_account_balance_report" model="ir.actions.act_window">
<record id="action_account_balance_report" model="ir.actions.act_window">
<field name="name">Account Balance</field>
<field name="res_model">account.balance.report</field>
<field name="type">ir.actions.act_window</field>
@@ -51,7 +51,7 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_balance_report_values">
<record model="ir.values" id="action_account_balance_report_values">
<field name="model_id" ref="account.model_account_account" />
<field name="object" eval="1" />
<field name="name">Account Balance</field>
@@ -59,19 +59,19 @@
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_balance_report'))" />
<field name="key">action</field>
<field name="model">account.account</field>
</record>
</record>
<record id="account_balance_report_account_view" model="ir.ui.view">
<record id="account_balance_report_account_view" model="ir.ui.view">
<field name="name">Account Balance</field>
<field name="model">account.balance.report</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Chart">
<field name="Account_list"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
</form>
<form string="Select Chart">
<field name="Account_list"/>
<separator colspan="4"/>
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button name="next_view" string="Next" type="object" icon="gtk-go-forward" default_focus="1"/>
</form>
</field>
</record>
@@ -86,11 +86,11 @@
<field name="target">new</field>
</record>
<menuitem icon="STOCK_PRINT"
name="Account Balance"
action="action_account_balance_account_report"
id="menu_account_balance_report"
parent="account.menu_generic_report"/>
<menuitem icon="STOCK_PRINT"
name="Account Balance"
action="action_account_balance_account_report"
id="menu_account_balance_report"
parent="account.final_accounting_reports"/>
</data>
</data>
</openerp>
@@ -2,27 +2,27 @@
<openerp>
<data>
<record id="view_account_central_journal" model="ir.ui.view">
<record id="view_account_central_journal" model="ir.ui.view">
<field name="name">Account central Journal</field>
<field name="model">account.central.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Print Central Journal">
<group height="370" width="400">
<group>
<separator string="Journals"/><newline/>
<field name="journal_id" nolabel="1"/><newline/>
<separator string="Periods"/><newline/>
<field name="period_id" nolabel="1"/><newline/>
</group>
<newline/>
<group>
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="check_data" string="Print" colspan="1" type="object" icon="gtk-ok"/>
</group>
</group>
</form>
<form string="Print Central Journal">
<group height="370" width="400">
<group>
<separator string="Journals"/><newline/>
<field name="journal_id" nolabel="1"/><newline/>
<separator string="Periods"/><newline/>
<field name="period_id" nolabel="1"/><newline/>
</group>
<newline/>
<group>
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="check_data" string="Print" colspan="1" type="object" icon="gtk-ok"/>
</group>
</group>
</form>
</field>
</record>
@@ -35,12 +35,12 @@
<field name="target">new</field>
</record>
<menuitem
name="Central Journals"
parent="account.menu_generic_report"
action="action_account_central_journal"
id="menu_account_central_journal"
icon="STOCK_PRINT"/>
<menuitem
name="Central Journals"
parent="account.menu_journals_report"
action="action_account_central_journal"
id="menu_account_central_journal"
icon="STOCK_PRINT"/>
</data>
</openerp>
</data>
</openerp>
@@ -58,6 +58,11 @@ cancelled, please check the box !'))
'WHERE fiscalyear_id = %s', ('done', fy_id))
cr.execute('UPDATE account_fiscalyear ' \
'SET state = %s WHERE id = %s', ('done', fy_id))
# Log message for Fiscalyear
fy_pool = self.pool.get('account.fiscalyear')
fy_code = fy_pool.browse(cr, uid, fy_id, context=context).code
fy_pool.log(cr, uid, fy_id, "Fiscal year '%s' is closed, no more modification allowed." % (fy_code))
return {}
account_fiscalyear_close_state()
@@ -2,27 +2,27 @@
<openerp>
<data>
<record id="view_account_general_journal" model="ir.ui.view">
<record id="view_account_general_journal" model="ir.ui.view">
<field name="name">Account Genral Journal</field>
<field name="model">account.general.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Print General Journal">
<group height="380" width="400">
<group>
<separator string="Journals"/><newline/>
<field name="journal_id" nolabel="1"/><newline/>
<separator string="Periods"/><newline/>
<field name="period_id" nolabel="1"/><newline/>
</group>
<newline/>
<group>
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="check_data" string="Print" colspan="1" type="object" icon="gtk-ok"/>
</group>
</group>
</form>
<form string="Print General Journal">
<group height="380" width="400">
<group>
<separator string="Journals"/><newline/>
<field name="journal_id" nolabel="1"/><newline/>
<separator string="Periods"/><newline/>
<field name="period_id" nolabel="1"/><newline/>
</group>
<newline/>
<group>
<separator colspan="4"/>
<button special="cancel" string="Cancel" icon='gtk-cancel'/>
<button name="check_data" string="Print" colspan="1" type="object" icon="gtk-ok"/>
</group>
</group>
</form>
</field>
</record>
@@ -35,12 +35,12 @@
<field name="target">new</field>
</record>
<menuitem
name="General Journals"
parent="account.menu_generic_report"
action="action_account_general_journal"
id="menu_account_general_journal"
icon="STOCK_PRINT"/>
<menuitem
name="General Journals"
parent="account.menu_journals_report"
action="action_account_general_journal"
id="menu_account_general_journal"
icon="STOCK_PRINT"/>
</data>
</openerp>
</data>
</openerp>
@@ -96,7 +96,7 @@
<menuitem
icon="STOCK_PRINT"
name="General Ledger"
parent="account.menu_generic_report"
parent="account.final_accounting_reports"
action="action_account_general_ledger_menu"
id="menu_general_ledger"
/>
@@ -25,15 +25,15 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_confirm_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Confirm Draft Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
<!-- <record model="ir.values" id="action_account_invoice_confirm_values">-->
<!-- <field name="model_id" ref="account.model_account_invoice" />-->
<!-- <field name="object" eval="1" />-->
<!-- <field name="name">Confirm Draft Invoices</field>-->
<!-- <field name="key2">client_action_multi</field>-->
<!-- <field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_confirm'))" />-->
<!-- <field name="key">action</field>-->
<!-- <field name="model">account.invoice</field>-->
<!-- </record>-->
<record id="account_invoice_cancel_view" model="ir.ui.view">
<field name="name">account.invoice.cancel.form</field>
@@ -59,15 +59,15 @@
<field name="target">new</field>
</record>
<record model="ir.values" id="action_account_invoice_cancel_values">
<field name="model_id" ref="account.model_account_invoice" />
<field name="object" eval="1" />
<field name="name">Cancel Selected Invoices</field>
<field name="key2">client_action_multi</field>
<field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />
<field name="key">action</field>
<field name="model">account.invoice</field>
</record>
<!-- <record model="ir.values" id="action_account_invoice_cancel_values">-->
<!-- <field name="model_id" ref="account.model_account_invoice" />-->
<!-- <field name="object" eval="1" />-->
<!-- <field name="name">Cancel Selected Invoices</field>-->
<!-- <field name="key2">client_action_multi</field>-->
<!-- <field name="value" eval="'ir.actions.act_window,' +str(ref('action_account_invoice_cancel'))" />-->
<!-- <field name="key">action</field>-->
<!-- <field name="model">account.invoice</field>-->
<!-- </record>-->
</data>
</openerp>
@@ -46,6 +46,11 @@ class account_period_close(osv.osv_memory):
for id in context['active_ids']:
cr.execute('update account_journal_period set state=%s where period_id=%s', (mode, id))
cr.execute('update account_period set state=%s where id=%s', (mode, id))
# Log message for Period
period_pool = self.pool.get('account.period')
for period_id, name in period_pool.name_get(cr, uid, [id]):
period_pool.log(cr, uid, period_id, "Period '%s' is closed, no more modification allowed for this period." % (name))
return {}
account_period_close()
@@ -76,11 +76,6 @@
<field name="target">new</field>
</record>
<menuitem
parent="account.menu_finance_legal_statement"
id="final_accounting_reports"
name="Accounting Reports"/>
<menuitem icon="STOCK_PRINT"
name="Profit And Loss"
action="action_pl_balance_account_report"
@@ -61,7 +61,7 @@
<menuitem
name="Journals"
parent="account.menu_generic_report"
parent="account.menu_journals_report"
action="action_account_print_journal"
id="menu_account_print_journal"
icon="STOCK_PRINT"/>
@@ -10,7 +10,8 @@
<form string="Create Entries From Models">
<group height="240" width="510">
<separator string="This wizard will create recurring accounting entries" colspan="4"/>
<field name="model"/>
<label string="Select recurring to create a manualy recurring accounting entries" width="400"/>
<field name="model" colspan="4" nolabel="1"/>
<separator colspan="4"/>
<group colspan="4" col="2">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
+1
View File
@@ -20,6 +20,7 @@
##############################################################################
import account_coda_import
import coda_import
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+347
View File
@@ -0,0 +1,347 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import pooler
import time
import datetime
import wizard
import netsvc
import base64
from osv import osv
from tools.translate import _
codawiz_form = """<?xml version="1.0"?>
<form string="Import Coda Statement">
<separator colspan="4" string="Select your bank journal :" />
<field name="journal_id" colspan="1" domain="[('type','=','cash')]" />
<newline />
<field name="def_payable" /> <field name="def_receivable" />
<newline />
<field name="awaiting_account" />
<separator string="Clic on 'New' to select your file :" colspan="4"/>
<field name="coda"/>
</form>
"""
codawiz_fields = {
'journal_id' : {
'string':'Bank Journal',
'type':'many2one',
'relation':'account.journal',
'required':True,
},
'coda' : {
'string':'Coda File',
'type':'binary',
'required':True,
},
'def_payable' : {
'string' : 'Default Payable Account',
'type' : 'many2one',
'relation': 'account.account',
'required':True,
'domain':[('type','=','payable')],
'help': 'Set here the payable account that will be used, by default, if the partner is not found',
},
'def_receivable' : {
'string' : 'Default receivable Account',
'type' : 'many2one',
'relation': 'account.account',
'required':True,
'domain':[('type','=','receivable')],
'help': 'Set here the receivable account that will be used, by default, if the partner is not found',
},
'awaiting_account' : {
'string' : 'Default Account for Unrecognized Movement',
'type' : 'many2one',
'relation': 'account.account',
'required':True,
'help': 'Set here the default account that will be used, if the partner is found but does not have the bank account , or if he is domiciled',
}
}
result_form = """<?xml version="1.0"?>
<form string="Import Coda Statement">
<separator colspan="4" string="Results :" />
<field name="note" colspan="4" nolabel="1" width="500"/>
</form>
"""
result_fields = {
'note' : {'string':'Log','type':'text'}
}
def _coda_parsing(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
codafile = data['form']['coda']
journal_code = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context).code
def_pay_acc = data['form']['def_payable']
def_rec_acc = data['form']['def_receivable']
str_log = ""
err_log = "Errors:\n------\n"
nb_err=0
std_log=''
str_log1 = "Coda File is Imported : "
str_not=''
str_not1=''
bank_statements=[]
recordlist = base64.decodestring(codafile).split('\n')
recordlist.pop()
for line in recordlist:
if line[0] == '0':
# header data
bank_statement = {}
bank_statement["bank_statement_line"]={}
bank_statement_lines = {}
bank_statement['date'] = str2date(line[5:11])
bank_statement['journal_id']=data['form']['journal_id']
period_id = pool.get('account.period').search(cr,uid,[('date_start','<=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d"))),('date_stop','>=',time.strftime('%Y-%m-%d',time.strptime(bank_statement['date'],"%y/%m/%d")))])
bank_statement['period_id'] = period_id[0]
bank_statement['state']='draft'
elif line[0] == '1':
# old balance data
bal_start = list2float(line[43:58])
if line[42] == '1':
bal_start = - bal_start
bank_statement["balance_start"]= bal_start
bank_statement["acc_number"]=line[5:17]
bank_statement["acc_holder"]=line[64:90]
bank_statement['name'] = journal_code + ' ' + str(line[2:5])
elif line[0]=='2':
# movement data record 2
if line[1]=='1':
# movement data record 2.1
if bank_statement_lines.has_key(line[2:6]):
continue
st_line = {}
st_line['extra_note'] = ''
st_line['statement_id']=0
st_line['ref'] = line[2:10]
st_line['date'] = time.strftime('%Y-%m-%d',time.strptime(str2date(line[115:121]),"%y/%m/%d")),
st_line_amt = list2float(line[32:47])
if line[61]=='1':
st_line['toreconcile'] = True
st_line['name']=line[65:77]
else:
st_line['toreconcile'] = False
st_line['name']=line[62:115]
st_line['free_comm'] = st_line['name']
st_line['val_date']=time.strftime('%Y-%m-%d',time.strptime(str2date(line[47:53]),"%y/%m/%d")),
st_line['entry_date']=time.strftime('%Y-%m-%d',time.strptime(str2date(line[115:121]),"%y/%m/%d")),
st_line['partner_id']=0
if line[31] == '1':
st_line_amt = - st_line_amt
st_line['account_id'] = def_pay_acc
else:
st_line['account_id'] = def_rec_acc
st_line['amount'] = st_line_amt
bank_statement_lines[line[2:6]]=st_line
bank_statement["bank_statement_line"]=bank_statement_lines
elif line[1] == '2':
st_line_name = line[2:6]
bank_statement_lines[st_line_name].update({'account_id': data['form']['awaiting_account']})
elif line[1] == '3':
# movement data record 3.1
st_line_name = line[2:6]
st_line_partner_acc = str(line[10:47]).strip()
cntry_number=line[10:47].strip()
contry_name=line[47:125].strip()
bank_ids = pool.get('res.partner.bank').search(cr,uid,[('acc_number','=',st_line_partner_acc)])
bank_statement_lines[st_line_name].update({'cntry_number': cntry_number, 'contry_name': contry_name})
if bank_ids:
bank = pool.get('res.partner.bank').browse(cr,uid,bank_ids[0],context)
if line and bank.partner_id:
bank_statement_lines[st_line_name].update({'partner_id': bank.partner_id.id})
if bank_statement_lines[st_line_name]['amount'] < 0 :
bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_payable.id})
else :
bank_statement_lines[st_line_name].update({'account_id': bank.partner_id.property_account_receivable.id})
else:
nb_err += 1
err_log += _('The bank account %s is not defined for the partner %s.\n')%(cntry_number,contry_name)
bank_statement_lines[st_line_name].update({'account_id': data['form']['awaiting_account']})
bank_statement["bank_statement_line"]=bank_statement_lines
elif line[0]=='3':
if line[1] == '1':
st_line_name = line[2:6]
bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[40:113]
elif line[1] == '2':
st_line_name = line[2:6]
bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[10:115]
elif line[1] == '3':
st_line_name = line[2:6]
bank_statement_lines[st_line_name]['extra_note'] += '\n' + line[10:100]
elif line[0]=='8':
# new balance record
bal_end = list2float(line[42:57])
if line[41] == '1':
bal_end = - bal_end
bank_statement["balance_end_real"]= bal_end
elif line[0]=='9':
# footer record
bank_statements.append(bank_statement)
#end for
bkst_list=[]
for statement in bank_statements:
try:
bk_st_id = pool.get('account.bank.statement').create(cr,uid,{
'journal_id': statement['journal_id'],
'date':time.strftime('%Y-%m-%d',time.strptime(statement['date'],"%y/%m/%d")),
'period_id':statement['period_id'],
'balance_start': statement["balance_start"],
'balance_end_real': statement["balance_end_real"],
'state': 'draft',
'name': statement['name'],
})
lines=statement["bank_statement_line"]
for value in lines:
line=lines[value]
reconcile_id = False
if line['toreconcile']:
name = line['name'][:3] + '/' + line['name'][3:7] + '/' + line['name'][7:]
rec_id = pool.get('account.move.line').search(cr, uid, [('name','=', name),('reconcile_id','=',False),('account_id.reconcile','=',True)])
if rec_id:
reconcile_id = pool.get('account.bank.statement.reconcile').create(cr, uid, {
'line_ids': [(6, 0, rec_id)]
}, context=context)
mv = pool.get('account.move.line').browse(cr, uid, rec_id[0], context=context)
if mv.partner_id:
line['partner_id'] = mv.partner_id.id
if line['amount'] < 0 :
line['account_id'] = mv.partner_id.property_account_payable.id
else :
line['account_id'] = mv.partner_id.property_account_receivable.id
str_not1 = ''
if line.has_key('contry_name') and line.has_key('cntry_number'):
str_not1="Partner name:%s \n Partner Account Number:%s \n Communication:%s \n Value Date:%s \n Entry Date:%s \n"%(line["contry_name"],line["cntry_number"],line["free_comm"]+line['extra_note'],line["val_date"][0],line["entry_date"][0])
id=pool.get('account.bank.statement.line').create(cr,uid,{
'name':line['name'],
'date': line['date'],
'type':line['amount']>0 and 'customer' or 'supplier',
'amount': line['amount'],
'partner_id':line['partner_id'] or 0,
'account_id':line['account_id'],
'statement_id': bk_st_id,
'reconcile_id': reconcile_id,
'note':str_not1,
'ref':line['ref'],
})
str_not= "\n \n Account Number: %s \n Account Holder Name: %s " %(statement["acc_number"],statement["acc_holder"])
std_log += "\nStatement : %s , Date : %s, Starting Balance : %.2f , Ending Balance : %.2f \n"\
%(statement['name'], statement['date'], float(statement["balance_start"]), float(statement["balance_end_real"]))
bkst_list.append(bk_st_id)
except osv.except_osv, e:
cr.rollback()
nb_err+=1
err_log += '\n Application Error : ' + str(e)
raise # REMOVEME
except Exception, e:
cr.rollback()
nb_err+=1
err_log += '\n System Error : '+str(e)
raise # REMOVEME
except :
cr.rollback()
nb_err+=1
err_log += '\n Unknown Error'
raise
err_log += '\n\nNumber of statements : '+ str(len(bkst_list))
err_log += '\nNumber of error :'+ str(nb_err) +'\n'
pool.get('account.coda').create(cr, uid,{
'name':codafile,
'statement_ids': [(6, 0, bkst_list,)],
'note':str_log1+str_not+std_log+err_log,
'journal_id':data['form']['journal_id'],
'date':time.strftime("%Y-%m-%d"),
'user_id':uid,
})
return {'note':str_log1 + std_log + err_log ,'journal_id': data['form']['journal_id'], 'coda': data['form']['coda'],'statment_ids':bkst_list}
def str2date(date_str):
return time.strftime("%y/%m/%d",time.strptime(date_str,"%d%m%y"))
def str2float(str):
try:
return float(str)
except:
return 0.0
def list2float(lst):
try:
return str2float((lambda s : s[:-3] + '.' + s[-3:])(lst))
except:
return 0.0
class coda_import(wizard.interface):
def _action_open_window(self, cr, uid, data, context):
form=data['form']
return {
'domain':"[('id','in',%s)]"%(form['statment_ids']),
'name': 'Statement',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.bank.statement',
'view_id': False,
'type': 'ir.actions.act_window',
}
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form',
'arch' : codawiz_form,
'fields' : codawiz_fields,
'state' : [('end', '_Close'),('extraction', '_Ok') ]}
},
'extraction' : {
'actions' : [_coda_parsing],
'result' : {'type' : 'form',
'arch' : result_form,
'fields' : result_fields,
'state' : [('end', '_Close'),('open', '_Open Statement')]}
},
'open': {
'actions': [],
'result': {'type': 'action', 'action': _action_open_window, 'state': 'end'}
},
}
coda_import("account.coda_import")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+2 -1
View File
@@ -22,6 +22,7 @@
import time
from osv import fields
from osv import osv
from tools.translate import _
journal2type = {
'cash':'rec_voucher',
@@ -367,7 +368,7 @@ class account_voucher(osv.osv):
'move_ids':[(6, 0,line_ids)]
}
message = _('Voucher ') + " '" + inv.name + "' "+ _("is confirm")
message = _('Voucher ') + " '" + inv.name + "' "+ _("is confirmed")
self.log(cr, uid, inv.id, message)
self.write(cr, uid, [inv.id], rec)
+15 -3
View File
@@ -139,12 +139,24 @@
</field>
</record>
<record id="account_cash_statement_graph" model="ir.ui.view">
<field name="name">account.voucher.graph</field>
<field name="model">account.voucher</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Voucher Statistics" type="bar">
<field name="date"/>
<field name="amount" operator="+"/>
</graph>
</field>
</record>
<!-- Receipt Vouchers -->
<record model="ir.actions.act_window" id="action_receipt_vou_voucher_list">
<field name="name">Receivable Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('journal_id.type','=','sale')]</field>
<field name="context">{'type':'sale'}</field>
@@ -158,7 +170,7 @@
<field name="name">Payable Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="domain">[('journal_id.type','=','purchase')]</field>
<field name="context">{'type':'purchase'}</field>
@@ -172,7 +184,7 @@
<field name="name">Journal Vouchers</field>
<field name="res_model">account.voucher</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_mode">tree,form,graph</field>
<field name="context">{'type':'general'}</field>
<field name="view_id" eval="view_voucher_tree"/>
<field name="search_view_id" ref="view_voucher_filter"/>
+266
View File
@@ -0,0 +1,266 @@
# Estonian translation for openobject-addons
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2010-06-18 10:59+0000\n"
"PO-Revision-Date: 2010-07-22 20:10+0000\n"
"Last-Translator: lyyser <logard.1961@gmail.com>\n"
"Language-Team: Estonian <et@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-23 04:08+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: analytic
#: field:account.analytic.account,child_ids:0
msgid "Child Accounts"
msgstr "Alamkontod"
#. module: analytic
#: help:account.analytic.line,amount_currency:0
msgid ""
"The amount expressed in the related account currency if not equal to the "
"company one."
msgstr ""
#. module: analytic
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
"Objekti nimi peab algama x_'ga ja ei tohi sisaldada ühtegi erisümbolit !"
#. module: analytic
#: field:account.analytic.account,name:0
msgid "Account Name"
msgstr "Konto nimi"
#. module: analytic
#: help:account.analytic.line,unit_amount:0
msgid "Specifies the amount of quantity to count."
msgstr ""
#. module: analytic
#: help:account.analytic.line,currency_id:0
msgid "The related account currency if not equal to the company one."
msgstr ""
#. module: analytic
#: model:ir.module.module,description:analytic.module_meta_information
msgid ""
"Module for defining analytic accounting object.\n"
" "
msgstr ""
#. module: analytic
#: field:account.analytic.account,state:0
msgid "State"
msgstr "Riik/Osariik"
#. module: analytic
#: field:account.analytic.account,user_id:0
msgid "Account Manager"
msgstr "Konto haldur"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Draft"
msgstr "Mustand"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Closed"
msgstr "Suletud"
#. module: analytic
#: field:account.analytic.account,debit:0
msgid "Debit"
msgstr "Deebet"
#. module: analytic
#: help:account.analytic.account,state:0
msgid ""
"* When an account is created its in 'Draft' state. "
" \n"
"* If any associated partner is there, it can be in 'Open' state. "
" \n"
"* If any pending balance is there it can be in 'Pending'. "
" \n"
"* And finally when all the transactions are over, it can be in 'Close' "
"state. \n"
"* The project can be in either if the states 'Template' and 'Running'.\n"
" If it is template then we can make projects based on the template projects. "
"If its in 'Running' state it is a normal project. "
" \n"
" If it is to be reviewed then the state is 'Pending'.\n"
" When the project is completed the state is set to 'Done'."
msgstr ""
#. module: analytic
#: field:account.analytic.account,type:0
msgid "Account Type"
msgstr "Konto tüüp"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Template"
msgstr "Mall"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Pending"
msgstr "Ootel"
#. module: analytic
#: model:ir.model,name:analytic.model_account_analytic_line
msgid "Analytic Line"
msgstr ""
#. module: analytic
#: field:account.analytic.account,description:0
#: field:account.analytic.line,name:0
msgid "Description"
msgstr "Kirjeldus"
#. module: analytic
#: help:account.analytic.line,amount:0
msgid ""
"Calculated by multiplying the quantity and the price given in the Product's "
"cost price."
msgstr ""
#. module: analytic
#: field:account.analytic.account,company_id:0
#: field:account.analytic.line,company_id:0
msgid "Company"
msgstr "Ettevõte"
#. module: analytic
#: field:account.analytic.account,quantity_max:0
msgid "Maximum Quantity"
msgstr ""
#. module: analytic
#: field:account.analytic.line,user_id:0
msgid "User"
msgstr "Kasutaja"
#. module: analytic
#: field:account.analytic.account,parent_id:0
msgid "Parent Analytic Account"
msgstr "Ülem analüütiline konto"
#. module: analytic
#: field:account.analytic.line,date:0
msgid "Date"
msgstr "Kuupäev"
#. module: analytic
#: field:account.analytic.account,currency_id:0
#: field:account.analytic.line,currency_id:0
msgid "Account currency"
msgstr ""
#. module: analytic
#: selection:account.analytic.account,type:0
msgid "View"
msgstr "Vaade"
#. module: analytic
#: help:account.analytic.account,quantity_max:0
msgid "Sets the higher limit of quantity of hours."
msgstr ""
#. module: analytic
#: field:account.analytic.account,credit:0
msgid "Credit"
msgstr "Krediit"
#. module: analytic
#: field:account.analytic.line,amount:0
msgid "Amount"
msgstr "Kogus"
#. module: analytic
#: field:account.analytic.account,contact_id:0
msgid "Contact"
msgstr "Kontakt"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Cancelled"
msgstr "Katkestatud"
#. module: analytic
#: field:account.analytic.account,balance:0
msgid "Balance"
msgstr "Balanss"
#. module: analytic
#: field:account.analytic.account,date_start:0
msgid "Date Start"
msgstr "Alguskuupäev"
#. module: analytic
#: field:account.analytic.account,quantity:0
#: field:account.analytic.line,unit_amount:0
msgid "Quantity"
msgstr "Kvantiteet"
#. module: analytic
#: field:account.analytic.account,date:0
msgid "Date End"
msgstr "Lõppkuupäev"
#. module: analytic
#: field:account.analytic.account,code:0
msgid "Account Code"
msgstr "Konto kood"
#. module: analytic
#: selection:account.analytic.account,type:0
msgid "Normal"
msgstr "Normaalne"
#. module: analytic
#: field:account.analytic.account,complete_name:0
msgid "Full Account Name"
msgstr "Täielik konto nimi"
#. module: analytic
#: field:account.analytic.line,account_id:0
#: model:ir.model,name:analytic.model_account_analytic_account
#: model:ir.module.module,shortdesc:analytic.module_meta_information
msgid "Analytic Account"
msgstr "Analüütiline konto"
#. module: analytic
#: field:account.analytic.account,company_currency_id:0
msgid "Currency"
msgstr "Rahaühik"
#. module: analytic
#: field:account.analytic.line,amount_currency:0
msgid "Amount currency"
msgstr ""
#. module: analytic
#: field:account.analytic.account,partner_id:0
msgid "Associated Partner"
msgstr "Seotud partner"
#. module: analytic
#: selection:account.analytic.account,state:0
msgid "Open"
msgstr "Ava"
#. module: analytic
#: field:account.analytic.account,line_ids:0
msgid "Analytic Entries"
msgstr "Analüütilised kirjed"
-1
View File
@@ -1147,7 +1147,6 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\
'active': fields.boolean('Active', help="If the active field is set to \
true, it will allow you to hide the event alarm information without removing it.")
}
_defaults = {
'state': 'tentative',
'class': 'public',
+3 -1
View File
@@ -43,7 +43,9 @@
'init_xml': ['base_setup_data.xml'],
'update_xml': ['security/ir.model.access.csv',
'base_setup_installer.xml',
'base_setup_todo.xml','gtk_contact_form.xml'],
'base_setup_todo.xml',
# 'gtk_contact_form.xml'
],
'demo_xml': ['base_setup_demo.xml'],
'installable': True,
'active': True,
+1 -1
View File
@@ -88,7 +88,7 @@ class base_setup_company(osv.osv_memory):
'city':fields.char('City', size=128),
'state_id':fields.selection(_get_all_states, 'State'),
'country_id':fields.selection(_get_all_countries, 'Country'),
'email':fields.char('E-mail', size=64, required=True),
'email':fields.char('E-mail', size=64),
'phone':fields.char('Phone', size=64),
'currency':fields.many2one('res.currency', 'Currency', required=True),
'rml_header1':fields.char('Report Header', size=200,
+7
View File
@@ -301,6 +301,13 @@ class crm_case(object):
self.write(cr, uid, ids, {'state': 'cancel',
'active': True})
self._action(cr, uid, cases, 'cancel')
for case in cases:
message = "The " + self._description + " '" + case.name + "' has been Cancelled."
#TODO: Need to differentiate lead and opportunity
# if hasattr(case, 'type'):
# #TO CHECK: hasattr gives warning for other crm objects that don't have field 'type'
# message = "The " + (case.type or 'Case').title() + " '" + case.name + "' has been Cancelled."
self.log(cr, uid, case.id, message)
return True
def case_pending(self, cr, uid, ids, *args):
+1 -1
View File
@@ -41,7 +41,7 @@
<group colspan="2" col="2">
<separator string="Plugins" colspan="4" />
<field name="thunderbird" />
<label string="*Outlook*" />
<!-- <label string="*Outlook*" />-->
<!-- TODO <field name="outlook" />-->
</group>
</group>
+3 -3
View File
@@ -198,8 +198,8 @@ class crm_lead(osv.osv, crm_case):
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
type = self.browse(cr, uid, id).type
message = (_('The ') + type.title() or 'Lead') + " '" + name + "' "+ _("has been written as Open.")
type = self.browse(cr, uid, id).type or 'Lead'
message = (_('The ') + type.title()) + " '" + name + "' "+ _("has been Opened.")
self.log(cr, uid, id, message)
return res
@@ -216,7 +216,7 @@ class crm_lead(osv.osv, crm_case):
for (id, name) in self.name_get(cr, uid, ids):
lead = self.browse(cr, uid, id)
if lead.type == 'lead':
message = _('The Lead') + " '" + name + "' "+ _("has been written as Closed.")
message = _('The Lead') + " '" + name + "' "+ _("has been Closed.")
self.log(cr, uid, id, message)
return res
+15 -1
View File
@@ -122,7 +122,21 @@ class crm_meeting(osv.osv, crm_case):
}
return value
def case_open(self, cr, uid, ids, *args):
"""Confirms meeting
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of Meeting Ids
@param *args: Tuple Value for additional Params
"""
res = super(crm_meeting, self).case_open(cr, uid, ids, args)
for (id, name) in self.name_get(cr, uid, ids):
message = _('The Meeting') + " '" + name + "' "+ _("has been Confirmed.")
self.log(cr, uid, id, message)
return res
crm_meeting()
class calendar_attendee(osv.osv):
+5 -5
View File
@@ -36,8 +36,6 @@ AVAILABLE_STATES = [
class crm_opportunity(osv.osv):
""" Opportunity Cases """
_name = "crm.lead"
_description = "Opportunity"
_order = "priority,date_action,id desc"
_inherit = 'crm.lead'
_columns = {
@@ -72,8 +70,10 @@ class crm_opportunity(osv.osv):
self.write(cr, uid, ids, value)
for (id, name) in self.name_get(cr, uid, ids):
message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Won.")
self.log(cr, uid, id, message)
opp = self.browse(cr, uid, id)
if opp.type == 'opportunity':
message = _('The Opportunity') + " '" + name + "' "+ _("has been Won.")
self.log(cr, uid, id, message)
return res
def case_mark_lost(self, cr, uid, ids, *args):
@@ -95,7 +95,7 @@ class crm_opportunity(osv.osv):
for (id, name) in self.name_get(cr, uid, ids):
opp = self.browse(cr, uid, id)
if opp.type == 'opportunity':
message = _('The Opportunity') + " '" + name + "' "+ _("has been written as Lost.")
message = _('The Opportunity') + " '" + name + "' "+ _("has been Lost.")
self.log(cr, uid, id, message)
return res
+3 -1
View File
@@ -233,7 +233,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"Partner: %s" % (lead.partner_id and lead.partner_id.name_get()[0][1]),
"Contact: %s" % (pa.name or ''),
"Title: %s" % (pa.title or ''),
"Function: %s" % (pa.function and pa.function.name_get()[0][1] or ''),
"Function: %s" % (pa.function or ''),
"Street: %s" % (pa.street or ''),
"Street2: %s" % (pa.street2 or ''),
"Zip: %s" % (pa.zip or ''),
@@ -244,6 +244,8 @@ class crm_lead_forward_to_partner(osv.osv_memory):
"Phone: %s" % (pa.phone or ''),
"Fax: %s" % (pa.fax or ''),
"Mobile: %s" % (pa.mobile or ''),
"Lead Category: %s" % (lead.categ_id and lead.categ_id.name or ''),
"Details: %s" % (lead.description or ''),
]
return "\n".join(body + ['---'])
+1 -1
View File
@@ -28,7 +28,7 @@ class crm_claim(osv.osv, crm.crm_case):
Crm claim
"""
_name = "crm.claim"
_description = "Claim Cases"
_description = "Claim"
_order = "id desc"
_inherit = ['mailgate.thread']
_columns = {
+1 -1
View File
@@ -26,7 +26,7 @@ class crm_fundraising(osv.osv, crm.crm_case):
""" Fund Raising Cases """
_name = "crm.fundraising"
_description = "Fund Raising Cases"
_description = "Fund Raising"
_order = "id desc"
_inherit = ['mailgate.thread']
_columns = {
+1 -1
View File
@@ -27,7 +27,7 @@ class crm_helpdesk(osv.osv, crm.crm_case):
""" Helpdesk Cases """
_name = "crm.helpdesk"
_description = "Helpdesk Cases"
_description = "Helpdesk"
_order = "id desc"
_inherit = ['mailgate.thread']
_columns = {
+1 -1
View File
@@ -85,7 +85,7 @@
<field name="inherit_id" ref="base.view_users_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Departements Informations" groups="base.group_extended">
<page string="Departments" groups="base.group_extended">
<field name="context_department_id" completion="1" widget="selection" string="Department"/>
<separator string="Managers" colspan="4"/>
<field name="parent_id" nolabel="1" colspan="4"/>
+2 -2
View File
@@ -46,9 +46,9 @@ class hr_installer(osv.osv_memory):
"performance review of employees."),
'hr_attendance': fields.boolean('Attendances (Sign In/Out)',
help="Simplifies the management of employee attendances."),
'hr_payroll': fields.boolean('Payroll' ,
'hr_payroll': fields.boolean('Payroll',
help="Generic Payroll system"),
'hr_payroll_account': fields.boolean('Payroll with Accounting',
'hr_payroll_account': fields.boolean('Payroll',
help="Generic Payroll system Integrated with Accountings."),
}
_defaults = {
+5 -4
View File
@@ -8,13 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-25 12:18+0000\n"
"PO-Revision-Date: 2010-06-29 22:34+0000\n"
"Last-Translator: Borja López Soilán (Pexego) <borjals@pexego.es>\n"
"PO-Revision-Date: 2010-07-23 19:03+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-01 03:45+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_evaluation
@@ -84,7 +85,7 @@ msgstr "Datos informales"
#. module: hr_evaluation
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Nombre de modelo inválido en la definición de acción."
msgstr "Nombre de modelo no válido en la definición de la acción."
#. module: hr_evaluation
#: field:hr_evaluation.evaluation,employee_id:0
+1 -2
View File
@@ -1,4 +1,3 @@
#!/usr/bin/env python
#-*- coding:utf-8 -*-
##############################################################################
#
@@ -25,4 +24,4 @@ import hr_payroll
import report
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+3 -5
View File
@@ -53,13 +53,11 @@
'wizard/hr_payroll_create_analytic.xml',
'wizard/hr_payroll_employees_detail.xml',
'wizard/hr_payroll_year_salary.xml',
],
'test': [
'test/payslip.yml',
'test/payment_advice.yml',
'test/payroll_register.yml',
'test/payslip.yml',
'test/payment_advice.yml',
'test/payroll_register.yml',
],
'demo_xml': [
'hr_payroll_demo.xml'
-21
View File
@@ -1145,27 +1145,6 @@ class hr_payslip_line(osv.osv):
_name = 'hr.payslip.line'
_description = 'Payslip Line'
# def _calculate(self, cr, uid, ids, field_names, arg, context):
# res = {}
# obj = {}
# for line in self.browse(cr, uid, ids, context):
# obj['basic'] = line.slip_id.basic
# amount = 0.0
#
# if line.amount_type == 'per' and line.base:
# print 'XXXXXXXXXXXXXXXX : ', obj
# amount = line.amount * eval(line.base, obj)
# elif line.amount_type in ('fix', 'func'):
# amount = line.amount
# cd = line.category_id.code.lower()
# obj[cd] = amount
# print 'XXXXXXXXXXXXXXXXXX : ', cd
#
# res[line.id] = amount
# print 'XXXXXXXXXXXX : ', obj
# return res
def onchange_category(self, cr, uid, ids, category_id):
seq = 0
res = {
-11
View File
@@ -25,16 +25,5 @@
parent="menu_hr_payroll_reporting"
name="Employee Salary Statement"
type="wizard"/>
<!-- <wizard id="wizard_payroll_analysis"-->
<!-- menu="False" -->
<!-- model="account.analytic.account" -->
<!-- name="payroll.analysis" -->
<!-- string="Create Analytic Structure"/>-->
<!-- <menuitem id="menu_wizard_payroll_analysis" -->
<!-- action="wizard_payroll_analysis" -->
<!-- parent="payroll_configure" -->
<!-- name="Create Analytic Structure"-->
<!-- type="wizard"/>-->
</data>
</openerp>
+112 -17
View File
@@ -7,13 +7,14 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0_rc3\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-17 07:12+0000\n"
"Last-Translator: Raimon Esteve (Zikzakmedia) <resteve@zikzakmedia.com>\n"
"PO-Revision-Date: 2010-07-24 10:06+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:09+0000\n"
"X-Launchpad-Export-Date: 2010-07-25 04:07+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet
@@ -112,7 +113,7 @@ msgstr "Producte"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "août"
msgstr ""
msgstr "Agost"
#. module: hr_timesheet
#: field:hr.employee,journal_id:0
@@ -157,11 +158,9 @@ msgstr "Temps total"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "juillet"
msgstr ""
msgstr "Juliol"
#. module: hr_timesheet
#: xsl:hr.analytical.timesheet:0
#: xsl:hr.analytical.timesheet_users:0
#: model:ir.ui.menu,name:hr_timesheet.next_id_48
msgid "Timesheet"
msgstr "Full d'assistència"
@@ -171,14 +170,14 @@ msgstr "Full d'assistència"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "janvier"
msgstr ""
msgstr "Gener"
#. module: hr_timesheet
#: selection:hr.analytical.timesheet,init,month:0
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "juin"
msgstr ""
msgstr "Juny"
#. module: hr_timesheet
#: model:ir.actions.wizard,name:hr_timesheet.wizard_hr_timesheet_my
@@ -233,7 +232,7 @@ msgstr "XML invàlid per a la definició de la vista!"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "avril"
msgstr ""
msgstr "Abril"
#. module: hr_timesheet
#: field:hr.analytic.timesheet,line_id:0
@@ -255,7 +254,7 @@ msgstr "Selecciona usuaris"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "novembre"
msgstr ""
msgstr "Novembre"
#. module: hr_timesheet
#: wizard_view:hr_timesheet.si_so,sign_out:0
@@ -283,7 +282,7 @@ msgstr "Estat actual"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "octobre"
msgstr ""
msgstr "Octubre"
#. module: hr_timesheet
#: view:account.analytic.account:0
@@ -295,7 +294,7 @@ msgstr "Estadístiques d'anàlisis"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "décembre"
msgstr ""
msgstr "Desembre"
#. module: hr_timesheet
#: wizard_field:hr_timesheet.si_so,sign_in,info:0
@@ -345,7 +344,7 @@ msgstr "Recursos humans (codificació d'horaris)"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "mars"
msgstr ""
msgstr "Març"
#. module: hr_timesheet
#: xsl:hr.analytical.timesheet:0
@@ -358,7 +357,7 @@ msgstr "Total"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "mai"
msgstr ""
msgstr "Maig"
#. module: hr_timesheet
#: wizard_button:hr_timesheet.si_so,sign_out,si_result:0
@@ -375,7 +374,7 @@ msgstr "Canvia treball"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "février"
msgstr ""
msgstr "Febrer"
#. module: hr_timesheet
#: view:account.analytic.account:0
@@ -469,9 +468,105 @@ msgstr "Horari d'empleats"
#: selection:hr.analytical.timesheet.my,init,month:0
#: selection:hr.analytical.timesheet_users,init,month:0
msgid "septembre"
msgstr ""
msgstr "Setembre"
#. module: hr_timesheet
#: view:hr.employee:0
msgid "Timesheets"
msgstr "Horaris"
#, python-format
#~ msgid "Wed"
#~ msgstr "Dc"
#, python-format
#~ msgid "No employee defined for your user !"
#~ msgstr "No s'ha definit un empleat pel vostre usuari!"
#, python-format
#~ msgid "Mon"
#~ msgstr "Dl"
#, python-format
#~ msgid "UserError"
#~ msgstr "Error d'usuari"
#, python-format
#~ msgid "No cost unit defined for this employee !"
#~ msgstr "No s'ha definit una unitat de cost per aquest empleat!"
#, python-format
#~ msgid "ValidateError"
#~ msgstr "Error de validació"
#, python-format
#~ msgid "Sat"
#~ msgstr "Ds"
#, python-format
#~ msgid "Sun"
#~ msgstr "Dg"
#, python-format
#~ msgid "July"
#~ msgstr "Juliol"
#, python-format
#~ msgid "Tue"
#~ msgstr "Dt"
#, python-format
#~ msgid "March"
#~ msgstr "Març"
#, python-format
#~ msgid "September"
#~ msgstr "Setembre"
#, python-format
#~ msgid "December"
#~ msgstr "Desembre"
#, python-format
#~ msgid "Fri"
#~ msgstr "Dv"
#, python-format
#~ msgid "August"
#~ msgstr "Agost"
#, python-format
#~ msgid "June"
#~ msgstr "Juny"
#, python-format
#~ msgid "November"
#~ msgstr "Novembre"
#, python-format
#~ msgid "October"
#~ msgstr "Octubre"
#, python-format
#~ msgid "January"
#~ msgstr "Gener"
#, python-format
#~ msgid "May"
#~ msgstr "Maig"
#, python-format
#~ msgid "February"
#~ msgstr "Febrer"
#, python-format
#~ msgid "Thu"
#~ msgstr "Dj"
#, python-format
#~ msgid "April"
#~ msgstr "Abril"
#, python-format
#~ msgid "UnknownError"
#~ msgstr "Error desconegut"
@@ -2,8 +2,6 @@
<openerp>
<data>
<act_window domain="[('state','&lt;&gt;','close'),('partner_id','&lt;&gt;',False),('to_invoice', '&lt;&gt;', False)]" id="act_my_account" name="Accounts to invoice" res_model="account.analytic.account" src_model="res.users" view_mode="tree,form" view_type="form"/>
<record id="action_account_analytic_line_to_invoice" model="ir.actions.act_window">
@@ -16,26 +14,26 @@
<record id="board_hr_timesheet_invoice_form" model="ir.ui.view">
<field name="name">board.hr.timesheet.invoice</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child1/action[@string='Draft Customer Invoices']" position="before">
<action colspan="4" height="160" name="%(hr_timesheet_invoice.action_analytic_account_tree)d" string="Analytic accounts to close" width="510"/>
<action colspan="4" height="160" name="%(act_my_account)d" string="Accounts to invoice" width="510"/>
</xpath>
<xpath expr="/form/hpaned/child1/action[@string='Draft Customer Invoices']" position="before">
<action colspan="4" height="160" name="%(hr_timesheet_invoice.action_analytic_account_tree)d" string="Analytic accounts to close" width="510"/>
<action colspan="4" height="160" name="%(act_my_account)d" string="Accounts to invoice" width="510"/>
</xpath>
</field>
</record>
<!-- Need to merge in above view -->
<record id="board_hr_timesheet_invoice_report_form1" model="ir.ui.view">
<!-- Need to merge in above view -->
<record id="board_hr_timesheet_invoice_report_form1" model="ir.ui.view">
<field name="name">board.hr.timesheet.invoice</field>
<field name="model">board.board</field>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="type">form</field>
<field name="inherit_id" ref="account.board_account_form"/>
<field name="arch" type="xml">
<xpath expr="/form/hpaned/child2/action[@string='Aged receivables']" position="before">
<action colspan="4" height="220" name="%(action_account_analytic_line_to_invoice)d" string="Costs to invoice"/>
</xpath>
<xpath expr="/form/hpaned/child2/action[@string='Aged receivables']" position="before">
<action colspan="4" height="220" name="%(action_account_analytic_line_to_invoice)d" string="Costs to invoice"/>
</xpath>
</field>
</record>
</data>
@@ -84,7 +84,6 @@
</record>
<!-- Inherits for account analytic lines -->
<record id="view_account_analytic_line_tree_inherit" model="ir.ui.view">
<field name="name">account.analytic.line.tree.to_invoice</field>
<field name="model">account.analytic.line</field>
@@ -110,6 +109,11 @@
</record>
<!-- Menus -->
<menuitem
parent="account.menu_finance_periodical_processing"
id="menu_finance_periodical_processing_billing"
name="Billing"/>
<record id="action_hr_analytic_timesheet_open_tree" model="ir.actions.act_window">
<field name="name">Entries to invoice</field>
<field name="res_model">account.analytic.line</field>
@@ -118,12 +122,11 @@
<field name="domain">[('to_invoice','&lt;&gt;',False)]</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="help">OpenERP automatically group the entries to be invoiced so you can keep an eye on them on real time in one glance.</field>
<!-- <field name="search_view_id" ref="account.view_account_analytic_account_search"/> -->
</record>
<menuitem
action="action_hr_analytic_timesheet_open_tree"
id="menu_hr_analytic_timesheet_tree"
parent="account.menu_finance_periodical_processing"/>
parent="menu_finance_periodical_processing_billing"/>
<record id="action_hr_analytic_timesheet_tree_invoiced" model="ir.actions.act_window">
<field name="name">Uninvoiced Entries</field>
+15 -13
View File
@@ -1,30 +1,30 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * hr_timesheet_invoice
# * hr_timesheet_invoice
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-09-08 14:49+0000\n"
"Last-Translator: filsys <office@filsystem.ro>\n"
"PO-Revision-Date: 2010-07-23 20:20+0000\n"
"Last-Translator: Desen <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:11+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: hr_timesheet_invoice
#: view:hr_timesheet_invoice.factor:0
msgid "Type of invoicing"
msgstr ""
msgstr "Tip de facturare"
#. module: hr_timesheet_invoice
#: rml:account.analytic.profit:0
msgid "Profit"
msgstr ""
msgstr "Profit"
#. module: hr_timesheet_invoice
#: wizard_view:hr.timesheet.invoice.create,init:0
@@ -39,17 +39,17 @@ msgstr ""
#. module: hr_timesheet_invoice
#: rml:account.analytic.profit:0
msgid "Income"
msgstr ""
msgstr "Venituri"
#. module: hr_timesheet_invoice
#: field:hr_timesheet_invoice.factor,customer_name:0
msgid "Visible name"
msgstr ""
msgstr "Nume vizibil"
#. module: hr_timesheet_invoice
#: wizard_field:hr.timesheet.invoice.account.analytic.account.cost_ledger.report,init,date1:0
msgid "Start of period"
msgstr ""
msgstr "Începutul perioadei"
#. module: hr_timesheet_invoice
#: help:hr.timesheet.invoice.create,init,price:0
@@ -57,11 +57,13 @@ msgid ""
"The cost of each work done will be displayed on the invoice. You probably "
"don't want to check this."
msgstr ""
"Costul fiecărei activități efectuate va fi tipărit pe factura. Probabil că "
"nu doriți să bifați această opțiune."
#. module: hr_timesheet_invoice
#: model:ir.actions.wizard,name:hr_timesheet_invoice.hr_timesheet_invoice_create
msgid "Invoice analytic lines"
msgstr ""
msgstr "Detalii factură"
#. module: hr_timesheet_invoice
#: help:hr.timesheet.final.invoice.create,init,time:0
@@ -72,18 +74,18 @@ msgstr ""
#: model:ir.actions.act_window,name:hr_timesheet_invoice.action_draft_analytic_accounts
#: model:ir.ui.menu,name:hr_timesheet_invoice.menu_action_draft_analytic_accounts
msgid "Draft Analytic Accounts"
msgstr ""
msgstr "Conturi analitice în schiță"
#. module: hr_timesheet_invoice
#: wizard_field:hr.timesheet.final.invoice.create,init,time:0
#: wizard_field:hr.timesheet.invoice.create,init,time:0
msgid "Time spent"
msgstr ""
msgstr "Timp consumat"
#. module: hr_timesheet_invoice
#: field:account.analytic.account,amount_invoiced:0
msgid "Invoiced Amount"
msgstr ""
msgstr "Valoarea Facturată"
#. module: hr_timesheet_invoice
#: help:account.analytic.account,to_invoice:0
+128 -62
View File
@@ -1,101 +1,167 @@
- |
In Order to test the Membership in OpenERP, which allows us to manage all operations for managing memberships.
- |
We have to create "Membership Products" to make it available for partner or customer to make membership with it.
select product type to "service" type and membership field is ticked to visible this product while creating membership for the partner.
I'm creating "Golden Membership" which has Membership fee 80 EURO and It's started from 1st June to 31st Dec.
-
!record {model: product.product, id: product_product_membershipproduct0}:
categ_id: product.cat1
membership: 1
membership_date_from: '2009-06-01'
membership_date_to: '2010-06-01'
name: Membership Products
membership_date_from: '2010-06-01'
membership_date_to: '2010-12-31'
name: Golden Membership
type: service
list_price: 80.00
- |
I create new member "Mark Johnson" and I provide an address to this
new customer, as well as an email "info@mycustomer.com".
"Mark Johnson" want to join "Golden Membership".
- |
I'm creating new member "Mark Johnson".
-
!record {model: res.partner, id: res_partner_markjohnson0}:
address:
- city: paris
country_id: base.fr
name: Arthur Grosbonnet
name: Mark Johnson
street: 1 rue Rockfeller
type: default
type: invoice
zip: '75016'
credit_limit: 0.0
membership_amount: 0.0
name: Mark Johnson
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
- |
I check that "Current membership state" is set to "Non Member".
I'm checking "Current Membership State" of "Mark Johnson". It is an "Non Member" or not.
-
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'none'
- |
I can make it a Free member by selecting the "Free member" check box.
-
!record {model: res.partner, id: membership.res_partner_markjohnson0}:
free_member: 1
- membership_state == 'none', 'Member should be has "Current Membership State" in "Non Member".'
- |
Now, I create Membership Invoices using wizard available on partner and Select Membership Product.
I'm doing to make membership invoice for "Mark Johnson" on joining "Golden Membership".
-
!record {model: membership.invoice, id: membership_invoice_0}:
product_id: membership.product_product_membershipproduct0
!python {model: res.partner}: |
self.create_membership_invoice(cr, uid, [ref("res_partner_markjohnson0")], product_id=ref("product_product_membershipproduct0"), datas={"amount":80.00})
- |
I click on "Confirm" button of this wizard. and also check that address is defined or not for this partner in this function.
I'm checking "Current Membership State" of "Mark Johnson". It is an "Waiting Member" or not.
-
!python {model: membership.invoice}: |
self.membership_invoice(cr, uid, [ref("membership_invoice_0")], {"active_ids": [ref("membership.res_partner_markjohnson0")]})
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'waiting', 'Member should be has "Current Membership State" in "Waiting Member".'
- |
I check that Invoice is created for this members.
I'm Opening that Invoice which is created for "Mark Johnson".
-
!python {model: res.partner}: |
import netsvc
from tools.translate import _
invoice_obj = self.pool.get('account.invoice')
partner_obj = self.pool.get('res.partner')
product_obj = self.pool.get('product.product')
invoice_line_obj = self.pool.get('account.invoice.line')
invoice_pool = self.pool.get('account.invoice')
partner_pool = self.pool.get('res.partner')
membership_line_pool = self.pool.get('membership.membership_line')
membership_pool = self.pool.get('product.product')
partner_id = self.browse(cr, uid, ref('res_partner_markjohnson0'))
inv_ids = invoice_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
invoice_id = invoice_obj.browse(cr, uid, inv_ids)[0]
product = product_obj.browse(cr, uid, ref('product_product_membershipproduct0'), context=context)
line_ids = invoice_line_obj.search(cr, uid, [('product_id', '=', product.id), ('invoice_id', '=', invoice_id.id)])
assert line_ids, _('Invoices has not been generated for this Member!')
membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))])
membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids)
assert membership_lines, _('Membership is not registrated.')
membership_line = membership_lines[0]
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.invoice', membership_line.account_invoice_id.id, 'invoice_open', cr)
- |
I check that the "Current membership state" will remain same untill opening the invoice.
I'm checking "Current membership state" of "Mark Johnson". It is an "Invoiced Member" or not.
-
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'free'
- membership_state == 'invoiced', 'Member should be has "Current Membership State" in "Invoiced Member".'
- |
"Current membership state" of any member depends on the state of invoice.
So, I check that invoice is in draft state then the "membership state" of a member is "Waiting member".
I'm doing to paid that invoice which is opened for "Mark Johnson".
-
!python {model: membership.membership_line}: |
partner_obj = self.pool.get('res.partner')
inv_obj = self.pool.get('account.invoice')
!python {model: account.invoice}: |
from tools.translate import _
invoice_pool = self.pool.get('account.invoice')
partner_pool = self.pool.get('res.partner')
membership_line_pool = self.pool.get('membership.membership_line')
membership_pool = self.pool.get('product.product')
invoice_pay_pool = self.pool.get('account.invoice.pay')
partner_id = partner_obj.browse(cr, uid, ref('res_partner_markjohnson0'))
member_ids = self.search(cr, uid, [('partner', '=', partner_id.id)])
current_id = self.browse(cr, uid, member_ids)[0]
inv_ids = inv_obj.search(cr, uid, [('partner_id', '=', partner_id.id), ('account_id', '=', partner_id.property_account_receivable.id)])
inv_id = inv_obj.browse(cr, uid, inv_ids)[0]
if inv_id.state == 'draft':
assert current_id.state == 'waiting'
membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))])
membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids)
assert membership_lines, _('Membership is not registrated.')
membership_line = membership_lines[0]
assert membership_line.account_invoice_id.state == 'open', _('Invoice should be Opened.')
pay_id = invoice_pay_pool.create(cr, uid, {'amount': 80, 'name': 'Payment of Membership', 'journal_id': ref('account.bank_journal')}, {'active_id': membership_line.account_invoice_id.id})
invoice_pay_pool.pay_and_reconcile(cr, uid, [pay_id], {'active_id': membership_line.account_invoice_id.id})
- |
When the invoice is in open state it become Invoiced Member, When the invoice is in paid state the same "Current membership state" changed to Paid Member.
Now, If we cancel the invoice "Current membership state" changed to Cancel Member.
I'm checking "Current membership state" of "Mark Johnson". It is an "Paid Member" or not.
-
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'paid', 'Member should be has "Current Membership State" in "Paid Member".'
- |
I'm creating free member "Ms. Johnson" of "Golden Membership".
-
!record {model: res.partner, id: res_partner_msjohnson0}:
address:
- city: paris
country_id: base.fr
name: Ms. Johnson
street: 1 rue Rockfeller
type: invoice
zip: '75016'
name: Ms. Johnson
free_member: True
- |
I'm checking "Current membership state" of "Ms. Johnson". It is an "Free Member" or not.
-
!assert {model: res.partner, id: res_partner_msjohnson0}:
- membership_state == 'free', 'Member should be has "Current Membership State" in "Free Member".'
- |
I'm set "Mark Johnson" as a associated member of "Ms. Johnson" and also set Non free member.
-
!python {model: res.partner}: |
self.write(cr, uid, [ref("res_partner_msjohnson0")], {'free_member': False, 'associate_member': ref("res_partner_markjohnson0")})
- |
I'm checking "Current membership state" of "Ms. Johnson". It is an "Paid Member" or not.
-
!assert {model: res.partner, id: res_partner_msjohnson0}:
- membership_state == 'paid', 'Member should be has "Current Membership State" in "Paid Member".'
- |
I'm creating new "Silver Membership" which has Membership fee 50 EURO and It's started from 1st June to 31st Dec.
-
!record {model: product.product, id: product_product_membershipproduct1}:
categ_id: product.cat1
membership: 1
membership_date_from: '2010-06-01'
membership_date_to: '2010-12-31'
name: Silver Membership
type: service
list_price: 50.00
- |
I'm making invoice of "Mark Johnson" member on joining new membership "Silver Membership".
-
!python {model: res.partner}: |
self.create_membership_invoice(cr, uid, [ref("res_partner_markjohnson0")], product_id=ref("product_product_membershipproduct1"), datas={"amount":50.00})
- |
I'm checking "Current membership state" of "Mark Johnson". It is an "Old Member" or not.
-
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'old', 'Member should be has "Current Membership State" in "Old Member".'
- |
I'm doing to make credit note of invoice which is paid by "Mark Johnson" to cancel membership.
-
!python {model: account.invoice}: |
from tools.translate import _
invoice_pool = self.pool.get('account.invoice')
partner_pool = self.pool.get('res.partner')
membership_line_pool = self.pool.get('membership.membership_line')
membership_pool = self.pool.get('product.product')
invoice_refund_pool = self.pool.get('account.invoice.refund')
membership_line_ids = membership_line_pool.search(cr, uid, [('membership_id','=',ref('product_product_membershipproduct0')),('partner','=',ref('res_partner_markjohnson0'))])
membership_lines = membership_line_pool.browse(cr, uid, membership_line_ids)
assert membership_lines, _('Membership is not registrated.')
membership_line = membership_lines[0]
refund_id = invoice_refund_pool.create(cr, uid, {'description': 'Refund of Membership'}, {'active_id': membership_line.account_invoice_id.id})
invoice_refund_pool.invoice_refund(cr, uid, [refund_id], {'active_id': membership_line.account_invoice_id.id, 'active_ids': [membership_line.account_invoice_id.id]})
- |
I'm checking "Current membership state" of "Mark Johnson". It is an "Cancelled Member" or not.
-
!assert {model: res.partner, id: res_partner_markjohnson0}:
- membership_state == 'canceled', 'Member should be has "Current Membership State" in "Cancelled Member".'
-1
View File
@@ -72,7 +72,6 @@
'wizard/mrp_change_standard_price_view.xml',
# 'wizard/mrp_track_prod_view.xml',
'mrp_view.xml',
'mrp_wizard.xml',
'mrp_report.xml',
'company_view.xml',
'process/stockable_product_process.xml',
+21 -14
View File
@@ -48,10 +48,10 @@ class mrp_workcenter(osv.osv):
'time_cycle': fields.float('Time for 1 cycle (hour)', help="Time in hours for doing one cycle."),
'time_start': fields.float('Time before prod.', help="Time in hours for the setup."),
'time_stop': fields.float('Time after prod.', help="Time in hours for the cleaning."),
'costs_hour': fields.float('Cost per hour'),
'costs_hour': fields.float('Cost per hour', help="Specify Cost of Workcenter per hour."),
'costs_hour_account_id': fields.many2one('account.analytic.account', 'Hour Account', domain=[('type','<>','view')],
help="Complete this only if you want automatic analytic accounting entries on production orders."),
'costs_cycle': fields.float('Cost per cycle'),
'costs_cycle': fields.float('Cost per cycle', help="Specify Cost of Workcenter per cycle."),
'costs_cycle_account_id': fields.many2one('account.analytic.account', 'Cycle Account', domain=[('type','<>','view')],
help="Complete this only if you want automatic analytic accounting entries on production orders."),
'costs_journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal'),
@@ -208,7 +208,7 @@ class mrp_bom(osv.osv):
'active': lambda *a: 1,
'product_efficiency': lambda *a: 1.0,
'product_qty': lambda *a: 1.0,
'product_rounding': lambda *a: 1.0,
'product_rounding': lambda *a: 0.0,
'type': lambda *a: 'normal',
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'mrp.bom', context=c),
}
@@ -269,11 +269,11 @@ class mrp_bom(osv.osv):
max_prop = prop
return result
def _bom_explode(self, cr, uid, bom, factor, properties, addthis=False, level=0):
def _bom_explode(self, cr, uid, bom, factor, properties=[], addthis=False, level=0):
""" Finds Products and Workcenters for related BoM for manufacturing order.
@param bom: BoM of particular product.
@param factor: Factor of product UoM.
@param properties: A dictionary for contextual values.
@param properties: A List of properties Ids.
@param addthis: If BoM found then True else False.
@param level: Depth level to find BoM lines starts from 10.
@return: result: List of dictionaries containing product details.
@@ -635,13 +635,11 @@ class mrp_production(osv.osv):
move_obj.write(cr, uid, [production.move_prod_id.id],
{'location_id': production.location_dest_id.id})
message = ("%s %s %s %s %s %s") % (
_('Manufacturing Order '),
name,
_("scheduled the"),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_("for"),
production.product_id.name)
message = ("Manufacturing Order '%s' for %s %s is Ready to produce.") % (
name,
production.product_qty,
production.product_id.name,
)
self.log(cr, uid, production_id, message)
return True
@@ -740,7 +738,7 @@ class mrp_production(osv.osv):
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'mrp.production', production_id, 'button_produce_done', cr)
message = _('Manufacturing order ') + " '" + production.name + "' "+ _("is finished.")
message = str(production_qty) + " '[" + production.product_id.code + '] ' + production.product_id.name + _("' have been manufactured for ") + production.name
self.log(cr, uid, production_id, message)
return True
@@ -910,7 +908,16 @@ class mrp_production(osv.osv):
proc_ids.append(proc_id)
wf_service.trg_validate(uid, 'stock.picking', picking_id, 'button_confirm', cr)
self.write(cr, uid, [production.id], {'picking_id': picking_id, 'move_lines': [(6,0,moves)], 'state':'confirmed'})
message = _('Manufacturing order ') + " '" + production.name + "' "+ _("is confirmed.")
message = ("%s '%s' %s %s %s %s %s %s.") % (
_('Manufacturing Order'),
production.name,
_('for'),
production.product_qty,
production.product_id.name,
_('scheduled for date '),
datetime.strptime(production.date_planned,'%Y-%m-%d %H:%M:%S').strftime('%Y-%m-%d'),
_('is waiting')
)
self.log(cr, uid, production.id, message)
return picking_id
+12 -6
View File
@@ -155,10 +155,10 @@
<group col="4" colspan="4">
<field name="capacity_per_cycle"/>
<newline/>
<field name="time_cycle"/>
<field name="time_cycle" widget="float_time"/>
<field name="time_efficiency"/>
<field name="time_start"/>
<field name="time_stop"/>
<field name="time_start" widget="float_time"/>
<field name="time_stop" widget="float_time"/>
</group>
</page>
<page string="Analytic Accounting" groups="base.group_extended">
@@ -204,6 +204,7 @@
<field name="view_type">form</field>
<field name="view_id" ref="mrp_workcenter_tree_view"/>
<field name="search_view_id" ref="view_mrp_workcenter_search"/>
<field name="help">Work Centers are units of manufacture consisting of one or several people and/or machines that can be considered as a unit for the purposes of forecasting capacity and planning.</field>
</record>
<!--
@@ -235,7 +236,7 @@
<field name="sequence" select="1"/>
<field name="workcenter_id" select="1"/>
<field name="cycle_nbr"/>
<field name="hour_nbr"/>
<field name="hour_nbr" widget="float_time"/>
<separator colspan="4" string="Description"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
@@ -278,6 +279,7 @@
<field name="res_model">mrp.routing</field>
<field name="view_type">form</field>
<field name="view_id" ref="mrp_routing_tree_view"/>
<field name="help">Routings define the assembly operations to be done in work centers for manufacturing a certain product. They are usually attached to bills of materials which will define the assembly of products required for manufacture or for finished products.</field>
</record>
<!-- <menuitem name="Routings" id="menu_mrp_routing_and_workcenters" parent="mrp.menu_mrp_bom" groups="base.group_extended"
sequence="100" />-->
@@ -299,8 +301,8 @@
<field name="name" select="1"/>
<field name="code" select="1" string="Reference" groups="base.group_extended"/>
<newline/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="routing_id" groups="base.group_extended"/>
<newline/>
<field name="product_uos" groups="product.group_uos"/>
@@ -314,8 +316,8 @@
<field colspan="4" name="bom_lines" nolabel="1" widget="one2many_list">
<tree string="Components" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id, name)" select="1"/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="product_uom"/>
<field name="name" invisible="1"/>
<field name="date_start"/>
<field name="date_stop"/>
@@ -398,6 +400,7 @@
<field name="view_type">form</field>
<field name="domain">[('bom_id','=',False)]</field>
<field name="search_view_id" ref="view_mrp_bom_filter"/>
<field name="help">Master Bills of Materials are documents that describe the list of raw materials used to make a finished product. You can generate documents for a product manufacturing (defining each manufacturing step) or you could define a single multi-level bill of materials.</field>
</record>
<record id="mrp_bom_form_action2" model="ir.actions.act_window">
<field name="name">Bill of Material Components</field>
@@ -405,6 +408,7 @@
<field name="res_model">mrp.bom</field>
<field name="view_type">form</field>
<field name="domain">[('bom_id','!=',False)]</field>
<field name="help">Bills of materials Components are components and sub-product used to create master bills of materials.</field>
</record>
<!-- BOM menus -->
@@ -762,6 +766,7 @@
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_mrp_production_filter"/>
<field name="context">{'search_default_Current':1}</field>
<field name="help">Manufacturing Orders describe the operations that need to be carried out and the raw materials usage for each stage of production. You use specifications (bills of materials) to work out the raw material requirements and the manufacturing orders needed for the finished products. Once the bills of materials have been defined, Open ERP becomes capable of automatically deciding on the manufacturing route depending on the needs of the company.</field>
</record>
<menuitem action="mrp_production_action" id="menu_mrp_production_action" parent="menu_mrp_manufacturing" sequence="1"/>
@@ -772,6 +777,7 @@
<field name="view_type">form</field>
<field name="view_mode">gantt,tree,form,calendar,graph</field>
<field name="domain">[('state','in',('ready','confirmed','in_production'))]</field>
<field name="help">Manufacturing Orders describe the operations that need to be carried out and the raw materials usage for each stage of production. You use specifications (bills of materials or BoM) to work out the raw material requirements and the manufacturing orders needed for the finished products. Once the bills of materials have been defined, Open ERP becomes capable of automatically deciding on the manufacturing route depending on the needs of the company.</field>
</record>
<record id="mrp_production_action2" model="ir.actions.act_window">
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
</data>
</openerp>
@@ -109,8 +109,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
<field name="context">{'search_default_Product': 1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
<field name="context">{'search_default_Product': 1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<record model="ir.actions.act_window.view" id="action_report_mrp_production_order_tree">
+2
View File
@@ -49,6 +49,7 @@
<field name="res_model">report.workcenter.load</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="help">Work Center Load is a projection of load in a work center given a period. The load is express in hour and cycle (for machines).</field>
</record>
<menuitem id="next_id_77" name="Reporting"
parent="base.menu_mrp_root" sequence="49"/>
@@ -100,6 +101,7 @@
<field name="res_model">report.mrp.inout</field>
<field name="view_type">form</field>
<field name="view_mode">graph,tree</field>
<field name="help">Weekly Stock Value Variation enables you to track stock value evolution as a result of manufacturing activities (consumption of raw materials, production of finished goods, added accounting value of stock by the creation of value following the transformation of products).</field>
</record>
<menuitem action="action_report_in_out_picking_tree" id="menu_report_in_out_picking" parent="next_id_77"/>
+105 -81
View File
@@ -31,75 +31,68 @@ from tools.translate import _
class report_custom(report_rml):
def create_xml(self, cr, uid, ids, datas, context={}):
number = (datas.get('form', False) and datas['form']['number']) or 1
def process_bom(bom, currency_id):
pool = pooler.get_pool(cr.dbname)
product_pool = pool.get('product.product')
product_uom_pool = pool.get('product.uom')
supplier_info_pool = pool.get('product.supplierinfo')
workcenter_pool = pool.get('mrp.workcenter')
user_pool = pool.get('res.users')
bom_pool = pool.get('mrp.bom')
def process_bom(bom, currency_id, factor=1):
xml = '<row>'
sum = 0
sum_strd = 0
prod = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, bom['product_id'])
prod = product_pool.browse(cr, uid, bom['product_id'])
prod_name = bom['name']
prod_qtty = bom['product_qty']
prod_uom = prod.uom_id.name
prod_qtty = factor * bom['product_qty']
product_uom = product_uom_pool.browse(cr, uid, bom['product_uom'], context=context)
level = 1
main_sp_price = ''
main_sp_name = ''
main_strd_price = ''
main_strd_price = ''
if prod.seller_ids and prod.seller_ids[0] :
main_sp_name = '<b>' + prod.seller_ids[0].name.name + '</b>\r\n'
pricelist_id = prod.seller_ids[0].name.property_product_pricelist_purchase.id
if pricelist_id:
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
price = pricelist_obj.price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0)
price = pooler.get_pool(cr.dbname).get('res.currency').compute(cr, uid, pricelist_obj.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
else:
price = 0
main_sp_price = '%.2f' % price + '\r\n'
main_sp_price, main_sp_name , main_strd_price = '','',''
sellers, sellers_price = '',''
if prod.seller_id:
main_sp_name = "<b>%s</b>\r\n" %(prod.seller_id.name)
price = supplier_info_pool.price_get(cr, uid, prod.seller_id.id, prod.id, number*prod_qtty)[prod.seller_id.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
main_sp_price = '<b>%s</b>\r\n' %(str(price))
sum += prod_qtty*price
std_price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, prod.standard_price, to_uom_id=product_uom.id)
main_strd_price = str(std_price) + '\r\n'
sum_strd = prod_qtty*std_price
main_strd_price = '%.2f' % prod.standard_price + '\r\n'
sum_strd = prod_qtty*prod.standard_price
sellers = ''
sellers_price = ''
for seller_id in prod.seller_ids:
sellers += '- <i>'+ seller_id.name.name +'</i>\r\n'
pricelist_id = seller_id.name.property_product_pricelist_purchase.id
if pricelist_id:
pricelist_obj = pooler.get_pool(cr.dbname).get('product.pricelist')
price = pricelist_obj.price_get(cr,uid,[pricelist_id], prod.id, number*prod_qtty or 1.0).setdefault(pricelist_id, 0)
price = pooler.get_pool(cr.dbname).get('res.currency').compute(cr, uid, pricelist_obj.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
else:
price = 0
sellers_price += '%.2f' % price + '\r\n'
price = supplier_info_pool.price_get(cr, uid, seller_id.name.id, prod.id, number*prod_qtty)[seller_id.name.id]
price = product_uom_pool._compute_price(cr, uid, prod.uom_id.id, price, to_uom_id=product_uom.id)
sellers_price += '<i>' + str(price) + '</i>\r\n'
xml += "<col para='yes'>" + prod_name + '</col>'
xml += "<col para='no'>" + main_sp_name + sellers + '</col>'
xml += "<col para='yes'>" + main_sp_name + sellers + '</col>'
xml += "<col para='yes'>" + str(prod_qtty) + '</col>'
xml += "<col para='yes'>" + prod_uom + '</col>'
xml += "<col para='yes'>" + product_uom.name + '</col>'
xml += "<col para='yes'>" + main_strd_price + '</col>'
xml += "<col para='no'>" + main_sp_price + sellers_price + '</col>'
xml += "<col para='yes'>" + main_sp_price + sellers_price + '</col>'
xml += '</row>'
return xml, sum, sum_strd
def process_workcenter(wrk):
workcenter = workcenter_pool.browse(cr, uid, wrk['workcenter_id'])
cost_cycle = wrk['cycle']*workcenter.costs_cycle
cost_hour = wrk['hour']*workcenter.costs_hour
total = cost_cycle + cost_hour
xml = '<row>'
workcenter = pooler.get_pool(cr.dbname).get('mrp.workcenter').browse(cr, uid, wrk['workcenter_id'])
xml += "<col para='yes'>" + wrk['name'] + '</col>'
xml += "<col para='yes'>" + '</col>'
xml += "<col para='no'>" + '</col>'
xml += "<col para='yes'>" + workcenter.name + '</col>'
xml += "<col/>"
xml += "<col para='no'>" + str(wrk['cycle']*workcenter.costs_cycle) + '</col>'
xml += "<col para='yes'>" + str(wrk['hour']*workcenter.costs_hour) + '</col>'
xml += "<col/>"
xml += "<col para='yes'>" + str(cost_cycle) + '</col>'
xml += "<col para='yes'>" + str(cost_hour) + '</col>'
xml += "<col para='yes'>" + str(cost_hour + cost_cycle) + '</col>'
xml += '</row>'
return xml, wrk['cycle']*workcenter.costs_cycle+wrk['hour']*workcenter.costs_hour
return xml, total
xml = ''
@@ -115,30 +108,20 @@ class report_custom(report_rml):
<report-footer>Generated by Open ERP</report-footer>
</config>
"""
header = """
<header>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
<field>%s</field>
</header>
""" % (_('Product name'), _('Product supplier'), _('Product quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
workcenter_header = """
<lines style='header'>
<row>
<col>%s</col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
<col>%s</col>
</row>
</lines>
""" % (_('Work Center name'), _('Cycles Cost'), _('Total hourly costs'))
""" % (_('Work Center name'), _('Cycles Cost'), _('Hourly Cost'),_('Work Cost'))
prod_header = """
<lines style='header'>
<row>
<col para='yes'>%s</col>
<col para='yes'>%s</col>
@@ -147,32 +130,62 @@ class report_custom(report_rml):
<col para='yes'>%s</col>
<col para='yes'>%s</col>
</row>
</lines>
""" % (_('Product name'), _('Product supplier'), _('Product Quantity'), _('Product uom'), _('Product Standard Price'), _('Unit Product Price'))
""" % (_('Componet'), _('Componet suppliers'), _('Quantity'), _('Uom'), _('Cost Unit Price per Uom'), _('Supplier Unit Price per Uom'))
company_currency = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id.currency_id.id
first = True
for prod_id in ids:
bom_ids = pooler.get_pool(cr.dbname).get('mrp.bom').search(cr, uid, [('product_id','=',prod_id)])
prod = pooler.get_pool(cr.dbname).get('product.product').browse(cr, uid, prod_id)
for bom_id in bom_ids:
bom = pooler.get_pool(cr.dbname).get('mrp.bom').browse(cr, uid, bom_id)
sub_boms = pooler.get_pool(cr.dbname).get('mrp.bom')._bom_explode(cr, uid, bom, number, [])
company_currency = user_pool.browse(cr, uid, uid).company_id.currency_id.id
for product in product_pool.browse(cr, uid, ids, context=context):
bom_id = bom_pool._bom_find(cr, uid, product.id, product.uom_id.id)
title = "<title>%s</title>" %(_("Cost Structure"))
title += "<title>%s</title>" %product.name
xml += "<lines style='header'>" + title + prod_header + "</lines>"
if not bom_id:
total_strd = number * product.standard_price
total = number * product_pool.price_get(cr, uid, [product.id], 'standard_price')[product.id]
xml += """<lines style='lines'><row>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
<col para='yes'>-</col>
</row></lines>"""
xml += """<lines style='total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
else:
bom = bom_pool.browse(cr, uid, bom_id, context=context)
factor = number * product.uom_id.factor / bom.product_uom.factor
sub_boms = bom_pool._bom_explode(cr, uid, bom, factor / bom.product_qty)
total = 0
total_strd = 0
parent_bom = {'product_qty': bom.product_qty, 'name': bom.product_id.name, 'product_uom': bom.product_id.uom_id.factor, 'product_id': bom.product_id.id}
parent_bom = {
'product_qty': bom.product_qty,
'name': bom.product_id.name,
'product_uom': bom.product_uom.id,
'product_id': bom.product_id.id
}
xml_tmp = ''
for sub_bom in (sub_boms and sub_boms[0]) or [parent_bom]:
txt, sum, sum_strd = process_bom(sub_bom, company_currency)
xml_tmp += txt
total += sum
total_strd += sum_strd
if not first:
xml += prod_header
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % total_strd + '</col><col>' + '%.2f' % total + '</col></row></lines>'
xml += """<lines style='sub_total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Cost'), _('of'), str(number), product.uom_id.name, str(total_strd), str(total))
total2 = 0
xml_tmp = ''
for wrk in (sub_boms and sub_boms[1]):
@@ -182,13 +195,24 @@ class report_custom(report_rml):
if xml_tmp:
xml += workcenter_header
xml += "<lines style='lines'>" + xml_tmp + '</lines>'
xml += "<lines style='sub_total'><row><col>%s : </col><col>(" % (_('SUBTOTAL')) + str(number) + " %s)</col><col/><col/><col/><col>" % (_('products')) + '%.2f' % total2 + '</col></row></lines>'
xml += "<lines style='total'><row><col>%s : </col><col>(" % (_('TOTAL')) + str(number) + " %s)</col><col/><col/><col>" % (_('products')) + '%.2f' % (total_strd+total2) + "</col><col>" + '%.2f' % (total+total2) + '</col></row></lines>'
first = False
xml = '<?xml version="1.0" ?><report>' + config_start + '<report-header>%s\n\r' % (_('Product Cost Structure')) + prod.name + '</report-header>'+ config_stop + header + xml + '</report>'
xml += """<lines style='sub_total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col/>
<col>%s</col>
</row></lines>'"""%(_('Work Cost'), _('of'), str(number), product.uom_id.name, str(total2))
xml += """<lines style='total'> <row>
<col>%s %s %s %s : </col>
<col/>
<col/>
<col/>
<col>%s</col>
<col>%s</col>
</row></lines>'"""%(_('Total Cost'), _('of'), str(number), product.uom_id.name, str(total_strd+total2), str(total+total2))
xml = '<?xml version="1.0" ?><report>' + config_start + config_stop + xml + '</report>'
return xml
report_custom('report.product.price', 'product.product', '', 'addons/mrp/report/price.xsl')
+1 -7
View File
@@ -43,13 +43,6 @@
<xsl:template match="report">
<xsl:apply-templates select="config"/>
<blockTable style="header">
<xsl:attribute name="colWidths">
<xsl:value-of select="./config/tableSize"/>
</xsl:attribute>
<xsl:apply-templates select="header"/>
</blockTable>
<xsl:apply-templates select="title"/>
<xsl:apply-templates select="lines"/>
</xsl:template>
@@ -82,6 +75,7 @@
</xsl:template>
<xsl:template match="lines">
<xsl:apply-templates select="title"/>
<blockTable>
<xsl:attribute name="style"><xsl:value-of select="@style"/></xsl:attribute>
<xsl:attribute name="colWidths">
+4 -2
View File
@@ -33,7 +33,8 @@
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 1.0
min_qty: 1.0
product_uom: product_uom_litre0
supply_method: buy
type: product
uom_id: product.product_uom_kgm
@@ -51,7 +52,8 @@
seller_ids:
- delay: 1
name: base.res_partner_desertic_hispafuentes
qty: 2.0
min_qty: 2.0
product_uom: product.product_uom_kgm
supply_method: buy
type: product
uom_id: product.product_uom_kgm
+4 -1
View File
@@ -25,7 +25,10 @@ class mrp_price(osv.osv_memory):
_name = 'mrp.product_price'
_description = 'Product Price'
_columns = {
'number': fields.integer('Number of products to produce', required=True),
'number': fields.integer('Quantity', required=True, help="Specify quantity of products to produce or buy. Report of Cost structure will be displayed base on this qunatity."),
}
_defaults = {
'number': 1,
}
def print_report(self, cr, uid, ids, context=None):
+4 -2
View File
@@ -9,14 +9,16 @@
<field name="model">mrp.product_price</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Paid ?">
<form string="Product Cost Structure">
<separator colspan="4" string="Print Cost Structure of Product." />
<field name="number"/>
<newline/>
<separator string="" colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-close' special="cancel"
string="Close" />
<button name="print_report" string="Print"
colspan="1" type="object" icon="gtk-ok" />
colspan="1" type="object" icon="gtk-print" />
</group>
</form>
</field>
@@ -194,6 +194,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form,gantt,calendar,graph</field>
<field name="search_view_id" ref="view_mrp_production_workcenter_form_view_filter"/>
<field name="help">Work Orders are manufacturing operations required to produce or assemble products. The different work orders will have different impacts on the costs of manufacture and planning depending on the available workload.</field>
</record>
<record model="ir.actions.act_window" id="mrp_production_wc_action_planning">
@@ -203,6 +204,7 @@
<field name="view_type">form</field>
<field name="domain">[('production_state','in',('ready','confirmed','in_production'))]</field>
<field name="view_mode">tree,form,graph,calendar</field>
<field name="help">To manufacture or assemble products, as well as using raw materials and finished product you must also handle manufacturing operations. Manufacturing operations are often called work orders. The different operations will have different impacts on the costs of manufacture and planning depending on the available workload.</field>
</record>
+5 -4
View File
@@ -8,13 +8,14 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-12-08 11:46+0000\n"
"PO-Revision-Date: 2010-03-07 17:36+0000\n"
"Last-Translator: Edgardo Ramos Roque <Unknown>\n"
"PO-Revision-Date: 2010-07-23 19:00+0000\n"
"Last-Translator: Jordi Esteve (www.zikzakmedia.com) "
"<jesteve@zikzakmedia.com>\n"
"Language-Team: Spanish <es@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-06-22 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-07-24 03:58+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: multi_company
@@ -46,7 +47,7 @@ msgstr "El IVA no parece ser correcto"
#. module: multi_company
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr "Nombre de modelo inválido en la definición de la acción"
msgstr "Nombre de modelo no válido en la definición de la acción."
#. module: multi_company
#: model:res.company,overdue_msg:multi_company.res_company_odoo
-1
View File
@@ -22,7 +22,6 @@
import pos
import account_bank_statement
import pos_account_bank_statement
import wizard
import report
+2 -1
View File
@@ -67,6 +67,7 @@ Main features :
# 'pos_wizard.xml',
'pos_view.xml',
'report/report_pos_order_view.xml',
'report/report_cash_register_view.xml',
'pos_sequence.xml',
'posrule_data.xml',
'pos_data.xml',
@@ -76,7 +77,7 @@ Main features :
'statement_data.xml',
],
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml'],
'test':['test/pos_test.yml',],
# 'test':['test/pos_test.yml',],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+50 -214
View File
@@ -20,13 +20,13 @@
#
##############################################################################
from osv import osv, fields
import time
from osv import osv
from osv import fields
from mx import DateTime
from decimal import Decimal
from tools.translate import _
class account_journal(osv.osv):
_inherit = 'account.journal'
@@ -34,230 +34,66 @@ class account_journal(osv.osv):
'auto_cash': fields.boolean('Automatic Opening', help="This field authorize the automatic creation of the cashbox"),
'special_journal':fields.boolean('Special Journal', help="Will put all the orders in waiting status till being accepted"),
'check_dtls': fields.boolean('Check Details', help="This field authorize Validation of Cashbox without checking ending details"),
'statement_sequence_id': fields.many2one('ir.sequence', 'Statement Sequence', \
help="The sequence used for statement numbers in this journal."),
}
'journal_users': fields.many2many('res.users','pos_journal_users','journal_id','user_id','Users'),
}
_defaults = {
'check_dtls': lambda *a:True,
'auto_cash': lambda *a:True,
}
}
account_journal()
class singer_statement(osv.osv):
""" Singer Statements """
_name = 'singer.statement'
_description = 'Statement'
def _sub_total(self, cr, uid, ids, name, arg, context=None):
""" Calculates Sub total"
@param name: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
res = {}
for obj in self.browse(cr, uid, ids):
res[obj.id] = obj.pieces * obj.number
return res
def on_change_sub(self, cr, uid, ids, pieces, number,*a):
""" Calculates Sub total on change of number
@param pieces: Names of fields.
@param number:
"""
sub=pieces*number
return {'value':{'subtotal': sub or 0.0}}
_columns = {
'pieces': fields.float('Values', digits=(16,2)),
'number': fields.integer('Number'),
'subtotal': fields.function(_sub_total, method=True, string='Sub Total', type='float',digits=(16,2)),
'starting_id': fields.many2one('account.bank.statement',ondelete='cascade'),
'ending_id': fields.many2one('account.bank.statement',ondelete='cascade'),
}
singer_statement()
class account_bank_statement(osv.osv):
class account_cash_statement(osv.osv):
_inherit = 'account.bank.statement'
def _get_starting_balance(self, cr, uid, ids, name, arg, context=None):
""" Find starting balance "
@param name: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
res ={}
for statement in self.browse(cr, uid, ids):
amount_total=0.0
for line in statement.starting_details_ids:
amount_total+= line.pieces * line.number
res[statement.id]=amount_total
return res
def _equal_balance(self, cr, uid, ids, statement, context={}):
def _get_sum_entry_encoding(self, cr, uid, ids, name, arg, context=None):
""" Find encoding total of statements "
@param name: Names of fields.
@param arg: User defined arguments
@return: Dictionary of values.
"""
res2={}
for statement in self.browse(cr, uid, ids):
encoding_total=0.0
for line in statement.line_ids:
encoding_total+= line.amount
res2[statement.id]=encoding_total
return res2
def _default_journal_id(self, cr, uid, context={}):
""" To get default journal for the object"
@param name: Names of fields.
@return: journal
"""
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
journal = self.pool.get('account.journal').search(cr, uid, [('type', '=', 'cash'), ('auto_cash','=',False), ('company_id', '=', company_id)])
if journal:
return journal[0]
else:
if not statement.journal_id.check_dtls:
return True
if statement.journal_id.check_dtls and (statement.balance_end != statement.balance_end_cash):
return False
else:
return True
def _user_allow(self, cr, uid, ids, statement, context={}):
res = False
uids = []
for user in statement.journal_id.journal_users:
uids.append(user.id)
if uid in uids:
res = True
return res
account_cash_statement()
class account_bank_statement_line(osv.osv):
def _default_company(self, cr, uid, context={}):
""" To get default company for the object"
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of bank statement ids
@param context: A standard dictionary for contextual values
@return: company
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
_inherit = 'account.bank.statement.line'
_columns = {
'journal_id': fields.many2one('account.journal', 'Journal', required=True),
'balance_start': fields.function(_get_starting_balance, method=True, string='Starting Balance', type='float',digits=(16,2)),
# 'balance_start': fields.float('Starting Balance',digits=(16,2)),
# 'balance_end': fields.float('Balance',digits=(16,2)),
'state': fields.selection([('draft', 'Draft'),('confirm', 'Confirm'),('open','Open')],
'State', required=True, states={'confirm': [('readonly', True)]}, readonly="1"),
'total_entry_encoding':fields.function(_get_sum_entry_encoding, method=True, string="Total of Entry encoding"),
'date':fields.datetime("Opening Date"),
'closing_date':fields.datetime("Closing Date"),
'starting_details_ids': fields.one2many('singer.statement', 'starting_id', string='Starting Details'),
'ending_details_ids': fields.one2many('singer.statement', 'ending_id', string='Ending Details'),
'name': fields.char('Name', size=64, required=True, readonly=True),
'company_id':fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
'state': lambda *a: 'draft',
'name': lambda *a: '/',
'date': lambda *a:time.strftime("%Y-%m-%d %H:%M:%S"),
'journal_id': _default_journal_id,
}
def create(self, cr, uid, vals, context=None):
company_id = vals and vals.get('company_id',False)
if company_id:
open_jrnl = self.search(cr, uid, [('company_id', '=', vals['company_id']), ('journal_id', '=', vals['journal_id']), ('state', '=', 'open')])
if open_jrnl:
raise osv.except_osv('Error', u'Une caisse de type espèce est déjà ouverte')
if 'starting_details_ids' in vals:
vals['starting_details_ids'] = starting_details_ids = map(list, vals['starting_details_ids'])
for i in starting_details_ids:
if i and i[0] and i[1]:
i[0], i[1] = 0, 0
res = super(account_bank_statement, self).create(cr, uid, vals, context=context)
return res
def onchange_journal_id(self, cursor, user, statement_id, journal_id, context=None):
""" Changes balance start and starting details if journal_id changes"
@param statement_id: Changed statement_id
@param journal_id: Changed journal_id
@return: Dictionary of changed values
"""
id_s=[]
if not journal_id:
return {'value': {'balance_start': 0.0}}
balance_start=0.0
cash_obj = self.pool.get('singer.statement')
statement_obj = self.pool.get('account.bank.statement')
cursor.execute("Select a.id from account_bank_statement a where journal_id=%d and user_id=%d order by a.id desc limit 1"%(journal_id,user))
res2=cursor.fetchone()
res2=res2 and res2[0] or None
if res2:
statmt_id=statement_obj.browse(cursor,user,res2)
check_det=statmt_id.journal_id.check_dtls
if not check_det:
balance_start=statmt_id.balance_end_real or 0.0
return {'value': {'balance_start': balance_start}}
cursor.execute("Select a.id from account_bank_statement a, singer_statement s where journal_id=%d and user_id=%d order by a.id desc limit 1"%(journal_id,user))
res1=cursor.fetchone()
res1=res1 and res1[0] or None
if res1:
cursor.execute("Select sum(ss.pieces*ss.number),ss.ending_id from singer_statement ss, account_bank_statement s where ss.ending_id=s.id and s.journal_id=%d and s.user_id=%d and s.id=%d group by ss.ending_id,s.id order by s.id desc"%(journal_id,user, res1))
res = cursor.fetchone()
balance_start = res and res[0] or 0.0
cash_end=res and res[1] or None
id_s=statement_obj.browse(cursor,user,cash_end).ending_details_ids
new=[]
if id_s:
for s in id_s:
new.append(s.id)
return {'value': {'balance_start': balance_start, 'starting_details_ids':new}}
def button_open(self, cr, uid, ids, context=None):
""" Changes statement state to Running.
@return: True
"""
obj_inv = self.browse(cr, uid, ids)[0]
s_id=obj_inv.journal_id
if s_id.statement_sequence_id:
s_id=s_id.id
number = self.pool.get('ir.sequence').get_id(cr, uid, s_id)
else:
number = self.pool.get('ir.sequence').get(cr, uid,
'account.bank.statement')
self.write(cr, uid, ids, {'date':time.strftime("%Y-%m-%d %H:%M:%S"), 'state':'open', 'name':number})
return True
def button_confirm(self, cr, uid, ids, context={}):
""" Check the starting and ending detail of statement
@return: True
"""
val = 0.0
val2 = 0.0
val_statement_line = 0.0
diff = self.pool.get('res.users').browse(cr,uid,uid).company_id.max_diff or 0.0
for statement in self.browse(cr, uid, ids):
bal = statement.balance_end
bal_st=statement.balance_start
for st in statement.line_ids:
val_statement_line += st.amount
for stat in statement.starting_details_ids:
val2 += stat.subtotal
for stat in statement.ending_details_ids:
val += stat.subtotal
if statement.journal_id.check_dtls:
if Decimal(str(val)).quantize(Decimal('.001')) != (Decimal(str(val_statement_line)) + Decimal(str(val2))).quantize(Decimal('.001')):
raise osv.except_osv(_('Invalid action !'), _(' You can not confirm your cashbox, Please enter ending details, missing value matches to "%s"')%(abs(Decimal(str(val))-(Decimal(str(val_statement_line))+Decimal(str(val2))))))
self.write(cr, uid, statement.id, {'balance_end_real':Decimal(str(val_statement_line))+Decimal(str(val2)),'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
# self.write(cr, uid, statement.id, {'balance_end_real':bal_st+val_statement_line,'closing_date':time.strftime("%Y-%m-%d %H:%M:%S"),'state':'draft'})
return super(account_bank_statement, self).button_confirm(cr, uid, ids, context={})
def button_cancel(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state':'draft'}, context=context)
account_bank_statement()
#class singer_account_bank_statement_line(osv.osv):
# _inherit = 'account.bank.statement.line'
# _columns = {
# 'pos_statement_id': fields.many2one('pos.order',ondelete='cascade'),
# }
#
#singer_account_bank_statement_line()
'company_id': _default_company,
}
account_bank_statement_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+48 -32
View File
@@ -287,8 +287,8 @@ class pos_order(osv.osv):
'date_validation': fields.function(_get_date_payment, method=True, string='Validation Date', type='date', store=True),
'date_payment': fields.function(_get_date_payment2, method=True, string='Payment Date', type='date', store=True),
'date_validity': fields.date('Validity Date', required=True),
'user_id': fields.many2one('res.users', 'Connected Salesman', readonly=True),
'user_salesman_id': fields.many2one('res.users', 'Salesman', required=True),
'user_id': fields.many2one('res.users', 'Connected Salesman'),
'user_salesman_id': fields.many2one('res.users', 'Cashier', required=True),
'sale_manager': fields.many2one('res.users', 'Salesman Manager'),
'amount_tax': fields.function(_amount_all, method=True, string='Taxes', digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),
@@ -298,7 +298,7 @@ class pos_order(osv.osv):
'price_type': fields.selection([
('tax_excluded','Tax excluded')
], 'Price method', required=True),
'statement_ids': fields.one2many('account.bank.statement.line','pos_statement_id','Payments'),
'statement_ids': fields.one2many('account.bank.statement.line','pos_statement_id','Payments',states={'draft': [('readonly', False)]},readonly=True),
'payments': fields.one2many('pos.payment', 'order_id', 'Order Payments', states={'draft': [('readonly', False)]}, readonly=True),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist', required=True, states={'draft': [('readonly', False)]}, readonly=True),
'partner_id': fields.many2one( 'res.partner', 'Customer', change_default=True, select=1, states={'draft': [('readonly', False)], 'paid': [('readonly', False)]}),
@@ -311,8 +311,7 @@ class pos_order(osv.osv):
'pickings': fields.one2many('stock.picking', 'pos_order', 'Picking', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Last Output Picking', readonly=True),
'first_name': fields.char('First Name', size=64),
'state_2': fields.function(_get_v,type='selection',selection=[('to_verify', 'To Verify'), ('accepted', 'Accepted'),
('refused', 'Refused')], string='State', readonly=True, method=True, store=True),
# 'state_2': fields.function(_get_v,type='selection',selection=[('to_verify', 'To Verify'), ('accepted', 'Accepted'),('refused', 'Refused')], string='State', readonly=True, method=True, store=True),
'note': fields.text('Internal Notes'),
'nb_print': fields.integer('Number of Print', readonly=True),
'sale_journal': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, ),
@@ -355,7 +354,7 @@ class pos_order(osv.osv):
'sale_manager': lambda self, cr, uid, context: uid,
'state': lambda *a: 'draft',
'price_type': lambda *a: 'tax_excluded',
'state_2': lambda *a: 'to_verify',
# 'state_2': lambda *a: 'to_verify',
'name': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'pos.order'),
'date_order': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'date_validity': lambda *a: (DateTime.now() + DateTime.RelativeDateTime(months=+6)).strftime('%Y-%m-%d'),
@@ -558,26 +557,26 @@ class pos_order(osv.osv):
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
return True
def button_validate(self, cr, uid, ids, *args):
""" Check the access for the sale order and update the date_validation
@return: True
"""
res_obj = self.pool.get('res.company')
try:
part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse(cr,uid,uid).parent_id.id or None
except Exception, e:
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
if part_company:
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
for order in self.browse(cr, uid, ids):
if not order.date_validation:
cr.execute("select max(date) from account_bank_statement_line where pos_statement_id=%d"%(order.id))
val=cr.fetchone()
val=val and val[0] or None
if val:
cr.execute("Update pos_order set date_validation='%s', state_2 ='%s' where id = %d"%(val, 'accepted', order.id))
return True
# def button_validate(self, cr, uid, ids, *args):
#
# """ Check the access for the sale order and update the date_validation
# @return: True
# """
# res_obj = self.pool.get('res.company')
# try:
# part_company=res_obj.browse(cr,uid,uid) and res_obj.browse(cr,uid,uid).parent_id and res_obj.browse######(cr,uid,uid).parent_id.id or None
# except Exception, e:
# raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
# if part_company:
# raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
# for order in self.browse(cr, uid, ids):
# if not order.date_validation:
# cr.execute("select max(date) from account_bank_statement_line where pos_statement_id=%d"%(order.id))
# val=cr.fetchone()
# val=val and val[0] or None
# if val:
# cr.execute("Update pos_order set date_validation='%s', state_2 ='%s' where id = %d"%(val, 'accepted', order.id))
# return True
def cancel_order(self, cr, uid, ids, context=None):
@@ -603,8 +602,8 @@ class pos_order(osv.osv):
if not order.num_sale and data['num_sale']:
self.write(cr,uid,order_id,{'num_sale': data['num_sale']})
ids_new=[]
if order.invoice_wanted and not order.partner_id:
raise osv.except_osv(_('Error'), _('Cannot create invoice without a partner.'))
# if order.invoice_wanted and not order.partner_id:
# raise osv.except_osv(_('Error'), _('Cannot create invoice without a partner.'))
args = {
'amount': data['amount'],
}
@@ -705,7 +704,7 @@ class pos_order(osv.osv):
product_obj= self.pool.get('product.product')
inv_ids = []
for order in self.browse(cr, uid, ids, context):
for order in self.pool.get('pos.order').browse(cr, uid, ids, context):
curr_c = order.user_salesman_id.company_id
if order.invoice_id:
inv_ids.append(order.invoice_id.id)
@@ -1072,8 +1071,8 @@ class pos_order_line(osv.osv):
else:
res[line.id]=line.price_unit*line.qty
res[line.id] = res[line.id] + tax_amount
return res
def _amount_line(self, cr, uid, ids, field_name, arg, context):
res = {}
@@ -1107,7 +1106,8 @@ class pos_order_line(osv.osv):
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)
self.write(cr,uid,ids,{'price_unit':price})
return {'value': {'price_unit': price}, 'qty': 1}
pos_stot = (price * qty)
return {'value': {'price_unit': price,'price_subtotal_incl': pos_stot}}
def onchange_subtotal(self, cr, uid, ids, discount, price, pricelist,qty,partner_id, product_id,*a):
prod_obj = self.pool.get('product.product')
@@ -1121,6 +1121,11 @@ class pos_order_line(osv.osv):
return {'value':{'discount':disc, 'price_unit':price_f}}
return {}
def onchange_dis(self, cr, uid,ids, qty, price_subtotal_incl, discount,*a):
price_sub = price_subtotal_incl
sub_total_discount = price_sub-(price_subtotal_incl*(discount*0.01))
return {'value': {'price_subtotal_incl':sub_total_discount}}
def onchange_ded(self, cr, uid,ids, val_ded,price_u,*a):
pos_order = self.pool.get('pos.order.line')
res_obj = self.pool.get('res.users')
@@ -1149,7 +1154,7 @@ class pos_order_line(osv.osv):
else:
return {'value': {'notice':'Minimum Discount','price_ded':price*discount*0.01 or 0.0 }}
else :
return {'value': {'notice':'No Discount', 'price_ded':price*discount*0.01 or 0.0 }}
return {'value': {'notice':'No Discount', 'price_ded':price*discount*0.01 or 0.0}}
_columns = {
'name': fields.char('Line Description', size=512),
'company_id':fields.many2one('res.company', 'Company', required=True),
@@ -1176,6 +1181,17 @@ class pos_order_line(osv.osv):
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
# def _check_qty(self, cr, uid, ids):
# lines = self.browse(cr, uid, ids)
# for line in lines:
# if line.qty <= 0:
# return False
# return True
# _constraints = [
# (_check_qty, 'Order quantity cannot be negative or zero !', ['qty']),
# ]
def create(self, cr, user, vals, context={}):
if vals.get('product_id'):
return super(pos_order_line, self).create(cr, user, vals, context)
@@ -1,67 +0,0 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import osv, fields
import time
import netsvc
class account_bank_statement(osv.osv):
_inherit = 'account.bank.statement'
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
account_bank_statement()
class account_bank_statement_line(osv.osv):
def _default_company(self, cr, uid, context={}):
""" To get default company for the object"
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of bank statement ids
@param context: A standard dictionary for contextual values
@return: company
"""
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
if user.company_id:
return user.company_id.id
return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
_inherit = 'account.bank.statement.line'
_columns = {
'company_id':fields.many2one('res.company', 'Company', required=True),
}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
account_bank_statement_line()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+45 -42
View File
@@ -12,9 +12,9 @@
<field name="arch" type="xml">
<form string="Sales Order POS">
<group col="6" colspan="4">
<field name="user_salesman_id" />
<!--field name="user_salesman_id" />
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="contract_number" groups="base.group_extended"/>
<field name="contract_number" groups="base.group_extended"/> -->
</group>
<notebook colspan="4">
@@ -22,19 +22,20 @@
<field name="lines" colspan="4" nolabel="1">
<tree string="Order lines" editable="bottom">
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275" />
<field name="qty" />
<field name="qty_rfd" groups="base.group_extended"/>
<field name="qty"/>
<!--<field name="qty" on_change="onchange_qty(qty,price_unit)"/>-->
<!--field name="qty_rfd" groups="base.group_extended"/-->
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_subtotal_incl,price_unit)" invisible="1"/>
<field name="price_unit" readonly="1"/>
<field name="notice"/>
<field name="serial_number"/>
<field name="notice" on_change="onchange_dis(qty,price_subtotal_incl,discount)"/>
<!--field name="serial_number"/-->
<field name="price_subtotal" />
<field name="price_subtotal_incl"/>
<field name="price_subtotal_incl" sum="Subtotal"/>
</tree>
<form string="Order lines" >
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
<field name="qty" />
<field name="qty"/>
<field name="qty_rfd" groups="base.group_extended"/>
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
@@ -47,24 +48,24 @@
<group colspan="4" col="7">
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="%(action_pos_discount)d" string="D_iscount" icon="gtk-execute" type="action" states="draft"/>
<button name="dummy_button" string="Compute" icon="gtk-execute" type="object" />
<!--button name="%(action_pos_discount)d" string="D_iscount" type="action" states="draft"/>
<button name="dummy_button" string="Compute" type="object" /-->
</group>
<group colspan="4" col="9" groups="base.group_extended">
<separator colspan="4" string="Validation of the Sale"/>
<newline/>
<field name="state_2" />
<button name="button_validate"
string="Accept"
type="object"
icon="gtk-ok"
states="paid, draft"
attrs="{'invisible':[('state_2','=','accepted')]}"/>
</group>
<!-- <group colspan="4" col="9" groups="base.group_extended">-->
<!-- <separator colspan="4" string="Validation of the Sale"/>-->
<!-- <newline/>-->
<!-- <field name="state_2" />-->
<!-- <button name="button_validate"-->
<!-- string="Accept"-->
<!-- type="object"-->
<!-- icon="gtk-ok"-->
<!-- states="paid, draft"-->
<!-- attrs="{'invisible':[('state_2','=','accepted')]}"/>-->
<!-- </group>-->
<separator colspan="4" string="Actions"/>
<group colspan="4" col="6">
<field name="state"/>
<field name="state" />
<button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" />
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
@@ -76,11 +77,12 @@
<page string="Order and Payment">
<group colspan="2" col="2" name="Type">
<separator string="Order Information" colspan="4"/>
<field name="user_salesman_id" />
<field name="company_id" groups="base.group_multi_company"/>
<field name="shop_id" widget="selection" />
<field name="name"/>
<field name="user_id" />
<field name="sale_manager" />
<field name="user_id" string="Salesman"/>
<!--field name="sale_manager" /-->
<field name="price_type" />
</group>
<group colspan="2" col="2" name="Type">
@@ -91,13 +93,14 @@
<field name="type_rec" colspan="4"/>
</group>
<group colspan="4">
<separator string="Invoicing" colspan="4"/>
<field name="sale_journal" domain="[('type','=','sale'),('company_id','=',company_id)]"/>
<field name="pricelist_id" domain="[('type','=','sale')]"/>
<field name="invoice_id"/>
<group colspan="2" col="4">
<button name="invoice" icon="gtk-execute" string="Create _Invoice" states="paid"/>
</group>
<!-- <separator string="Invoicing" colspan="4"/>-->
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)" invisible="1"/>
<field name="sale_journal" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
<field name="pricelist_id" domain="[('type','=','sale')]" widget="selection" invisible="1"/>
<!-- <field name="invoice_id"/>-->
<!-- <group colspan="2" col="4">-->
<!-- <button name="invoice" icon="gtk-execute" string="Create _Invoice" states="paid"/>-->
<!-- </group>-->
</group>
<field name="statement_ids" colspan="4" nolabel="1">
@@ -172,9 +175,9 @@
</field>
</record>
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
<menuitem name="Daily Operations" id="menu_point_of_sale" parent="menu_point_root" sequence="3" />
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="29" />
<menuitem name="Products" id="menu_point_of_sale_product" parent="menu_point_root" sequence="15" />
<menuitem action="product.product_normal_action" id="menu_pos_products" parent="menu_point_of_sale_product" sequence="2" name="Products"/>
@@ -186,7 +189,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_pos_order_tree"/>
<field name="domain">['|',('state_2','=','to_verify'),('state','=','advance')]</field>
<field name="domain">['|',('state','=','advance')]</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_pos_order_filter"/>
@@ -743,7 +746,7 @@
</record>
<menuitem name="Configuration" parent="menu_point_root"
id="menu_point_config_product" sequence="6"/>
id="menu_point_config_product" sequence="25"/>
<record model="ir.actions.act_window" id="action_product_input">
<field name="name">Products</field>
@@ -795,16 +798,16 @@
action="action_product_output"
id="products_for_output_operations"/>
<menuitem name="Register Management" parent="menu_point_root"
id="menu_point_config" sequence="3"/>
<!-- <menuitem name="Register Management" parent="menu_point_root"-->
<!-- id="menu_point_config" sequence="4"/>-->
<menuitem
name="Input Operations" parent="menu_point_config"
name="Input Operations" parent="menu_point_of_sale"
string="Refloat"
action="action_box_entries"
id="menu_wizard_enter_jrnl" sequence="3" />
id="menu_wizard_enter_jrnl" sequence="2" />
<menuitem
name="Output Operations" parent="menu_point_config"
name="Output Operations" parent="menu_point_of_sale"
string="Refloat"
action="action_box_out"
id="menu_wizard_enter_jrnl2" sequence="3" />
@@ -860,7 +863,7 @@
</record>
<!-- Miscelleanous Operations/Reporting -->
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="30"/>
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="20"/>
<menuitem name="Registers" parent="menu_point_rep" id="menu_point_report_register" sequence="0" />
<menuitem name="Sales" parent="menu_point_rep" id="menu_point_report_sale" sequence="1" />
+1
View File
@@ -38,5 +38,6 @@ import pos_receipt_with_remboursment
import pos_receipt_without_remboursment
import point_of_sale_report
import report_pos_order
import report_cash_register
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,64 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import tools
from osv import fields,osv
class report_cash_register(osv.osv):
_name = "report.cash.register"
_description = "Point of Sale Cash Register Analysis"
_auto = False
_columns ={
'date': fields.date('Create Date', readonly=True),
'year': fields.char('Year', size=4),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'user_id':fields.many2one('res.users', 'User', readonly=True),
'state':fields.selection([('draft', 'Draft'),('confirm', 'Confirmed')],'State'),
'journal_id': fields.many2one('account.journal', 'Journal'),
'balance_start': fields.float('Opening Balance'),
'balance_end_real': fields.float('Closing Balance'),
}
_order = 'date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_cash_register')
cr.execute("""
create or replace view report_cash_register as (
select
min(s.id) as id,
to_date(to_char(s.create_date, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
s.user_id as user_id,
s.journal_id as journal_id,
s.state as state,
s.balance_start as balance_start,
s.balance_end_real as balance_end_real,
to_char(s.create_date, 'YYYY') as year,
to_char(s.create_date, 'MM') as month,
to_char(s.create_date, 'YYYY-MM-DD') as day
from account_bank_statement as s where s.user_id=1
group by
s.user_id,s.journal_id, s.balance_start, s.balance_end_real,s.state,to_char(s.create_date, 'dd-MM-YYYY'),
to_char(s.create_date, 'YYYY'),
to_char(s.create_date, 'MM'),
to_char(s.create_date, 'YYYY-MM-DD'))""")
report_cash_register()
@@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="view_report_cash_register_tree" model="ir.ui.view">
<field name="name">report.cash.register.tree</field>
<field name="model">report.cash.register</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Point of Sale Cash Register Analysis">
<field name="date" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="year" invisible="1"/>
<field name="month" invisible="1"/>
<field name="day" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="balance_start" />
<field name="balance_end_real" />
</tree>
</field>
</record>
<record id="view_report_cash_register_search" model="ir.ui.view">
<field name="name">report.cash.register.search</field>
<field name="model">report.cash.register</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Point of Sale Cash Register Analysis">
<group>
<filter icon="terp-go-year" string=" 365 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')),('date','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created last 365 days"/>
<filter icon="terp-go-month" string=" 30 Days "
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created in last 30 days"/>
<filter icon="terp-go-week"
string=" 7 Days "
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created last 7 days"/>
<separator orientation="vertical"/>
<filter icon="terp-go-today"
string=" Today "
name="today"
separator="1"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d'))]"
help="Cash Analysis created by today"/>
<separator orientation="vertical"/>
<filter icon="terp-document-new"
string="Draft"
domain="[('state','=',('draft'))]"/>
<filter icon="terp-camera_test"
string="Confirm"
domain="[('state','=',('confirm'))]"/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection">
<filter icon="terp-personal"
string="My Sales"
help="My Sales"
domain="[('user_id','=',uid)]"/>
</field>
</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'}"/>
<filter string="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"/>
<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>
<record id="action_report_cash_register_all" model="ir.actions.act_window">
<field name="name">Cash Register Analysis</field>
<field name="res_model">report.cash.register</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_report_cash_register_search"/>
<field name="context">{'search_default_today':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<menuitem action="action_report_cash_register_all" id="menu_report_cash_register_all" parent="menu_point_rep"/>
</data>
</openerp>
+36 -43
View File
@@ -28,8 +28,6 @@ class report_pos_order(osv.osv):
_auto = False
_columns ={
'date': fields.date('Date Order', readonly=True),
'date_validation': fields.date('Date Confirm', readonly=True),
'date_payment': fields.date('Date Confirm', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
@@ -41,8 +39,8 @@ class report_pos_order(osv.osv):
('advance','Advance'),
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced'), ('cancel', 'Cancel')],
'State'),
'state_2': fields.function([('to_verify', 'To Verify'), ('accepted', 'Accepted'),
('refused', 'Refused')], string='State'),
# 'state_2': fields.function([('to_verify', 'To Verify'), ('accepted', 'Accepted'),
# ('refused', 'Refused')], string='State'),
'user_id':fields.many2one('res.users', 'Salesman', readonly=True),
'price_total':fields.float('Total Price', readonly=True),
'total_discount':fields.float('Total Discount', readonly=True),
@@ -50,53 +48,48 @@ class report_pos_order(osv.osv):
'shop_id':fields.many2one('sale.shop', 'Shop', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
'nbr':fields.integer('# of Lines', readonly=True),
'product_qty':fields.float('# of Qty', readonly=True),
'product_qty':fields.integer('# of Qty', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal'),
'statement_journal_id': fields.many2one('account.journal','Cash Register'),
'delay_validation': fields.integer('Delay Validation'),
'delay_payment': fields.integer('Delay Payment'),
'date_validation': fields.date('Validation Date', required=True),
'date_payment': fields.date('Payment Date', required=True),
}
_order = 'date desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'report_pos_order')
cr.execute("""
create or replace view report_pos_order as (
select el.*,
(select 1) as nbr,
to_date(to_char(po.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
po.date_validation as date_validation,
po.date_payment as date_payment,
to_char(po.date_order, 'YYYY') as year,
to_char(po.date_order, 'MM') as month,
to_char(po.date_order, 'YYYY-MM-DD') as day,
(date(po.date_order)-date(po.date_validation)) as delay_validation,
(date(po.date_order)-date(po.date_payment)) as delay_payment,
po.partner_id as partner_id,
po.state as state,
po.state_2 as state_2,
po.user_id as user_id,
po.shop_id as shop_id,
po.company_id as company_id,
po.sale_journal as journal_id,
aj.id as statement_journal_id
from
pos_order as po,account_bank_statement_line absl,account_journal as aj,
( select pl.id as id,
pl.product_id as product_id,
pl.qty as product_qty,
sum(pl.qty * pl.price_unit)- sum(pl.qty * pl.price_ded) as price_total,
sum(pl.qty * pl.price_ded) as total_discount,
((sum(pl.qty * pl.price_unit)-sum(pl.qty * pl.price_ded))/sum(pl.qty)*count(pl.qty))::decimal(16,2) as average_price,
pl.order_id
from
pos_order_line as pl
left join product_template pt on (pt.id=pl.product_id)
group by
pl.id,pl.order_id, pl.qty,pl.product_id) el
where po.id = el.order_id and absl.pos_statement_id = po.id and aj.name = absl.journal_id
)
""")
select
min(l.id) as id,
count(*) as nbr,
to_date(to_char(s.date_order, 'dd-MM-YYYY'),'dd-MM-YYYY') as date,
sum(l.qty * u.factor) as product_qty,
sum(l.qty * l.price_unit) as price_total,
sum(l.qty * l.price_ded) as total_discount,
(sum(l.qty*l.price_unit)/sum(l.qty * u.factor))::decimal(16,2) as average_price,
sum(cast(to_char(date_trunc('day',s.date_validation) - date_trunc('day',s.date_order),'DD') as int)) as delay_validation,
sum(cast(to_char(date_trunc('day',s.date_payment) - date_trunc('day',s.date_order),'DD') as int)) as delay_payment,
to_char(s.date_order, 'YYYY') as year,
to_char(s.date_order, 'MM') as month,
to_char(s.date_order, 'YYYY-MM-DD') as day,
s.partner_id as partner_id,
s.state as state,
s.user_id as user_id,
s.shop_id as shop_id,
s.company_id as company_id,
s.sale_journal as journal_id,
l.product_id as product_id,
s.date_validation,
s.date_payment
from pos_order_line as l
left join pos_order s on (s.id=l.order_id)
left join product_template pt on (pt.id=l.product_id)
left join product_uom u on (u.id=pt.uom_id)
group by
to_char(s.date_order, 'dd-MM-YYYY'),to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),
to_char(s.date_order, 'YYYY-MM-DD'), s.partner_id,s.state,
s.user_id,s.shop_id,s.company_id,s.sale_journal,l.product_id,s.date_validation,
s.date_payment)""")
report_pos_order()
@@ -8,26 +8,25 @@
<field name="arch" type="xml">
<tree string="Point of Sale Analysis">
<field name="date" invisible="1"/>
<field name="date_validation" invisible="1"/>
<field name="date_payment" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="year" invisible="1"/>
<field name="day" invisible="1"/>
<field name="month" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="shop_id" invisible="1"/>
<field name="journal_id" invisible="1"/>
<field name="statement_journal_id" invisible="1"/>
<!--<field name="journal_id" invisible="1"/>-->
<field name="date_validation" invisible="1"/>
<field name="date_payment" invisible="1"/>
<field name="company_id" invisible="1" groups="base.group_multi_company"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_qty" sum="# of Qty"/>
<field name="price_total" sum="Total Price"/>
<field name="average_price" sum="Average Price"/>
<field name="total_discount" sum="Total Discount"/>
<field name="average_price" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="delay_validation"/>
<field name="delay_payment"/>
<field name="state" invisible="1"/>
<!--<field name="state" invisible="1"/>-->
</tree>
</field>
</record>
@@ -58,9 +57,6 @@
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d'))]"
help="POS ordered created by today"/>
<separator orientation="vertical"/>
<filter icon="terp-dolar"
string="Accepted"
domain="[('state_2','=',('to_verify'))]" groups="base.group_extended"/>
<filter icon="terp-dolar"
string="Invoiced"
domain="[('state','=',('invoiced'))]"/>
@@ -82,16 +78,18 @@
<filter string="Customer" icon="terp-personal" context="{'group_by':'partner_id'}"/>
<separator orientation="vertical"/>
<filter string="Product" icon="terp-accessories-archiver" context="{'group_by':'product_id'}"/>
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
<!--<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>-->
<separator orientation="vertical"/>
<filter string="Cash Register" icon="terp-folder-orange" context="{'group_by':'statement_journal_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<!--<filter string="State" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>-->
<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..." groups="base.group_extended">
<field name="date_validation"/>
<field name="date_payment"/>
</group>
</search>
</field>
</record>
@@ -102,9 +100,9 @@
<field name="view_type">form</field>
<field name="view_mode">tree,graph</field>
<field name="search_view_id" ref="view_report_pos_order_search"/>
<field name="context">{'search_default_today':1,'search_default_User':1}</field>
<field name="context">{'search_default_today':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<menuitem action="action_report_pos_order_all" id="menu_report_pos_order_all" parent="menu_point_rep" sequence="1"/>
</data>
</openerp>
</openerp>
@@ -17,5 +17,37 @@
"access_report_sales_by_user_pos_month","report.sales.by.user.pos.month","model_report_sales_by_user_pos_month","point_of_sale.group_pos_user",1,0,0,0
"access_report_sales_by_margin_pos","report.sales.by.margin.pos","model_report_sales_by_margin_pos","point_of_sale.group_pos_user",1,0,0,0
"access_report_sales_by_margin_pos_month","report.sales.by.margin.pos.month","model_report_sales_by_margin_pos_month","point_of_sale.group_pos_user",1,0,0,0
"access_singer_statement","singer.statement","model_singer_statement","point_of_sale.group_pos_user",1,0,0,0
"access_add_product","pos.add.product ","model_pos_add_product","point_of_sale.group_pos_user",1,0,0,0
"access_pos_confirm","pos.confirm","model_pos_confirm","point_of_sale.group_pos_user",1,0,0,0
"access_pos_discount","pos.discount","model_pos_discount","point_of_sale.group_pos_user",1,0,0,0
"access_pos_get_sale","pos.get.sale","model_pos_get_sale","point_of_sale.group_pos_user",1,0,0,0
"access_pos_close_statement","pos.open.statement","model_pos_open_statement","point_of_sale.group_pos_user",1,1,1,0
"access_pos_open_statement","pos.close.statement","model_pos_close_statement","point_of_sale.group_pos_user",1,1,1,0
"acess_pos_box_entries ","pos.box.entries ","model_pos_box_entries","point_of_sale.group_pos_user",1,0,0,0
"access_pos_box_out","pos.box.out","model_pos_box_out","point_of_sale.group_pos_user",1,0,0,0
"access_pos_details ","pos.details ","model_pos_details","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sale_user","pos.sale.user","model_pos_sale_user","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sale_user_today","pos.sales.user.today","model_pos_sales_user_today","point_of_sale.group_pos_user",1,0,0,0
"access_pos_sales_user_today_current_user","pos.sales.user.today.current_user","model_pos_sales_user_today_current_user","point_of_sale.group_pos_user",1,0,0,0
"access_all_closed_cashbox_of_the_day","all.closed.cashbox.of.the.day","model_all_closed_cashbox_of_the_day","point_of_sale.group_pos_user",1,0,0,0
"access_pos_receipt","pos.receipt ","model_pos_receipt","point_of_sale.group_pos_user",1,0,0,0
"access_pos_payment_report_user","pos.payment.report.user","model_pos_payment_report_user","point_of_sale.group_pos_user",1,0,0,0
"access_pos_payment_report_date ","pos.payment.report.date ","model_pos_payment_report_date","point_of_sale.group_pos_user",1,0,0,0
"access_pos_make_payment","pos.make.payment","model_pos_make_payment","point_of_sale.group_pos_user",1,1,1,0
"access_pos_scan_product","pos.scan.product","model_pos_scan_product","point_of_sale.group_pos_user",1,0,0,0
"access_pos_payment_report","pos.payment.report","model_pos_payment_report","point_of_sale.group_pos_user",1,0,0,0
"access_report_pos_order","report.pos.order","model_report_pos_order","point_of_sale.group_pos_user",1,0,0,0
"access_pos_return","pos.return","model_pos_return","point_of_sale.group_pos_user",1,0,0,0
"access_account_bank_statement","account.bank.statement","account.model_account_bank_statement","point_of_sale.group_pos_user",1,1,1,0
"access_account_bank_statement_line","account.bank.statement.line","account.model_account_bank_statement_line","point_of_sale.group_pos_user",1,1,1,0
"access_account_period","account.period","account.model_account_period","point_of_sale.group_pos_user",1,1,1,0
"access_account_fiscalyear","account.fiscalyear","account.model_account_fiscalyear","point_of_sale.group_pos_user",1,1,1,0
"access_account_cashbox_line","account.cashbox.line","account.model_account_cashbox_line","point_of_sale.group_pos_user",1,1,1,0
"access_product_product","product.product","product.model_product_product","point_of_sale.group_pos_user",1,1,1,0
"access_account_move_line","account.move.line","account.model_account_move_line","point_of_sale.group_pos_user",1,1,1,0
"access_account_move","account.move","account.model_account_move","point_of_sale.group_pos_user",1,1,1,0
"access_account_journal","account.journal","account.model_account_journal","point_of_sale.group_pos_user",1,1,1,0
"access_account_journal_view","account.journal.view","account.model_account_journal_view","point_of_sale.group_pos_user",1,1,1,0
"access_account_analytic_line","account.analytic.line","analytic.model_account_analytic_line","point_of_sale.group_pos_user",1,1,1,0
"access_account_analytic_account","account.analytic.account","analytic.model_account_analytic_account","point_of_sale.group_pos_user",1,1,1,0
"access_account_journal_column","account.journal.column","account.model_account_journal_column","point_of_sale.group_pos_user",1,1,1,0
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
17 access_report_sales_by_user_pos_month report.sales.by.user.pos.month model_report_sales_by_user_pos_month point_of_sale.group_pos_user 1 0 0 0
18 access_report_sales_by_margin_pos report.sales.by.margin.pos model_report_sales_by_margin_pos point_of_sale.group_pos_user 1 0 0 0
19 access_report_sales_by_margin_pos_month report.sales.by.margin.pos.month model_report_sales_by_margin_pos_month point_of_sale.group_pos_user 1 0 0 0
20 access_singer_statement access_add_product singer.statement pos.add.product model_singer_statement model_pos_add_product point_of_sale.group_pos_user 1 0 0 0
21 access_pos_confirm pos.confirm model_pos_confirm point_of_sale.group_pos_user 1 0 0 0
22 access_pos_discount pos.discount model_pos_discount point_of_sale.group_pos_user 1 0 0 0
23 access_pos_get_sale pos.get.sale model_pos_get_sale point_of_sale.group_pos_user 1 0 0 0
24 access_pos_close_statement pos.open.statement model_pos_open_statement point_of_sale.group_pos_user 1 1 1 0
25 access_pos_open_statement pos.close.statement model_pos_close_statement point_of_sale.group_pos_user 1 1 1 0
26 acess_pos_box_entries pos.box.entries model_pos_box_entries point_of_sale.group_pos_user 1 0 0 0
27 access_pos_box_out pos.box.out model_pos_box_out point_of_sale.group_pos_user 1 0 0 0
28 access_pos_details pos.details model_pos_details point_of_sale.group_pos_user 1 0 0 0
29 access_pos_sale_user pos.sale.user model_pos_sale_user point_of_sale.group_pos_user 1 0 0 0
30 access_pos_sale_user_today pos.sales.user.today model_pos_sales_user_today point_of_sale.group_pos_user 1 0 0 0
31 access_pos_sales_user_today_current_user pos.sales.user.today.current_user model_pos_sales_user_today_current_user point_of_sale.group_pos_user 1 0 0 0
32 access_all_closed_cashbox_of_the_day all.closed.cashbox.of.the.day model_all_closed_cashbox_of_the_day point_of_sale.group_pos_user 1 0 0 0
33 access_pos_receipt pos.receipt model_pos_receipt point_of_sale.group_pos_user 1 0 0 0
34 access_pos_payment_report_user pos.payment.report.user model_pos_payment_report_user point_of_sale.group_pos_user 1 0 0 0
35 access_pos_payment_report_date pos.payment.report.date model_pos_payment_report_date point_of_sale.group_pos_user 1 0 0 0
36 access_pos_make_payment pos.make.payment model_pos_make_payment point_of_sale.group_pos_user 1 1 1 0
37 access_pos_scan_product pos.scan.product model_pos_scan_product point_of_sale.group_pos_user 1 0 0 0
38 access_pos_payment_report pos.payment.report model_pos_payment_report point_of_sale.group_pos_user 1 0 0 0
39 access_report_pos_order report.pos.order model_report_pos_order point_of_sale.group_pos_user 1 0 0 0
40 access_pos_return pos.return model_pos_return point_of_sale.group_pos_user 1 0 0 0
41 access_account_bank_statement account.bank.statement account.model_account_bank_statement point_of_sale.group_pos_user 1 1 1 0
42 access_account_bank_statement_line account.bank.statement.line account.model_account_bank_statement_line point_of_sale.group_pos_user 1 1 1 0
43 access_account_period account.period account.model_account_period point_of_sale.group_pos_user 1 1 1 0
44 access_account_fiscalyear account.fiscalyear account.model_account_fiscalyear point_of_sale.group_pos_user 1 1 1 0
45 access_account_cashbox_line account.cashbox.line account.model_account_cashbox_line point_of_sale.group_pos_user 1 1 1 0
46 access_product_product product.product product.model_product_product point_of_sale.group_pos_user 1 1 1 0
47 access_account_move_line account.move.line account.model_account_move_line point_of_sale.group_pos_user 1 1 1 0
48 access_account_move account.move account.model_account_move point_of_sale.group_pos_user 1 1 1 0
49 access_account_journal account.journal account.model_account_journal point_of_sale.group_pos_user 1 1 1 0
50 access_account_journal_view account.journal.view account.model_account_journal_view point_of_sale.group_pos_user 1 1 1 0
51 access_account_analytic_line account.analytic.line analytic.model_account_analytic_line point_of_sale.group_pos_user 1 1 1 0
52 access_account_analytic_account account.analytic.account analytic.model_account_analytic_account point_of_sale.group_pos_user 1 1 1 0
53 access_account_journal_column account.journal.column account.model_account_journal_column point_of_sale.group_pos_user 1 1 1 0
@@ -1,7 +1,69 @@
<?xml version="1.0" ?>
<openerp>
<data>
<record id="pos_visa_journal" model="account.journal">
<field name="name">Visa Journal</field>
<field name="code">VIJ</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="pos_cash_journal" model="account.journal">
<field name="name">Cash Journal</field>
<field name="code">CAJ</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="pos_bankcard_journal" model="account.journal">
<field name="name">Bancontact Journal</field>
<field name="code">BACJ</field>
<field name="type">cash</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_sale_journal"/>
<field model="account.account" name="default_credit_account_id" ref="account.a_sale"/>
<field model="account.account" name="default_debit_account_id" ref="account.a_sale"/>
<field name="user_id" ref="base.user_root"/>
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.sales_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.refund_sales_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.expenses_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.refund_expenses_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.bank_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="account.check_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
<record id="stock.stock_journal" model="account.journal">
<field eval="[(6,0,[ref('base.user_root')])]" name="journal_users"/>
</record>
</data>
</openerp>
+90 -456
View File
@@ -1,480 +1,114 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_account_journal_form">
<field name="name">Journal</field>
<record model="ir.ui.view" id="view_account_journal_pos_user_form">
<field name="name">POS Journal</field>
<field name="model">account.journal</field>
<field name="type">form</field>
<field name="priority">10</field>
<field name="inherit_id" ref="account.view_account_journal_form"/>
<field name="arch" type="xml">
<field name="invoice_sequence_id" position="after">
<field name="statement_sequence_id"/>
<field name="auto_cash"/>
<field name="check_dtls"/>
<field name="special_journal"/>
</field>
</field>
</record>
<!-- Bank Statement -->
<record id="view_bank_statement_tree" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
<field name="model">account.bank.statement</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end);black:state in ('open');blue:state in ('draft')" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="user_id"/>
<field name="state"/>
<button type="object" string="Open" name="button_open" states="draft" icon="terp-camera_test"/>
<button type="object" string="Confirm" name="button_confirm" states="open" icon="terp-gtk-go-back-rtl"/>
<button type="object" string="Cancel" name="button_cancel" states="confirm" icon="terp-gtk-stop"/>
</tree>
</field>
</record>
<record id="view_bank_statement_form2" model="ir.ui.view">
<field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Statement">
<field name="name" select="1"/>
<field name="user_id" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash'),('auto_cash','=',False)]" select="1" />
<newline/>
<field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="closing_date" select="1" attrs="{'readonly':[('state','=','confirm')]}"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<notebook colspan="4">
<page string="Starting Details">
<field name="starting_details_ids" nolabel = "1" colspan="4">
<tree string = "Starting Details" editable="bottom">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal" sum="Total"/>
</tree>
<form string = "Ending Details">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal"/>
</form>
</field>
</page>
<page string="Ending Details">
<field name="ending_details_ids" nolabel = "1" colspan="4">
<tree string = "Ending Details" editable="bottom">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal" sum="Total"/>
</tree>
<form string = "Ending Details">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal"/>
</form>
</field>
</page>
<page string="Entry encoding">
<field colspan="4" name="line_ids" nolabel="1">
<tree editable="bottom" string="Statement lines">
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount"/>
</tree>
<form string="Statement lines">
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount"/>
<field name="name"/>
<field name="ref"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
</field>
</page>
</notebook>
<group col="7" colspan="4">
<field name="state" colspan="4"/>
<field name="total_entry_encoding"/>
<xpath expr="//notebook[last()]" position="inside">
<page string="Point of Sale">
<group col="6" colspan="4">
<separator colspan="6" string="Extended Configureation"/>
<field name="check_dtls"/>
<field name="auto_cash"/>
<field name="special_journal"/>
</group>
<group colspan="4">
<button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" string="Cancel" type="object" icon="gtk-cancel" groups="base.group_extended"/>
</group>
</form>
</field>
</record>
<record id="view_bank_statement_form1" model="ir.ui.view">
<field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Statement">
<field name="name" select="1"/>
<field name="user_id" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" readonly="1"/>
<newline/>
<field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="closing_date" select="1" attrs="{'readonly':[('state','=','confirm')]}"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<notebook colspan="4">
<page string="Details">
<field name="ending_details_ids" nolabel = "1" colspan="4">
<tree string = "Ending Details" editable="bottom">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal" sum="Total"/>
</tree>
<form string = "Ending Details">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number, parent.balance_end)"/>
<field name="subtotal"/>
</form>
</field>
<separator colspan="4" string="Users"/>
<field name="journal_users" nolabel="1" colspan="4"/>
</page>
<page string="Entry encoding">
<field colspan="4" name="line_ids" nolabel="1">
<tree editable="bottom" string="Statement lines">
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount"/>
</tree>
<form string="Statement lines">
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount"/>
<field name="name"/>
<field name="ref"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
</field>
</page>
</notebook>
<group col="7" colspan="4">
<field name="state" colspan="4"/>
<field name="total_entry_encoding"/>
</group>
<group colspan="4">
<button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" icon="gtk-cancel" string="Cancel" type="object" groups="base.group_extended"/>
</group>
</form>
</field>
</record>
<record id="action_bank_statement_tree_all" model="ir.actions.act_window">
<field name="name">My CashBoxes</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="domain">[('user_id','=',uid)]</field>
</record>
<record model="ir.actions.act_window.view" id="act_statement1_all">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_bank_statement_tree_all"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement2_all">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form1"/>
<field name="act_window_id" ref="action_bank_statement_tree_all"/>
</record>
<!-- <menuitem action="action_bank_statement_tree_all" id="menu_statement_tree_all" parent="point_of_sale.menu_point_root" sequence="2"/-->
<!-- <menuitem action="action_bank_statement_tree_all" id="menu_statement_tree_all" parent="point_of_sale.menu_point_root" sequence="2"/>
-->
<menuitem name="Cashboxes" parent="point_of_sale.menu_point_root" id="menu_statement_tree_all" sequence="3"/>
<record id="action_bank_statement_tree1" model="ir.actions.act_window">
<field name="name">My Cashboxes to Close</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="domain">[('state','=','open'), ('user_id','=',uid)]</field>
</record>
<record model="ir.actions.act_window.view" id="act_statement1">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_bank_statement_tree1"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement2">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form1"/>
<field name="act_window_id" ref="action_bank_statement_tree1"/>
</record>
<!-- <menuitem action="action_bank_statement_tree1" id="menu_statement_tree1" parent="menu_statement_tree_all" sequence="2"/>-->
<record id="view_bank_statement_form3" model="ir.ui.view">
<field name="name">account.bank.statement.form</field>
<field name="model">account.bank.statement</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Statement">
<field name="name" select="1"/>
<field name="user_id" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<field name="journal_id" on_change="onchange_journal_id(journal_id)" domain="[('type','=','cash')]" select="1" readonly="1"/>
<newline/>
<field name="date" select="1" attrs="{'readonly':[('state','!=','draft')]}"/>
<field name="closing_date" select="1" attrs="{'readonly':[('state','=','confirm')]}"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<notebook colspan="4">
<page string="Entry encoding">
<field colspan="4" name="line_ids" nolabel="1">
<tree editable="bottom" string="Statement lines">
<field name="name"/>
<field name="ref"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount" />
</tree>
<form string="Statement lines">
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
<field name="amount"/>
<field name="name"/>
<field name="ref"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</form>
</field>
</page>
<page string="Starting Details">
<field name="balance_end" colspan="4" nolabel="1"/>
<newline/>
<field name="starting_details_ids" nolabel = "1" colspan="4">
<tree string = "Starting Details" editable="bottom">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number)"/>
<field name="subtotal" sum="Total"/>
</tree>
<form string = "Starting Details">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number)"/>
<field name="subtotal"/>
</form>
</field>
</page>
<page string="Ending Details">
<field name="ending_details_ids" nolabel = "1" colspan="4">
<tree string = "Ending Details" editable="bottom">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number)"/>
<field name="subtotal" sum="Total"/>
</tree>
<form string = "Ending Details">
<field name="pieces"/>
<field name="number" on_change="on_change_sub(pieces,number)"/>
<field name="subtotal"/>
</form>
</field>
</page>
</notebook>
<group col="7" colspan="4">
<field name="state" colspan="4"/>
<field name="total_entry_encoding"/>
</group>
<group colspan="4">
<button name="button_dummy" states="draft" icon="gtk-execute" string="Compute"/>
<button name="button_confirm" states="open" icon="terp-gtk-go-back-rtl" string="Close CashBox" type="object"/>
<button name="button_open" states="draft" icon="terp-camera_test" string="Open CashBox" type="object"/>
<button name="button_cancel" states="confirm" icon="gtk-cancel" string="Cancel" type="object" groups="base.group_extended"/>
</group>
</form>
</xpath>
</field>
</record>
<record id="view_bank_statement_tree2" model="ir.ui.view">
<field name="name">account.bank.statement.tree</field>
<field name="model">account.bank.statement</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:balance_end_real!=balance_end;blue:state=='draft' and (balance_end_real==balance_end)" string="Statement">
<field name="date"/>
<field name="name"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="balance_start"/>
<field name="balance_end_real"/>
<field name="balance_end"/>
<field name="state"/>
</tree>
</field>
</record>
<record id="action_bank_statement_treenew" model="ir.actions.act_window">
<field name="name">Open a CashBox</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_id" ref="view_bank_statement_form2"/>
<field name="domain">[('state','=','draft'),('user_id','=',uid)]</field>
</record>
<record model="ir.actions.act_window.view" id="act_statement12">
<field name="sequence" eval="2"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree2"/>
<field name="act_window_id" ref="action_bank_statement_treenew"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement22">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form2"/>
<field name="act_window_id" ref="action_bank_statement_treenew"/>
</record>
<!-- <menuitem action="action_bank_statement_treenew" id="menu_statement_tree2" parent="menu_statement_tree_all" sequence="1"/>-->
<menuitem action="action_bank_statement_treenew" id="menu_statement_tree2" parent="menu_statement_tree_all" sequence="1"/>
<record id="view_account_bank_statment_filter" model="ir.ui.view">
<field name="name">account.bank.statment.select</field>
<field name="model">account.bank.statement</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Cashbox">
<group col='9' colspan='4'>
<filter icon="terp-camera_test" string="Open"
domain="[('state','=','open')]"
help="All open cashboxes"/>
<filter icon="terp-dialog-close" string="To Close"
domain="[('state','=','draft')]"
help="All cashboxes to close"/>
<filter icon="terp-go-today" name="Today" string="Today"
domain="[('date','&lt;=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
help="All cashboxes to opened today"/>
<separator orientation="vertical"/>
<field name="name"/>
</group>
<newline/>
<group expand="0" string="Group By..." colspan="4" col="20">
<filter string="Journal" icon="terp-folder-blue" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_pos_account_bank_statment">
<field name="name">All Cashboxes</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_Today':1}</field>
<field name="search_view_id" ref="view_account_bank_statment_filter"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement_a1">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_pos_account_bank_statment"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement_a2">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form3"/>
<field name="act_window_id" ref="action_pos_account_bank_statment"/>
</record>
<menuitem name="All Cashboxes" parent="menu_statement_tree_all"
action="action_pos_account_bank_statment" id="menu_pos_bank_statment_tree" groups="base.group_extended" sequence="4"/>
<record model="ir.actions.act_window" id="action_my_all_pos_account_bank_statment">
<field name="name">All My Cashboxes</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="domain">[('user_id','=',uid)]</field>
</record>
<record model="ir.actions.act_window.view" id="act_my_all_statement_a1">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_my_all_pos_account_bank_statment"/>
</record>
<record model="ir.actions.act_window.view" id="act_my_all_statement_a2">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form1"/>
<field name="act_window_id" ref="action_my_all_pos_account_bank_statment"/>
</record>
<!-- <menuitem name="All My Cashboxes" parent="menu_statement_tree_all"-->
<!-- action="action_my_all_pos_account_bank_statment" id="menu_my_pos_bank_statment_tree" sequence="3"/>-->
<record model="ir.actions.act_window" id="action_cashboxes_to_close">
<field name="name">Cashboxes to Close</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','draft')]</field>
</record>
<record model="ir.actions.act_window.view" id="act_statement_a5">
<field name="sequence" eval="1"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="view_bank_statement_tree"/>
<field name="act_window_id" ref="action_cashboxes_to_close"/>
</record>
<record model="ir.actions.act_window.view" id="act_statement_a6">
<field name="sequence" eval="1"/>
<field name="view_mode">form</field>
<field name="view_id" ref="view_bank_statement_form1"/>
<field name="act_window_id" ref="action_cashboxes_to_close"/>
</record>
<!-- <menuitem name="Cashboxes to Close" parent="menu_statement_tree_all"-->
<!-- action="action_cashboxes_to_close" id="menu_cashboxes_to_close_tree" groups="base.group_extended"/>-->
<menuitem name="Cash Register" parent="point_of_sale.menu_point_root" id="menu_cash_register" sequence="4"/>
<menuitem
name="Open Registers" parent="point_of_sale.menu_point_config"
string="Open Register"
name="All Cash Registers"
parent="menu_cash_register"
action="account.action_view_bank_statement_tree"
id="menu_all_menu_cash_register"
sequence="4"
/>
<record id="action_new_bank_statement_tree" model="ir.actions.act_window">
<field name="name">Cash Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="search_view_id" ref="account.view_account_bank_statement_filter"/>
<field name="domain">[('journal_id.type', '=', 'cash')]</field>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement1_all">
<field name="sequence" eval="5"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="account.view_bank_statement_tree"/>
<field name="act_window_id" ref="action_new_bank_statement_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement2_all">
<field name="sequence" eval="0"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="act_window_id" ref="action_new_bank_statement_tree"/>
</record>
<record id="action_new_bank_statement_all_tree" model="ir.actions.act_window">
<field name="name">All Register</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="search_view_id" ref="account.view_account_bank_statement_filter"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement_all_register1">
<field name="sequence" eval="0"/>
<field name="view_mode">tree</field>
<field name="view_id" ref="account.view_bank_statement_tree"/>
<field name="act_window_id" ref="action_new_bank_statement_all_tree"/>
</record>
<record model="ir.actions.act_window.view" id="act_cash_statement_all_register">
<field name="sequence" eval="5"/>
<field name="view_mode">form</field>
<field name="view_id" ref="account.view_bank_statement_form2"/>
<field name="act_window_id" ref="action_new_bank_statement_all_tree"/>
</record>
<menuitem
name="All Registers"
parent="menu_cash_register"
action="action_new_bank_statement_all_tree"
id="menu_all_menu_all_register"
sequence="4"
/>
<menuitem
name="Open a Cash Registers"
parent="menu_cash_register"
action="action_new_bank_statement_tree"
id="menu_new_cash_register"
sequence="3"
/>
<menuitem name="Opening Operations" parent="point_of_sale.menu_point_root"
id="menu_point_open_config" sequence="1"/>
<menuitem
name="Open my Cash Registers" parent="menu_point_open_config"
string="Open my Cash Register"
action="action_pos_open_statement"
id="menu_open_statement" sequence="1" />
<menuitem icon="STOCK_PRINT"
action="action_report_all_closed_cashbox_of_the_day"
id="menu_all_closed_cashbox_of_the_day"
parent="menu_statement_tree_all"/>
<menuitem name="Closing Operations" parent="point_of_sale.menu_point_root"
id="menu_point_close_config" sequence="3"/>
<menuitem
name="Close Register" parent="point_of_sale.menu_point_config"
string="Close Register"
name="Close my Cash Register" parent="menu_point_close_config"
string="Close my Cash Register"
action="action_pos_close_statement"
id="menu_close_statement" sequence="2" />
<menuitem icon="STOCK_PRINT"
action="action_report_all_closed_cashbox_of_the_day"
id="menu_all_closed_cashbox_of_the_day"
parent="menu_point_report_register"/>
</data>
</openerp>
@@ -35,14 +35,16 @@ def get_journal(self, cr, uid, context):
"""
obj = self.pool.get('account.journal')
statement_obj = self.pool.get('account.bank.statement')
user = self.pool.get('res.users').browse(cr, uid, uid)
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', user.company_id.id)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res.insert(0, ('', ''))
obj_ids= statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', 'in', ids)])
res_obj = obj.read(cr, uid, ids, ['journal_id'], context)
res_obj = [(r1['id'])for r1 in res_obj]
res = statement_obj.read(cr, uid, obj_ids, ['journal_id'], context)
res = [(r['journal_id']) for r in res]
return res
class pos_box_entries(osv.osv_memory):
_name = 'pos.box.entries'
_description = 'Pos Box Entries'
@@ -62,15 +64,15 @@ class pos_box_entries(osv.osv_memory):
obj = self.pool.get('product.product')
ids = obj.search(cr, uid, [('income_pdt', '=', True)])
res = obj.read(cr, uid, ids, ['id', 'name'], context)
res = [(r['id'], r['name']) for r in res]
res = [(r['id'],r['name']) for r in res]
res.insert(0, ('', ''))
return res
_columns = {
'name': fields.char('Name', size=32, required=True),
'journal_id': fields.selection(get_journal, "Journal", required=True),
'name': fields.char('Description', size=32, required=True),
'journal_id': fields.selection(get_journal, "Register", required=True),
'product_id': fields.selection(_get_income_product, "Operation", required=True),
'amount': fields.float('Amount', digits=(16, 2)),
'ref': fields.char('Ref', size=32),
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<!-- Box Entries -->
<record id="view_box_entries" model="ir.ui.view">
<field name="name">Box Entries</field>
<field name="model">pos.box.entries</field>
@@ -14,11 +14,11 @@
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="ref"/>
<!-- <field name="ref"/>-->
<group colspan="4" col="2">
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="get_in" string="Make Entries in the CashBox"
<button name="get_in" string="Take Money"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
@@ -31,8 +31,8 @@
<field name="res_model">pos.box.entries</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="target">new</field>
</record>
</data>
</openerp>
</openerp>
+8 -8
View File
@@ -49,8 +49,8 @@ class pos_box_out(osv.osv_memory):
return res
_columns = {
'name': fields.char('Name', size=32, required=True),
'journal_id': fields.selection(pos_box_entries.get_journal, "Journal", required=True),
'name': fields.char('Description', size=32, required=True),
'journal_id': fields.selection(pos_box_entries.get_journal, "Register", required=True),
'product_id': fields.selection(_get_expense_product, "Operation", required=True),
'amount': fields.float('Amount', digits=(16, 2)),
'ref': fields.char('Ref', size=32),
@@ -62,12 +62,12 @@ class pos_box_out(osv.osv_memory):
def get_out(self, cr, uid, ids, context):
"""
Create the entries in the CashBox .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
Create the entries in the CashBox .
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return :Return of operation of product
"""
args = {}
statement_obj = self.pool.get('account.bank.statement')
+7 -7
View File
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<data>
<!-- Box Entries -->
<record id="view_pos_box_out" model="ir.ui.view">
<field name="name">Box Out</field>
<field name="model">pos.box.out</field>
@@ -14,11 +14,11 @@
<field name="journal_id"/>
<field name="product_id"/>
<field name="amount"/>
<field name="ref"/>
<!-- <field name="ref"/>-->
<group colspan="4" col="2">
<button icon='gtk-cancel' special="cancel"
string="Close" />
<button name="get_out" string="Make Entries in the CashBox"
<button name="get_out" string="Put Money"
colspan="1" type="object" icon="gtk-ok" />
</group>
</form>
@@ -31,8 +31,8 @@
<field name="res_model">pos.box.out</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
<field name="target">new</field>
</record>
</data>
</openerp>
</openerp>
@@ -22,7 +22,6 @@
from osv import osv
from tools.translate import _
class pos_close_statement(osv.osv_memory):
_name = 'pos.close.statement'
_description = 'Close Statements'
@@ -38,27 +37,55 @@ class pos_close_statement(osv.osv_memory):
"""
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
list_statement = []
mod_obj = self.pool.get('ir.model.data')
statement_obj = self.pool.get('account.bank.statement')
journal_obj = self.pool.get('account.journal')
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True), ('check_dtls', '=', False)])
journal_ids = journal_obj.browse(cr, uid, journal_lst)
user_obj="""select DISTINCT journal_id from pos_journal_users where user_id=%d"""%(uid)
cr.execute(user_obj)
user_journals1= cr.fetchall()
lst1=map(lambda x1:x1[0],user_journals1)
journal_ids = journal_obj.browse(cr, uid, lst1)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
list_statement = ids
statement_obj.button_confirm(cr, uid, ids, context)
if not list_statement:
return {}
sql = """ select id from account_journal
where auto_cash = 'True'
and company_id =%d and id =%d"""%(company_id,journal.id)
cr.execute(sql)
user_journals= cr.fetchall()
lst=map(lambda x1:x1[0],user_journals)
journal_ids1 = journal_obj.browse(cr, uid, lst)
#list_statement=[]
for journal1 in journal_ids1:
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
if not ids:
raise osv.except_osv(_('Message'), _('Journals are allready closed'))
else:
list_statement.append(ids[0])
if not journal.check_dtls:
statement_obj.button_confirm_bank(cr, uid, ids, context)
# if not list_statement:
# return {}
# model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_bank_statement_tree')], context=context)
# resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')
id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
return {
'domain': "[('id','in', list_statement)]",
'domain': "[('id','in'," + str(list_statement) + ")]",
'name': 'Close Statements',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.bank.statement',
'view_id': False,
'type': 'ir.actions.act_window'
}
'views': [(id2, 'tree'),(id3, 'form')],
'type': 'ir.actions.act_window'}
pos_close_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -23,7 +23,6 @@ from osv import osv
from tools.translate import _
import time
class pos_open_statement(osv.osv_memory):
_name = 'pos.open.statement'
_description = 'Open Statements'
@@ -38,67 +37,91 @@ class pos_open_statement(osv.osv_memory):
@return : Blank Directory
"""
list_statement = []
mod_obj = self.pool.get('ir.model.data')
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
statement_obj = self.pool.get('account.bank.statement')
singer_obj = self.pool.get('singer.statement')
sequence_obj = self.pool.get('ir.sequence')
journal_obj = self.pool.get('account.journal')
journal_lst = journal_obj.search(cr, uid, [('company_id', '=', company_id), ('auto_cash', '=', True)])
journal_ids = journal_obj.browse(cr, uid, journal_lst)
user_obj="""select DISTINCT journal_id from pos_journal_users where user_id=%d"""%(uid)
cr.execute(user_obj)
user_journals1= cr.fetchall()
lst1=map(lambda x1:x1[0],user_journals1)
journal_ids = journal_obj.browse(cr, uid, lst1)
for journal in journal_ids:
ids = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
if len(ids):
raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s". \n Please close the cashbox related to. ' % (journal.name)))
sql = """ Select id from account_bank_statement
where journal_id=%d
and company_id =%d
order by id desc limit 1""" % (journal.id, company_id)
sql = """ select id from account_journal
where auto_cash = 'True'
and company_id =%d and id =%d"""%(company_id,journal.id)
cr.execute(sql)
st_id = cr.fetchone()
number = ''
if journal.statement_sequence_id:
number = sequence_obj.get_id(cr, uid, journal.id)
else:
number = sequence_obj.get(cr, uid,
'account.bank.statement')
user_journals= cr.fetchall()
lst=map(lambda x1:x1[0],user_journals)
journal_ids1 = journal_obj.browse(cr, uid, lst)
# statement_id=statement_obj.create(cr,uid,{'journal_id':journal.id,
# 'company_id':company_id,
# 'user_id':uid,
# 'state':'open',
# 'name':number
# })
period = statement_obj._get_period(cr, uid, context) or None
cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id, company_id, uid, number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
cr.execute("select id from account_bank_statement where journal_id=%d and company_id=%d and user_id=%d and state='open' and name='%s'"%(journal.id, company_id, uid, number))
statement_id = cr.fetchone()[0]
if st_id:
statemt_id = statement_obj.browse(cr, uid, st_id[0])
list_statement.append(statemt_id.id)
if statemt_id and statemt_id.ending_details_ids:
statement_obj.write(cr, uid, [statement_id], {
'balance_start': statemt_id.balance_end,
'state': 'open',
})
if statemt_id.ending_details_ids:
for i in statemt_id.ending_details_ids:
c = singer_obj.create(cr, uid, {
'pieces': i.pieces,
'number': i.number,
'starting_id': statement_id,
})
return {
'domain': "[('id','in', ["+','.join(map(str,list_statement))+"])]",
'name': 'Open Statement',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.bank.statement',
'view_id': False, # TODO: REFERENCE RIGHT VIEWS
'type': 'ir.actions.act_window'
}
return {}
for journal1 in journal_ids1:
ids1 = statement_obj.search(cr, uid, [('state', '!=', 'confirm'), ('user_id', '=', uid), ('journal_id', '=', journal.id)])
if len(ids):
raise osv.except_osv(_('Message'), _('You can not open a Cashbox for "%s". \n Please close the cashbox related to. ' %(journal.name)))
sql = """ Select id from account_bank_statement
where journal_id =%d
and company_id =%d
order by id desc limit 1""" %(journal.id, company_id)
cr.execute(sql)
st_id = cr.fetchone()
number = ''
if journal.sequence_id:
number = sequence_obj.get_id(cr, uid, journal.id)
else:
number = sequence_obj.get(cr, uid,
'account.bank.statement')
statement_id=statement_obj.create(cr,uid,{'journal_id':journal.id,
'company_id':company_id,
'user_id':uid,
'state':'open',
'name':number
})
statement_obj.button_open(cr,uid,[statement_id],context)
# period = statement_obj._get_period(cr, uid, context) or None
# cr.execute("INSERT INTO account_bank_statement(journal_id,company_id,user_id,state,name, period_id,date) VALUES(%d,%d,%d,'open','%s',%d,'%s')"%(journal.id, company_id, uid, number, period, time.strftime('%Y-%m-%d %H:%M:%S')))
# cr.commit()
# cr.execute("select id from account_bank_statement where journal_id=%d and company_id=%d and user_id=%d and state='open' and name='%s'"%(journal.id, company_id, uid, number))
# statement_id = cr.fetchone()[0]
# print "statement_id",statement_id
# if st_id:
# statemt_id = statement_obj.browse(cr, uid, st_id[0])
# list_statement.append(statemt_id.id)
# if statemt_id and statemt_id.ending_details_ids:
# statement_obj.write(cr, uid, [statement_id], {
# 'balance_start': statemt_id.balance_end,
# 'state': 'open',
# })
# if statemt_id.ending_details_ids:
# for i in statemt_id.ending_details_ids:
# c = statement_obj.create(cr, uid, {
# 'pieces': i.pieces,
# 'number': i.number,
# 'starting_id': statement_id,
# })
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_tree')
id3 = data_obj._get_id(cr, uid, 'account', 'view_bank_statement_form2')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
if id3:
id3 = data_obj.browse(cr, uid, id3, context=context).res_id
return {
# 'domain': "[('id','in', ["+','.join(map(str,list_statement))+"])]",
'domain': "[('state','=','open')]",
'name': 'Open Statement',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.bank.statement',
'views': [(id2, 'tree'),(id3, 'form')],
'type': 'ir.actions.act_window'
}
pos_open_statement()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+154 -67
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -31,31 +31,31 @@ import pos_receipt
class pos_make_payment(osv.osv_memory):
_name = 'pos.make.payment'
_description = 'Point of Sale Payment'
def default_get(self, cr, uid, fields, context):
"""
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
active_id = context and context.get('active_id',False)
if active_id:
active_id = context and context.get('active_id',False)
if active_id:
j_obj = self.pool.get('account.journal')
company_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
journal = journal[0]
else:
journal = None
wf_service = netsvc.LocalService("workflow")
order_obj=self.pool.get('pos.order')
order = order_obj.browse(cr, uid, active_id, context)
#get amount to pay
@@ -66,50 +66,50 @@ class pos_make_payment(osv.osv_memory):
elif order.amount_paid > 0.0:
order_obj.write(cr, uid, [active_id], {'state': 'advance'})
invoice_wanted_checked = False
current_date = time.strftime('%Y-%m-%d')
if 'journal' in fields:
res.update({'journal':journal})
res.update({'journal':journal})
if 'amount' in fields:
res.update({'amount':amount})
res.update({'amount':amount})
if 'invoice_wanted' in fields:
res.update({'invoice_wanted':invoice_wanted_checked})
res.update({'invoice_wanted':invoice_wanted_checked})
if 'payment_date' in fields:
res.update({'payment_date':current_date})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
return res
def view_init(self, cr, uid, fields_list, context=None):
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
active_id = context and context.get('active_id', False) or False
active_id = context and context.get('active_id', False) or False
if active_id:
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if not order.lines:
raise osv.except_osv('Error!','No order lines defined for this sale ')
return True
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
"""
"""
Changes the view dynamically
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@param context: A standard dictionary
@return: New arch of view.
"""
result = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
active_model = context.get('active_model')
active_id = context.get('active_id', False)
if not active_id or (active_model and active_model != 'pos.order'):
return result
return result
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if order.amount_total == order.amount_paid:
result['arch'] = """ <form string="Make Payment" colspan="4">
@@ -120,22 +120,23 @@ class pos_make_payment(osv.osv_memory):
<button name="print_report" string="Print Receipt" type="object" icon="gtk-print"/>
</group>
</form>
"""
"""
return result
def check(self, cr, uid, ids, context):
"""Check the order:
if the order is not paid: continue payment,
if the order is paid print invoice (if wanted) or ticket.
"""
active_id = context and context.get('active_id',False)
active_id = context and context.get('active_id',False)
order_obj = self.pool.get('pos.order')
jrnl_obj = self.pool.get('account.journal')
jrnl_obj = self.pool.get('account.journal')
order = order_obj.browse(cr, uid, active_id, context)
order_name = order.name
amount = order.amount_total - order.amount_paid
data = self.read(cr, uid, ids)[0]
# Todo need to check ...
if amount !=0.0:
invoice_wanted = data['invoice_wanted']
@@ -143,61 +144,140 @@ class pos_make_payment(osv.osv_memory):
if data.get('journal',False):
jrnl_used=jrnl_obj.browse(cr, uid, data['journal'])
order_obj.write(cr, uid, [active_id], {'invoice_wanted': invoice_wanted})
order_obj.add_payment(cr, uid, active_id, data, context=context)
order_obj.add_payment(cr, uid, active_id, data, context=context)
res_obj = self.pool.get('res.company')
inv_ref = self.pool.get('account.invoice')
inv_line_ref = self.pool.get('account.invoice.line')
product_obj= self.pool.get('product.product')
inv_ids = []
for order in self.pool.get('pos.order').browse(cr, uid, ids, context):
# curr_c = order.user_salesman_id.company_id
make_obj = self.pool.get('pos.make.payment').browse(cr, uid, uid)
if invoice_wanted:
if order.invoice_id:
inv_ids.append(order.invoice_id.id)
# continue
# if not make_obj.partner_id:
# raise osv.except_osv(_('Error'), _('Please provide a partner for the sale.'))
acc= make_obj.partner_id.property_account_receivable.id
inv = {
'name': 'Invoice from POS: '+order_name,
'origin': order_name,
'account_id':acc,
'journal_id':order.sale_journal.id or None,
'type': 'out_invoice',
'reference': order.name,
'partner_id': make_obj.partner_id.id,
'comment': order.note or '',
}
inv.update(inv_ref.onchange_partner_id(cr, uid, [], 'out_invoice', make_obj.partner_id.id)['value'])
if not inv.get('account_id', None):
inv['account_id'] = acc
inv_id = inv_ref.create(cr, uid, inv, context)
self.write(cr, uid, [order.id], {'invoice_id': inv_id, 'state': 'invoiced'})
inv_ids.append(inv_id)
for line in order.lines:
inv_line = {
'invoice_id': inv_id,
'product_id': line.product_id.id,
'quantity': line.qty,
}
inv_name = product_obj.name_get(cr, uid, [line.product_id.id], context=context)[0][1]
inv_line.update(inv_line_ref.product_id_change(cr, uid, [],
line.product_id.id,
line.product_id.uom_id.id,
line.qty, partner_id = make_obj.partner_id.id, fposition_id=make_obj.partner_id.property_account_position.id)['value'])
# inv_line['price_unit'] = line.price_unit
# inv_line['discount'] = line.discount
# inv_line['account_id'] = acc
# inv_line['name'] = inv_name
inv_line['price_unit'] = amount
inv_line['discount'] = line.discount
inv_line['account_id'] = acc
inv_line['name'] = inv_name
inv_line['invoice_line_tax_id'] = ('invoice_line_tax_id' in inv_line)\
and [(6, 0, inv_line['invoice_line_tax_id'])] or []
inv_line_ref.create(cr, uid, inv_line, context)
for i in inv_ids:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'account.invoice', i, 'invoice_open', cr)
# return inv_ids
# Todo need to check
# if amount<=0.0:
# context.update({'flag':True})
# order_obj.action_paid(cr,uid,[active_id],context)
if order_obj.test_paid(cr, uid, [active_id]):
if order.partner_id and order.invoice_wanted:
return self.create_invoice(cr, uid, ids, context)
else:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
# def test_paid(self, cr, uid, ids, context=None):
# """ Test all amount is paid for this order
# @return: True
# """
# for order in self.browse(cr, uid, ids, context):
# if order.lines and not order.amount_total:
# return True
# if (not order.lines) or (not order.statement_ids) or \
# Decimal(str(order.amount_total))!=Decimal(str(order.amount_paid)):
# return False
# return True
# if order_obj.test_paid(cr, uid, [active_id]):
if order_obj.browse(cr, uid, [active_id]):
if make_obj.partner_id and make_obj.invoice_wanted:
order_obj.write(cr, uid, [active_id],{'state':'paid'})
if context.get('return'):
order_obj.write(cr, uid, [active_id],{'state':'done'})
order_obj.write(cr, uid, [active_id],{'state':'done'})
else:
order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
# return self.create_invoice(cr, uid, ids, context)
else:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
if context.get('return'):
order_obj.write(cr, uid, [active_id],{'state':'done'})
else:
order_obj.write(cr, uid, [active_id],{'state':'paid'})
return self.print_report(cr, uid, ids, context)
if order.amount_paid > 0.0:
context.update({'flag': True})
# Todo need to check
order_obj.action_paid(cr, uid, [active_id], context)
order_obj.action_paid(cr, uid, [active_id], context)
self.pool.get('pos.order').write(cr, uid, [active_id],{'state':'advance'})
return self.print_report(cr, uid, ids, context)
return {}
return self.print_report(cr, uid, ids, context)
# return {}
return inv_ids
def create_invoice(self, cr, uid, ids, context):
"""
Create a invoice
"""
Create a invoice
"""
wf_service = netsvc.LocalService("workflow")
active_ids = [context and context.get('active_id',False)]
active_ids = [context and context.get('active_id',False)]
for i in active_ids:
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
datas = {'ids' : context.get('active_id', [])}
return {
datas = {'ids' : context.get('active_id', [])}
return {
'type' : 'ir.actions.report.xml',
'report_name':'pos.invoice',
'datas' : datas,
}
'datas' : datas,
}
def print_report(self, cr, uid, ids, context=None):
"""
@summary: To get the date and print the report
"""
@summary: To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@param context: A standard dictionary
@return : retrun report
"""
"""
if not context:
context={}
active_id=context.get('active_id',[])
active_id=context.get('active_id',[])
datas = {'ids' : [active_id]}
res = {}
res = {}
datas['form'] = res
return {
@@ -207,7 +287,7 @@ class pos_make_payment(osv.osv_memory):
}
_columns = {
'journal':fields.selection(pos_box_entries.get_journal, "Journal",required=True),
'journal':fields.selection(pos_box_entries.get_journal, "Cash Register",required=True),
'product_id': fields.many2one('product.product', "Acompte"),
'amount':fields.float('Amount', digits=(16,2) ,required= True),
'payment_name': fields.char('Payment name', size=32, required=True),
@@ -215,8 +295,15 @@ class pos_make_payment(osv.osv_memory):
'is_acc': fields.boolean('Accompte'),
'invoice_wanted': fields.boolean('Invoice'),
'num_sale':fields.char('Num.File', size=32),
'pricelist_id': fields.many2one('product.pricelist', 'Pricelist'),
'partner_id': fields.many2one('res.partner', 'Customer'),
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'state': fields.selection([('draft', 'Draft'), ('payment', 'Payment'),
('advance','Advance'),
('paid', 'Paid'), ('done', 'Done'), ('invoiced', 'Invoiced'), ('cancel', 'Cancel')],
'State', readonly=True, ),
}
pos_make_payment()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+9 -4
View File
@@ -12,11 +12,11 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Add payment :">
<group colspan="4" >
<field name="amount" />
<group colspan="4" width="600" height="230">
<field name="journal"/>
<field name="amount" />
<field name="payment_date" />
<field name="payment_name" />
<!--field name="payment_name" /-->
<field name="invoice_wanted" />
<field name="num_sale" />
<field name="is_acc" />
@@ -24,6 +24,11 @@
<field name="product_id" attrs="{'required':[('is_acc', '=', True)]}" domain="[('type','=','service')]"/>
</group>
<newline/>
<group attrs="{'invisible':[('invoice_wanted','=',False)]}" colspan="4">
<field name="partner_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
<field name="pricelist_id" attrs="{'required':[('invoice_wanted', '=', True)]}" colspan="2"/>
</group>
<newline/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel" string="Cancel" />
<button name="check" string="Make Payment" colspan="1" type="object" icon="gtk-ok"/>
@@ -42,4 +47,4 @@
</record>
</data>
</openerp>
+4 -4
View File
@@ -41,10 +41,10 @@ class pos_receipt(osv.osv_memory):
@return: New arch of view with new columns.
"""
order_lst = self. pool.get('pos.order').browse(cr, uid, context['active_id'])
for order in order_lst:
if order.state_2 in ('to_verify'):
raise osv.except_osv(_('Error!', 'Can not print the receipt because of discount and/or payment '))
True
# for order in order_lst:
# if order.state_2 in ('to_verify'):
# raise osv.except_osv(_('Error!', 'Can not print the receipt because of discount and/or payment '))
# True
def print_report(self, cr, uid, ids, context=None):
+1 -2
View File
@@ -291,8 +291,7 @@ class procurement_order(osv.osv):
if not procurement.product_id.seller_ids:
cr.execute('update procurement_order set message=%s where id=%s', (_('No supplier defined for this product !'), procurement.id))
return False
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in procurement.product_id.seller_ids if partner_id and partner_id.sequence])
partner = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].name or False
partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
if user.company_id and user.company_id.partner_id:
if partner.id == user.company_id.partner_id.id:
+10 -8
View File
@@ -70,7 +70,7 @@
<group colspan="4" groups="base.group_extended">
<separator colspan="4" string="Properties" />
<field colspan="4" name="property_ids" nolabel="1"/>
</group>
</group>
</page>
<page string="Notes">
<separator colspan="4" string="Note" />
@@ -119,6 +119,7 @@
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_procurement_filter"/>
<field name="context">{'search_default_Current':1}</field>
<field name="help">The procurement order will schedule a proposal for automatic procurement for the product concerned. This procurement will start a task, a purchase order form for the supplier or a production depending on the product configuration.</field>
</record>
<record id="procurement_action3" model="ir.actions.act_window">
@@ -139,6 +140,7 @@
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','exception')]</field>
<field name="help"> For each customer order line or raw materials in a manufacturing order, there is a procurement form . In normal system use, procurement orders are automatically generated by Open ERP. But if there are configuration problems, the system can remain blocked by a procurement without generating a corresponding document. It is a procurement exception. Some problems are link to timing and will be correct automatically by the system. If there is no procurement rule, the exception must be corrected manually.</field>
</record>
<record id="procurement_action4" model="ir.actions.act_window">
@@ -255,18 +257,18 @@
<act_window
context="{'product_uom': locals().has_key('uom_id') and uom_id}"
domain="[('product_id', '=', active_id)]"
domain="[('procurement_id', '=', active_id)]"
id="act_procurement_2_stock_warehouse_orderpoint"
name="Minimum Stock Rules"
res_model="stock.warehouse.orderpoint"
src_model="procurement.order"/>
<act_window
domain="[('id', '=', product_id)]"
id="act_product_product_2_stock_warehouse_orderpoint"
name="Product"
res_model="product.product"
src_model="procurement.order"/>
<!-- <act_window-->
<!-- domain="[('id', '=', product_id)]"-->
<!-- id="act_product_product_2_stock_warehouse_orderpoint"-->
<!-- name="Product"-->
<!-- res_model="product.product"-->
<!-- src_model="procurement.order"/>-->
</data>
</openerp>
+85 -10
View File
@@ -59,7 +59,7 @@ class product_uom(osv.osv):
def _factor_inv_write(self, cursor, user, id, name, value, arg, context):
return self.write(cursor, user, id, {'factor': self._compute_factor_inv(value)}, context=context)
def create(self, cr, uid, data, context={}):
if 'factor_inv' in data:
if data['factor_inv'] <> 1:
@@ -180,7 +180,7 @@ class product_category(osv.osv):
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of product categories."),
'type': fields.selection([('view','View'), ('normal','Normal')], 'Category Type'),
}
_defaults = {
'type' : lambda *a : 'normal',
@@ -212,14 +212,18 @@ product_category()
class product_template(osv.osv):
_name = "product.template"
_description = "Product Template"
def _calc_seller_delay(self, cr, uid, ids, name, arg, context={}):
def _calc_seller(self, cr, uid, ids, fields, arg, context={}):
result = {}
for product in self.browse(cr, uid, ids, context):
for field in fields:
result[product.id] = {field:False}
result[product.id]['seller_delay'] = 1
if product.seller_ids:
partner_list = sorted([(partner_id.sequence, partner_id) for partner_id in product.seller_ids if partner_id and partner_id.sequence])
result[product.id] = partner_list and partner_list[0] and partner_list[0][1] and partner_list[0][1].delay or False
else:
result[product.id] = 1
main_supplier = partner_list and partner_list[0] and partner_list[0][1] or False
result[product.id]['seller_delay'] = main_supplier and main_supplier.delay or 1
result[product.id]['seller_qty'] = main_supplier and main_supplier.qty or 0.0
result[product.id]['seller_id'] = main_supplier and main_supplier.name.id or False
return result
_columns = {
@@ -230,8 +234,8 @@ class product_template(osv.osv):
'description_sale': fields.text('Sale Description',translate=True),
'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way procurements are processed. Consumables are stockable products with infinite stock, or for use when you have no inventory management in the system."),
'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True, help="Produce will generate production order or tasks, according to the product type. Purchase will trigger purchase orders when requested."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing Lead Time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different lead times will be summed for all levels and purchase orders."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average delay in days between the confirmation of the customer order and the delivery of the finished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing Lead Time', help="Average delay in days to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different lead times will be summed for all levels and purchase orders."),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procurement Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until re-supplying. 'Make to Order': When needed, purchase or produce for the procurement request."),
'rental': fields.boolean('Can be Rent'),
'categ_id': fields.many2one('product.category','Category', required=True, change_default=True, domain="[('type','=','normal')]" ,help="Select category for the current product"),
@@ -254,7 +258,9 @@ class product_template(osv.osv):
help='Coefficient to convert UOM to UOS\n'
' uos = uom * coeff'),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type', required=True),
'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier Lead Time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_delay': fields.function(_calc_seller, method=True, type='integer', string='Supplier Lead Time', multi="seller_delay", help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_qty': fields.function(_calc_seller, method=True, type='float', string='Supplier Quantity', multi="seller_qty", help="This is minimum quantity to purchase from Main Supplier."),
'seller_id': fields.function(_calc_seller, method=True, type='many2one', relation="res.partner", string='Main Supplier', help="Main Supplier who has highest priority in Supplier List.", multi="seller_id"),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'),
'loc_rack': fields.char('Rack', size=16),
'loc_row': fields.char('Row', size=16),
@@ -616,12 +622,32 @@ product_packaging()
class product_supplierinfo(osv.osv):
_name = "product.supplierinfo"
_description = "Information about a product supplier"
def _calc_qty(self, cr, uid, ids, fields, arg, context={}):
result = {}
product_uom_pool = self.pool.get('product.uom')
for supplier_info in self.browse(cr, uid, ids, context):
for field in fields:
result[supplier_info.id] = {field:False}
if supplier_info.product_uom.id:
qty = product_uom_pool._compute_qty(cr, uid, supplier_info.product_uom.id, supplier_info.min_qty, to_uom_id=supplier_info.product_id.uom_id.id)
else:
qty = supplier_info.min_qty
result[supplier_info.id]['qty'] = qty
return result
def _get_uom_id(self, cr, uid, *args):
cr.execute('select id from product_uom order by id limit 1')
res = cr.fetchone()
return res and res[0] or False
_columns = {
'name' : fields.many2one('res.partner', 'Supplier', required=True, ondelete='cascade', help="Supplier of this product"),
'product_name': fields.char('Supplier Product Name', size=128, help="This supplier's product name will be used when printing a request for quotation. Keep empty to use the internal one."),
'product_code': fields.char('Supplier Product Code', size=64, help="This supplier's product code will be used when printing a request for quotation. Keep empty to use the internal one."),
'sequence' : fields.integer('Sequence', help="Assigns the priority to the list of product supplier."),
'qty' : fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the default unit of measure."),
'product_uom': fields.many2one('product.uom', string="UOM", help="Supplier Product UoM."),
'min_qty': fields.float('Minimal Quantity', required=True, help="The minimal quantity to purchase to this supplier, expressed in the default unit of measure."),
'qty': fields.function(_calc_qty, method=True, store=True, type='float', string='Quantity', multi="qty", help="This is a quantity which is converted into Default Uom."),
'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True),
'delay' : fields.integer('Delivery Lead Time', required=True, help="Lead time in days between the confirmation of the purchase order and the reception of the products in your warehouse. Used by the scheduler for automatic computation of the purchase order planning."),
'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'),
@@ -633,6 +659,55 @@ class product_supplierinfo(osv.osv):
'delay': lambda *a: 1,
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'product.supplierinfo', context=c)
}
def _check_uom(self, cr, uid, ids):
for supplier_info in self.browse(cr, uid, ids):
if supplier_info.product_uom and supplier_info.product_uom.category_id.id <> supplier_info.product_id.uom_id.category_id.id:
return False
return True
_constraints = [
(_check_uom, 'Error: The default UOM and the Supplier Product UOM must be in the same category.', ['product_uom']),
]
def price_get(self, cr, uid, supplier_ids, product_id, product_qty=1, context=None):
"""
Calculate price from supplier pricelist.
@param supplier_ids: Ids of res.partner object.
@param product_id: Id of product.
@param product_qty: specify quantity to purchase.
"""
if not context:
context = {}
if type(supplier_ids) in (int,long,):
supplier_ids = [supplier_ids]
res = {}
product_pool = self.pool.get('product.product')
partner_pool = self.pool.get('res.partner')
pricelist_pool = self.pool.get('product.pricelist')
currency_pool = self.pool.get('res.currency')
currency_id = self.pool.get('res.users').browse(cr, uid, uid).company_id.currency_id.id
for supplier in partner_pool.browse(cr, uid, supplier_ids, context=context):
# Compute price from standard price of product
price = product_pool.price_get(cr, uid, [product_id], 'standard_price')[product_id]
# Compute price from Purchase pricelist of supplier
pricelist_id = supplier.property_product_pricelist_purchase.id
if pricelist_id:
price = pricelist_pool.price_get(cr, uid, [pricelist_id], product_id, product_qty).setdefault(pricelist_id, 0)
price = currency_pool.compute(cr, uid, pricelist_pool.browse(cr, uid, pricelist_id).currency_id.id, currency_id, price)
# Compute price from supplier pricelist which are in Supplier Information
supplier_info_ids = self.search(cr, uid, [('name','=',supplier.id),('product_id','=',product_id)])
if supplier_info_ids:
cr.execute('SELECT * ' \
'FROM pricelist_partnerinfo ' \
'WHERE suppinfo_id IN %s' \
'AND min_quantity <= %s ' \
'ORDER BY min_quantity DESC LIMIT 1', (tuple(supplier_info_ids),product_qty,))
res2 = cr.dictfetchone()
if res2:
price = res2['price']
res[supplier.id] = price
return res
_order = 'sequence'
product_supplierinfo()
+19
View File
@@ -356,114 +356,133 @@
<record id="supplierinfo1" model="product.supplierinfo">
<field name="name" ref="base.res_partner_asus"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb1"/>
<field name="delay">5</field>
</record>
<record id="supplierinfo2" model="product.supplierinfo">
<field name="name" ref="base.res_partner_asus"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb2"/>
<field name="delay">5</field>
</record>
<record id="supplierinfo3" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo4" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_mb2"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo5" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc1"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo6" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc2"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo7" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc3"/>
<field name="delay">2</field>
</record>
<record id="supplierinfo8" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_pc4"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo9" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_cpu1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo10" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_cpu3"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo11" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd1"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo12" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd2"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo13" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd3"/>
<field name="delay">1</field>
</record>
<record id="supplierinfo14" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_20"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo15" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_21"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo16" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">1</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_22"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo17" model="product.supplierinfo">
<field name="name" ref="base.res_partner_seagate"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd1"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo18" model="product.supplierinfo">
<field name="name" ref="base.res_partner_seagate"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd2"/>
<field name="delay">10</field>
</record>
<record id="supplierinfo19" model="product.supplierinfo">
<field name="name" ref="base.res_partner_4"/>
<field name="qty">10</field>
<field name="min_qty">1</field>
<field name="product_id" ref="product_product_hdd3"/>
<field name="delay">10</field>
</record>
+5 -1
View File
@@ -149,6 +149,8 @@
<newline/>
<field groups="base.group_extended" name="cost_method"/>
<newline/>
<field groups="base.group_extended" name="seller_id"/>
<newline/>
<field colspan="4" name="seller_ids" nolabel="1"/>
</page>
<page string="Descriptions">
@@ -453,8 +455,10 @@
<field name="sequence"/>
<field name="product_name" groups="base.group_extended"/>
<field name="product_code" groups="base.group_extended"/>
<field name="delay"/>
<field name="min_qty"/>
<field name="product_uom" widget="selection"/>
<field name="qty"/>
<field name="delay"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field colspan="4" groups="base.group_extended" name="pricelist_ids" nolabel="1" widget="one2many_list">
<tree editable="bottom" string="Pricelist">
+1 -1
View File
@@ -23,7 +23,7 @@ import time
from report import report_sxw
from osv import osv
import pooler
from tools.translate import _
class product_pricelist(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(product_pricelist, self).__init__(cr, uid, name, context=context)
+3 -7
View File
@@ -44,18 +44,14 @@ class product_price_list(osv.osv_memory):
}
def print_report(self, cr, uid, ids, context=None):
"""
To get the date and print the report
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param context: A standard dictionary
@return : return report
To get the date and print the report
@return : return report
"""
datas = {'ids': context.get('active_ids', [])}
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context)
res = res and res[0] or {}
price_dict = self.pool.get('product.pricelist').price_get(cr, uid, [res['price_list']], 1, 1.0)
datas['form'] = res
return {
'type': 'ir.actions.report.xml',
+8 -5
View File
@@ -5,11 +5,12 @@
<!-- Product Price List -->
<record id="view_product_price_list" model="ir.ui.view">
<field name="name">Price List</field>
<field name="name">Price per unit</field>
<field name="model">product.price_list</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Price list">
<form string="Price per Unit">
<separator colspan="4" string="Calculate Product Price per unit base on pricelist version."/>
<field name="price_list" widget="selection"/>
<field name="qty1" colspan="2" />
<field name="qty2" colspan="2" />
@@ -19,15 +20,17 @@
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Close"/>
<button name="print_report" string="Print Report" type="object" icon="gtk-print"/>
<button name="print_report" string="Print" type="object" icon="gtk-print"/>
</group>
</form>
</field>
</record>
<act_window id="action_product_price_list"
key2="client_action_multi" name="Price List"
res_model="product.price_list" src_model="product.product"
key2="client_print_multi"
name="Price Per Unit"
res_model="product.price_list"
src_model="product.product"
view_mode="form" target="new" view_type="form" />
</data>
+105
View File
@@ -0,0 +1,105 @@
# French translation for openobject-addons
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-25 13:27+0000\n"
"PO-Revision-Date: 2010-07-22 09:16+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: French <fr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-23 04:08+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: product_electronic
#: model:ir.module.module,description:product_electronic.module_meta_information
msgid "A module that add manufacturers and attributes on the product form"
msgstr ""
#. module: product_electronic
#: field:product.product,manufacturer_pref:0
msgid "Manufacturer product code"
msgstr ""
#. module: product_electronic
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: product_electronic
#: view:product.electronic.attribute:0
msgid "Product Template Name"
msgstr ""
#. module: product_electronic
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
#. module: product_electronic
#: model:ir.model,name:product_electronic.model_product_electronic_attribute
msgid "Product attributes"
msgstr ""
#. module: product_electronic
#: view:product.product:0
msgid "Manufacturing data"
msgstr ""
#. module: product_electronic
#: view:product.product:0
msgid "Product reference"
msgstr ""
#. module: product_electronic
#: field:product.electronic.attribute,name:0
msgid "Attribute"
msgstr ""
#. module: product_electronic
#: field:product.electronic.attribute,product_id:0
msgid "Product"
msgstr ""
#. module: product_electronic
#: field:product.electronic.attribute,value:0
msgid "Value"
msgstr ""
#. module: product_electronic
#: view:product.product:0
msgid "Manufacturing Data"
msgstr ""
#. module: product_electronic
#: view:product.product:0
msgid "Product name"
msgstr ""
#. module: product_electronic
#: view:product.product:0
#: field:product.product,attribute_ids:0
msgid "Attributes"
msgstr ""
#. module: product_electronic
#: model:ir.module.module,shortdesc:product_electronic.module_meta_information
msgid "Products Attributes & Manufacturers"
msgstr ""
#. module: product_electronic
#: field:product.product,manufacturer_pname:0
msgid "Manufacturer product name"
msgstr ""
#. module: product_electronic
#: field:product.product,manufacturer:0
msgid "Manufacturer"
msgstr ""
+8 -7
View File
@@ -311,7 +311,7 @@ class purchase_order(osv.osv):
'product_id': ol.product_id.id or False,
'uos_id': ol.product_uom.id or False,
'invoice_line_tax_id': [(6, 0, [x.id for x in ol.taxes_id])],
'account_analytic_id': ol.account_analytic_id.id,
'account_analytic_id': ol.account_analytic_id.id or False,
})
def action_cancel_draft(self, cr, uid, ids, *args):
@@ -344,7 +344,7 @@ class purchase_order(osv.osv):
if not a:
raise osv.except_osv(_('Error !'), _('There is no expense account defined for this product: "%s" (id:%d)') % (ol.product_id.name, ol.product_id.id,))
else:
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category')
a = self.pool.get('ir.property').get(cr, uid, 'property_account_expense_categ', 'product.category').id
fpos = o.fiscal_position or False
a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, a)
il.append(self.inv_line_create(cr, uid, a, ol))
@@ -746,23 +746,24 @@ class procurement_order(osv.osv):
po_obj = self.pool.get('purchase.order')
for procurement in self.browse(cr, uid, ids):
res_id = procurement.move_id.id
partner = procurement.product_id.seller_ids[0].name
partner = procurement.product_id.seller_id # Taken Main Supplier of Product of Procurement.
seller_qty = procurement.product_id.seller_qty
seller_delay = int(procurement.product_id.seller_delay)
partner_id = partner.id
partner_rec = procurement.product_id.seller_ids[0]
address_id = partner_obj.address_get(cr, uid, [partner_id], ['delivery'])['delivery']
pricelist_id = partner.property_product_pricelist_purchase.id
uom_id = procurement.product_id.uom_po_id.id
qty = uom_obj._compute_qty(cr, uid, procurement.product_uom.id, procurement.product_qty, uom_id)
if procurement.product_id.seller_ids[0].qty:
qty = max(qty,partner_rec.qty)
if seller_qty:
qty = max(qty,seller_qty)
price = pricelist_obj.price_get(cr, uid, [pricelist_id], procurement.product_id.id, qty, False, {'uom': uom_id})[pricelist_id]
newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S')
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
newdate = newdate - partner_rec.delay
newdate = newdate - seller_delay
#Passing partner_id to context for purchase order line integrity of Line name
context.update({'lang': partner.lang, 'partner_id': partner_id})
+1 -2
View File
@@ -78,8 +78,7 @@
<field name="name" select="1"/>
<field name="manager" select="1"/>
<field name="company_id" select="1" groups="base.group_multi_company"/>
<newline/>
<field colspan="4" name="week_id" nolabel="1" widget="one2many_list"/>
<!-- <field colspan="4" name="week_id" nolabel="1" widget="one2many_list"/>-->
</form>
</field>
</record>

Some files were not shown because too many files have changed in this diff Show More