bzr revid: olt@tinyerp.com-20090203151234-fsreb9235019z0gk
This commit is contained in:
Olivier Laurent 2009-02-03 16:12:34 +01:00
commit eefc03dbdd
32 changed files with 208 additions and 92 deletions

View File

@ -559,12 +559,12 @@ class account_move_line(osv.osv):
GROUP BY account_id,reconcile_id')
r = cr.fetchall()
#TODO: move this check to a constraint in the account_move_reconcile object
if (len(r) != 1) and context.get('same_account', True):
if (len(r) != 1) and not context.get('fy_closing', False):
raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! '))
if not unrec_lines:
raise osv.except_osv(_('Error'), _('Entry is already reconciled'))
account = self.pool.get('account.account').browse(cr, uid, account_id, context=context)
if not account.reconcile:
if not context.get('fy_closing', False) and not account.reconcile:
raise osv.except_osv(_('Error'), _('The account is not defined to be reconcile !'))
if r[0][1] != None:
raise osv.except_osv(_('Error'), _('Some entries are already reconciled !'))

View File

@ -1309,7 +1309,7 @@
</record>
<record id="action_move_line_tree1" model="ir.actions.act_window">
<field name="name" eval="False"/>
<field name="name">Entry Lines</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>

View File

@ -427,6 +427,8 @@ class account_invoice(osv.osv):
return ok
def button_reset_taxes(self, cr, uid, ids, context=None):
if not context:
context = {}
ait_obj = self.pool.get('account.invoice.tax')
for id in ids:
cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,))

View File

@ -56,13 +56,13 @@ def _data_save(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
fy_id = data['form']['fy_id']
new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id'])
period_ids = pool.get('account.period').search(cr, uid, [('fiscalyear_id', '=', fy_id)])
fy_period_set = ','.join(map(str, period_ids))
periods_fy2 = pool.get('account.period').search(cr, uid, [('fiscalyear_id', '=', data['form']['fy2_id'])])
fy2_period_set = ','.join(map(str, periods_fy2))
periods_fy2 = new_fyear.period_ids
if not periods_fy2:
raise wizard.except_wizard(_('UserError'),
_('There are no periods defined on New Fiscal Year.'))
period=periods_fy2[0]
period = pool.get('account.period').browse(cr, uid, data['form']['period_id'], context=context)
new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id'], context=context)
new_journal = data['form']['journal_id']
new_journal = pool.get('account.journal').browse(cr, uid, new_journal, context=context)
@ -87,6 +87,7 @@ def _data_save(self, cr, uid, data, context):
ids = map(lambda x: x[0], cr.fetchall())
for account in pool.get('account.account').browse(cr, uid, ids,
context={'fiscalyear': fy_id}):
accnt_type_data = account.user_type
if not accnt_type_data:
continue
@ -120,7 +121,40 @@ def _data_save(self, cr, uid, data, context):
if not result:
break
for move in result:
parent_id = move['id']
move.pop('id')
move.update({
'date': period.date_start,
'journal_id': new_journal.id,
'period_id': period.id,
})
pool.get('account.move.line').create(cr, uid, move, {
'journal_id': new_journal.id,
'period_id': period.id,
})
offset += limit
#We have also to consider all move_lines that were reconciled
#on another fiscal year, and report them too
offset = 0
limit = 100
while True:
#TODO: this query could be improved in order to work if there is more than 2 open FY
# a.period_id IN ('+fy2_period_set+') is the problematic clause
cr.execute('SELECT b.id, b.name, b.quantity, b.debit, b.credit, b.account_id, b.ref, ' \
'b.amount_currency, b.currency_id, b.blocked, b.partner_id, ' \
'b.date_maturity, b.date_created ' \
'FROM account_move_line a, account_move_line b ' \
'WHERE b.account_id = %s ' \
'AND b.reconcile_id is NOT NULL ' \
'AND a.reconcile_id = b.reconcile_id ' \
'AND b.period_id IN ('+fy_period_set+') ' \
'AND a.period_id IN ('+fy2_period_set+') ' \
'ORDER BY id ' \
'LIMIT %s OFFSET %s', (account.id, limit, offset))
result = cr.dictfetchall()
if not result:
break
for move in result:
move.pop('id')
move.update({
'date': period.date_start,
@ -148,7 +182,6 @@ def _data_save(self, cr, uid, data, context):
if not result:
break
for move in result:
parent_id = move['id']
move.pop('id')
move.update({
'date': period.date_start,
@ -160,10 +193,8 @@ def _data_save(self, cr, uid, data, context):
ids = pool.get('account.move.line').search(cr, uid, [('journal_id','=',new_journal.id),
('period_id.fiscalyear_id','=',new_fyear.id)])
context['same_account'] = False
context['fy_closing'] = True
pool.get('account.move.line').reconcile(cr, uid, ids, context=context)
new_period = data['form']['period_id']
ids = pool.get('account.journal.period').search(cr, uid, [('journal_id','=',new_journal.id),('period_id','=',new_period)])
if ids:

View File

@ -451,6 +451,7 @@ class account_analytic_account_summary_user(osv.osv):
'user' : fields.many2one('res.users', 'User'),
}
def init(self, cr):
tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user')
cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \
'SELECT ' \
'(u.account_id * u.max_user) + u."user" AS id, ' \

View File

@ -31,13 +31,9 @@
<separator string="Legend" colspan="4"/>
<label string="%%(partner_name)s: Partner name" colspan="2"/>
<label string="%%(user_signature)s: User name" colspan="2"/>
<label string="%%(followup_amount)s: Total Amount Due" colspan="2"/>
<label string="%%(date)s: Current Date" colspan="2"/>
<label string="%%(user_signature)s: User name" colspan="2"/>
<label string="%%(company_name)s: User's Company name" colspan="2"/>
<label string="%%(company_currency)s: User's Company Currency" colspan="2"/>
<label string="%%(heading)s: Move line header" colspan="2"/>
<label string="%%(line)s: Account Move lines" colspan="2"/>
</form>
</field>
</record>
@ -134,11 +130,11 @@
<act_window domain="[('reconcile_id', '=', False),('account_id.type','=','receivable')]" id="act_account_partner_account_move_all" name="All receivable entries" res_model="account.move.line" src_model="" view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_all" id="menu_account_move_open_unreconcile" parent="account_followup.account_followup_wizard_menu"/>
<menuitem action="act_account_partner_account_move_all" id="menu_account_move_open_unreconcile" parent="account_followup.menu_action_followup_stat"/>
<act_window domain="[('reconcile_id', '=', False), ('account_id.type','=','payable')]" id="act_account_partner_account_move_payable_all" name="All payable entries" res_model="account.move.line" src_model="" view="account_move_line_partner_tree"/>
<menuitem action="act_account_partner_account_move_payable_all" id="menu_account_move_open_unreconcile_payable" parent="account_followup.account_followup_wizard_menu"/>
<menuitem action="act_account_partner_account_move_payable_all" id="menu_account_move_open_unreconcile_payable" parent="account_followup.menu_action_followup_stat"/>
</data>

View File

@ -61,7 +61,7 @@ class report_rappel(report_sxw.rml_parse):
movelines = moveline_obj.read(self.cr, self.uid, movelines)
return movelines
def _get_text(self, partner, followup_id):
def _get_text(self, partner, followup_id, context={}):
fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup')
fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line
li_delay = []
@ -82,7 +82,12 @@ class report_rappel(report_sxw.rml_parse):
partner_delay.append(delay)
text = partner_delay and a[max(partner_delay)] or ''
if text:
text = text % {'partner_name':partner.name}
text = text % {
'partner_name': partner.name,
'date': time.strftime('%Y-%m-%d'),
'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name,
'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature,
}
return text

View File

@ -204,7 +204,7 @@ class followup_all_print(wizard.interface):
summary = msg_unsent + line + msg_sent
return {'summary' : summary}
else:
return {'summary' : '\n\n\nMain not sent to any partner if you want to sent it please tick send email confirmation on wizard'}
return {'summary' : '\n\n\nMail not sent to any partner if you want to sent it please tick send email confirmation on wizard'}
def _get_partners(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)

View File

@ -23,7 +23,7 @@
{
'name': 'Reporting for accounting',
'version': '1.0',
'version': '1.1',
'category': 'Generic Modules/Accounting',
'description': """Financial and accounting reporting
Fiscal statements

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -140,12 +140,12 @@ class account_invoice_line(osv.osv):
else:
return super(account_invoice_line, self).product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context)
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None):
# note: will call product_id_change_unit_price_inv with context...
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None):
# note: will call product_id_change_unit_price_inv with context...
if context is None:
context = {}
context.update({'price_type': price_type})
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context=context)
return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, context=context)
account_invoice_line()
class account_invoice_tax(osv.osv):

View File

@ -4,7 +4,7 @@
<!-- Create the functions -->
<record id="res_partner_function_privateaddress0" model="res.partner.function">
<field eval="&quot;&quot;&quot;Private Address&quot;&quot;&quot;" name="name"/>
<field name="ref"></field>
<field name="code">PA</field>
</record>
<!-- Create the contacts -->

View File

@ -30,7 +30,7 @@ This module install the base for IBAN bank accounts.
""",
'author': 'Tiny',
'depends': ['base'],
'depends': ['base', 'account'],
'init_xml': ['base_iban_data.xml'],
'update_xml': ['base_iban_view.xml'],
'installable': True,

View File

@ -38,13 +38,13 @@ class res_partner_bank(osv.osv):
def create(self, cr, uid, vals, context={}):
#overwrite to format the iban number correctly
if vals.has_key('iban'):
if 'iban' in vals and vals['iban']:
vals['iban'] = _format_iban(vals['iban'])
return super(res_partner_bank, self).create(cr, uid, vals, context)
def write(self, cr, uid, ids, vals, context={}):
#overwrite to format the iban number correctly
if vals.has_key('iban'):
if 'iban' in vals and vals['iban']:
vals['iban'] = _format_iban(vals['iban'])
return super(res_partner_bank, self).write(cr, uid, ids, vals, context)

View File

@ -40,7 +40,7 @@ init_fields = {
finish_form = '''<?xml version="1.0"?>
<form string="Finish">
<separator string="Module successfully exported !" colspan="4"/>
<field name="module_file"/>
<field name="module_file" filename='module_filename'/>
<newline/>
<field name="module_filename"/>
</form>'''

View File

@ -182,7 +182,7 @@ class base_module_record(osv.osv):
val = str(val)
val = val and ('"""%s"""' % val.replace('\\', '\\\\').replace('"', '\"')) or 'False'
field.setAttribute(u"eval", val)
field.setAttribute(u"eval", val.decode('utf-8'))
record.appendChild(field)
return record_list, noupdate
@ -324,8 +324,8 @@ class base_module_record(osv.osv):
data.appendChild(res)
elif rec[0]=='assert':
pass
res = doc.toprettyxml(indent="\t")
return doc.toprettyxml(indent="\t").encode('utf8')
return doc.toprettyxml(indent="\t").encode('utf-8')
base_module_record()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -498,6 +498,7 @@
<xsl:call-template name="make_alignment" />
<xsl:call-template name="make_background" />
<xsl:call-template name="make_space_beforeafter" />
<xsl:call-template name="make_fontcolor" />
</paraStyle>
</xsl:template>
@ -670,6 +671,17 @@
</xsl:choose>
</xsl:template>
<xsl:template name="make_fontcolor">
<xsl:variable name="textColor">
<xsl:value-of select="style:properties/@fo:color"/>
</xsl:variable>
<xsl:if test="not($textColor='') and boolean(style:properties/@fo:color)">
<xsl:attribute name="textColor">
<xsl:value-of select="$textColor" />
</xsl:attribute>
</xsl:if>
</xsl:template>
<!--
This stylesheet is part of:
PyOpenOffice Version 0.4

View File

@ -499,6 +499,7 @@
<xsl:call-template name="make_alignment" />
<xsl:call-template name="make_background" />
<xsl:call-template name="make_space_beforeafter" />
<xsl:call-template name="make_fontcolor" />
</paraStyle>
</xsl:template>
@ -670,6 +671,16 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template name="make_fontcolor">
<xsl:variable name="textColor">
<xsl:value-of select="style:properties/@fo:color"/>
</xsl:variable>
<xsl:if test="not($textColor='') and boolean(style:properties/@fo:color)">
<xsl:attribute name="textColor">
<xsl:value-of select="$textColor" />
</xsl:attribute>
</xsl:if>
</xsl:template>
<!--
This stylesheet is part of:

View File

@ -158,7 +158,7 @@
<record id="crm_case_patcheserrorinprogram0" model="crm.case">
<field name="partner_address_id" ref="base.res_partner_address_9"/>
<field eval="time.strftime('%Y-%m-30 16:30:00')" name="date"/>
<field eval="time.strftime('%Y-%m-28 16:30:00')" name="date"/>
<field name="category2_id" ref="crm_configuration.category2"/>
<field eval="&quot;2&quot;" name="priority"/>
<field name="user_id" ref="base.user_root"/>

View File

@ -85,8 +85,8 @@
<field eval="&quot;More than 5 yrs Experience in PHP&quot;" name="name"/>
</record>
<record id="crm_case_marketingjob0" model="crm.case">
<field eval="time.strftime('%Y-%m-29 17:15:32')" name="date"/>
<field eval="time.strftime('%Y-%m-30')" name="date_deadline"/>
<field eval="time.strftime('%Y-%m-26 17:15:32')" name="date"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field name="category2_id" ref="crm_configuration.category_job2"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field eval="&quot;4&quot;" name="priority"/>
@ -105,7 +105,7 @@
</record>
<record id="crm_case_financejob0" model="crm.case">
<field eval="time.strftime('%Y-%m-26 17:39:42')" name="date"/>
<field eval="time.strftime('%Y-%m-29')" name="date_deadline"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field name="category2_id" ref="crm_configuration.category_job2"/>
<field name="partner_id" ref="base.res_partner_11"/>
<field eval="&quot;4&quot;" name="priority"/>

View File

@ -90,7 +90,7 @@
<field name="categ_id" ref="crm_configuration.categ_meet2"/>
<field name="stage_id" ref="crm_configuration.stage_meet2"/>
<field eval="&quot;Changes in Designing&quot;" name="name"/>
<field eval="time.strftime('%Y-%m-30')" name="date_deadline"/>
<field eval="time.strftime('%Y-%m-28')" name="date_deadline"/>
<field eval="&quot;info@opensides.be&quot;" name="email_from"/>
</record>

View File

@ -1,4 +1,3 @@
name,ref,employee_id,line_ids/date_value,line_ids/name,line_ids/analytic_account,line_ids/unit_quantity,line_ids/ref,line_ids/unit_amount
September Expenses,09/06,Fabien Pinckaers,2006-09-05,Travel by Car - Customer Seagate 2 - Double,Thymbra,130.0,,0.22
,,,2006-09-05,Travel by Car - Trainging,Trainings,100.0,,0.22
,,,2006-09-05,Basic PC - Server for Seagate,Seagate P2,1.0,S1234435,300.0

1 name ref employee_id line_ids/date_value line_ids/name line_ids/analytic_account line_ids/unit_quantity line_ids/ref line_ids/unit_amount
2 September Expenses 09/06 Fabien Pinckaers 2006-09-05 Travel by Car - Customer Seagate 2 - Double Thymbra 130.0 0.22
2006-09-05 Travel by Car - Trainging Trainings 100.0 0.22
3 2006-09-05 Basic PC - Server for Seagate Seagate P2 1.0 S1234435 300.0

View File

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
</data>
</openerp>

View File

@ -20,6 +20,7 @@
#
##############################################################################
import company
import wizard
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

43
addons/l10n_be/company.py Normal file
View File

@ -0,0 +1,43 @@
# -*- 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
class res_company(osv.osv):
_inherit = "res.company"
_description = 'res.company'
def _get_default_ad(self, addresses):
city = post_code = address = ""
for ads in addresses:
if ads.type == 'default':
city = ads.city
post_code = ads.zip
if ads.street:
address = ads.street
if ads.street2:
address += " " + ads.street2
return city, post_code, address
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -25,6 +25,8 @@ import datetime
import pooler
import base64
from tools.translate import _
form_fyear = """<?xml version="1.0"?>
<form string="Select Period">
<field name="period" />
@ -48,6 +50,7 @@ fields = {
'readonly': True,},
}
class wizard_vat_declaration(wizard.interface):
def _create_xml(self, cr, uid, data, context):
@ -58,7 +61,7 @@ class wizard_vat_declaration(wizard.interface):
user_cmpny = obj_company.name
vat_no=obj_company.partner_id.vat
if not vat_no:
raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!')
raise wizard.except_wizard(_('Data Insufficient'),_('No VAT Number Associated with Main Company!'))
tax_ids = pool_obj.get('account.tax.code').search(cr,uid,[])
ctx = context.copy()
@ -69,30 +72,33 @@ class wizard_vat_declaration(wizard.interface):
if not obj_company.partner_id.address:
address=post_code=city=''
for ads in obj_company.partner_id.address:
if ads.type=='default':
if ads.zip_id:
city=ads.zip_id.city
post_code=ads.zip_id.name
if ads.street:
address=ads.street
if ads.street2:
address +=ads.street2
city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address)
obj_fyear = pool_obj.get('account.fiscalyear')
year_id = obj_fyear.find(cr, uid)
current_year = obj_fyear.browse(cr,uid,year_id).name
month=time.strftime('%m')
period_code = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).code
send_ref = user_cmpny
if period_code:
send_ref = send_ref + period_code
data_of_file='<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+str(address)+'</ADDRESS>'
data_of_file +='\n\t\t<POSTCODE>'+str(post_code)+'</POSTCODE>\n\t\t<CITY>'+str(city)+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t<MONTH>'+str(month)+'</MONTH>\n\t\t\t<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+address+'</ADDRESS>'
data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
starting_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_start[5:7]
ending_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_stop[5:7]
if starting_month != ending_month:
#starting month and ending month of selected period are not the same
#it means that the accounting isn't based on periods of 1 month but on quarters
quarter = str(((int(starting_month) - 1) / 3) + 1)
data_of_file += '<QUARTER>'+quarter+'</QUARTER>\n\t\t\t'
else:
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
data_of_file += '<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
for item in tax_info:

View File

@ -76,8 +76,7 @@ class wizard_vat(wizard.interface):
# obj_company=pooler.get_pool(cr.dbname).get('res.company').browse(cr,uid,1)
# vat_company=obj_company.partner_id.vat
#TODO: can be improved if we replace this test => add a new field on res_partner for cases when a partner has a number and is not subjected to the VAT... have to see if this situation could happen
p_id_list=pooler.get_pool(cr.dbname).get('res.partner').search(cr,uid,[('vat','!=',False)])
p_id_list=pooler.get_pool(cr.dbname).get('res.partner').search(cr,uid,[('vat_subjected','!=',False)])
if not p_id_list:
raise wizard.except_wizard('Data Insufficient!','No partner has a VAT Number asociated with him.')

View File

@ -3403,6 +3403,7 @@
<field name="type">view</field>
<field name="user_type" ref="account_type_view"/>
<field name="parent_id" ref="pcg_Classe_4"/>
<field name="reconcile" eval="True"/>
</record>
<record id="pcg_400" model="account.account.template">
@ -3417,7 +3418,7 @@
<record id="pcg_401" model="account.account.template">
<field name="name">Fournisseurs</field>
<field name="code">401</field>
<field name="type">payable</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_payable"/>
<field name="parent_id" ref="pcg_40"/>
<field name="reconcile" eval="True"/>
@ -3530,7 +3531,7 @@
<record id="pcg_409" model="account.account.template">
<field name="name">Fournisseurs débiteurs</field>
<field name="code">409</field>
<field name="type">payable</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_payable"/>
<field name="parent_id" ref="pcg_40"/>
@ -3561,7 +3562,7 @@
<field name="name">Fournisseurs - Autres avoirs</field>
<field name="code">4097</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_stocks" />
<field name="user_type" ref="account_type_stocks" />
<field name="parent_id" ref="pcg_409"/>
<field name="reconcile" eval="True"/>
@ -3604,6 +3605,7 @@
<field name="user_type" ref="account_type_view"/>
<field name="parent_id" ref="pcg_Classe_4"/>
<field name="reconcile" eval="True"/>
</record>
<record id="pcg_410" model="account.account.template">
@ -3619,7 +3621,7 @@
<record id="pcg_411" model="account.account.template">
<field name="name">Clients</field>
<field name="code">411</field>
<field name="type">receivable</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_receivable"/>
<field name="parent_id" ref="pcg_41"/>
@ -3701,7 +3703,7 @@
<record id="pcg_419" model="account.account.template">
<field name="name">Clients créditeurs</field>
<field name="code">419</field>
<field name="type">receivable</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_receivable"/>
<field name="parent_id" ref="pcg_41"/>
@ -3760,7 +3762,7 @@
<record id="pcg_421" model="account.account.template">
<field name="name">Personnel - Rémunérations dues</field>
<field name="code">421</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_dettes"/>
<field name="parent_id" ref="pcg_42"/>
@ -3909,7 +3911,7 @@
<record id="pcg_437" model="account.account.template">
<field name="name">Autres organismes sociaux</field>
<field name="code">437</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_dettes"/>
<field name="parent_id" ref="pcg_43"/>
@ -4168,7 +4170,7 @@
<record id="pcg_4456" model="account.account.template">
<field name="name">Taxes sur le chiffre d'affaires déductibles</field>
<field name="code">4456</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_tax"/>
<field name="parent_id" ref="pcg_445"/>
@ -4239,7 +4241,7 @@
<record id="pcg_4457" model="account.account.template">
<field name="name">Taxes sur le chiffre d'affaires collectées par l'entreprise</field>
<field name="code">4457</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_tax"/>
<field name="parent_id" ref="pcg_445"/>
@ -5268,7 +5270,7 @@
<record id="fr_pcg_cash" model="account.account.template">
<field name="name">Banques</field>
<field name="code">512</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_cash"/>
<field name="note">Créer 1 compte par compte bancaire</field>
@ -5472,6 +5474,7 @@
<field name="user_type" ref="account_type_view"/>
<field name="parent_id" ref="pcg_Classe_5"/>
<field name="reconcile" eval="True"/>
</record>
<record id="pcg_59" model="account.account.template">
@ -6940,7 +6943,7 @@
<record id="pcg_645" model="account.account.template">
<field name="name">Charges de Sécurité sociale et de prévoyance</field>
<field name="code">645</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense"/>
<field name="parent_id" ref="pcg_64"/>
@ -6994,7 +6997,7 @@
<record id="pcg_646" model="account.account.template">
<field name="name">Cotisations sociales personnelles de l'exploitant</field>
<field name="code">646</field>
<field name="type">other</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense"/>
<field name="parent_id" ref="pcg_64"/>

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -55,7 +55,7 @@ class pos_order(osv.osv):
def onchange_partner_pricelist(self, cr, uid, ids, part, context={}):
if not part:
return {}
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'pricelist_id': pricelist}}
def _amount_total(self, cr, uid, ids, field_name, arg, context):
@ -521,7 +521,7 @@ class pos_order(osv.osv):
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 = order.partner_id.id)['value'])
line.qty, partner_id = order.partner_id.id, fposition_id=order.partner_id.property_account_position.id)['value'])
inv_line['price_unit'] = line.price_unit
inv_line['discount'] = line.discount

View File

@ -213,7 +213,7 @@
<record id="product_normal_action_tree" model="ir.actions.act_window">
<field name="name" eval="False"/>
<field name="name">Products"</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -61,7 +61,7 @@ def _createInvoices(self, cr, uid, data, context={}):
raise osv.except_osv(
_('Error'),
_("You cannot make an advance on a sale order that is defined as 'Automatic Invoice after delivery'."))
val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id)
val = obj_lines.product_id_change(cr, uid, [], data['form']['product_id'],uom = False, partner_id = sale.partner_id.id, fposition_id=sale.fiscal_position.id)
line_id =obj_lines.create(cr, uid, {
'name': val['value']['name'],
'account_id':val['value']['account_id'],

View File

@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
@ -72,21 +72,22 @@ class make_sale(wizard.interface):
['invoice', 'delivery', 'contact'])
default_pricelist = partner_obj.browse(cr, uid, data['form']['partner_id'],
context).property_product_pricelist.id
fpos_data = partner_obj.browse(cr, uid, data['form']['partner_id'],context).property_account_position
new_ids = []
for case in case_obj.browse(cr, uid, data['ids']):
if case.partner_id and case.partner_id.id:
partner_id = case.partner_id.id
fpos = case.partner_id.property_account_position and case.partner_id.property_account_position.id or False
partner_addr = partner_obj.address_get(cr, uid, [case.partner_id.id],
['invoice', 'delivery', 'contact'])
pricelist = partner_obj.browse(cr, uid, case.partner_id.id,
context).property_product_pricelist.id
else:
partner_id = data['form']['partner_id']
fpos = fpos_data and fpos_data.id or False
partner_addr = default_partner_addr
pricelist = default_pricelist
vals = {
'origin': 'CRM:%s' % str(case.id),
'picking_policy': data['form']['picking_policy'],
@ -102,10 +103,9 @@ class make_sale(wizard.interface):
if data['form']['analytic_account']:
vals['project_id'] = data['form']['analytic_account']
new_id = sale_obj.create(cr, uid, vals)
for product_id in data['form']['products'][0][2]:
value = sale_line_obj.product_id_change(cr, uid, [], pricelist,
product_id, qty=1, partner_id=partner_id)['value']
product_id, qty=1, partner_id=partner_id, fiscal_position=fpos)['value']
value['product_id'] = product_id
value['order_id'] = new_id
sale_line_obj.create(cr, uid, value)

View File

@ -28,9 +28,18 @@ import pooler
_form = """<?xml version="1.0"?>
<form string="Set Stock to Zero">
<separator colspan="4" string="Set Stocks to Zero" />
<label string="Do you want to set stocks to zero ?"/>
<field name="location_id"/>
<newline/>
<label colspan="4" string="Do you want to set stocks to zero ?"/>
</form>
"""
_inventory_fields = {
'location_id' : {
'string':'Location',
'type':'many2one',
'relation':'stock.location',
}
}
def do_merge(self, cr, uid, data, context):
@ -44,14 +53,18 @@ def do_merge(self, cr, uid, data, context):
cr.execute('select distinct location_id from stock_inventory_line where inventory_id=%s', (data['ids'][0],))
loc_ids = map(lambda x: x[0], cr.fetchall())
if data['form']['location_id']:
loc_ids.append(data['form']['location_id'])
locs = ','.join(map(lambda x: str(x), loc_ids))
cr.execute('select distinct location_id,product_id from stock_inventory_line where inventory_id=%s', (data['ids'][0],))
inv = cr.fetchall()
if not inv:
if not locs:
raise wizard.except_wizard("Warning",
"Please select at least one inventory location !")
# if not inv:
# raise wizard.except_wizard("Warning",
# "Please select at least one inventory location !")
else:
cr.execute('select distinct product_id from stock_move where (location_dest_id in ('+locs+')) or (location_id in ('+locs+'))')
stock = cr.fetchall()
@ -75,7 +88,7 @@ class merge_inventory(wizard.interface):
'actions' : [],
'result' : {'type' : 'form',
'arch' : _form,
'fields' : {},
'fields' : _inventory_fields,
'state' : [('end', 'Cancel'),
('merge', 'Set to Zero') ]}
},