bzr revid: fp@tinyerp.com-20090119154640-434shet1q6uzwus7
This commit is contained in:
Fabien Pinckaers 2009-01-19 16:46:40 +01:00
commit c5a3bbccc0
14 changed files with 114 additions and 83 deletions

View File

@ -197,6 +197,7 @@
</page>
<page string="Other Info">
<field name="company_id"/>
<field name="fiscal_position"/>
<newline/>
<field name="payment_term" on_change="onchange_payment_term_date_invoice(payment_term, date_invoice)"/>
<field name="name" select="2"/>
@ -283,6 +284,7 @@
</page>
<page string="Other Info">
<field name="company_id"/>
<field name="fiscal_position"/>
<newline/>
<field name="date_due" select="1"/>
<newline/>

View File

@ -270,6 +270,7 @@ class account_invoice(osv.osv):
help="Remaining amount due."),
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
'move_name': fields.char('Account Move', size=64),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position')
}
_defaults = {
'type': _get_type,
@ -305,6 +306,7 @@ class account_invoice(osv.osv):
partner_payment_term = False
acc_id = False
bank_id = False
fiscal_position = False
opt = [('uid', str(uid))]
if partner_id:
@ -318,7 +320,8 @@ class account_invoice(osv.osv):
acc_id = p.property_account_receivable.id
else:
acc_id = p.property_account_payable.id
if p.property_account_position:
fiscal_position = p.property_account_position.id
partner_payment_term = p.property_payment_term and p.property_payment_term.id or False
if p.bank_ids:
bank_id = p.bank_ids[0].id
@ -328,6 +331,7 @@ class account_invoice(osv.osv):
'address_invoice_id': invoice_addr_id,
'account_id': acc_id,
'payment_term': partner_payment_term,
'fiscal_position': fiscal_position
}
}

View File

@ -93,9 +93,9 @@ class payment_order(osv.osv):
return res
_columns = {
'date_planned': fields.date('Scheduled date if fixed',help='Select a date if you have chosen Preferred Date to be fixed.'),
'reference': fields.char('Reference',size=128,required=1),
'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1,help='Select the Payment Mode to be applied.'),
'date_planned': fields.date('Scheduled date if fixed', states={'done':[('readonly',True)]}, help='Select a date if you have chosen Preferred Date to be fixed.'),
'reference': fields.char('Reference', size=128, required=1, states={'done':[('readonly',True)]}),
'mode': fields.many2one('payment.mode','Payment mode', select=True, required=1, states={'done':[('readonly',True)]}, help='Select the Payment Mode to be applied.'),
'state': fields.selection([
('draft', 'Draft'),
('open','Confirmed'),
@ -104,12 +104,12 @@ class payment_order(osv.osv):
'line_ids': fields.one2many('payment.line','order_id','Payment lines',states={'done':[('readonly',True)]}),
'total': fields.function(_total, string="Total", method=True,
type='float'),
'user_id': fields.many2one('res.users','User',required=True),
'user_id': fields.many2one('res.users','User', required=True, states={'done':[('readonly',True)]}),
'date_prefered': fields.selection([
('now', 'Directly'),
('due', 'Due date'),
('fixed', 'Fixed date')
], "Preferred date", change_default=True, required=True,help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
], "Preferred date", change_default=True, required=True, states={'done':[('readonly',True)]}, help="Choose an option for the Payment Order:'Fixed' stands for a date specified by you.'Directly' stands for the direct execution.'Due date' stands for the scheduled date of execution."),
'date_created': fields.date('Creation date', readonly=True),
'date_done': fields.date('Execution date', readonly=True),
}

View File

@ -96,7 +96,7 @@
<field name="date_prefered"/>
<field name="date_planned" select="1"/>
<field name="user_id" select="2"/>
<button colspan="2" name="%(wizard_populate_payment)d" string="Select Invoices to Pay" type="action"/>
<button colspan="2" name="%(wizard_populate_payment)d" string="Select Invoices to Pay" type="action" attrs="{'invisible':[('state','=','done')]}"/>
<field name="line_ids" colspan="4" widget="one2many_list" nolabel="1">
<form string="Payment Line">
<notebook>
@ -177,7 +177,7 @@
</record>
<record id="action_payment_order_tree" model="ir.actions.act_window">
<field name="name">Payment order</field>
<field name="name">Payment Orders</field>
<field name="res_model">payment.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@ -185,22 +185,22 @@
<menuitem action="action_payment_order_tree" id="menu_action_payment_order_form" parent="account_payment.menu_main" sequence="3"/>
<record id="action_payment_order_draft" model="ir.actions.act_window">
<field name="name">Draft payment order</field>
<field name="name">Draft Payment Order</field>
<field name="res_model">payment.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','draft')]</field>
</record>
<menuitem action="action_payment_order_draft" id="menu_action_payment_order_draft" parent="account_payment.menu_action_payment_order_form" sequence="1"/>
<menuitem action="action_payment_order_draft" id="menu_action_payment_order_draft" parent="account_payment.menu_action_payment_order_form" sequence="2"/>
<record id="action_payment_order_open" model="ir.actions.act_window">
<field name="name">Payment orders to validate</field>
<field name="name">Payment Orders to Validate</field>
<field name="res_model">payment.order</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('state','=','open')]</field>
</record>
<menuitem action="action_payment_order_open" id="menu_action_payment_order_open" parent="account_payment.menu_action_payment_order_form" sequence="2"/>
<menuitem action="action_payment_order_open" id="menu_action_payment_order_open" parent="account_payment.menu_action_payment_order_form" sequence="3"/>
<record id="action_payment_order_tree_new" model="ir.actions.act_window">
<field name="name">New Payment Order</field>
@ -208,7 +208,7 @@
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
</record>
<menuitem action="action_payment_order_tree_new" id="menu_action_payment_order_form_new" parent="menu_main" sequence="3"/>
<menuitem action="action_payment_order_tree_new" id="menu_action_payment_order_form_new" parent="account_payment.menu_action_payment_order_form" sequence="1"/>
<record id="view_payment_line_form" model="ir.ui.view">

View File

@ -98,56 +98,59 @@ class accounting_report_indicator(report_sxw.rml_parse):
self.header_name = []
self.header_val = []
self.main_dict = {}
def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[],data=''):
self._node.data = ''
node = self._find_parent(self._node, nodes_parent or parents)
ns = node.nextSibling
#start
if not name=='array':
if (not name in ['array','array_header']):
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
array_header = eval(data,{'year':'Fiscal Year','periods':'Periods'})
value = [array_header]
value.extend(self.header_name)
type=['string'].extend(['float']*len(self.header_name))
width=[40]*(len(self.header_name)+1)
type=['string']
if name=='array':
type.extend(['float']*len(self.header_name))
else:
type=['lable'] * (len(self.header_name)+1)
width = [538/float(len(value))]*(len(value))
if not lst:
lst.append(1)
for ns in node.childNodes :
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
width_str = ns._attrs['colWidths'].nodeValue
ns.removeAttribute('colWidths')
total_td = td * len(value)
# total_td = td * len(value)
if not width:
for v in value:
width.append(30)
for v in range(len(value)):
for v in range(len(width)):
width_str +=',%d'%width[v]
ns.setAttribute('colWidths',width_str)
child_list = ns.childNodes
check=0
for child in child_list:
if child.nodeName=='tr':
lc = child.childNodes[1]
# for t in range(td):
i=0
for v in value:
newnode = lc.cloneNode(1)
if check==1:
t1="[[ %s['%s'] ]]"%(name,v)
else:
if type[i] == 'float':
t1="[[ '%.2f' % " + "%s['%s'] ]]"%(name,v)
if type[i] == 'lable':
t1="%s"%(v)
newnode.childNodes[1].lastChild.data = t1
else:
t1="[[ %s['%s'] ]]"%(name,v)
newnode.childNodes[1].lastChild.data = t1
child.appendChild(newnode)
newnode=False
i+=1
check=1
return super(accounting_report_indicator,self).repeatIn(lst, name, nodes_parent=False)
def lines(self,data):
@ -190,7 +193,7 @@ class accounting_report_indicator(report_sxw.rml_parse):
temp_dict=zip(self.header_name,self.header_val)
res=dict(temp_dict)
array_header = eval(array_header,{'year':'Fiscal Year','periods':'Periods'})
res[array_header]='Value'
res[array_header]=object['name']
result.append(res)
return result

View File

@ -150,22 +150,30 @@
</para>
</section>
<section>
<para style="P1">[[ repeatIn(lines(data['form']),'o')]]</para>
<para style="P13">[[ o['array_table'] and repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]]</para>
<para style="P13">[[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array_header',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]]</para>
<blockTable colWidths="0.0" style="Table5">
<tr>
<td>
<para style="P9"> </para>
</td>
</tr>
<tr>
<td>
<para style="P9"> </para>
<para style="P3"> </para>
</td>
</tr>
</blockTable>
</section>
<hr color="black" thickness="1.5"/>
<section>
<para style="P1">[[ repeatIn(lines(data['form']),'o')]]</para>
<para style="P13">[[ repeatIn(getarray(data['form'],o,array_header=data['form']['select_base']),'array',td=len(data['form']['base_selection'][0][2]),data=data['form']['select_base']) or removeParentNode('section') ]]</para>
<blockTable colWidths="0.00" style="Table5">
<tr>
<td>
<para style="P9"> </para>
</td>
</tr>
</blockTable>
</section>
</story>
</document>

View File

@ -54,8 +54,8 @@ def _load_base(self, cr, uid, data, context):
return data['form']
def _check_len(self, cr, uid, data, context):
if len(data['form']['base_selection'][0][2])>12:
raise wizard.except_wizard('User Error!',"Please select maximum 12 records to fit the page-width.")
if len(data['form']['base_selection'][0][2])>8:
raise wizard.except_wizard('User Error!',"Please select maximum 8 records to fit the page-width.")
return data['form']
class wizard_print_indicators(wizard.interface):

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$
#
@ -85,20 +85,19 @@ class wizard_vat(wizard.interface):
period="to_date('" + str(obj_year.date_start) + "','yyyy-mm-dd') and to_date('" + str(obj_year.date_stop) +"','yyyy-mm-dd')"
street=zip_city=country=''
if not obj_cmpny.partner_id.address:
street=zip_city=country=''
for ads in obj_cmpny.partner_id.address:
if ads.type=='default':
zip_city = pooler.get_pool(cr.dbname).get('res.partner.address').get_city(cr,uid,ads.id)
if not zip_city:
zip_city = ''
if ads.street:
street=ads.street
if ads.street2:
street +=ads.street2
if ads.country_id:
country=ads.country_id.code
addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [obj_cmpny.partner_id.id], ['invoice'])
if addr.get('invoice',False):
ads=pooler.get_pool(cr.dbname).get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
zip_city = pooler.get_pool(cr.dbname).get('res.partner.address').get_city(cr,uid,ads.id)
if not zip_city:
zip_city = ''
if ads.street:
street=ads.street
if ads.street2:
street +=ads.street2
if ads.country_id:
country=ads.country_id.code
sender_date=time.strftime('%Y-%m-%d')
@ -111,7 +110,7 @@ class wizard_vat(wizard.interface):
data_file +='\n\t\t<Country>'+ str(country) +'</Country>\n\t</CompanyInfo>\n</AgentRepr>'
data_comp ='\n<CompanyInfo>\n\t<VATNum>'+str(company_vat)+'</VATNum>\n\t<Name>'+str(obj_cmpny.name)+'</Name>\n\t<Street>'+ str(street) +'</Street>\n\t<CityAndZipCode>'+ str(zip_city) +'</CityAndZipCode>\n\t<Country>'+ str(country) +'</Country>\n</CompanyInfo>'
data_period ='\n<Period>'+ str(obj_year.name[-4:]) +'</Period>'
error_message=[]
for p_id in p_id_list:
record=[] # this holds record per partner
obj_partner=pooler.get_pool(cr.dbname).get('res.partner').browse(cr,uid,p_id)
@ -121,14 +120,18 @@ class wizard_vat(wizard.interface):
continue
record.append(obj_partner.vat)
for ads in obj_partner.address:
if ads.type=='default':
if ads.country_id:
record.append(ads.country_id.code)
else:
raise wizard.except_wizard('Data Insufficient!', 'The Partner "'+obj_partner.name + '"'' has no country associated with its default type address!')
addr = pooler.get_pool(cr.dbname).get('res.partner').address_get(cr, uid, [obj_partner.id], ['invoice'])
if addr.get('invoice',False):
ads=pooler.get_pool(cr.dbname).get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
if ads.country_id:
record.append(ads.country_id.code)
else:
raise wizard.except_wizard('Data Insufficient!', 'The Partner "'+obj_partner.name + '"'' has no default type address!')
error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no country associated with its Invoice address!')
if len(record)<2:
record.append('')
error_message.append('Data Insufficient! : '+ 'The Partner "'+obj_partner.name + '"'' has no Invoice address!')
if len(line_info)==1:
if line_info[0][0]=='produit':
record.append(0.00)
@ -145,6 +148,9 @@ class wizard_vat(wizard.interface):
data_clientinfo=''
sum_tax=0.00
sum_turnover=0.00
if len(error_message):
data['form']['msg']='Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
return data['form']
for line in datas:
if line[3]< data['form']['limit_amount']:
continue

View File

@ -258,15 +258,17 @@ class mrp_bom(osv.osv):
factor = bom.product_rounding
result = []
result2 = []
phantom=False
if bom.type=='phantom' and not bom.bom_lines:
newbom = self._bom_find(cr, uid, bom.product_id.id, bom.product_uom.id, properties)
if newbom:
res = self._bom_explode(cr, uid, self.browse(cr, uid, [newbom])[0], factor*bom.product_qty, properties, addthis=True, level=level+10)
result = result + res[0]
result2 = result2 + res[1]
phantom=True
else:
return [],[]
else:
phantom=False
if not phantom:
if addthis and not bom.bom_lines:
result.append(
{

View File

@ -1,8 +1,8 @@
<?xml version="1.0"?>
<document filename="test.pdf">
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<template pageSize="(224.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
<pageTemplate id="first">
<frame id="first" x1="34.0" y1="42.0" width="145" height="758"/>
<frame id="first" x1="0.0" y1="0.0" width="224" height="842"/>
</pageTemplate>
</template>
<stylesheet>
@ -56,8 +56,8 @@
<story>
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
<para style="P2">[[ o.user_id.company_id.name ]]</para>
<para style="P3">[[ address and address.street or '' ]], [[ address and address.zip or '']] [[ address and address.city or '' ]]</para>
<para style="P3">[[ address and address.country_id and address.country_id.name or '' ]]</para>
<para style="P3">[[ address and address.street ]], [[ address and address.zip ]] [[ address and address.city ]]</para>
<para style="P3">[[ address and address.country_id and address.country_id.name ]]</para>
<para style="P3">Tel : [[ address and address.phone ]]</para>
<para style="P3">E-mail : [[ address and address.email ]]</para>
<para style="P3">User : [[ o.user_id.name ]]</para>

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$
#
@ -184,6 +184,7 @@ class purchase_order(osv.osv):
store={
'purchase.order.line': (_get_order, None, 10),
}, multi="sums"),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position')
}
_defaults = {
'date_order': lambda *a: time.strftime('%Y-%m-%d'),
@ -198,7 +199,7 @@ class purchase_order(osv.osv):
_name = "purchase.order"
_description = "Purchase order"
_order = "name desc"
def unlink(self, cr, uid, ids):
purchase_orders = self.read(cr, uid, ids, ['state'])
unlink_ids = []
@ -207,8 +208,8 @@ class purchase_order(osv.osv):
unlink_ids.append(s['id'])
else:
raise osv.except_osv(_('Invalid action !'), _('Cannot delete Purchase Order(s) which are in %s State!' % s['state']))
return osv.osv.unlink(self, cr, uid, unlink_ids)
return osv.osv.unlink(self, cr, uid, unlink_ids)
def button_dummy(self, cr, uid, ids, context={}):
return True
@ -227,11 +228,12 @@ class purchase_order(osv.osv):
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
return {'value':{'partner_address_id': False}}
return {'value':{'partner_address_id': False, 'fiscal_position': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
part = self.pool.get('res.partner').browse(cr, uid, part)
pricelist = part.property_product_pricelist_purchase.id
return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}}
fiscal_position = part.property_account_position and part.property_account_position.id or False
return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist, 'fiscal_position': fiscal_position}}
def wkf_approve_order(self, cr, uid, ids, context={}):
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': time.strftime('%Y-%m-%d')})

View File

@ -82,6 +82,7 @@
<separator string="Invoice Control" colspan="2"/>
<field name="invoice_method"/>
<field name="invoice_id" readonly="1"/>
<field name="fiscal_position"/>
</group>
<newline/>
<separator string="Purchase Control" colspan="4"/>
@ -206,11 +207,11 @@
</record>
<act_window
context="{'partner_id': active_id}"
domain="[('partner_id', '=', active_id)]"
id="act_res_partner_2_purchase_order"
name="Purchase orders"
res_model="purchase.order"
context="{'partner_id': active_id}"
domain="[('partner_id', '=', active_id)]"
id="act_res_partner_2_purchase_order"
name="Purchase orders"
res_model="purchase.order"
src_model="res.partner"/>
</data>
</openerp>

View File

@ -250,6 +250,7 @@ class sale_order(osv.osv):
'invoice_quantity': fields.selection([('order','Ordered Quantities'),('procurement','Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks.",required=True),
'payment_term' : fields.many2one('account.payment.term', 'Payment Term'),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position')
}
_defaults = {
'picking_policy': lambda *a: 'direct',
@ -303,12 +304,13 @@ class sale_order(osv.osv):
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False, 'fiscal_position': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact'])
part = self.pool.get('res.partner').browse(cr, uid, part)
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
payment_term = part.property_payment_term and part.property_payment_term.id or False
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}}
fiscal_position = part.property_account_position and part.property_account_position.id or False
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term, 'fiscal_position': fiscal_position}}
def shipping_policy_change(self, cr, uid, ids, policy, context={}):
if not policy:

View File

@ -206,6 +206,7 @@
<field groups="base.group_extended" name="origin"/>
<field groups="base.group_extended" name="invoice_quantity" attrs="{'readonly':[('order_policy','=','prepaid'),('order_policy','=','picking')]}"/>
<field name="payment_term"/>
<field name="fiscal_position"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</page>