bzr revid: mra@tinyerp.com-20081205110600-l3yixw34191505f7
This commit is contained in:
Mustufa Rangwala 2008-12-05 16:36:00 +05:30
commit 78ad3d0904
18 changed files with 263 additions and 37 deletions

View File

@ -1369,7 +1369,7 @@ class account_tax(osv.osv):
r['amount'] *= quantity
return res
def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None):
def _unit_compute_inv(self, cr, uid, taxes, price_unit, address_id=None, product=None, partner=None,tax_parent_tot=0.0):
taxes = self._applicable(cr, uid, taxes, price_unit, address_id, product, partner)
res = []

View File

@ -125,7 +125,8 @@
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<separator string="Notes" position="before">
<field name="carrier_id"/>
<field name="id" invisible="True"/>
<field name="carrier_id" context="{'order_id':id}"/>
</separator>
</field>
</record>
@ -136,7 +137,7 @@
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_form"/>
<field name="arch" type="xml">
<field name="address_id" position="after">
<field name="address_id" position="after">
<field name="carrier_id"/>
<field name="weight"/>
</field>

View File

@ -28,6 +28,7 @@ class sale_order(osv.osv):
_inherit = 'sale.order'
_columns = {
'carrier_id':fields.many2one("delivery.carrier","Delivery method", help="Complete this field if you plan to invoice the shipping based on packings made."),
'id': fields.integer('ID', readonly=True,invisible=True),
}
def onchange_partner_id(self, cr, uid, ids, part):

View File

@ -51,7 +51,8 @@ class event(osv.osv):
def write(self, cr, uid, ids,vals, *args, **kwargs):
if 'date_begin' in vals and vals['date_begin']:
for eve in self.browse(cr, uid, ids):
self.pool.get('project.project').write(cr, uid, [eve.project_id.id], {'date_end':eve.date_begin})
if eve.project_id:
self.pool.get('project.project').write(cr, uid, [eve.project_id.id], {'date_end':eve.date_begin[:10]})
return super(event,self).write(cr, uid, ids,vals, *args, **kwargs)

View File

@ -134,7 +134,10 @@ class invoice_create(wizard.interface):
if data['form']['date']:
details.append(line['date'])
if data['form']['time']:
details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
if line['product_uom_id']:
details.append("%s %s" % (line['unit_amount'], pool.get('product.uom').browse(cr, uid, [line['product_uom_id']])[0].name))
else:
details.append("%s" % (line['unit_amount'], ))
if data['form']['name']:
details.append(line['name'])
#if data['form']['price']:

View File

@ -891,7 +891,7 @@ class mrp_procurement(osv.osv):
res = True
user = self.pool.get('res.users').browse(cr, uid, uid)
for procurement in self.browse(cr, uid, ids):
if procurement.product_id.product_tmpl_id.supply_method=='buy':
if procurement.product_id.product_tmpl_id.supply_method<>'produce':
if procurement.product_id.seller_ids:
partner = procurement.product_id.seller_ids[0].name
if user.company_id and user.company_id.partner_id:
@ -909,7 +909,7 @@ class mrp_procurement(osv.osv):
def check_buy(self, cr, uid, ids):
user = self.pool.get('res.users').browse(cr, uid, uid)
for procurement in self.browse(cr, uid, ids):
if procurement.product_id.product_tmpl_id.supply_method=='produce':
if procurement.product_id.product_tmpl_id.supply_method<>'buy':
return False
if not procurement.product_id.seller_ids:
cr.execute('update mrp_procurement set message=%s where id=%d', ('No supplier defined for this product !', procurement.id))

View File

@ -38,7 +38,7 @@
"demo_xml":[],
"update_xml":[
#"security/mrp_repair_security.xml",
#"security/ir.model.access.csv",
"security/ir.model.access.csv",
"mrp_repair_sequence.xml",
"mrp_repair_wizard.xml",
"mrp_repair_view.xml",

View File

@ -50,11 +50,13 @@ class mrp_repair(osv.osv):
val = 0.0
cur=repair.pricelist_id.currency_id
for line in repair.operations:
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
val+= c['amount']
if line.to_invoice:
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
val+= c['amount']
for line in repair.fees_lines:
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
val+= c['amount']
if line.to_invoice:
for c in self.pool.get('account.tax').compute(cr, uid, line.tax_id, line.price_unit, line.product_uom_qty, repair.partner_invoice_id.id, line.product_id, repair.partner_id):
val+= c['amount']
res[repair.id]=cur_obj.round(cr, uid, cur, val)
return res
@ -68,6 +70,7 @@ class mrp_repair(osv.osv):
cur=repair.pricelist_id.currency_id
res[id] = cur_obj.round(cr, uid, cur, untax.get(id, 0.0) + tax.get(id, 0.0))
return res
_columns = {
'name' : fields.char('Repair Ref',size=24, required=True),
'product_id': fields.many2one('product.product', string='Product to Repair', required=True, readonly=True, states={'draft':[('readonly',False)]}),
@ -155,7 +158,10 @@ class mrp_repair(osv.osv):
data['value']['guarantee_limit'] = limit.strftime('%Y-%m-%d')
data['value']['location_id'] = move.location_dest_id.id
data['value']['location_dest_id'] = move.location_dest_id.id
data['value']['partner_id'] = move.address_id and move.address_id.partner_id and move.address_id.partner_id.id
if move.address_id:
data['value']['partner_id'] = move.address_id.partner_id and move.address_id.partner_id.id
else:
data['value']['partner_id'] = False
data['value']['address_id'] = move.address_id and move.address_id.id
d = self.onchange_partner_id(cr, uid, ids, data['value']['partner_id'], data['value']['address_id'])
data['value'].update(d['value'])
@ -425,13 +431,17 @@ class ProductChangeMixin(object):
def product_id_change(self, cr, uid, ids, pricelist, product, uom=False, product_uom_qty=0, partner_id=False, guarantee_limit=False):
result = {}
warning = {}
if not product_uom_qty:
product_uom_qty = 1
result['product_uom_qty'] = product_uom_qty
if product:
product_obj = self.pool.get('product.product').browse(cr, uid, product)
if partner_id:
partner = self.pool.get('res.partner').browse(cr, uid, partner_id)
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, partner, product_obj.taxes_id)
result['name'] = product_obj.partner_ref
result['product_uom'] = product_obj.uom_id and product_obj.uom_id.id or False
if not pricelist:

View File

@ -18,11 +18,11 @@
<field name="repaired"/>
<newline/>
<field name="partner_id" select="2" on_change="onchange_partner_id(partner_id,address_id)"/>
<field name="address_id"/>
<field name="address_id" attrs="{'readonly':[('deliver_bool','=', False)]}"/>
<field name="invoiced"/>
</group>
<notebook colspan="4">
<page string="Operationss">
<page string="Operations">
<field name="guarantee_limit" />
<newline/>
<field colspan="4" mode="tree,form" name="operations" nolabel="1" widget="one2many_list">
@ -31,7 +31,7 @@
<page string="Repair Line">
<field name="name" colspan="4"/>
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)" colspan="4"/>
<field name="product_uom_qty" string="Qty" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
<field name="product_uom_qty" string="Qty" />
<field name="product_uom" string="UoM"/>
<field name="price_unit"/>
<field name="price_subtotal"/>
@ -61,9 +61,10 @@
<field name='name'/>
<field name="location_id"/>
<field name="location_dest_id"/>
<field name="product_uom_qty" string="Qty" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id)"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM"/>
<field name="price_unit"/>
<field name="tax_id"/>
<field name="to_invoice"/>
<field name="price_subtotal"/>
</tree>
@ -102,7 +103,7 @@
<page string="Fees Line">
<field name='name'/>
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)" colspan="4"/>
<field name="product_uom_qty" string="Qty" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM" />
<field name="price_unit"/>
<field name="price_subtotal"/>
@ -122,7 +123,7 @@
<tree string="Fees" editable="bottom">
<field name="product_id" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)"/>
<field name='name'/>
<field name="product_uom_qty" string="Qty" on_change="product_id_change(parent.pricelist_id,product_id,product_uom,product_uom_qty, parent.partner_id,parent.guarantee_limit)"/>
<field name="product_uom_qty" string="Qty"/>
<field name="product_uom" string="UoM"/>
<field name="price_unit"/>
<field name="to_invoice"/>

View File

@ -70,6 +70,7 @@
<blockTableStyle id="Table6">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<<<<<<< TREE
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
@ -81,6 +82,24 @@
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,1" stop="-1,-1"/>
=======
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="4,-1" stop="4,-1"/>
<lineStyle kind="LINEBELOW" colorName="#cccccc" start="5,-1" stop="5,-1"/>
</blockTableStyle>
<blockTableStyle id="Table9">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,2" stop="1,2"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,2" stop="2,2"/>
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,2" stop="3,2"/>
>>>>>>> MERGE-SOURCE
</blockTableStyle>
<blockTableStyle id="Table8">
<blockAlignment value="LEFT"/>
@ -106,6 +125,7 @@
<paraStyle name="P15" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P16" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<<<<<<< TREE
<paraStyle name="P18" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P19" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
@ -127,6 +147,21 @@
<paraStyle name="P36" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P37" fontName="Helvetica-Oblique" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P38" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
=======
<paraStyle name="P18" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P19" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="P20" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P21" fontName="Helvetica-Oblique" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P22" fontName="Helvetica-Oblique" fontSize="2.0" leading="3"/>
<paraStyle name="P23" fontName="Helvetica-Bold" fontSize="9.0" leading="11"/>
<paraStyle name="P24" fontName="Helvetica"/>
<paraStyle name="P25" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P26" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P27" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P28" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT"/>
<paraStyle name="P29" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
<paraStyle name="P30" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
>>>>>>> MERGE-SOURCE
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="8.0" leading="10" spaceBefore="12.0" spaceAfter="6.0"/>
@ -280,15 +315,24 @@
</tr>
</blockTable>
<section>
<<<<<<< TREE
<para style="P28"/>
<para style="P27">Operation Line(s)</para>
<blockTable colWidths="26.0,142.0,153.0,95.0,52.0,69.0" style="Table5">
=======
<para style="P30">
<font color="white"> </font>
</para>
<para style="P29">Operation Line(s)</para>
<blockTable colWidths="28.0,145.0,150.0,96.0,51.0,69.0" style="Table5">
>>>>>>> MERGE-SOURCE
<tr>
<td>
<para style="P4"><font face="Times-Roman" size="2.0">[[ repeatIn(o.operations,'line') ]]</font>Add [[ ((line.type == 'add') or removeParentNode('para')) and '' ]] </para>
<para style="P4">Remove [[ ((line.type == 'remove') or removeParentNode('para')) and '' ]]</para>
</td>
<td>
<<<<<<< TREE
<para style="P3">[[ line.name ]]</para>
</td>
<td>
@ -296,6 +340,15 @@
</td>
<td>
<para style="P20">[[ line.product_uom_qty or '0.00' ]] [[ line.product_uom.name ]] </para>
=======
<para style="P3">[[ line.name ]][[ (line.to_invoice==True) or removeParentNode('tr') ]]</para>
</td>
<td>
<para style="P6">[[ ','.join(map( lambda x: x.name, line.tax_id)) or '0.00' ]]</para>
</td>
<td>
<para style="P20">[[ line.product_uom_qty or '0.00' ]] [[ line.product_uom.name ]]</para>
>>>>>>> MERGE-SOURCE
</td>
<td>
<para style="P1">[[ line.price_unit ]]</para>
@ -306,13 +359,19 @@
</tr>
</blockTable>
</section>
<<<<<<< TREE
<para style="P22">Fees Line(s)</para>
<para style="P21">
<font color="white"> </font>
</para>
=======
<para style="P23">Fees Line(s)</para>
<para style="P21"/>
>>>>>>> MERGE-SOURCE
<blockTable colWidths="28.0,145.0,150.0,96.0,51.0,69.0" style="Table6">
<tr>
<td>
<<<<<<< TREE
<para style="P21">[[ repeatIn(o.fees_lines,'fees') ]]</para>
</td>
<td>
@ -323,6 +382,18 @@
</td>
<td>
<para style="P20">[[ fees.product_uom_qty or '0.00' ]] [[ fees.product_uom.name ]] </para>
=======
<para style="P21">[[ repeatIn(o.fees_lines,'fees') ]]</para>
</td>
<td>
<para style="P3">[[ fees.name ]][[ (fees.to_invoice==True) or removeParentNode('tr') ]]</para>
</td>
<td>
<para style="P6">[[ ','.join(map( lambda x: x.name, fees.tax_id)) or '0.00' ]]</para>
</td>
<td>
<para style="P20">[[ fees.product_uom_qty or '0.00' ]] [[ fees.product_uom.name ]] </para>
>>>>>>> MERGE-SOURCE
</td>
<td>
<para style="P1">[[ fees.price_unit ]]</para>
@ -332,6 +403,7 @@
</td>
</tr>
</blockTable>
<<<<<<< TREE
<blockTable colWidths="90.0,90.0,221.0,57.0,54.0,28.0" style="Table7">
<tr>
<td>
@ -416,6 +488,68 @@
<font color="white"> </font>
</para>
<para style="P29">
=======
<para style="P22">
<font color="white"> </font>
</para>
<para style="P22">
<font color="white"> </font>
</para>
<blockTable colWidths="384.0,67.0,64.0,24.0" style="Table9">
<tr>
<td>
<para style="P28">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P25">Net Total :</para>
</td>
<td>
<para style="P26">[[ o.amount_untaxed or '0.00' ]]</para>
</td>
<td>
<para style="P26">[[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P28">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P25">Taxes:</para>
</td>
<td>
<para style="P26">[[ o.amount_tax or '0.00']]</para>
</td>
<td>
<para style="P26">[[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
<tr>
<td>
<para style="P28">
<font color="white"> </font>
</para>
</td>
<td>
<para style="P25">Total :</para>
</td>
<td>
<para style="P27">[[ total(o) ]]</para>
</td>
<td>
<para style="P26">[[ o.pricelist_id.currency_id.name ]]</para>
</td>
</tr>
</blockTable>
<para style="Standard">
<font color="white"> </font>
</para>
<para style="Standard">
>>>>>>> MERGE-SOURCE
<font color="white"> </font>
</para>
<blockTable colWidths="534.0" style="Table8">
@ -425,6 +559,12 @@
</td>
</tr>
</blockTable>
<<<<<<< TREE
<para style="P23"/>
=======
<para style="P24">
<font color="white"> </font>
</para>
>>>>>>> MERGE-SOURCE
</story>
</document>

View File

@ -0,0 +1,7 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_mrp_repair_user","MRP Repair user","model_mrp_repair","stock.group_stock_user",1,0,0,0
"access_mrp_repair_manager","MRP Repair manager","model_mrp_repair","stock.group_stock_manager",1,1,1,1
"access_mrp_repair_line_user","MRP Repair Line user","model_mrp_repair_line","stock.group_stock_user",1,0,0,0
"access_mrp_repair_line_manager","MRP Repair Line manager","model_mrp_repair_line","stock.group_stock_manager",1,1,1,1
"access_mrp_repair_fee_user","MRP Repair Fee user","model_mrp_repair_fee","stock.group_stock_user",1,0,0,0
"access_mrp_repair_fee_manager","MRP Repair Fee manager","model_mrp_repair_fee","stock.group_stock_manager",1,1,1,1
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_mrp_repair_user MRP Repair user model_mrp_repair stock.group_stock_user 1 0 0 0
3 access_mrp_repair_manager MRP Repair manager model_mrp_repair stock.group_stock_manager 1 1 1 1
4 access_mrp_repair_line_user MRP Repair Line user model_mrp_repair_line stock.group_stock_user 1 0 0 0
5 access_mrp_repair_line_manager MRP Repair Line manager model_mrp_repair_line stock.group_stock_manager 1 1 1 1
6 access_mrp_repair_fee_user MRP Repair Fee user model_mrp_repair_fee stock.group_stock_user 1 0 0 0
7 access_mrp_repair_fee_manager MRP Repair Fee manager model_mrp_repair_fee stock.group_stock_manager 1 1 1 1

View File

@ -29,3 +29,4 @@
"access_product_pricelist_item_user","product.pricelist.item.user","model_product_pricelist_item","base.group_user",1,0,0,0
"access_product_pricelist_type_partner_manager","product.pricelist.type partner manager","model_product_pricelist_type","base.group_partner_manager",1,0,0,0
"access_product_pricelist_partner_manager","product.pricelist partner manager","model_product_pricelist","base.group_partner_manager",1,0,0,0
"access_ir_property_group_product_manager","ir_property group_product_manager","base.model_ir_property",product.group_product_manager,1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
29 access_product_pricelist_item_user product.pricelist.item.user model_product_pricelist_item base.group_user 1 0 0 0
30 access_product_pricelist_type_partner_manager product.pricelist.type partner manager model_product_pricelist_type base.group_partner_manager 1 0 0 0
31 access_product_pricelist_partner_manager product.pricelist partner manager model_product_pricelist base.group_partner_manager 1 0 0 0
32 access_ir_property_group_product_manager ir_property group_product_manager base.model_ir_property product.group_product_manager 1 1 1 1

View File

@ -247,15 +247,6 @@ class task(osv.osv):
# ('remaining_hours', 'CHECK (remaining_hours>=0)', 'Please increase and review remaining hours ! It can not be smaller than 0.'),
#]
def _button_dummy(self, cr, uid, ids, context={}):
tot_work=0
for obj in self.browse(cr,uid,ids):
for work in obj.work_ids:
tot_work+=work.hours
final_val = obj.planned_hours - tot_work
self.write(cr,uid,ids[0],{'remaining_hours':final_val})
return True
def copy(self, cr, uid, id, default={},context={}):
default = default or {}
default['work_ids'] = []
@ -417,8 +408,45 @@ class project_work(osv.osv):
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S')
}
_order = "date desc"
def create(self, cr, uid, vals, *args, **kwargs):
if 'task_id' in vals:
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f where id=%d', (-vals.get('hours',0.0), vals['task_id']))
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
def write(self, cr, uid, ids,vals,context={}):
for work in self.browse(cr, uid, ids, context):
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f+(%.2f) where id=%d', (-vals.get('hours',0.0), work.hours, work.task_id.id))
return super(project_work,self).write(cr, uid, ids, vals, context)
def unlink(self, cr, uid, ids, *args, **kwargs):
for work in self.browse(cr, uid, ids):
cr.execute('update project_task set remaining_hours=remaining_hours+%.2f where id=%d', (work.hours, work.task_id.id))
return super(project_work,self).unlink(cr, uid, ids,*args, **kwargs)
project_work()
class config_compute_remaining(osv.osv_memory):
_name='config.compute.remaining'
def _get_remaining(self,cr, uid, ctx):
if 'active_id' in ctx:
return self.pool.get('project.task').browse(cr,uid,ctx['active_id']).remaining_hours
return False
_columns = {
'remaining_hours' : fields.float('Remaining Hours', digits=(16,2), help="Total remaining time, can be re-estimated periodically by the assignee of the task."),
}
_defaults = {
'remaining_hours': _get_remaining
}
def compute_hours(self, cr, uid, ids, context=None):
if 'active_id' in context:
remaining_hrs=self.browse(cr,uid,ids)[0].remaining_hours
self.pool.get('project.task').write(cr,uid,context['active_id'],{'remaining_hours':remaining_hrs})
return {
'type': 'ir.actions.act_window_close',
}
config_compute_remaining()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -197,6 +197,34 @@
id="menu_open_view_my_project_open"
parent="project.menu_all_project"/>
<!-- Wizard for compute remaining hours -->
<record id="view_config_compute_remaining" model="ir.ui.view">
<field name="name">Compute Remaining Hours </field>
<field name="model">config.compute.remaining</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Remaining Hours">
<separator colspan="4" string="Change Remaining Hours"/>
<newline/>
<field name="remaining_hours" widget="float_time"/>
<group col="4" colspan="4">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="compute_hours" string="Update" type="object"/>
</group>
</form>
</field>
</record>
<record id="action_config_compute_remaining" model="ir.actions.act_window">
<field name="name">Compute Remaining Hours</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">config.compute.remaining</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<!-- Task -->
<record id="view_task_form2" model="ir.ui.view">
<field name="name">project.task.form</field>
@ -220,8 +248,10 @@
widget="float_time"
on_change="onchange_planned(planned_hours,effective_hours)"/>
<field name="delay_hours" widget="float_time"/>
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="1"/>
<button name="_button_dummy" string="Compute" type="object" colspan="1"/>
<group col="3" colspan="2">
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="2"/>
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" attrs="{'invisible':[('state','=','draft')]}"/>
</group>
<field name="effective_hours" widget="float_time"/>
<field colspan="4" name="description" nolabel="1" select="2"/>

View File

@ -6,3 +6,4 @@
"access_project_task_manager","project.task manager","model_project_task","project.group_project_manager",1,1,1,1
"access_project_task","project.task","model_project_task","project.group_project_user",1,1,1,1
"access_project_task_work","project.task.work","model_project_task_work","project.group_project_user",1,1,1,1
"access_config_compute_remaining","project.config.compute.remaining","model_config_compute_remaining","project.group_project_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
6 access_project_task_manager project.task manager model_project_task project.group_project_manager 1 1 1 1
7 access_project_task project.task model_project_task project.group_project_user 1 1 1 1
8 access_project_task_work project.task.work model_project_task_work project.group_project_user 1 1 1 1
9 access_config_compute_remaining project.config.compute.remaining model_config_compute_remaining project.group_project_manager 1 1 1 1

View File

@ -209,15 +209,15 @@ class sale_order(osv.osv):
'picking_policy': fields.selection([('direct','Partial Delivery'),('one','Complete Delivery')],
'Packing Policy', required=True, help="""If you don't have enough stock available to deliver all at once, do you accept partial shippings or not."""),
'order_policy': fields.selection([
('prepaid','Payment before delivery'),
('prepaid','Payment Before Delivery'),
('manual','Shipping & Manual Invoice'),
('postpaid','Automatic Invoice after delivery'),
('postpaid','Invoice on Order After Delivery'),
('picking','Invoice from the packings'),
], 'Shipping Policy', required=True, readonly=True, states={'draft':[('readonly',False)]},
help="""The Shipping Policy is used to synchronise invoice and delivery operations.
- The 'Pay before delivery' choice will first generate the invoice and then generate the packing order after the payment of this invoice.
- The 'Shipping & Manual Invoice' will create the packing order directly and wait for the user to manually click on the 'Invoice' button to generate the draft invoice.
- The 'Invoice after delivery' choice will generate the draft invoice after the packing list have been finished.
- The 'Invoice on Order Ater Delivery' choice will generate the draft invoice based on sale order after all packing lists have been finished.
- The 'Invoice from the packings' choice is used to create an invoice during the packing process."""),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'project_id':fields.many2one('account.analytic.account', 'Analytic Account', readonly=True, states={'draft':[('readonly', False)]}),

View File

@ -27,7 +27,7 @@
<field name="arch" type="xml">
<form string="Stock Inventory Lines">
<field colspan="4" domain="[('usage','=','internal')]" name="location_id" select="1"/>
<field context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1"/>
<field context="location=location_id,uom=product_uom" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom)" select="1" domain="[('type','&lt;&gt;','service')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
</form>

View File

@ -98,14 +98,16 @@
<field name="name" select="1"/>
<field name="group_id" select="1" on_change="onchange_group_id(group_id, text_area)"/>
<field name="section" select="2" invisible="not context.get('section',False)"/>
</group>
<field name="text_area" nolabel="1" colspan="4" select="1" widget="text_wiki"/>
<separator colspan="4" string="Modifications"/>
<group col="6" colspan="4">
<field name="write_date" readonly="1" select="2"/>
<field name="review" select="1"/>
<field name="minor_edit" select="2" groups="base.group_extended"/>
<field name="toc"/>
<field name="tags" select="2" groups="base.group_extended"/>
<field name="summary" colspan="4" select="2" groups="base.group_extended"/>
</group>
<field name="text_area" nolabel="1" colspan="4" select="1" widget="text_wiki"/>
</form>
</field>
</record>