@@ -22,6 +22,7 @@
|
||||
|
||||
import account
|
||||
import project
|
||||
import partner
|
||||
import invoice
|
||||
import account_bank_statement
|
||||
import account_move_line
|
||||
@@ -29,7 +30,6 @@ import account_analytic_line
|
||||
import wizard
|
||||
import report
|
||||
|
||||
import partner
|
||||
import product
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -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/>
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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),
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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')})
|
||||
|
||||
@@ -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>
|
||||
|
||||
+4
-2
@@ -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:
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user