View Improvement

bzr revid: fp@tinyerp.com-20080824232345-v3f5phajqy2mo9kr
This commit is contained in:
Fabien Pinckaers 2008-08-25 01:23:45 +02:00
parent 45cd43be4c
commit 0ff09fd6a9
6 changed files with 195 additions and 105 deletions

View File

@ -7,12 +7,19 @@
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="product_manager" position="after">
<newline/>
<field colspan="4" name="supplier_taxes_id"/>
<field colspan="4" name="taxes_id"/>
<newline/>
</field>
<notebook position="inside">
<page string="Accounting">
<separator string="Sales" colspan="2"/>
<separator string="Purchases" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
<separator string="Sale Taxes" colspan="2"/>
<separator string="Purchase Taxes" colspan="2"/>
<field name="taxes_id" nolabel="1" colspan="2"/>
<field name="supplier_taxes_id" nolabel="1" colspan="2"/>
</page>
</notebook>
</field>
</record>
@ -22,13 +29,17 @@
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<field name="cost_method" position="after">
<newline/>
<field colspan="4" name="supplier_taxes_id"/>
<field colspan="4" name="taxes_id"/>
<newline/>
</field>
</field>
<notebook position="inside">
<page string="Accounting">
<separator string="Sales" colspan="2"/>
<separator string="Purchases" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
<field name="supplier_taxes_id"/>
<field name="taxes_id"/>
</page>
</notebook>
</field>
</record>
@ -46,39 +57,5 @@
</field>
</record>
<record id="view_template_property_form" model="ir.ui.view">
<field name="name">product.template.property.form.inherit</field>
<field name="model">product.template</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_template_form_view"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchases Properties" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
</page>
</field>
</record>
<record id="view_normal_property_form" model="ir.ui.view">
<field name="name">product.normal.property.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Sales Properties" colspan="2"/>
<separator string="Purchases Properties" colspan="2"/>
<field name="property_account_income"/>
<field name="property_account_expense"/>
</page>
</field>
</record>
</data>
</terp>

View File

@ -246,12 +246,12 @@ class product_template(osv.osv):
'description_sale': fields.text('Sale Description'),
'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True),
'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True),
'sale_delay': fields.float('Customer lead time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing lead time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different delays will be summed for all levels and purchase orders."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."),
'produce_delay': fields.float('Manufacturing Lead Time', help="Average time to produce this product. This is only for the production order and, if it is a multi-level bill of material, it's only for the level of this product. Different delays will be summed for all levels and purchase orders."),
'procure_method': fields.selection([('make_to_stock','Make to Stock'),('make_to_order','Make to Order')], 'Procure Method', required=True, help="'Make to Stock': When needed, take from the stock or wait until refurnishing. 'Make to Order': When needed, purchase or produce for the procurement request."),
'rental': fields.boolean('Rentable product'),
'categ_id': fields.many2one('product.category','Category', required=True, change_default=True),
'list_price': fields.float('Public Price', digits=(16, int(config['price_accuracy']))),
'list_price': fields.float('Sale Price', digits=(16, int(config['price_accuracy']))),
'standard_price': fields.float('Cost Price', required=True, digits=(16, int(config['price_accuracy']))),
'volume': fields.float('Volume'),
'weight': fields.float('Gross weight'),
@ -268,10 +268,13 @@ class product_template(osv.osv):
'uos_coeff': fields.float('UOM -> UOS Coeff', digits=(16,4),
help='Coefficient to convert UOM to UOS\n'
' uom = uos * coeff'),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure type', required=True),
'tracking': fields.boolean('Track lots'),
'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier lead time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'mes_type': fields.selection((('fixed', 'Fixed'), ('variable', 'Variable')), 'Measure Type', required=True),
'tracking': fields.boolean('Track Lots', help="Force to use a Production Lot number during stock operations for traceability."),
'seller_delay': fields.function(_calc_seller_delay, method=True, type='integer', string='Supplier Lead Time', help="This is the average delay in days between the purchase order confirmation and the reception of goods for this product and for the default supplier. It is used by the scheduler to order requests based on reordering delays."),
'seller_ids': fields.one2many('product.supplierinfo', 'product_id', 'Partners'),
'loc_rack': fields.char('Rack', size=16),
'loc_row': fields.char('Row', size=16),
'loc_case': fields.char('Case', size=16),
}
def _get_uom_id(self, cr, uid, *args):
@ -410,8 +413,8 @@ class product_product(osv.osv):
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True),
'ean13': fields.char('EAN13', size=13),
'packaging' : fields.one2many('product.packaging', 'product_id', 'Palettization', help="Gives the different ways to package the same product. This has no impact on the packing order and is mainly used if you use the EDI module."),
'price_extra': fields.float('Price Extra', digits=(16, int(config['price_accuracy']))),
'price_margin': fields.float('Price Margin', digits=(16, int(config['price_accuracy']))),
'price_extra': fields.float('Variant Price Extra', digits=(16, int(config['price_accuracy']))),
'price_margin': fields.float('Variant Price Margin', digits=(16, int(config['price_accuracy']))),
}
def onchange_uom(self, cursor, user, ids, uom_id,uom_po_id):
@ -580,7 +583,7 @@ class product_supplierinfo(osv.osv):
'qty' : fields.float('Minimal quantity', required=True),
'product_id' : fields.many2one('product.template', 'Product', required=True, ondelete='cascade', select=True),
'delay' : fields.integer('Delivery delay', required=True),
'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Pricelist'),
'pricelist_ids': fields.one2many('pricelist.partnerinfo', 'suppinfo_id', 'Supplier Pricelist'),
}
_defaults = {
'qty': lambda *a: 0.0,

View File

@ -31,44 +31,84 @@
<field eval="7" name="priority"/>
<field name="arch" type="xml">
<form string="Product">
<group colspan="2" col="4">
<separator string="Product Description" colspan="4"/>
<field name="name" select="1"/>
<field name="default_code" select="1"/>
<field groups="base.group_extended" name="variants" select="2"/>
<field groups="base.group_extended" name="ean13" select="2"/>
</group>
<group colspan="2" col="2">
<separator string="Product Type" colspan="2"/>
<field name="sale_ok" select="2"/>
<field name="purchase_ok" select="2"/>
<field groups="base.group_extended" name="rental" select="2"/>
</group>
<notebook>
<page string="Information">
<field name="name" select="1"/>
<field name="default_code" select="1"/>
<field groups="base.group_extended" name="variants" select="2"/>
<field groups="base.group_extended" name="ean13" select="2"/>
<newline/>
<field name="categ_id" select="1"/>
<field name="type" select="2"/>
<field digits="(14, 3)" groups="base.group_extended" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
<newline/>
<field digits="(14, 3)" groups="base.group_extended" name="weight" attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" groups="base.group_extended" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
<field name="procure_method"/>
<field name="state" select="2"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
<field name="uom_po_id"/>
<field groups="base.group_extended" name="product_manager" select="2"/>
<group colspan="2" col="2">
<separator string="Procurement" colspan="2"/>
<field name="type" select="2"/>
<field name="procure_method"/>
<field name="supply_method"/>
</group>
<group colspan="2" col="2">
<separator string="Weigths" colspan="2"/>
<field digits="(14, 3)" groups="base.group_extended" name="volume" attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" groups="base.group_extended" name="weight" attrs="{'readonly':[('type','=','service')]}"/>
<field digits="(14, 3)" groups="base.group_extended" name="weight_net" attrs="{'readonly':[('type','=','service')]}"/>
</group>
<group colspan="2" col="2" name="status">
<separator string="Status" colspan="2"/>
<field name="categ_id" select="1"/>
<field name="state" select="2"/>
<field groups="base.group_extended" name="product_manager" select="2"/>
</group>
<group colspan="2" col="2" name="uom">
<separator string="Lots" colspan="2"/>
<field name="uom_id" on_change="onchange_uom(uom_id,uom_po_id)"/>
<field name="uom_po_id"/>
<field name="tracking"/>
</group>
<group colspan="2" col="2" name="uom">
<separator string="Second UoM" colspan="2"/>
<field name="uos_id"/>
<field name="uos_coeff"/>
<field name="mes_type"/>
</group>
</page>
<page string="Procurement">
<field name="supply_method"/>
<field name="active" select="2"/>
<newline/>
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',0)]}"/>
<field name="sale_ok" select="2"/>
<field name="produce_delay"/>
<field name="purchase_ok" select="2"/>
<field name="warranty"/>
<field groups="base.group_extended" name="rental" select="2"/>
<newline/>
<field name="list_price"/>
<page string="Procurement &amp; Locations">
<group colspan="2" col="2" name="delay">
<separator string="Delays" colspan="2"/>
<field name="sale_delay" attrs="{'readonly':[('sale_ok','=',0)]}"/>
<field name="produce_delay"/>
<field name="warranty"/>
</group>
<group colspan="2" col="2" name="store">
<separator string="Storage Localisation" colspan="2"/>
<field name="loc_rack"/>
<field name="loc_row"/>
<field name="loc_case"/>
</group>
<group colspan="2" col="2" name="misc">
<separator string="Miscelleanous" colspan="2"/>
<field name="active" select="2"/>
</group>
</page>
<page string="Prices">
<separator string="Base Prices" colspan="4"/>
<field name="standard_price"/>
<field name="list_price"/>
<field groups="base.group_extended" name="cost_method"/>
<newline/>
<field groups="base.group_uos" name="uos_id"/>
<field groups="base.group_uos" name="uos_coeff"/>
<newline/>
<field colspan="4" name="seller_ids" nolabel="1" widget="one2many_list"/>
<field colspan="4" name="seller_ids" nolabel="1" mode="form,tree"/>
</page>
<page string="Descriptions">
<separator string="Description"/>
@ -79,8 +119,6 @@
<field colspan="4" name="description_purchase" nolabel="1"/>
</page>
<page groups="base.group_extended" string="Packaging">
<field name="mes_type"/>
<field name="tracking"/>
<field colspan="4" name="packaging" nolabel="1">
<form string="Packaging">
<field name="ean" select="1"/>
@ -101,8 +139,6 @@
</form>
</field>
</page>
<page groups="base.group_extended" string="Properties">
</page>
</notebook>
</form>
</field>
@ -438,8 +474,6 @@
<separator string="Purchase Description"/>
<field colspan="4" name="description_purchase" nolabel="1"/>
</page>
<page string="Properties">
</page>
</notebook>
</form>
</field>

View File

@ -102,6 +102,49 @@ class sale_order(osv.osv):
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
return res
def _picked_rate(self, cr, uid, ids, name, arg, context=None):
if not ids: return {}
res = {}
for id in ids:
res[id] = [0.0,0.0]
cr.execute('''SELECT
p.sale_id,sum(m.product_qty), m.state
FROM
stock_move m
LEFT JOIN
stock_picking p on (p.id=m.picking_id)
WHERE
p.sale_id in ('''+','.join(map(str,ids))+''')
GROUP BY m.state, p.sale_id''')
for oid,nbr,state in cr.fetchall():
if state=='cancel':
continue
if state=='done':
res[oid][0] += nbr or 0.0
res[oid][1] += nbr or 0.0
else:
res[oid][1] += nbr or 0.0
print res
for r in res:
if not res[r][1]:
res[r] = 0.0
else:
res[r] = 100.0 * res[r][0] / res[r][1]
return res
def _invoiced_rate(self, cursor, user, ids, name, arg, context=None):
res = {}
for sale in self.browse(cursor, user, ids, context=context):
tot = 0.0
for invoice in sale.invoice_ids:
if invoice.state not in ('draft','cancel'):
tot += invoice.amount_untaxed
if tot:
res[sale.id] = tot * 100.0 / sale.amount_untaxed
else:
res[sale.id] = 0.0
return res
def _invoiced(self, cursor, user, ids, name, arg, context=None):
res = {}
for sale in self.browse(cursor, user, ids, context=context):
@ -187,6 +230,8 @@ class sale_order(osv.osv):
'invoice_ids': fields.many2many('account.invoice', 'sale_order_invoice_rel', 'order_id', 'invoice_id', 'Invoice', help="This is the list of invoices that have been generated for this sale order. The same sale order may have been invoiced in several times (by line for example)."),
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Packing List', readonly=True, help="This is the list of picking list that have been generated for this invoice"),
'shipped':fields.boolean('Picked', readonly=True),
'picked_rate': fields.function(_picked_rate, method=True, string='Picked', type='float'),
'invoiced_rate': fields.function(_invoiced_rate, method=True, string='Invoiced', type='float'),
'invoiced': fields.function(_invoiced, method=True, string='Paid',
fnct_search=_invoiced_search, type='boolean'),
'note': fields.text('Notes'),

View File

@ -54,8 +54,8 @@
<field name="name"/>
<field name="partner_id"/>
<field name="partner_shipping_id"/>
<field name="shipped"/>
<field name="invoiced"/>
<field name="picked_rate" widget="progressbar"/>
<field name="invoiced_rate" widget="progressbar"/>
<field name="amount_untaxed"/>
<field name="state"/>
</tree>

View File

@ -38,21 +38,52 @@
</record>
<record id="view_normal_property_acc.form" model="ir.ui.view">
<field name="name">product.normal.stock.acc.property.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<field name="property_account_expense" position="after">
<separator string="Accounting Entries" colspan="4"/>
<field name="property_stock_account_input"/>
<field name="property_stock_account_output"/>
</field>
</field>
</record>
<record id="view_normal_stock_property_form" model="ir.ui.view">
<field name="name">product.normal.stock.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<group name="status" position="after">
<group colspan="2" col="2">
<separator string="Stocks" colspan="4"/>
<field name="qty_available"/>
<field name="virtual_available"/>
<field name="incoming_qty"/>
<field name="outgoing_qty"/>
</group>
</group>
</field>
</record>
<record id="view_normal_property_form" model="ir.ui.view">
<field name="name">product.normal.stock.property.form.inherit</field>
<field name="model">product.product</field>
<field name="type">form</field>
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Counter-Part Locations" colspan="4"/>
<field name="property_stock_procurement"/>
<field name="property_stock_production"/>
<field name="property_stock_inventory"/>
<separator string="Accounting Entries" colspan="4"/>
<field name="property_stock_account_input"/>
<field name="property_stock_account_output"/>
</page>
<group name="store" position="after">
<group col="2" colspan="2" name="store">
<separator string="Counter-Part Locations" colspan="2"/>
<field name="property_stock_procurement"/>
<field name="property_stock_production"/>
<field name="property_stock_inventory"/>
</group>
</group>
</field>
</record>