[MERGE] fix account asset, event, purchase

bzr revid: fp@tinyerp.com-20121208103338-5cm3knhiaijvgks4
This commit is contained in:
Fabien Pinckaers 2012-12-08 11:33:38 +01:00
commit fae0f2e539
16 changed files with 53 additions and 31 deletions

View File

@ -4,6 +4,7 @@
<record id="product_normal_form_view" model="ir.ui.view">
<field name="name">product.normal.form.inherit</field>
<field name="model">product.product</field>
<field name="priority">5</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<notebook position="inside">

View File

@ -41,8 +41,8 @@ class account_asset_category(osv.osv):
'company_id': fields.many2one('res.company', 'Company', required=True),
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, help="Choose the method to use to compute the amount of depreciation lines.\n"\
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
" * Degressive: Calculated on basis of: Remaining Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations'),
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations', help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Period Length', help="State here the time between 2 depreciations, in months", required=True),
'method_progress_factor': fields.float('Degressive Factor'),
'method_time': fields.selection([('number','Number of Depreciations'),('end','Ending Date')], 'Time Method', required=True,
@ -222,6 +222,15 @@ class account_asset_asset(osv.osv):
else:
val['currency_id'] = company.currency_id.id
return {'value': val}
def onchange_purchase_salvage_value(self, cr, uid, ids, purchase_value, salvage_value, context=None):
val = {}
for asset in self.browse(cr, uid, ids, context=context):
if purchase_value:
val['value_residual'] = purchase_value - salvage_value
if salvage_value:
val['value_residual'] = purchase_value - salvage_value
return {'value': val}
_columns = {
'account_move_line_ids': fields.one2many('account.move.line', 'asset_id', 'Entries', readonly=True, states={'draft':[('readonly',False)]}),
@ -243,9 +252,9 @@ class account_asset_asset(osv.osv):
'partner_id': fields.many2one('res.partner', 'Partner', readonly=True, states={'draft':[('readonly',False)]}),
'method': fields.selection([('linear','Linear'),('degressive','Degressive')], 'Computation Method', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="Choose the method to use to compute the amount of depreciation lines.\n"\
" * Linear: Calculated on basis of: Gross Value / Number of Depreciations\n" \
" * Degressive: Calculated on basis of: Remaining Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations', readonly=True, states={'draft':[('readonly',False)]}, help="Calculates Depreciation within specified interval"),
'method_period': fields.integer('Number of Months in a Period', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="State here the time during 2 depreciations, in months"),
" * Degressive: Calculated on basis of: Residual Value * Degressive Factor"),
'method_number': fields.integer('Number of Depreciations', readonly=True, states={'draft':[('readonly',False)]}, help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Number of Months in a Period', required=True, readonly=True, states={'draft':[('readonly',False)]}, help="The amount of time between two depreciations, in months"),
'method_end': fields.date('Ending Date', readonly=True, states={'draft':[('readonly',False)]}),
'method_progress_factor': fields.float('Degressive Factor', readonly=True, states={'draft':[('readonly',False)]}),
'value_residual': fields.function(_amount_residual, method=True, digits_compute=dp.get_precision('Account'), string='Residual Value'),
@ -359,8 +368,8 @@ class account_asset_depreciation_line(osv.osv):
'sequence': fields.integer('Sequence', required=True),
'asset_id': fields.many2one('account.asset.asset', 'Asset', required=True),
'parent_state': fields.related('asset_id', 'state', type='char', string='State of Asset'),
'amount': fields.float('Depreciation Amount', digits_compute=dp.get_precision('Account'), required=True),
'remaining_value': fields.float('Amount to Depreciate', digits_compute=dp.get_precision('Account'),required=True),
'amount': fields.float('Current Depreciation', digits_compute=dp.get_precision('Account'), required=True),
'remaining_value': fields.float('Next Period Depreciation', digits_compute=dp.get_precision('Account'),required=True),
'depreciated_value': fields.float('Amount Already Depreciated', required=True),
'depreciation_date': fields.date('Depreciation Date', select=1),
'move_id': fields.many2one('account.move', 'Depreciation Entry'),
@ -460,7 +469,7 @@ class account_asset_history(osv.osv):
help="The method to use to compute the dates and number of depreciation lines.\n"\
"Number of Depreciations: Fix the number of depreciation lines and the time between 2 depreciations.\n" \
"Ending Date: Choose the time between 2 depreciations and the date the depreciations won't go beyond."),
'method_number': fields.integer('Number of Depreciations'),
'method_number': fields.integer('Number of Depreciations', help="The number of depreciations needed to depreciate your asset"),
'method_period': fields.integer('Period Length', help="Time in month between two depreciations"),
'method_end': fields.date('Ending date'),
'note': fields.text('Note'),

View File

@ -108,8 +108,8 @@
<page string="General">
<group>
<group>
<field name="purchase_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="purchase_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_purchase_salvage_value(purchase_value, salvage_value)"/>
<field name="salvage_value" widget="monetary" options="{'currency_field': 'currency_id'}" on_change="onchange_purchase_salvage_value(purchase_value, salvage_value)"/>
<field name="value_residual" widget="monetary" options="{'currency_field': 'currency_id'}"/>
<field name="partner_id"/>
</group>

View File

@ -8,12 +8,17 @@
<field name="arch" type="xml">
<form string="Modify Asset" version="7.0">
<group string="Asset Durations to Modify" col="4">
<field name="name" colspan="4"/>
<group colspan="2" col="2">
<field name="name"/>
<field name="method_number"/>
<field name="method_end"/>
</group>
<field name="method_period"/>
<group colspan="2" col="2">
<field name="method_end"/>
<label for="method_period"/>
<div>
<field name="method_period" class="oe_inline"/> months
</div>
</group>
</group>
<separator string="Notes"/>
<field name="note"/>

View File

@ -9,7 +9,7 @@
<field name="model">account.voucher</field>
<field name="inherit_id" ref="account_voucher.view_vendor_payment_form" />
<field name="arch" type="xml">
<field name="journal_id" position="after">
<field name="amount" position="after">
<newline/>
<field name="allow_check" invisible="1"/>
<field name="amount_in_word" attrs="{'invisible':[('allow_check','!=',1)]}" nolabel="1" colspan="6"/>

View File

@ -26,7 +26,7 @@ class product(osv.osv):
_inherit = 'product.product'
_columns = {
'event_ok': fields.boolean('Event Subscription', help='Determine if a product needs to create automatically an event registration at the confirmation of a sale order line.'),
'event_type_id': fields.many2one('event.type', 'Type of Event', help='Filter the list of event on this category only, in the sale order lines'),
'event_type_id': fields.many2one('event.type', 'Type of Event', help='Select event types so when we use this product in Sale order line, it will filter events of this type only.'),
}
def onchange_event_ok(self, cr, uid, ids, event_ok, context=None):

View File

@ -10,9 +10,9 @@
<field name="event_ok" on_change="onchange_event_ok(event_ok, context)"/>
<label for="event_ok"/>
</div>
<field name='default_code' position='before'>
<div name='ean' position="after">
<field name="event_type_id" attrs="{'readonly': [('event_ok', '=', False)]}"/>
</field>
</div>
</field>
</record>
@ -21,12 +21,18 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<xpath expr="//field[@name='discount']" position="after">
<field name="event_id" colspan="3" domain="[('type', 'in', list(set((event_type_id,False))))]" attrs="{'invisible': [('event_ok', '=', False)],'required': [('event_ok', '!=', False)]}"/>
<xpath expr="//field[@name='product_id']" position="after">
<field name="event_id" domain="['|', ('type','=', False),('type', '=', event_type_id)]" attrs="{'invisible': [('event_ok', '=', False)],'required': [('event_ok', '!=', False)]}"/>
<field name="event_type_id" invisible="1"/>
<field name="event_ok" invisible="1"/>
</xpath>
</field>
</record>
<!-- the presence of 'event user' makes the order lines non-editable -->
<record id="sale.view_order_form_editable_list" model="ir.ui.view">
<field name="groups_id" eval="[(4, ref('event.group_event_user'))]"/>
</record>
</data>
</openerp>

View File

@ -25,8 +25,8 @@
<h1>
<field name="name"/>
</h1>
<label for="category_ids" class="oe_edit_only"/>
<field name="category_ids" widget="many2many_tags" placeholder="e.g. Part Time"/>
<label for="category_ids" class="oe_edit_only" groups="base.group_hr_user"/>
<field name="category_ids" widget="many2many_tags" placeholder="e.g. Part Time" groups="base.group_hr_user"/>
</div>
<div class="oe_right oe_button_box" name="button_box">
<!-- Put here related buttons -->
@ -112,7 +112,7 @@
<search string="Employees">
<field name="name" string="Employees"/>
<field name="department_id" />
<field name="category_ids"/>
<field name="category_ids" groups="base.group_hr_user"/>
<group expand="0" string="Group By...">
<filter string="Manager" icon="terp-personal" domain="[]" context="{'group_by':'parent_id'}"/>
<filter string="Coach" icon="terp-personal" domain="[]" context="{'group_by':'coach_id'}"/>

View File

@ -84,9 +84,10 @@
<record model="ir.ui.view" id="product_normal_form_view">
<field name="name">Membership Products</field>
<field name="model">product.product</field>
<field name="priority">6</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<page string="Information" position="after">
<page string="Accounting" position="after">
<page string="Membership">
<group col="1">
<group>

View File

@ -360,9 +360,9 @@
<label string="-" attrs="{'invisible':[('product_uos','=',False)]}" class="oe_inline"/>
<field name="product_uos" class="oe_inline"/>
</div>
<label for="routing_id" class="oe_inline" groups="mrp.group_mrp_routings"/>
<div groups="mrp.group_mrp_routings">
<label for="routing_id" class="oe_edit_only"/>
<h2><field name="routing_id" class="oe_inline"/></h2>
<field name="routing_id" class="oe_inline"/>
</div>
</group>
<group>

View File

@ -39,6 +39,7 @@ class mrp_subproduct(osv.osv):
}
_defaults={
'subproduct_type': 'variable',
'product_qty': lambda *a: 1.0,
}
def onchange_product_id(self, cr, uid, ids, product_id, context=None):

View File

@ -323,7 +323,7 @@ class product_template(osv.osv):
help='Coefficient to convert default Unit of Measure to Unit of Sale\n'
' uos = uom * coeff'),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type'),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Supplier'),
'company_id': fields.many2one('res.company', 'Company', select=1),
}

View File

@ -124,7 +124,7 @@
</group>
</group>
</page>
<page string="Sales" attrs="{'readonly':[('sale_ok','=',0)]}">
<page string="Sales" attrs="{'invisible':[('sale_ok','=',False)]}">
<group name="sale">
<group string="Sale Conditions">
<label for="warranty"/>

View File

@ -32,7 +32,6 @@
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
@ -167,4 +166,4 @@
</para>
<para style="terp_default_9">[[ user.signature or '' ]]</para>
</story>
</document>
</document>

View File

@ -182,7 +182,7 @@
<field name="model">product.product</field>
<field name="inherit_id" ref="procurement.product_form_view_procurement_button"/>
<field name="arch" type="xml">
<field name="procure_method" position="before">
<field name="supply_method" position="after">
<field name="purchase_requisition"/>
</field>
</field>

View File

@ -198,7 +198,7 @@
</div>
<field name="price_unit"/>
<label for="discount" groups="sale.group_discount_per_so_line"/>
<div groups="sale.group_discount_per_so_line">
<div name="discount" groups="sale.group_discount_per_so_line">
<field name="discount" class="oe_inline"/> %%
</div>
</group>