bzr revid: mra@tinyerp.com-20090119135911-haorjopuozgsxght
This commit is contained in:
mra (Open ERP) 2009-01-19 19:29:11 +05:30
parent b5a174257b
commit 095558d2a6
6 changed files with 26 additions and 14 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

@ -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>