ACCOUNT: new cash_discount on payment term\n ACCOUNT: invoice: debug product_id_change

bzr revid: pinky-ba5d75544867334035140493cc12dacf90d8b886
This commit is contained in:
pinky 2006-12-28 09:30:48 +00:00
parent 4335486ae8
commit e5206f9329
3 changed files with 51 additions and 7 deletions

View File

@ -36,6 +36,18 @@ from tools.misc import currency
import mx.DateTime
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
class account_cash_discount(osv.osv):
_name = "account.cash.discount"
_description = "Cash Discount" #A reduction in the price of an item for sale allowed if payment is made within a stipulated period.
_columns = {
'name': fields.char('Name', size=32),
'date': fields.date('Date', required=True),
'discount': fields.float('Discount (%)', digits=(16,2)),
'payment_id': fields.many2one('account.payment.term','Associated Payment Term'),
}
account_cash_discount()
class account_payment_term(osv.osv):
_name = "account.payment.term"
_description = "Payment Term"
@ -43,7 +55,8 @@ class account_payment_term(osv.osv):
'name': fields.char('Payment Term', size=32),
'active': fields.boolean('Active'),
'note': fields.text('Description'),
'line_ids': fields.one2many('account.payment.term.line', 'payment_id', 'Terms')
'line_ids': fields.one2many('account.payment.term.line', 'payment_id', 'Terms'),
'cash_discount_ids': fields.one2many('account.cash.discount', 'payment_id', 'Cash Discount'),
}
_defaults = {
'active': lambda *a: 1,

View File

@ -1092,6 +1092,36 @@
</record>
<menuitem name="Financial Management/Configuration/Models/Models Definition" id="menu_action_model_form" action="action_model_form"/>
<!-- cash discount -->
<record model="ir.ui.view" id="view_cash_discount_form">
<field name="name">account.cash.discount.form</field>
<field name="model">account.cash.discount</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Cash Discount">
<field name="name" select="1"/>
<field name="date" select="1"/>
<field name="discount" select="1"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_cash_discount_tree">
<field name="name">account.cash.discount.tree</field>
<field name="model">account.cash.discount</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Cash Discount">
<field name="name" select="1"/>
<field name="date" select="1"/>
<field name="discount" select="1"/>
</tree>
</field>
</record>
<!--
# Payment Terms
-->
@ -1142,6 +1172,8 @@
<field name="note" colspan="3"/>
<separator string="Computation" colspan="4"/>
<field name="line_ids" colspan="3"/>
<separator string="Cash Discount" colspan="4"/>
<field name="cash_discount_ids" colspan="3"/>
</form>
</field>
</record>

View File

@ -525,12 +525,11 @@ class account_invoice_line(osv.osv):
result['account_id'] = a[0]
domain = {}
if not uom:
result['product_uom'] = res.uom_id.id or False
if result['product_uom']:
res2 = self.pool.get('product.uom').read(cr, uid, [result['product_uom']], ['category_id'])
if res2 and res2[0]['category_id']:
domain = {'product_uom':[('category_id','=',res2[0]['category_id'][0])]}
result['uos_id'] = uom or res.uom_id.id or False
if result['uos_id']:
res2 = res.uom_id.category_id.id
if res2 :
domain = {'uos_id':[('category_id','=',res2 )]}
return {'value':result, 'domain':domain}
def move_line_get(self, cr, uid, invoice_id, context={}):