@@ -692,17 +692,7 @@ class account_move_line(osv.osv):
|
||||
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||
if not context:
|
||||
context={}
|
||||
raise_ex=False
|
||||
|
||||
if ('debit' in vals and 'credit' in vals) and not vals['debit'] and not vals['credit']:
|
||||
raise_ex=True
|
||||
if ('debit' in vals and 'credit' not in vals) and not vals['debit']:
|
||||
raise_ex=True
|
||||
if ('credit' in vals and 'debit' not in vals) and not vals['credit']:
|
||||
raise_ex=True
|
||||
|
||||
if raise_ex:
|
||||
raise osv.except_osv(_('Wrong Accounting Entry!'), _('Both Credit and Debit cannot be zero!'))
|
||||
account_obj = self.pool.get('account.account')
|
||||
if ('account_id' in vals) and not account_obj.read(cr, uid, vals['account_id'], ['active'])['active']:
|
||||
raise osv.except_osv(_('Bad account!'), _('You can not use an inactive account!'))
|
||||
|
||||
@@ -77,7 +77,6 @@ class mrp_repair(osv.osv):
|
||||
'state': fields.selection([
|
||||
('draft','Quotation'),
|
||||
('confirmed','Confirmed'),
|
||||
('ready','Ready to Repair'),
|
||||
('under_repair','Under Repair'),
|
||||
('2binvoiced','To be Invoiced'),
|
||||
('invoice_except','Invoice Exception'),
|
||||
@@ -204,14 +203,14 @@ class mrp_repair(osv.osv):
|
||||
}
|
||||
|
||||
def get_last_move(lst_move):
|
||||
while lst_move.move_dest_id and lst_move.state == 'done':
|
||||
while lst_move.move_dest_id and lst_move.move_dest_id and lst_move.move_dest_id.picking_id.state == 'done':
|
||||
lst_move = lst_move.move_dest_id
|
||||
return lst_move
|
||||
|
||||
move_id = move_ids[0]
|
||||
move = get_last_move(self.pool.get('stock.move').browse(cr, uid, move_id))
|
||||
product = self.pool.get('product.product').browse(cr, uid, product_id)
|
||||
date = move.date_planned
|
||||
date = move.picking_id.date_done
|
||||
limit = mx.DateTime.strptime(date, '%Y-%m-%d %H:%M:%S') + RelativeDateTime(months=product.warranty)
|
||||
return {'value': {
|
||||
'location_id': move.location_dest_id.id,
|
||||
@@ -259,8 +258,8 @@ class mrp_repair(osv.osv):
|
||||
invoices_group = {}
|
||||
for repair in self.browse(cr, uid, ids, context=context):
|
||||
res[repair.id]=False
|
||||
if repair.state in ('draft','cancel') or repair.invoice_id:
|
||||
continue
|
||||
if repair.state in ('draft','cancel') or repair.invoice_id:
|
||||
continue
|
||||
if not (repair.partner_id.id and repair.partner_invoice_id.id):
|
||||
raise osv.except_osv('No partner !','You have to select a partner in the repair form ! ')
|
||||
comment=repair.quotation_notes
|
||||
@@ -337,10 +336,6 @@ class mrp_repair(osv.osv):
|
||||
self.write(cr, uid, ids, {'state':'invoice_except'})
|
||||
return True
|
||||
|
||||
def action_repair_ready(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'ready'})
|
||||
return True
|
||||
|
||||
def action_repair_start(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state':'under_repair'})
|
||||
return True
|
||||
@@ -349,7 +344,7 @@ class mrp_repair(osv.osv):
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = {}
|
||||
if (order.invoice_method=='b4repair'):
|
||||
val['state'] = 'ready'
|
||||
val['state'] = 'under_repair'
|
||||
else:
|
||||
#val['state'] = 'done'
|
||||
pass
|
||||
@@ -363,7 +358,7 @@ class mrp_repair(osv.osv):
|
||||
if (not order.invoiced and order.invoice_method=='after_repair'):
|
||||
val['state'] = '2binvoiced'
|
||||
elif (not order.invoiced and order.invoice_method=='b4repair'):
|
||||
val['state'] = 'ready'
|
||||
val['state'] = 'confirmed'
|
||||
else:
|
||||
#val['state'] = 'done'
|
||||
pass
|
||||
@@ -381,13 +376,15 @@ class mrp_repair(osv.osv):
|
||||
|
||||
picking = self.pool.get('stock.picking').create(cr, uid, {
|
||||
'origin': repair.name,
|
||||
'state': 'assigned',
|
||||
'state': 'draft',
|
||||
'move_type': 'one',
|
||||
'address_id': repair.address_id and repair.address_id.id or False,
|
||||
'note': repair.internal_notes,
|
||||
'invoice_state': 'none',
|
||||
'type': 'out', # FIXME delivery ?
|
||||
})
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', picking, 'button_confirm', cr)
|
||||
|
||||
move_id = self.pool.get('stock.move').create(cr, uid, {
|
||||
'name': repair.name,
|
||||
|
||||
@@ -83,8 +83,7 @@
|
||||
<group col="13" colspan="4">
|
||||
<field name="state" select="2"/>
|
||||
<button name="repair_confirm" states="draft" string="Confirm Repair"/>
|
||||
<button name="repair_ready" states="confirmed" string="Ready to Repair"/>
|
||||
<button name="action_repair_start" states="ready" string="Start Repair"/>
|
||||
<button name="action_repair_start" states="confirmed" string="Start Repair"/>
|
||||
<button name="action_repair_end" states="under_repair" string="End Repair"/>
|
||||
<button name="invoice_recreate" states="invoice_except" string="Recreate Invoice"/>
|
||||
<button name="invoice_corrected" states="invoice_except" string="Invoice Corrected"/>
|
||||
@@ -92,7 +91,7 @@
|
||||
<button name="%(action_cancel_repair)d" states="invoice_except" string="Cancel Repair" type="action"/>
|
||||
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object"/>
|
||||
<button name="cancel" states="draft" string="Cancel Repair"/>
|
||||
<button name="%(action_cancel_repair)d" states="confirmed,2binvoiced,ready,under_repair" string="Cancel Repair" type="action"/>
|
||||
<button name="%(action_cancel_repair)d" states="confirmed,2binvoiced,under_repair" string="Cancel Repair" type="action"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Invoicing">
|
||||
|
||||
@@ -51,15 +51,6 @@
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_repair_start()</field>
|
||||
</record>
|
||||
<record id="act_repair_ready" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_repair"/>
|
||||
<field name="name">Ready Repair</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_repair_ready()</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="act_invoice_end" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_repair"/>
|
||||
<field name="name">invoice_end</field>
|
||||
@@ -87,8 +78,6 @@
|
||||
<field name="action">action_invoice_cancel()</field>
|
||||
</record> -->
|
||||
|
||||
|
||||
|
||||
<record id="act_cancel" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_repair"/>
|
||||
<field name="name">cancel</field>
|
||||
@@ -103,14 +92,8 @@
|
||||
<field name="kind">stopall</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
<record id="act_cancel3" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf_repair"/>
|
||||
<field name="name">cancel3</field>
|
||||
<field name="flow_stop">True</field>
|
||||
<field name="kind">stopall</field>
|
||||
<field name="action">action_cancel()</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<!-- Transistion -->
|
||||
|
||||
|
||||
@@ -148,12 +131,13 @@
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
<field name="act_to" ref="act_invoice_end"/>
|
||||
<field name="signal">action_invoice_create</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="trans_invoice_start_repair" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice_end"/>
|
||||
<field name="act_to" ref="act_repair_ready"/>
|
||||
<field name="act_to" ref="act_repair_start"/>
|
||||
<field name="condition">invoice_method=='b4repair'</field>
|
||||
</record>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_invoice_cancel2" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_invoice"/>
|
||||
@@ -161,55 +145,36 @@
|
||||
<field name="signal">cancel</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record id="trans_invoice_end_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_invoice_end"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
<field name="condition">invoice_method=='after_repair'</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
<record id="trans_wait_repair_ready" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_repair"/>
|
||||
<field name="act_to" ref="act_repair_ready"/>
|
||||
<field name="act_to" ref="act_repair_start"/>
|
||||
<field name="signal">repair_ready</field>
|
||||
</record>
|
||||
<record id="trans_ready_repair_start" model="workflow.transition">
|
||||
<field name="act_from" ref="act_repair_ready"/>
|
||||
<field name="act_to" ref="act_repair_start"/>
|
||||
<field name="signal">action_repair_start</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_repair_repair_end" model="workflow.transition">
|
||||
<field name="act_from" ref="act_repair_start"/>
|
||||
<field name="act_to" ref="act_repair_end"/>
|
||||
<field name="signal">action_repair_end</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_reapir_end_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_repair_end"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
<field name="condition">invoice_method=='none' or invoice_method=='b4repair'</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_reapir_end_invoice" model="workflow.transition">
|
||||
<field name="act_from" ref="act_repair_end"/>
|
||||
<field name="act_to" ref="act_wait_invoice"/>
|
||||
<field name="condition">invoice_method=='after_repair'</field>
|
||||
</record>
|
||||
|
||||
<record id="trans_wait_repair_cancel3" model="workflow.transition">
|
||||
<field name="act_from" ref="act_wait_repair"/>
|
||||
<field name="act_to" ref="act_cancel3"/>
|
||||
<field name="signal">cancel</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -184,7 +184,9 @@
|
||||
<blockTable colWidths="265.0,51.0,225.0" style="AddressTable">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">Shipping address :[[ o.address_id.title or '' ]] [[ o.address_id.name ]]</para>
|
||||
<para style="P10">Shipping address :</para>
|
||||
<para style="P1">[[ o.partner_id.name ]]</para>
|
||||
<para style="P1">[[ o.address_id.title or '' ]] [[ o.address_id.name ]]</para>
|
||||
<para style="P1">[[ o.address_id.street ]]</para>
|
||||
<para style="P1">[[ o.address_id.street2 or '' ]]</para>
|
||||
<para style="P1">[[ o.address_id.city or '' ]] [[ o.address_id.zip or '' ]]</para>
|
||||
@@ -202,7 +204,6 @@
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P19">[[ o.partner_id.name ]]</para>
|
||||
<para style="P18">[[ o.partner_id and adr_get(o.partner_id, 'default')['name'] ]]</para>
|
||||
<para style="P18">[[ o.partner_id and adr_get(o.partner_id, 'default')['street'] ]]</para>
|
||||
<para style="P18">[[ o.partner_id and adr_get(o.partner_id, 'default')['zip'] ]] [[ o.partner_id and adr_get(o.partner_id, 'default')['city'] ]]</para>
|
||||
@@ -216,7 +217,7 @@
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P6">[[ o.state<>'draft' and removeParentNode('para') ]]Repair Quotation</para>
|
||||
<para style="P6">[[ o.state<>'draft' and removeParentNode('para') ]]Repair Quotation N° : [[ o.name ]]</para>
|
||||
<para style="P26">[[ o.state=='draft' and removeParentNode('para') ]]Repair Order N° : [[ o.name ]]</para>
|
||||
<para style="P8">
|
||||
<font color="white"> </font>
|
||||
@@ -262,11 +263,9 @@
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="100.0,100,80.0,100.0,60.0,64.0" repeatRows="1" style="HeadingTable">
|
||||
<blockTable colWidths="120.0,140.0,100.0,80.0,80.0" repeatRows="1" style="HeadingTable">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P11">Product</para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P11">Description</para>
|
||||
</td>
|
||||
@@ -293,13 +292,9 @@
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P4">[[ repeatIn(o.operations,'line') ]]</para>
|
||||
<blockTable colWidths="100.0,120,80.0,100.0,60.0,64.0" style="Table7">
|
||||
<blockTable colWidths="120.0,140.0,100.0,80.0,80.0" style="Table7">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">Add [[ ((line.type == 'add') or removeParentNode('para')) and '' ]] </para>
|
||||
<para style="P3">Remove [[ ((line.type == 'remove') or removeParentNode('para')) and '' ]]</para>
|
||||
<para style="P1">[[ line.product_id.name ]]</para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P1">[[ line.name ]]</para>
|
||||
</td>
|
||||
@@ -332,11 +327,9 @@
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P23">[[ repeatIn(o.fees_lines,'fees') ]]</para>
|
||||
<blockTable colWidths="100.0,120,80.0,100.0,60.0,64.0" style="Table9">
|
||||
<blockTable colWidths="120.0,140.0,100.0,80.0,80.0" style="Table9">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P1">[[ fees.product_id.name ]]</para>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<para style="P1">[[ fees.name ]]</para>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user