bzr revid: mra@tinyerp.com-20080826081603-4vlg3q7he8aphss7
This commit is contained in:
Mustufa Rangwala 2008-08-26 13:46:03 +05:30
commit de04df653b
30 changed files with 1506 additions and 285 deletions

View File

@ -139,7 +139,7 @@ class account_account(osv.osv):
context=None, count=False):
if context is None:
context = {}
pos = 0
pos = 0
while pos<len(args):
if args[pos][0]=='code' and args[pos][1] in ('like','ilike'):
args[pos][1]='=like'
@ -156,7 +156,7 @@ class account_account(osv.osv):
ids1 = super(account_account,self).search(cr, uid, [('type','in',ids3)])
ids1 += map(lambda x: x.id, jour.account_control_ids)
args[pos] = ('id','in',ids1)
pos+=1
pos+=1
return super(account_account,self).search(cr, uid, args, offset, limit,
order, context=context, count=count)
@ -346,7 +346,7 @@ class account_account(osv.osv):
res.append((record['id'],name ))
return res
def copy(self, cr, uid, id, default={}, context={}):
def copy(self, cr, uid, id, default={}, context={}):
account = self.browse(cr, uid, id, context=context)
new_child_ids = []
default['parent_id'] = False
@ -423,6 +423,7 @@ class account_journal(osv.osv):
'user_id': fields.many2one('res.users', 'User', help="The responsible user of this journal"),
'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'),
'currency': fields.many2one('res.currency', 'Currency', help='The currency used to enter statement'),
'entry_posted': fields.boolean('Skip \'Draft\' State for Created Entries', help='Check this box if you don\'t want that new account moves pass through the \'draft\' state and goes direclty to the \'posted state\' without any manual validation.'),
}
_defaults = {
'active': lambda *a: 1,
@ -715,6 +716,7 @@ class account_move(osv.osv):
vals['name'] = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('Error'), _('No sequence defined in the journal !'))
accnt_journal = self.pool.get('account.journal').browse(cr, uid, vals['journal_id'])
if 'line_id' in vals:
c = context.copy()
c['novalidate'] = True
@ -1782,7 +1784,7 @@ class account_chart_template(osv.osv):
account_chart_template()
class wizard_account_chart_duplicate(osv.osv_memory):
"""
"""
Create a new account chart for a new company.
Wizards ask:
* an accuont chart (parent_id,=,False)
@ -1790,27 +1792,27 @@ class wizard_account_chart_duplicate(osv.osv_memory):
Then, the wizard:
* duplicates all accounts and assign to the right company
* duplicates all taxes, changing account assignations
* duplicate all accounting properties and assign correctly
* duplicate all accounting properties and assign correctly
"""
_name = 'wizard.account.chart.duplicate'
_columns = {
'name':fields.char('Name',size=64),
'account_id':fields.many2one('account.account','Account Chart',required=True,domain=[('parent_id','=',False)]),
'company_id':fields.many2one('res.company','Company',required=True),
}
'company_id':fields.many2one('res.company','Company',required=True),
}
def action_create(self, cr, uid,ids, context=None):
res=self.read(cr,uid,ids)[0]
if res.get('account_id',False) and res.get('company_id',False):
account_obj=self.pool.get('account.account')
account_obj=self.pool.get('account.account')
account_tax_obj=self.pool.get('account.tax')
property_obj=self.pool.get('ir.property')
# duplicate all accounts
account_obj.copy(cr,uid,res['account_id'],default={'company_id':res['company_id']})
# duplicate all taxes
# duplicate all taxes
tax_ids=account_tax_obj.search(cr,uid,[])
for tax in account_tax_obj.browse(cr,uid,tax_ids):
for tax in account_tax_obj.browse(cr,uid,tax_ids):
val={'company_id':res['company_id']}
if tax.account_collected_id:
new_invoice_account_ids=account_obj.search(cr,uid,[('name','=',tax.account_collected_id.name),('company_id','=',res['company_id'])])
@ -1818,7 +1820,7 @@ class wizard_account_chart_duplicate(osv.osv_memory):
if tax.account_paid_id:
new_refund_account_ids=account_obj.search(cr,uid,[('name','=',tax.account_paid_id.name),('company_id','=',res['company_id'])])
val['account_paid_id']=len(new_refund_account_ids) and new_refund_account_ids[0] or False
account_tax_obj.copy(cr,uid,tax.id,default=val)
account_tax_obj.copy(cr,uid,tax.id,default=val)
# duplicate all accouting properties
property_ids=property_obj.search(cr,uid,[('value','=like','account.account,%')])
for property in property_obj.browse(cr,uid,property_ids):
@ -1830,7 +1832,7 @@ class wizard_account_chart_duplicate(osv.osv_memory):
'value':'account.account,'+str(new_account_ids[0]),
'company_id':res['company_id']
})
return {'type':'ir.actions.act_window_close'}
wizard_account_chart_duplicate()

View File

@ -138,7 +138,7 @@ class account_bank_statement(osv.osv):
'currency': fields.function(_currency, method=True, string='Currency',
type='many2one', relation='res.currency'),
}
_defaults = {
'name': lambda self, cr, uid, context=None: \
self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement'),
@ -289,6 +289,8 @@ class account_bank_statement(osv.osv):
except:
raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount))
if st.journal_id.entry_posted:
account_move_obj.write(cr, uid, [move_id], {'state':'posted'})
done.append(st.id)
self.write(cr, uid, done, {'state':'confirm'}, context=context)
return True

View File

@ -404,7 +404,11 @@ class account_move_line(osv.osv):
account_id = line['account_id']['id']
partner_id = (line['partner_id'] and line['partner_id']['id']) or False
writeoff = debit - credit
date = time.strftime('%Y-%m-%d')
# Ifdate_p in context => take this date
if context.has_key('date_p') and context['date_p']:
date=context['date_p']
else:
date = time.strftime('%Y-%m-%d')
cr.execute('SELECT account_id, reconcile_id \
FROM account_move_line \
@ -435,9 +439,15 @@ class account_move_line(osv.osv):
self_credit = 0.0
self_debit = -writeoff
# If comment exist in context, take it
if context['comment']:
libelle=context['comment']
else:
libelle='Write-Off'
writeoff_lines = [
(0, 0, {
'name':'Write-Off',
'name':libelle,
'debit':self_debit,
'credit':self_credit,
'account_id':account_id,
@ -447,7 +457,7 @@ class account_move_line(osv.osv):
'amount_currency': account.currency_id.id and -currency or 0.0
}),
(0, 0, {
'name':'Write-Off',
'name':libelle,
'debit':debit,
'credit':credit,
'account_id':writeoff_acc_id,
@ -488,6 +498,11 @@ class account_move_line(osv.osv):
return r_id
def view_header_get(self, cr, user, view_id, view_type, context):
if context.get('account_id', False):
cr.execute('select code from account_account where id=%d', (context['account_id'],))
res = cr.fetchone()
res = _('Entries: ')+ (res[0] or '')
return res
if (not context.get('journal_id', False)) or (not context.get('period_id', False)):
return False
cr.execute('select code from account_journal where id=%d', (context['journal_id'],))
@ -495,8 +510,8 @@ class account_move_line(osv.osv):
cr.execute('select code from account_period where id=%d', (context['period_id'],))
p = cr.fetchone()[0] or ''
if j or p:
return j+':'+p
return 'Journal'
return j+(p and (':'+p) or '')
return False
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False):
result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context)
@ -709,7 +724,6 @@ class account_move_line(osv.osv):
tax_id=tax_obj.browse(cr,uid,vals['account_tax_id'])
total = vals['credit'] or (-vals['debit'])
for tax in tax_obj.compute(cr,uid,[tax_id],total,1.00):
print 'Processing Tax', tax
self.write(cr, uid,[result], {
'tax_code_id': tax['base_code_id'],
'tax_amount': tax['base_sign'] * total
@ -729,10 +743,11 @@ class account_move_line(osv.osv):
'credit': tax['amount']>0 and tax['amount'] or 0.0,
'debit': tax['amount']<0 and -tax['amount'] or 0.0,
}
print data
self.create(cr, uid, data, context)
if check:
self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
tmp = self.pool.get('account.move').validate(cr, uid, [vals['move_id']], context)
if journal.entry_posted and tmp:
self.pool.get('account.move').write(cr,uid, [vals['move_id']],{'state':'posted'})
return result
account_move_line()

View File

@ -256,6 +256,7 @@
<newline/>
<field name="centralisation"/>
<field name="update_posted"/>
<field name="entry_posted"/>
</page>
<page string="Entry Controls">
<separator colspan="4" string="Accounts Type Allowed (empty for no control)"/>
@ -887,7 +888,7 @@
<menuitem action="action_move_line_search" id="menu_action_move_line_search" parent="account.next_id_29"/>
<menuitem id="menu_finance_charts" name="Charts" parent="account.menu_finance" sequence="7"/>
<wizard id="wizard_account_chart" menu="False" model="account.account" name="account.chart" string="Accounts Charts"/>
<wizard id="wizard_account_chart" menu="False" model="account.account" name="account.chart" string="Chart of Accounts"/>
<menuitem action="wizard_account_chart" id="menu_action_account_tree2" parent="account.menu_finance_charts" type="wizard"/>
@ -1318,17 +1319,18 @@
</record>
<record id="action_move_line_tree1" model="ir.actions.act_window">
<field name="name">Move line select</field>
<field name="name">Entries</field>
<field name="res_model">account.move.line</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('account_id','child_of', [active_id]),('state','&lt;&gt;','draft')]</field>
<field name="context">{'account_id':active_id}</field>
</record>
<wizard id="wizard_move_line_select" menu="False" model="account.move.line" name="account.move.line.select" string="Move line select"/>
<record id="ir_open_account_account" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>
<field eval="'account.account'" name="model"/>
<field name="name">Open all entries lines</field>
<field name="name">Account Entries</field>
<field eval="'ir.actions.wizard,%d'%wizard_move_line_select" name="value"/>
<field eval="True" name="object"/>
</record>
@ -1513,14 +1515,14 @@
<menuitem id="account_account_template_menu" name="Templates" parent="account.menu_finance_configuration"/>
<menuitem action="action_account_template_form" id="menu_action_account_template_form" parent="account_account_template_menu"/>
<!-- Account Chart Templates -->
<!-- Chart of Accounts Templates -->
<record id="view_account_chart_template_form" model="ir.ui.view">
<field name="name">account.chart.template.form</field>
<field name="model">account.chart.template</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Chart Template">
<form string="Chart of Accounts Template">
<field colspan="4" name="name" select="1"/>
<newline/>
<field name="account_root_id" select="1"/>
@ -1537,7 +1539,7 @@
<field name="model">account.chart.template</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Account Chart Template">
<tree string="Chart of Accounts Template">
<field name="name"/>
<field name="account_root_id"/>
<field name="bank_account_view_id"/>
@ -1545,7 +1547,7 @@
</field>
</record>
<record id="action_account_chart_template_form" model="ir.actions.act_window">
<field name="name">Account Chart Templates</field>
<field name="name">Chart of Accounts Templates</field>
<field name="res_model">account.chart.template</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
@ -1597,7 +1599,7 @@
<field name="model">wizard.account.chart.duplicate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Duplicate Account Chart">
<form string="Duplicate Chart of Accounts">
<field name="account_id"/>
<field name="company_id"/>
<newline/>
@ -1610,7 +1612,7 @@
</record>
<record id="action_wizard_account_duplicate_chart_form" model="ir.actions.act_window">
<field name="name">Duplicate Account Chart</field>
<field name="name">Duplicate Chart of Accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">wizard.account.chart.duplicate</field>
<field name="view_type">form</field>

View File

@ -499,14 +499,18 @@ class account_invoice(osv.osv):
_('Can not create invoice move on centralized journal'))
move = {'name': name, 'line_id': line, 'journal_id': journal_id}
if inv.period_id:
move['period_id'] = inv.period_id.id
period_id=inv.period_id and inv.period_id.id or False
if not period_id:
period_ids= self.pool.get('account.period').search(cr,uid,[('date_start','<=',inv.date_invoice),('date_stop','>=',inv.date_invoice)])
if len(period_ids):
period_id=period_ids[0]
if period_id:
move['period_id'] = period_id
for i in line:
i[2]['period_id'] = inv.period_id.id
i[2]['period_id'] = period_id
move_id = self.pool.get('account.move').create(cr, uid, move)
# make the invoice point to that move
self.write(cr, uid, [inv.id], {'move_id': move_id})
self.write(cr, uid, [inv.id], {'move_id': move_id,'period_id':period_id})
self.pool.get('account.move').post(cr, uid, [move_id])
self._log_event(cr, uid, ids)
return True
@ -681,20 +685,30 @@ class account_invoice(osv.osv):
invoice = self.browse(cr, uid, ids[0])
src_account_id = invoice.account_id.id
journal = self.pool.get('account.journal').browse(cr, uid, pay_journal_id)
if not name:
if journal.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('No piece number !'), _('Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
if journal.sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv(_('No piece number !'), _('Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.'))
# Take the seq as name for move
if journal.sequence_id:
seq = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
else:
raise osv.except_osv('No piece number !', 'Can not create an automatic sequence for this piece !\n\nPut a sequence in the journal definition for automatic numbering or create a sequence manually for this piece.')
types = {'out_invoice': -1, 'in_invoice': 1, 'out_refund': 1, 'in_refund': -1}
direction = types[invoice.type]
#take the choosen date
if context.has_key('date_p') and context['date_p']:
date=context['date_p']
else:
date=time.strftime('%Y-%m-%d')
l1 = {
'name': name,
'debit': direction * pay_amount>0 and direction * pay_amount,
'credit': direction * pay_amount<0 and - direction * pay_amount,
'account_id': src_account_id,
'partner_id': invoice.partner_id.id,
'date': time.strftime('%Y-%m-%d'),
'date': date,
'ref':invoice.number,
}
l2 = {
'name':name,
@ -702,11 +716,12 @@ class account_invoice(osv.osv):
'credit': direction * pay_amount>0 and direction * pay_amount,
'account_id': pay_account_id,
'partner_id': invoice.partner_id.id,
'date': time.strftime('%Y-%m-%d'),
'date': date,
'ref':invoice.number,
}
lines = [(0, 0, l1), (0, 0, l2)]
move = {'name': name, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id}
move = {'name': seq, 'line_id': lines, 'journal_id': pay_journal_id, 'period_id': period_id}
move_id = self.pool.get('account.move').create(cr, uid, move)
line_ids = []

View File

@ -5,20 +5,6 @@
Partners Extension
-->
<record id="view_partner_form" model="ir.ui.view">
<field name="name">res.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<field name="credit_limit" position="after">
<field name="credit" select="2"/>
<field name="debit" select="2"/>
<newline/>
</field>
</field>
</record>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.property.form.inherit</field>
<field name="model">res.partner</field>
@ -26,16 +12,56 @@
<field name="priority">2</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<newline/>
<separator string="Customer Accounting Properties" colspan="2"/>
<separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_receivable"/>
<field name="property_account_payable"/>
<field name="property_account_tax"/>
<field name="property_account_supplier_tax"/>
<field name="property_payment_term"/>
</page>
<notebook>
<page string="Accounting" position="inside">
<group col="2" colspan="2">
<separator string="Customer Accounting Properties" colspan="2"/>
<field name="property_account_receivable"/>
<field name="property_account_tax"/>
<field name="property_payment_term"/>
</group>
<group col="2" colspan="2">
<separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_payable"/>
<field name="property_account_supplier_tax"/>
</group>
<group col="2" colspan="2">
<separator string="Customer Credit" colspan="2"/>
<field name="credit" select="2"/>
<field name="credit_limit" select="2"/>
</group>
<group col="2" colspan="2">
<separator string="Supplier Debit" colspan="2"/>
<field name="debit" select="2"/>
</group>
<field colspan="4" context="address=address" name="bank_ids" nolabel="1">
<form string="Bank account">
<field name="state" select="2"/>
<newline/>
<field name="acc_number" select="1"/>
<newline/>
<field name="bank"/>
<newline/>
<field name="sequence"/>
<field colspan="4" name="name" select="2"/>
<separator colspan="4" string="Bank account owner"/>
<field colspan="4" name="owner_name"/>
<field colspan="4" name="street"/>
<newline/>
<field name="zip"/>
<field name="city"/>
<newline/>
<field completion="1" name="country_id"/>
<field name="state_id"/>
</form>
<tree string="Bank Details">
<field name="state"/>
<field name="owner_name"/>
<field name="acc_number"/>
</tree>
</field>
</page>
</notebook>
</field>
</record>

View File

@ -50,10 +50,13 @@
<field name="type">form</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<group string="Properties" position="inside">
<field name="property_account_income_categ"/>
<field name="property_account_expense_categ"/>
</group>
<form position="inside">
<group col="2" colspan="2">
<separator string="Accounting Properties" colspan="2"/>
<field name="property_account_income_categ"/>
<field name="property_account_expense_categ"/>
</group>
</form>
</field>
</record>

View File

@ -78,7 +78,7 @@
<menuitem action="action_account_analytic_account_form" id="account_analytic_def_account" parent="next_id_39"/>
<record id="action_account_analytic_account_tree2" model="ir.actions.act_window">
<field name="name">Analytic Charts of Accounts</field>
<field name="name">Analytic Chart of Accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">account.analytic.account</field>
<field name="domain">[('parent_id','=',False)]</field>

View File

@ -52,7 +52,10 @@ class wizard_move_line_select(wizard.interface):
result = mod_obj._get_id(cr, uid, 'account', 'action_move_line_tree1')
id = mod_obj.read(cr, uid, [result], ['res_id'])[0]['res_id']
result = act_obj.read(cr, uid, [id])[0]
result['context'] = str({'fiscalyear': context.get('fiscalyear', False)})
result['context'] = {
'fiscalyear': context.get('fiscalyear', False),
'account_id': data['id']
}
result['domain']=result['domain'][0:-1]+','+domain+result['domain'][-1]
return result

View File

@ -68,6 +68,13 @@ def _pay_and_reconcile(self, cr, uid, data, context):
ctx = {'date':data['form']['date']}
amount = cur_obj.compute(cr, uid, journal.currency.id, invoice.company_id.currency_id.id, amount, context=ctx)
# Take the choosen date
if form.has_key('comment'):
context={'date_p':form['date'],'comment':form['comment']}
else:
context={'date_p':form['date'],'comment':False}
acc_id = journal.default_credit_account_id and journal.default_credit_account_id.id
if not acc_id:
raise wizard.except_wizard(_('Error !'), _('Your journal must have a default credit and debit account.'))
@ -80,7 +87,7 @@ def _wo_check(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
invoice = pool.get('account.invoice').browse(cr, uid, data['id'], context)
journal = pool.get('account.journal').browse(cr, uid, data['form']['journal_id'], context)
if invoice.company_id.currency_id.id<>journal.currency.id:
if invoice.company_id.currency_id.id<>journal.currency.id or journal.currency.id <> invoice.currency_id.id:
return 'addendum'
if pool.get('res.currency').is_zero(cr, uid, invoice.currency_id,
(data['form']['amount'] - invoice.amount_total)):
@ -92,11 +99,13 @@ _transaction_add_form = '''<?xml version="1.0"?>
<separator string="Write-Off Move" colspan="4"/>
<field name="writeoff_acc_id"/>
<field name="writeoff_journal_id"/>
<field name="comment"/>
</form>'''
_transaction_add_fields = {
'writeoff_acc_id': {'string':'Write-Off account', 'type':'many2one', 'relation':'account.account', 'required':True},
'writeoff_journal_id': {'string': 'Write-Off journal', 'type': 'many2one', 'relation':'account.journal', 'required':True},
'comment': {'string': 'Entry Name', 'type':'char', 'size': 64, 'required':True},
}
def _get_value_addendum(self, cr, uid, data, context={}):

View File

@ -62,6 +62,20 @@ view_form_charts = """<?xml version="1.0"?>
</group>
</form>"""
view_form_vatcheck = """<?xml version="1.0"?>
<form string="Setup">
<image name="gtk-dialog-info" colspan="2"/>
<group>
<separator string="Install 'base_vat_check' module" colspan="2"/>
<newline/>
<field name="vatcheck" align="0.0"/>
<newline/>
<label string="This module allow you to force the validation of the VAT number. This module is optional but highly recommanded." colspan="2" align="0.0"/>
<newline/>
<label string="If you don't install it now, you'll be able to install it through the Administration menu." colspan="2" align="0.0"/>
</group>
</form>"""
view_form_company = """<?xml version="1.0"?>
<form string="Setup">
<image name="gtk-dialog-info" colspan="2"/>
@ -97,6 +111,8 @@ view_form_update = """<?xml version="1.0"?>
<newline/>
<field name="charts" align="0.0" readonly="1"/>
<newline/>
<field name="vatcheck" align="0.0" readonly="1"/>
<newline/>
<field name="name" align="0.0" readonly="1"/>
</group>
</form>
@ -185,12 +201,16 @@ class wizard_base_setup(wizard.interface):
def _update(self, cr, uid, data, context):
pool=pooler.get_pool(cr.dbname)
form=data['form']
if 'profile' in data['form'] and data['form']['profile'] > 0:
module_obj=pool.get('ir.module.module')
module_obj.state_update(cr, uid, [data['form']['profile']], 'to install', ['uninstalled'], context)
if 'charts' in data['form'] and data['form']['charts'] > 0:
module_obj=pool.get('ir.module.module')
module_obj.state_update(cr, uid, [data['form']['charts']], 'to install', ['uninstalled'], context)
module_obj=pool.get('ir.module.module')
if 'profile' in form and form['profile'] > 0:
module_obj.state_update(cr, uid, [form['profile']], 'to install', ['uninstalled'], context)
if 'charts' in form and form['charts'] > 0:
module_obj.state_update(cr, uid, [form['charts']], 'to install', ['uninstalled'], context)
if 'vatcheck' in form and form['vatcheck']:
mid = module_obj.search(cr, uid, [('name', '=', 'base_vat_check')], context=context)
if mid:
module_obj.state_update(cr, uid, mid, 'to install', ['uninstalled'], context)
company_obj=pool.get('res.company')
partner_obj=pool.get('res.partner')
@ -271,7 +291,7 @@ class wizard_base_setup(wizard.interface):
def _previous(self, cr, uid, data, context):
if 'profile' not in data['form'] or data['form']['profile'] <= 0:
return 'init'
return 'charts'
return 'vatcheck'
def _config(self, cr, uid, data, context=None):
users_obj=pooler.get_pool(cr.dbname).get('res.users')
@ -307,6 +327,11 @@ class wizard_base_setup(wizard.interface):
'default': -1,
'required': True,
},
'vatcheck':{
'string': "Install 'base_vat_check' module",
'type': 'boolean',
'default': False,
},
'name':{
'string': 'Company Name',
'type': 'char',
@ -402,6 +427,15 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701""",
'result': {'type': 'form', 'arch': view_form_charts, 'fields': fields,
'state':[
('init', 'Previous', 'gtk-go-back'),
('vatcheck', 'Next', 'gtk-go-forward', True)
]
}
},
'vatcheck':{
'actions':[],
'result': {'type': 'form', 'arch': view_form_vatcheck, 'fields': fields,
'state': [
('charts', 'Previous', 'gtk-go-back'),
('company', 'Next', 'gtk-go-forward', True)
]
}
@ -424,7 +458,7 @@ IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701""",
'result': {'type': 'form', 'arch': view_form_update, 'fields': fields,
'state': [
('company', 'Previous', 'gtk-go-back'),
('finish', 'Install', 'gtk-ok', True)
('finish', 'Install', 'gtk-save', True)
]
}
},

View File

@ -0,0 +1,34 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
import partner
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,42 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004-2008 Tiny SPRL (http://tiny.be) All Rights Reserved.
#
# $Id$
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
###############################################################################
{
"name": "VAT Check",
"description": "Add a check of the VAT Number. Idea and code from Tryton (c2bk)",
"version": "1.0",
"author": "Tiny",
"category": "Generic Modules/Base",
"depends": ["base", "base_vat"],
"update_xml": [],
"active": False,
"installable": True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

File diff suppressed because it is too large Load Diff

View File

@ -124,10 +124,9 @@
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form"/>
<field name="arch" type="xml">
<field name="client_order_ref" position="after">
<separator string="Notes" position="before">
<field name="carrier_id"/>
</field>
</separator>
</field>
</record>
@ -195,4 +194,4 @@
</data>
</terp>
</terp>

View File

@ -318,7 +318,7 @@
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Extra Info" position="after">
<notebook position="inside">
<page string="Membership">
<field name="membership_state" select="2"/>
<field name="membership_amount" select="2"/>
@ -341,7 +341,7 @@
</form>
</field>
</page>
</page>
</notebook>
</field>
</record>

View File

@ -7,9 +7,12 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Sales" colspan="4"/>
<field name="property_product_pricelist"/>
<page string="Sales &amp; Purchases" position="inside">
<newline/>
<group col="2" colspan="2">
<separator string="Sales" colspan="2"/>
<field name="property_product_pricelist"/>
</group>
</page>
</field>
</record>

View File

@ -328,6 +328,13 @@ class product_template(osv.osv):
product_template()
class product_product(osv.osv):
def view_header_get(self, cr, uid, view_id, view_type, context):
res = super(product_product, self).view_header_get(cr, uid, view_id, view_type, context)
if res: return res
if (not context.get('categ_id', False)):
return False
return _('Products: ')+self.pool.get('product.category').browse(cr, uid, context['categ_id'], context).name
def _product_price(self, cr, uid, ids, name, arg, context={}):
res = {}
quantity = context.get('quantity', 1)

View File

@ -46,64 +46,64 @@
</group>
<notebook>
<page string="Information">
<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="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">
<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="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="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>
<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 &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="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>
<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"/>
<separator string="Base Prices" colspan="4"/>
<field name="standard_price"/>
<field name="list_price"/>
<field groups="base.group_extended" name="cost_method"/>
@ -162,8 +162,7 @@
<field name="name" select="1"/>
<field name="parent_id"/>
<field name="sequence"/>
<group string="Properties" colspan="4" groups="base.group_extended">
</group>
<newline/>
</form>
</field>
</record>
@ -199,12 +198,13 @@
<record id="product_normal_action_tree" model="ir.actions.act_window">
<field name="name">product.normal.action.tree</field>
<field name="name" eval="False"/>
<field name="type">ir.actions.act_window</field>
<field name="res_model">product.product</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="domain">[('categ_id','child_of',[active_id])]</field>
<field name="context">{'categ_id':active_id}</field>
</record>
<record id="ir_product_category_open" model="ir.values">
<field eval="'tree_but_open'" name="key2"/>

View File

@ -7,9 +7,11 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Purchases" colspan="4"/>
<field name="property_product_pricelist_purchase"/>
<page string="Sales &amp; Purchases" position="inside">
<group colspan="2" col="2">
<separator string="Purchases" colspan="2"/>
<field name="property_product_pricelist_purchase"/>
</group>
</page>
</field>
</record>

View File

@ -99,10 +99,10 @@ class purchase_order(osv.osv):
'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', states={'posted':[('readonly',True)]}),
'location_id': fields.many2one('stock.location', 'Delivery destination', required=True),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
'pricelist_id':fields.many2one('product.pricelist', 'Pricelist', required=True, states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}, help="The pricelist sets the currency used for this purchase order. It also computes the supplier price for the selected products/quantities."),
'state': fields.selection([('draft', 'Request for Quotation'), ('wait', 'Waiting'), ('confirmed', 'Confirmed'), ('approved', 'Approved'),('except_picking', 'Shipping Exception'), ('except_invoice', 'Invoice Exception'), ('done', 'Done'), ('cancel', 'Cancelled')], 'Order State', readonly=True, help="The state of the purchase order or the quotation request. A quotation is a purchase order in a 'Draft' state. Then the order has to be confirmed by the user, the state switch to 'Confirmed'. Then the supplier must confirm the order to change the state to 'Approved'. When the purchase order is paid and received, the state becomes 'Done'. If a cancel action occurs in the invoice or in the reception of goods, the state becomes in exception.", select=True),
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order State', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
'order_line': fields.one2many('purchase.order.line', 'order_id', 'Order Lines', states={'confirmed':[('readonly',True)], 'approved':[('readonly',True)]}),
'validator' : fields.many2one('res.users', 'Validated by', readonly=True),
'notes': fields.text('Notes'),
'invoice_id': fields.many2one('account.invoice', 'Invoice', readonly=True),
@ -331,7 +331,7 @@ class purchase_order_line(osv.osv):
}
_table = 'purchase_order_line'
_name = 'purchase.order.line'
_description = 'Purchase Order line'
_description = 'Purchase Order lines'
def copy(self, cr, uid, id, default=None,context={}):
if not default:
default = {}

View File

@ -1,10 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<terp>
<data>
<record id="category_supplier" model="res.partner.category">
<field name="name">Suppliers</field>
</record>
<menuitem icon="terp-purchase" id="menu_purchase_root" name="Purchase Management"/>
<record id="purchase_order_form" model="ir.ui.view">
@ -13,23 +9,23 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Purchase Order">
<notebook>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="shipped" select="2"/>
<field name="invoiced" select="2"/>
<newline/>
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)"/>
<field name="origin" select="2"/>
<field name="date_order" select="2"/>
</group>
<notebook colspan="4">
<page string="Purchase Order">
<field name="name" select="1"/>
<group col="4" colspan="2">
<field name="shipped" select="2"/>
<field name="invoiced" select="2"/>
</group>
<newline/>
<field name="warehouse_id" on_change="onchange_warehouse_id(warehouse_id)"/>
<field name="date_order" select="2"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" domain="[('category_id','child_of', [%(category_supplier)d])]"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" domain="[('supplier','=', 1)]"/>
<field name="partner_address_id"/>
<field domain="[('type','=','purchase')]" name="pricelist_id"/>
<field name="partner_ref" select="2"/>
<newline/>
<field colspan="4" name="order_line" nolabel="1" widget="one2many_list"/>
<separator colspan="4" select="2" string="Document State"/>
<group col="7" colspan="4">
<field name="amount_untaxed" sum="Untaxed amount"/>
<field name="amount_tax"/>
@ -53,7 +49,6 @@
<field name="dest_address_id" on_change="onchange_dest_address_id(dest_address_id)"/>
<field name="location_id"/>
<field name="invoice_method"/>
<field name="origin" select="2"/>
<newline/>
<field name="validator"/>
<field name="date_approve"/>

File diff suppressed because one or more lines are too long

View File

@ -228,7 +228,7 @@ class sale_order(osv.osv):
'order_line': fields.one2many('sale.order.line', 'order_id', 'Order Lines', readonly=True, states={'draft':[('readonly',False)]}),
'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"),
'picking_ids': fields.one2many('stock.picking', 'sale_id', 'Related Packings', 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'),
@ -239,6 +239,7 @@ class sale_order(osv.osv):
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
'amount_total': fields.function(_amount_total, method=True, string='Total'),
'invoice_quantity': fields.selection([('order','Ordered Quantities'),('procurement','Shipped Quantities')], 'Invoice on', help="The sale order will automatically create the invoice proposition (draft invoice). Ordered and delivered quantities may not be the same. You have to choose if you invoice based on ordered or shipped quantities. If the product is a service, shipped quantities means hours spent on the associated tasks."),
'payment_term' : fields.many2one('account.payment.term', 'Payment Term'),
}
_defaults = {
'picking_policy': lambda *a: 'direct',
@ -281,10 +282,11 @@ class sale_order(osv.osv):
def onchange_partner_id(self, cr, uid, ids, part):
if not part:
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False}}
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact'])
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist}}
payment_term = self.pool.get('res.partner').browse(cr, uid, part).property_payment_term.id
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}}
def button_dummy(self, cr, uid, ids, context={}):
return True
@ -298,8 +300,8 @@ class sale_order(osv.osv):
def _make_invoice(self, cr, uid, order, lines):
a = order.partner_id.property_account_receivable.id
if order.partner_id and order.partner_id.property_payment_term.id:
pay_term = order.partner_id.property_payment_term.id
if order.payment_term:
pay_term = order.payment_term.id
else:
pay_term = False
for preinv in order.invoice_ids:

View File

@ -51,7 +51,7 @@
<field name="arch" type="xml">
<tree string="Sales orders">
<field name="date_order"/>
<field name="name"/>
<field name="name" string="Reference"/>
<field name="partner_id"/>
<field name="partner_shipping_id"/>
<field name="picked_rate" widget="progressbar"/>
@ -68,16 +68,17 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales order">
<notebook>
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="client_order_ref"/>
<field name="shipped" select="2"/>
<field name="shop_id" on_change="onchange_shop_id(shop_id)" select="2"/>
<field name="date_order" select="1"/>
<field name="invoiced" select="2"/>
</group>
<notebook colspan="4">
<page string="Sale Order">
<field name="name" select="1"/>
<group col="4" colspan="2">
<field name="shipped" select="2"/>
<field name="invoiced" select="2"/>
</group>
<newline/>
<field name="date_order" select="1"/>
<field name="shop_id" on_change="onchange_shop_id(shop_id)" select="2"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1" select="1"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id"/>
@ -166,14 +167,13 @@
<field name="order_policy"/>
<field groups="base.group_extended" name="origin"/>
<field groups="base.group_extended" name="invoice_quantity" attrs="{'readonly':[('order_policy','=','picking')]}"/>
<field name="client_order_ref"/>
<field name="payment_term"/>
<separator colspan="4" string="Notes"/>
<field colspan="4" name="note" nolabel="1"/>
</page>
<page groups="base.group_extended" string="History">
<separator colspan="4" string="Related invoices"/>
<field colspan="4" name="invoice_ids" nolabel="1"/>
<separator colspan="4" string="Related packings"/>
<field colspan="4" name="picking_ids" nolabel="1"/>
</page>
</notebook>

View File

@ -43,7 +43,8 @@
"stock_report.xml",
"stock_sequence.xml",
"product_data.xml",
"product_view.xml"
"product_view.xml",
"partner_view.xml"
],
"active": False,
"installable": True

View File

@ -11,10 +11,12 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Properties" position="inside">
<separator string="Stock Properties" colspan="2"/>
<field name="property_stock_customer"/>
<field name="property_stock_supplier"/>
<page string="Sales &amp; Purchases" position="inside">
<group colspan="2" col="2">
<separator string="Stock Properties" colspan="2"/>
<field name="property_stock_customer"/>
<field name="property_stock_supplier"/>
</group>
</page>
</field>
</record>

View File

@ -8,12 +8,14 @@
<field name="type">form</field>
<field name="inherit_id" ref="product.product_category_form_view"/>
<field name="arch" type="xml">
<group string="Properties" position="inside">
<separator string="Stock Accounting" colspan="4"/>
<field name="property_stock_account_input_categ"/>
<field name="property_stock_account_output_categ"/>
<field name="property_stock_journal"/>
</group>
<form position="inside">
<group col="2" colspan="2">
<separator string="Accounting Stock Properties" colspan="2"/>
<field name="property_stock_account_input_categ"/>
<field name="property_stock_account_output_categ"/>
<field name="property_stock_journal"/>
</group>
</form>
</field>
</record>
@ -48,8 +50,8 @@
<field name="property_stock_account_input"/>
<field name="property_stock_account_output"/>
</field>
</field>
</record>
</field>
</record>
<record id="view_normal_stock_property_form" model="ir.ui.view">
<field name="name">product.normal.stock.form.inherit</field>
@ -58,13 +60,13 @@
<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">
<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>
<field name="qty_available"/>
<field name="virtual_available"/>
<field name="incoming_qty"/>
<field name="outgoing_qty"/>
</group>
</group>
</field>
</record>
@ -76,12 +78,12 @@
<field name="inherit_id" ref="product.product_normal_form_view"/>
<field name="arch" type="xml">
<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 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>

View File

@ -606,15 +606,14 @@ class stock_picking(osv.osv):
for picking in self.browse(cursor, user, ids, context=context):
if picking.invoice_state != '2binvoiced':
continue
payment_term_id = False
partner = picking.address_id.partner_id
if type in ('out_invoice', 'out_refund'):
account_id = partner.property_account_receivable.id
payment_term_id= picking.sale_id.payment_term.id
else:
account_id = partner.property_account_payable.id
payment_term_id = False
if partner.property_payment_term:
payment_term_id = partner.property_payment_term.id
# payment_term_id = picking.purchase_id.payment_term.id
address_contact_id, address_invoice_id = \
self._get_address_invoice(cursor, user, picking).values()
@ -1136,6 +1135,8 @@ class product_product(osv.osv):
# Utiliser browse pour limiter les queries !
#
def view_header_get(self, cr, user, view_id, view_type, context):
res = super(product_product, self).view_header_get(cr, user, view_id, view_type, context)
if res: return res
if (not context.get('location', False)):
return False
cr.execute('select name from stock_location where id=%d', (context['location'],))

View File

@ -55,20 +55,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Lot Inventory">
<notebook>
<page string="General Informations">
<field name="name" select="1"/>
<field name="date" select="1"/>
<field colspan="4" name="inventory_line_id" nolabel="1" widget="one2many_list"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<button name="action_done" states="draft" string="Confirm Inventory" type="object"/>
<button name="action_cancel" states="done" string="Cancel Inventory" type="object"/>
</group>
</page>
<page string="Posted Inventory">
<field colspan="4" name="move_ids" nolabel="1"/>
</page>
<field name="name" select="1"/>
<field name="date" select="1"/>
<notebook colspan="4">
<page string="General Informations">
<field colspan="4" name="inventory_line_id" nolabel="1" widget="one2many_list"/>
</page><page string="Posted Inventory">
<field colspan="4" name="move_ids" nolabel="1"/>
<field name="state" select="1"/>
<group col="2" colspan="2">
<button name="action_done" states="draft" string="Confirm Inventory" type="object"/>
<button name="action_cancel" states="done" string="Cancel Inventory" type="object"/>
</group>
</page>
</notebook>
</form>
</field>
@ -185,7 +184,6 @@
<field name="name" select="1"/>
<field name="ref" select="1"/>
<field name="date" select="1"/>
<separator colspan="4" string="Revisions"/>
<field colspan="4" name="revisions" nolabel="1" widget="one2many_list"/>
</form>
</field>
@ -310,27 +308,27 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Stock location">
<notebook>
<page string="General Informations">
<field name="name" select="1"/>
<field name="active" select="2"/>
<field name="usage" select="1"/>
<field name="account_id" select="1"/>
<field name="location_id"/>
<field name="address_id"/>
<field name="chained_location_type"/>
<field name="chained_location_id"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
<newline/>
<field colspan="4" name="comment"/>
</page>
<page string="Localisation">
<field name="posx"/>
<field name="posy"/>
<field name="posz"/>
</page>
</notebook>
<field name="name" select="1"/>
<field name="active" select="2"/>
<field name="usage" select="1"/>
<field name="account_id" select="1"/>
<field name="location_id"/>
<field name="address_id"/>
<group col="2" colspan="2">
<separator string="Chained Locations" colspan="2"/>
<field name="chained_location_type"/>
<field name="chained_location_id"/>
<field name="chained_auto_packing"/>
<field name="chained_delay"/>
</group>
<group col="2" colspan="2">
<separator string="Localisation" colspan="2"/>>
<field name="posx"/>
<field name="posy"/>
<field name="posz"/>
</group>
<separator string="Additional Information" colspan="4"/>
<field colspan="4" name="comment" nolabel="1"/>
</form>
</field>
</record>
@ -538,12 +536,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Packing list">
<notebook>
<field name="name" select="1"/>
<field name="date" select="1"/>
<newline/>
<field name="address_id" select="2"/>
<notebook colspan="4">
<page string="General Information">
<field name="name" select="1"/>
<field name="date" select="1"/>
<newline/>
<field name="address_id" select="2"/>
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list">
<form string="Stock Moves">
<separator colspan="4" string="Move Information"/>
@ -693,12 +691,12 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Packing list">
<notebook>
<field name="name" select="1"/>
<field name="date" select="1"/>
<newline/>
<field name="address_id" select="2"/>
<notebook colspan="4">
<page string="General Information">
<field name="name" select="1"/>
<field name="date" select="1"/>
<newline/>
<field name="address_id" select="2"/>
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list">
<form string="Stock Moves">
<separator colspan="4" string="Move Information"/>
@ -845,15 +843,14 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Input Packing List">
<notebook>
<field name="address_id" on_change="onchange_partner_in(address_id)" select="2"/>
<field name="name" readonly="1" select="1"/>
<field name="location_id"/>
<field domain="[('usage','=','internal')]" name="location_dest_id"/>
<field name="invoice_state" select="2" string="Supplier Invoice Control"/>
<field name="origin" select="2"/>
<notebook colspan="4">
<page string="General Information">
<field name="address_id" on_change="onchange_partner_in(address_id)" select="2"/>
<field name="name" readonly="1" select="1"/>
<field name="location_id"/>
<field domain="[('usage','=','internal')]" name="location_dest_id"/>
<field name="invoice_state" select="2" string="Supplier Invoice Control"/>
<field name="origin" select="2"/>
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list">
<tree string="Stock Moves">
<field name="product_id"/>
@ -884,7 +881,6 @@
<newline/>
<label/>
<button groups="base.group_extended" name="%(track_line)d" string="Split in production lots" type="action"/>
<separator colspan="4" string="Move State"/>
<field name="state" select="1"/>
<group>
@ -896,7 +892,6 @@
<group col="7" colspan="4">
<label colspan="5"/>
<button name="llk" string="Fill From Unreceived Products" type="action"/>
<button groups="base.group_extended" name="%(move_split)d" string="Split move lines in two" type="action"/>
</group>
<group col="8" colspan="4">
<field name="state" readonly="1"/>
@ -1186,32 +1181,30 @@
<field eval="True" name="object"/>
</record>
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
<record id="stock_picking_move_wizard_form" model="ir.ui.view">
<field name="name">stock.picking.move.wizard.form</field>
<field name="model">stock.picking.move.wizard</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Move Lines">
<form string="Move Lines">
<field name="address_id" invisible="True"/>
<field name="picking_id" invisible="True"/>
<field name="picking_id" invisible="True"/>
<field domain="[('picking_id','&lt;&gt;',picking_id),('address_id','=',address_id),('state','in',['confirmed','assigned'])]" name="move_ids" select="1"/><newline/>
<group colspan="4">
<button special="cancel" string="Cancel"/>
<button name="action_move" string="Add" type="object"/>
</group>
<group colspan="4">
<button special="cancel" string="Cancel"/>
<button name="action_move" string="Add" type="object"/>
</group>
</form>
</field>
</record>
<act_window name="Get move lines"
context="{'action_id': active_id}"
res_model="stock.picking.move.wizard"
src_model="stock.picking"
view_mode="form"
target="new"
id="act_stock_picking_move_wizard"/>
<act_window name="Get move lines"
context="{'action_id': active_id}"
res_model="stock.picking.move.wizard"
src_model="stock.picking"
view_mode="form"
target="new"
id="act_stock_picking_move_wizard"/>
</data>
</terp>