[MERGE] merge from lp:~openerp/openobject-addons/5.0/
bzr revid: hmo@tinyerp.com-20091202085041-v3ae7tu3krbr2heh
This commit is contained in:
commit
ec0abc8968
|
@ -920,7 +920,10 @@ class account_move(osv.osv):
|
||||||
amount+= (line.debit - line.credit)
|
amount+= (line.debit - line.credit)
|
||||||
return amount
|
return amount
|
||||||
|
|
||||||
def _centralise(self, cr, uid, move, mode):
|
def _centralise(self, cr, uid, move, mode, context=None):
|
||||||
|
if context is None:
|
||||||
|
context = {}
|
||||||
|
|
||||||
if mode=='credit':
|
if mode=='credit':
|
||||||
account_id = move.journal_id.default_debit_account_id.id
|
account_id = move.journal_id.default_debit_account_id.id
|
||||||
mode2 = 'debit'
|
mode2 = 'debit'
|
||||||
|
@ -943,8 +946,9 @@ class account_move(osv.osv):
|
||||||
if res:
|
if res:
|
||||||
line_id = res[0]
|
line_id = res[0]
|
||||||
else:
|
else:
|
||||||
|
context.update({'journal_id': move.journal_id.id, 'period_id': move.period_id.id})
|
||||||
line_id = self.pool.get('account.move.line').create(cr, uid, {
|
line_id = self.pool.get('account.move.line').create(cr, uid, {
|
||||||
'name': 'Centralisation '+mode,
|
'name': _t(cr, None, 'selection', context.get('lang'), source=(mode.capitalize()+' Centralisation')) or (mode.capitalize()+' Centralisation'),
|
||||||
'centralisation': mode,
|
'centralisation': mode,
|
||||||
'account_id': account_id,
|
'account_id': account_id,
|
||||||
'move_id': move.id,
|
'move_id': move.id,
|
||||||
|
@ -953,7 +957,7 @@ class account_move(osv.osv):
|
||||||
'date': move.period_id.date_stop,
|
'date': move.period_id.date_stop,
|
||||||
'debit': 0.0,
|
'debit': 0.0,
|
||||||
'credit': 0.0,
|
'credit': 0.0,
|
||||||
}, {'journal_id': move.journal_id.id, 'period_id': move.period_id.id})
|
}, context)
|
||||||
|
|
||||||
# find the first line of this move with the other mode
|
# find the first line of this move with the other mode
|
||||||
# so that we can exclude it from our calculation
|
# so that we can exclude it from our calculation
|
||||||
|
@ -1035,8 +1039,8 @@ class account_move(osv.osv):
|
||||||
#
|
#
|
||||||
continue
|
continue
|
||||||
if journal.centralisation:
|
if journal.centralisation:
|
||||||
self._centralise(cr, uid, move, 'debit')
|
self._centralise(cr, uid, move, 'debit', context=context)
|
||||||
self._centralise(cr, uid, move, 'credit')
|
self._centralise(cr, uid, move, 'credit', context=context)
|
||||||
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
|
self.pool.get('account.move.line').write(cr, uid, line_draft_ids, {
|
||||||
'state': 'valid'
|
'state': 'valid'
|
||||||
}, context, check=False)
|
}, context, check=False)
|
||||||
|
|
|
@ -578,7 +578,7 @@ class account_bank_statement_line(osv.osv):
|
||||||
'account_id': fields.many2one('account.account','Account',
|
'account_id': fields.many2one('account.account','Account',
|
||||||
required=True),
|
required=True),
|
||||||
'statement_id': fields.many2one('account.bank.statement', 'Statement',
|
'statement_id': fields.many2one('account.bank.statement', 'Statement',
|
||||||
select=True, required=True),
|
select=True, required=True, ondelete='cascade'),
|
||||||
'reconcile_id': fields.many2one('account.bank.statement.reconcile',
|
'reconcile_id': fields.many2one('account.bank.statement.reconcile',
|
||||||
'Reconcile', states={'confirm':[('readonly',True)]}),
|
'Reconcile', states={'confirm':[('readonly',True)]}),
|
||||||
'move_ids': fields.many2many('account.move',
|
'move_ids': fields.many2many('account.move',
|
||||||
|
|
|
@ -425,6 +425,20 @@
|
||||||
<field name="context">{'type':'out_refund'}</field>
|
<field name="context">{'type':'out_refund'}</field>
|
||||||
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
<field name="search_view_id" ref="view_account_invoice_filter"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<record id="action_invoice_tree3_view1" model="ir.actions.act_window.view">
|
||||||
|
<field eval="1" name="sequence"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="act_window_id" ref="action_invoice_tree3"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="action_invoice_tree3_view2" model="ir.actions.act_window.view">
|
||||||
|
<field eval="2" name="sequence"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="invoice_form"/>
|
||||||
|
<field name="act_window_id" ref="action_invoice_tree3"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
<menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="account.menu_finance_invoice"/>
|
<menuitem action="action_invoice_tree3" id="menu_action_invoice_tree3" parent="account.menu_finance_invoice"/>
|
||||||
|
|
||||||
<record id="action_invoice_tree3_new" model="ir.actions.act_window">
|
<record id="action_invoice_tree3_new" model="ir.actions.act_window">
|
||||||
|
|
|
@ -103,9 +103,10 @@ class account_move_line(osv.osv):
|
||||||
|
|
||||||
total_new=0.00
|
total_new=0.00
|
||||||
for i in context['lines']:
|
for i in context['lines']:
|
||||||
total_new +=(i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00)
|
if i[2]:
|
||||||
for item in i[2]:
|
total_new +=(i[2]['debit'] or 0.00)- (i[2]['credit'] or 0.00)
|
||||||
data[item]=i[2][item]
|
for item in i[2]:
|
||||||
|
data[item]=i[2][item]
|
||||||
if context['journal']:
|
if context['journal']:
|
||||||
journal_obj=self.pool.get('account.journal').browse(cr,uid,context['journal'])
|
journal_obj=self.pool.get('account.journal').browse(cr,uid,context['journal'])
|
||||||
if journal_obj.type == 'purchase':
|
if journal_obj.type == 'purchase':
|
||||||
|
|
|
@ -340,7 +340,6 @@
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="ref"/>
|
<field name="ref"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="account_id"/>
|
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
||||||
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
|
<field domain="[('journal_id','=',parent.journal_id)]" name="account_id"/>
|
||||||
|
@ -351,7 +350,6 @@
|
||||||
<form string="Statement lines">
|
<form string="Statement lines">
|
||||||
<field name="date"/>
|
<field name="date"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="account_id"/>
|
|
||||||
<field name="type"/>
|
<field name="type"/>
|
||||||
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
<field name="partner_id" on_change="onchange_partner_id(partner_id, type, parent.currency)"/>
|
||||||
<field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id"/>
|
<field domain="[('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id"/>
|
||||||
|
|
|
@ -758,7 +758,7 @@ class account_invoice(osv.osv):
|
||||||
for i in line:
|
for i in line:
|
||||||
i[2]['period_id'] = period_id
|
i[2]['period_id'] = period_id
|
||||||
|
|
||||||
move_id = self.pool.get('account.move').create(cr, uid, move)
|
move_id = self.pool.get('account.move').create(cr, uid, move, context=context)
|
||||||
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
|
new_move_name = self.pool.get('account.move').browse(cr, uid, move_id).name
|
||||||
# make the invoice point to that move
|
# make the invoice point to that move
|
||||||
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
|
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id, 'move_name':new_move_name})
|
||||||
|
|
|
@ -162,8 +162,8 @@
|
||||||
<group col="4" colspan="2">
|
<group col="4" colspan="2">
|
||||||
<button name="button_confirm" states="draft" string="Confirm" type="object" icon="gtk-execute"/>
|
<button name="button_confirm" states="draft" string="Confirm" type="object" icon="gtk-execute"/>
|
||||||
<button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert"/>
|
<button name="action_set_to_draft" states="done" string="Set to Draft" type="object" icon="gtk-convert"/>
|
||||||
<button name="cancel" states="confirm" string="Refuse" icon="gtk-stop"/>
|
<button name="cancel" states="confirm" string="Refuse" type="workflow" icon="gtk-stop"/>
|
||||||
<button name="done" states="confirm" string="Accept" icon="gtk-apply"/>
|
<button name="done" states="confirm" string="Accept" type="workflow" icon="gtk-apply"/>
|
||||||
</group>
|
</group>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
|
|
@ -3093,28 +3093,28 @@
|
||||||
<record id="vat_refund0" model="account.account.template">
|
<record id="vat_refund0" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 0%</field>
|
<field name="name">T.V.A. due 0%</field>
|
||||||
<field name="code">411000</field>
|
<field name="code">411000</field>
|
||||||
<field name="type">receivable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4110" name="parent_id"/>
|
<field ref="a4110" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_refund06" model="account.account.template">
|
<record id="vat_refund06" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 6%</field>
|
<field name="name">T.V.A. due 6%</field>
|
||||||
<field name="code">4110001</field>
|
<field name="code">4110001</field>
|
||||||
<field name="type">receivable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4110" name="parent_id"/>
|
<field ref="a4110" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_refund12" model="account.account.template">
|
<record id="vat_refund12" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 12%</field>
|
<field name="name">T.V.A. due 12%</field>
|
||||||
<field name="code">4110002</field>
|
<field name="code">4110002</field>
|
||||||
<field name="type">receivable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4110" name="parent_id"/>
|
<field ref="a4110" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_refund21" model="account.account.template">
|
<record id="vat_refund21" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 21%</field>
|
<field name="name">T.V.A. due 21%</field>
|
||||||
<field name="code">4110003</field>
|
<field name="code">4110003</field>
|
||||||
<field name="type">receivable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4110" name="parent_id"/>
|
<field ref="a4110" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
|
@ -3689,28 +3689,28 @@
|
||||||
<record id="vat_payable0" model="account.account.template">
|
<record id="vat_payable0" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 0%</field>
|
<field name="name">T.V.A. due 0%</field>
|
||||||
<field name="code">451000</field>
|
<field name="code">451000</field>
|
||||||
<field name="type">payable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4510" name="parent_id"/>
|
<field ref="a4510" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_payable06" model="account.account.template">
|
<record id="vat_payable06" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 6%</field>
|
<field name="name">T.V.A. due 6%</field>
|
||||||
<field name="code">4510001</field>
|
<field name="code">4510001</field>
|
||||||
<field name="type">payable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4510" name="parent_id"/>
|
<field ref="a4510" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_payable12" model="account.account.template">
|
<record id="vat_payable12" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 12%</field>
|
<field name="name">T.V.A. due 12%</field>
|
||||||
<field name="code">4510002</field>
|
<field name="code">4510002</field>
|
||||||
<field name="type">payable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4510" name="parent_id"/>
|
<field ref="a4510" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
<record id="vat_payable21" model="account.account.template">
|
<record id="vat_payable21" model="account.account.template">
|
||||||
<field name="name">T.V.A. due 21%</field>
|
<field name="name">T.V.A. due 21%</field>
|
||||||
<field name="code">4510003</field>
|
<field name="code">4510003</field>
|
||||||
<field name="type">payable</field>
|
<field name="type">other</field>
|
||||||
<field name="user_type" ref="user_type_tax"/>
|
<field name="user_type" ref="user_type_tax"/>
|
||||||
<field ref="a4510" name="parent_id"/>
|
<field ref="a4510" name="parent_id"/>
|
||||||
</record>
|
</record>
|
||||||
|
|
|
@ -48,6 +48,13 @@ fields = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _check_picking(self, cr, uid, data, context):
|
||||||
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
move_obj = pool.get('stock.move').browse(cr, uid, data['id'])
|
||||||
|
if not move_obj.picking_id:
|
||||||
|
raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.'))
|
||||||
|
return data['form']
|
||||||
|
|
||||||
def _track_lines(self, cr, uid, data, context):
|
def _track_lines(self, cr, uid, data, context):
|
||||||
move_id = data['id']
|
move_id = data['id']
|
||||||
|
|
||||||
|
@ -115,7 +122,7 @@ def _track_lines(self, cr, uid, data, context):
|
||||||
class wizard_track_move(wizard.interface):
|
class wizard_track_move(wizard.interface):
|
||||||
states = {
|
states = {
|
||||||
'init': {
|
'init': {
|
||||||
'actions': [],
|
'actions': [_check_picking],
|
||||||
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
|
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
|
||||||
},
|
},
|
||||||
'track': {
|
'track': {
|
||||||
|
|
|
@ -524,7 +524,7 @@ class sale_order(osv.osv):
|
||||||
for move in stock_move_obj.browse( cr, uid, move_ids ):
|
for move in stock_move_obj.browse( cr, uid, move_ids ):
|
||||||
#if one of the related order lines is in state draft, auto or confirmed
|
#if one of the related order lines is in state draft, auto or confirmed
|
||||||
#this order line is not yet delivered
|
#this order line is not yet delivered
|
||||||
if move.state in ('draft', 'auto', 'confirmed'):
|
if move.state in ('draft', 'waiting', 'confirmed'):
|
||||||
pending_deliveries = True
|
pending_deliveries = True
|
||||||
# Reason => if there are no move lines,the following condition will always set to be true,and will set SO to 'DONE'.
|
# Reason => if there are no move lines,the following condition will always set to be true,and will set SO to 'DONE'.
|
||||||
# Added move_ids check to SOLVE.
|
# Added move_ids check to SOLVE.
|
||||||
|
@ -967,7 +967,7 @@ class sale_order_line(osv.osv):
|
||||||
partner = partner_obj.browse(cr, uid, partner_id)
|
partner = partner_obj.browse(cr, uid, partner_id)
|
||||||
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
|
result['tax_id'] = self.pool.get('account.fiscal.position').map_tax(cr, uid, fpos, product_obj.taxes_id)
|
||||||
if not flag:
|
if not flag:
|
||||||
result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id])[0][1]
|
result['name'] = self.pool.get('product.product').name_get(cr, uid, [product_obj.id], context=context)[0][1]
|
||||||
domain = {}
|
domain = {}
|
||||||
if (not uom) and (not uos):
|
if (not uom) and (not uos):
|
||||||
result['product_uom'] = product_obj.uom_id.id
|
result['product_uom'] = product_obj.uom_id.id
|
||||||
|
|
|
@ -47,6 +47,13 @@ fields = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
def _check_picking(self, cr, uid, data, context):
|
||||||
|
pool = pooler.get_pool(cr.dbname)
|
||||||
|
move_obj = pool.get('stock.move').browse(cr, uid, data['id'])
|
||||||
|
if not move_obj.picking_id:
|
||||||
|
raise wizard.except_wizard(_('Caution!'), _('Before splitting the production lots,make sure this move has a Picking attached !\nYou must save the move before performing this operation.'))
|
||||||
|
return data['form']
|
||||||
|
|
||||||
def _track_lines(self, cr, uid, data, context):
|
def _track_lines(self, cr, uid, data, context):
|
||||||
move_id = data['id']
|
move_id = data['id']
|
||||||
|
|
||||||
|
@ -115,7 +122,7 @@ def _track_lines(self, cr, uid, data, context):
|
||||||
class wizard_track_move(wizard.interface):
|
class wizard_track_move(wizard.interface):
|
||||||
states = {
|
states = {
|
||||||
'init': {
|
'init': {
|
||||||
'actions': [],
|
'actions': [_check_picking],
|
||||||
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
|
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
|
||||||
},
|
},
|
||||||
'track': {
|
'track': {
|
||||||
|
|
Loading…
Reference in New Issue