@@ -19,7 +19,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
from datetime import datetime
|
||||
from datetime import datetime, timedelta
|
||||
from dateutil.relativedelta import relativedelta
|
||||
from operator import itemgetter
|
||||
|
||||
@@ -79,9 +79,19 @@ class account_payment_term(osv.osv):
|
||||
elif line.value == 'balance':
|
||||
amt = round(amount, prec)
|
||||
if amt:
|
||||
next_date = datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days)
|
||||
next_date = (datetime.strptime(date_ref, '%Y-%m-%d') + relativedelta(days=line.days))
|
||||
if line.days2 < 0:
|
||||
next_date += relativedelta(day=line.days2)
|
||||
nyear = next_date.strftime("%Y")
|
||||
nmonth = str(int(next_date.strftime("%m"))% 12+1)
|
||||
nday = "1"
|
||||
|
||||
ndate = "%s-%s-%s" % (nyear, nmonth, nday)
|
||||
nseconds = time.mktime(time.strptime(ndate, '%Y-%m-%d'))
|
||||
next_month = datetime.fromtimestamp(nseconds)
|
||||
|
||||
delta = timedelta(seconds=1)
|
||||
next_date = next_month - delta
|
||||
next_date = next_date + relativedelta(days=line.days2)
|
||||
if line.days2 > 0:
|
||||
next_date += relativedelta(day=line.days2, months=1)
|
||||
result.append( (next_date.strftime('%Y-%m-%d'), amt) )
|
||||
@@ -1236,7 +1246,7 @@ class account_move(osv.osv):
|
||||
return amount
|
||||
|
||||
def _centralise(self, cr, uid, move, mode, context=None):
|
||||
assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection
|
||||
assert mode in ('debit', 'credit'), 'Invalid Mode' #to prevent sql injection
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
|
||||
@@ -462,7 +462,7 @@ class account_invoice(osv.osv):
|
||||
date_invoice = time.strftime('%Y-%m-%d')
|
||||
|
||||
pterm_list = pt_obj.compute(cr, uid, payment_term_id, value=1, date_ref=date_invoice)
|
||||
|
||||
|
||||
if pterm_list:
|
||||
pterm_list = [line[0] for line in pterm_list]
|
||||
pterm_list.sort()
|
||||
|
||||
@@ -307,7 +307,13 @@
|
||||
<field name="model">account.analytic.journal</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="analytic Journals">
|
||||
<search string="Analytic Journals">
|
||||
<group>
|
||||
<field name="name"/>
|
||||
<field name="code"/>
|
||||
<field name="type"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Type" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'type'}"/>
|
||||
</group>
|
||||
@@ -334,6 +340,7 @@
|
||||
<field name="res_model">account.analytic.journal</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form,search</field>
|
||||
<field name="search_view_id" ref="view_analytic_journal_search" />
|
||||
</record>
|
||||
<menuitem action="action_account_analytic_journal_form" id="account_def_analytic_journal" parent="menu_analytic_accounting"/>
|
||||
|
||||
|
||||
@@ -49,18 +49,17 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
||||
self.query = data['form'].get('query_line', '')
|
||||
self.direction_selection = data['form'].get('direction_selection', 'past')
|
||||
self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
|
||||
if (data['form']['result_selection'] == 'customer' ):
|
||||
self.ACCOUNT_TYPE = ['receivable']
|
||||
elif (data['form']['result_selection'] == 'supplier'):
|
||||
self.ACCOUNT_TYPE = ['payable']
|
||||
else:
|
||||
self.ACCOUNT_TYPE = ['payable','receivable']
|
||||
return super(aged_trial_report, self).set_context(objects, data, ids, report_type=report_type)
|
||||
|
||||
def _get_lines(self, form):
|
||||
res = []
|
||||
account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
if (form['result_selection'] == 'customer' ):
|
||||
self.ACCOUNT_TYPE = ['receivable']
|
||||
elif (form['result_selection'] == 'supplier'):
|
||||
self.ACCOUNT_TYPE = ['payable']
|
||||
else:
|
||||
self.ACCOUNT_TYPE = ['payable','receivable']
|
||||
|
||||
self.cr.execute('SELECT DISTINCT res_partner.id AS id,\
|
||||
res_partner.name AS name \
|
||||
FROM res_partner,account_move_line AS l, account_account\
|
||||
@@ -129,8 +128,8 @@ class aged_trial_report(rml_parse.rml_parse, common_report_header):
|
||||
|
||||
# Use one query per period and store results in history (a list variable)
|
||||
# Each history will contain : history[1] = {'<partner_id>': <partner_debit-credit>}
|
||||
history = []
|
||||
for i in range(5):
|
||||
history = []
|
||||
for i in range(5):
|
||||
self.cr.execute('SELECT partner_id, SUM(debit-credit)\
|
||||
FROM account_move_line AS l, account_account\
|
||||
WHERE (l.account_id = account_account.id)\
|
||||
|
||||
@@ -67,7 +67,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
||||
return self.pool.get('account.account').browse(self.cr, self.uid, data['form']['id']).company_id.name
|
||||
return super(account_balance ,self)._get_account(data)
|
||||
|
||||
def lines(self, form, ids=[], done=None, level=1):
|
||||
def lines(self, form, ids=[], done=None):#, level=1):
|
||||
obj_account = self.pool.get('account.account')
|
||||
if not ids:
|
||||
ids = self.ids
|
||||
@@ -94,7 +94,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
||||
child_ids = obj_account._get_children_and_consol(self.cr, self.uid, ids, ctx)
|
||||
if child_ids:
|
||||
ids = child_ids
|
||||
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id'], ctx)
|
||||
accounts = obj_account.read(self.cr, self.uid, ids, ['type','code','name','debit','credit','balance','parent_id','level'], ctx)
|
||||
for account in accounts:
|
||||
if account['id'] in done:
|
||||
continue
|
||||
@@ -104,7 +104,7 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
||||
'type': account['type'],
|
||||
'code': account['code'],
|
||||
'name': account['name'],
|
||||
'level': level,
|
||||
'level': account['level'],
|
||||
'debit': account['debit'],
|
||||
'credit': account['credit'],
|
||||
'balance': account['balance'],
|
||||
@@ -124,12 +124,12 @@ class account_balance(report_sxw.rml_parse, common_report_header):
|
||||
# return False
|
||||
# if not _check_rec(account) :
|
||||
# continue
|
||||
if account['parent_id']:
|
||||
# if account['parent_id']:
|
||||
# acc = obj_account.read(self.cr, self.uid, [ account['parent_id'][0] ] ,['name'], ctx)
|
||||
for r in result_acc:
|
||||
if r['id'] == account['parent_id'][0]:
|
||||
res['level'] = r['level'] + 1
|
||||
break
|
||||
# for r in result_acc:
|
||||
# if r['id'] == account['parent_id'][0]:
|
||||
# res['level'] = r['level'] + 1
|
||||
# break
|
||||
if form['display_account'] == 'bal_movement':
|
||||
if res['credit'] > 0 or res['debit'] > 0 or res['balance'] > 0 :
|
||||
result_acc.append(res)
|
||||
|
||||
@@ -170,7 +170,7 @@
|
||||
<para style="P12">Dated :</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P13">[[ time.strftime('%d %B,%Y', time.strptime(voucher.date , '%Y-%m-%d')) or '' ]]</para>
|
||||
<para style="P13">[[ formatLang(voucher.date, date=True) or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
||||
@@ -92,7 +92,7 @@ class account_statement_from_invoice_lines(osv.osv_memory):
|
||||
'ref': line.ref,
|
||||
'reconcile_id': reconcile_id,
|
||||
'date': time.strftime('%Y-%m-%d'), #time.strftime('%Y-%m-%d'), #line.date_maturity or,
|
||||
}, context=context)
|
||||
}, context=context)
|
||||
return {}
|
||||
|
||||
account_statement_from_invoice_lines()
|
||||
@@ -107,10 +107,10 @@ class account_statement_from_invoice(osv.osv_memory):
|
||||
'date': fields.date('Date payment',required=True),
|
||||
'journal_ids': fields.many2many('account.journal', 'account_journal_relation', 'account_id', 'journal_id', 'Journal'),
|
||||
'line_ids': fields.many2many('account.move.line', 'account_move_line_relation', 'move_id', 'line_id', 'Invoices'),
|
||||
}
|
||||
}
|
||||
_defaults = {
|
||||
'date':lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
}
|
||||
|
||||
def search_invoices(self, cr, uid, ids, context=None):
|
||||
|
||||
@@ -167,4 +167,4 @@ class account_statement_from_invoice(osv.osv_memory):
|
||||
}
|
||||
|
||||
account_statement_from_invoice()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="view_account_statement_from_invoice" model="ir.ui.view">
|
||||
<record id="view_account_statement_from_invoice" model="ir.ui.view">
|
||||
<field name="name">account.statement.from.invoice.form</field>
|
||||
<field name="model">account.statement.from.invoice</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Import Invoices in Statement">
|
||||
<group colspan="4" >
|
||||
<field name="date"/>
|
||||
<newline/>
|
||||
<field name="journal_ids" domain="[('type','in',['sale','purchase','cash'])]"/>
|
||||
</group>
|
||||
<group colspan="4" >
|
||||
<field name="date"/>
|
||||
<newline/>
|
||||
<field name="journal_ids" domain="[('type','in',['sale','purchase','cash'])]"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Go" name="search_invoices" type="object"/>
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="terp-gtk-go-back-rtl" string="Go" name="search_invoices" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="action_view_account_statement_from_invoice" model="ir.actions.act_window">
|
||||
<field name="name">Import Invoices in Statement</field>
|
||||
<record id="action_view_account_statement_from_invoice" model="ir.actions.act_window">
|
||||
<field name="name">Import Invoices in Statement</field>
|
||||
<field name="res_model">account.statement.from.invoice</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_statement_from_invoice"/>
|
||||
<field name="target">new</field>
|
||||
<field name="view_id" ref="view_account_statement_from_invoice"/>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
<record id="view_account_statement_from_invoice_lines" model="ir.ui.view">
|
||||
@@ -36,27 +36,26 @@
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Import Entries">
|
||||
<group colspan="4" >
|
||||
<field name="line_ids" />
|
||||
</group>
|
||||
<group colspan="4" expand="1">
|
||||
<separator string="Payable and Receivables" colspan="4"/>
|
||||
<field name="line_ids" colspan="4" nolabel="1"/>
|
||||
</group>
|
||||
<group colspan="4" col="6">
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="populate_statement" type="object"/>
|
||||
<label string ="" colspan="2"/>
|
||||
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
|
||||
<button icon="gtk-execute" string="Ok" name="populate_statement" type="object"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record id="action_view_account_statement_from_invoice_lines" model="ir.actions.act_window">
|
||||
<field name="name">Import Entries</field>
|
||||
<record id="action_view_account_statement_from_invoice_lines" model="ir.actions.act_window">
|
||||
<field name="name">Import Entries</field>
|
||||
<field name="res_model">account.statement.from.invoice.lines</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_account_statement_from_invoice_lines"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'statement_id': active_id}</field>
|
||||
<field name="view_id" ref="view_account_statement_from_invoice_lines"/>
|
||||
<field name="target">new</field>
|
||||
<field name="context">{'statement_id': active_id}</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -50,7 +50,7 @@ class report_rappel(report_sxw.rml_parse):
|
||||
res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
|
||||
res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
|
||||
adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
|
||||
return adr and res_partner_address.read(self.cr, self.uid, [adr]) or False
|
||||
return adr and res_partner_address.read(self.cr, self.uid, [adr]) or [{}]
|
||||
|
||||
def _lines_get(self, partner):
|
||||
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
|
||||
@@ -95,4 +95,4 @@ report_sxw.report_sxw('report.account_followup.followup.print',
|
||||
'res.partner', 'addons/account_followup/report/rappel.rml',
|
||||
parser=report_rappel)
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -91,24 +91,23 @@ class base_setup_installer(osv.osv_memory):
|
||||
'crm': True,
|
||||
}
|
||||
|
||||
def _if_mrp(self, cr, uid, ids, context=None):
|
||||
if self.pool.get('res.users').browse(cr, uid, uid, context=context)\
|
||||
.view == 'simple':
|
||||
return ['mrp_jit']
|
||||
return None
|
||||
|
||||
def _if_knowledge(self, cr, uid, ids, context=None):
|
||||
if self.pool.get('res.users').browse(cr, uid, uid, context=context)\
|
||||
.view == 'simple':
|
||||
return ['document_ftp']
|
||||
return None
|
||||
|
||||
def onchange_moduleselection(self, cr, uid, ids, *args):
|
||||
progress = self._progress(cr, uid) - round((len(filter(lambda x: x==1, args)))*80/len(args))
|
||||
if progress <= 10.0:
|
||||
progress = 10.0
|
||||
closed, total = self.get_current_progress(cr, uid)
|
||||
|
||||
progress = round(100. * closed / (total + len(filter(None, args))))
|
||||
if progress < 10.:
|
||||
progress = 10.
|
||||
return {'value':{'progress':progress}}
|
||||
|
||||
def modules_to_install(self, cr, uid, ids, context=None):
|
||||
modules = super(base_setup_installer, self).modules_to_install(cr, uid, ids, context=context)
|
||||
interface_id = self.pool.get('res.config.view').search(cr, uid, [])
|
||||
interface = self.pool.get('res.config.view').read(cr, uid, interface_id)[0]
|
||||
modules_selected = self.read(cr, uid, ids)[0]
|
||||
added_modules = []
|
||||
if interface.get('view', '') == 'simple' :
|
||||
if modules_selected.get('mrp', False):
|
||||
added_modules.append('mrp_jit')
|
||||
if modules_selected.get('knowledge', False):
|
||||
added_modules.append('document_ftp')
|
||||
return modules | set(added_modules)
|
||||
base_setup_installer()
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
parent="base.menu_base_partner" sequence="1" />
|
||||
|
||||
<menuitem parent="base.menu_sales" name="Leads"
|
||||
groups="base.group_extended,base.group_sale_salesman,base.group_sale_manager"
|
||||
groups="base.group_extended,base.group_system"
|
||||
id="menu_crm_case_categ0_act_leads"
|
||||
action="crm_case_category_act_leads_all" sequence="1" />
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ class crm_opportunity(osv.osv):
|
||||
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
|
||||
stage_id = super(crm_opportunity, self).stage_next(cr, uid, ids, context={'force_domain': [('probability', '=', 100)]})
|
||||
if not stage_id:
|
||||
raise osv.except_osv(_('Warning !'), _('There is no stage for won oppportunities defined for this Sale Team.'))
|
||||
raise osv.except_osv(_('Warning !'), _('There is no stage for won opportunities defined for this Sale Team.'))
|
||||
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
|
||||
value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
|
||||
|
||||
@@ -87,7 +87,7 @@ class crm_opportunity(osv.osv):
|
||||
res = super(crm_opportunity, self).case_close(cr, uid, ids, args)
|
||||
stage_id = super(crm_opportunity, self).stage_next(cr, uid, ids, context={'force_domain': [('probability', '=', 0)]})
|
||||
if not stage_id:
|
||||
raise osv.except_osv(_('Warning !'), _('There is no stage for lost oppportunities defined for this Sale Team.'))
|
||||
raise osv.except_osv(_('Warning !'), _('There is no stage for lost opportunities defined for this Sale Team.'))
|
||||
value = self.onchange_stage_id(cr, uid, ids, stage_id, context={})['value']
|
||||
value.update({'date_closed': time.strftime('%Y-%m-%d %H:%M:%S'), 'stage_id': stage_id})
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
</record>
|
||||
|
||||
<menuitem name="Phone Calls" id="menu_crm_case_phone"
|
||||
groups="base.group_extended,base.group_sale_salesman,base.group_sale_manager"
|
||||
groups="base.group_extended,base.group_system"
|
||||
parent="base.menu_base_partner" sequence="4" />
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_categ_phone_incoming0">
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
"access_crm_case_categ","crm.case.categ","model_crm_case_categ","base.group_sale_salesman",1,1,1,0
|
||||
"access_crm_meeting_manager","crm.meeting.manager","model_crm_meeting","base.group_sale_manager",1,0,0,0
|
||||
"access_crm_lead_manager","crm.lead.manager","model_crm_lead","base.group_sale_manager",1,0,0,0
|
||||
"access_crm_phonecall_system","crm.phonecall.system","model_crm_phonecall","base.group_system",1,0,0,0
|
||||
"access_crm_phonecall_manager","crm.phonecall.manager","model_crm_phonecall","base.group_sale_manager",1,0,0,0
|
||||
"access_crm_case_categ","crm.case.categ","model_crm_case_categ","base.group_user",1,0,0,0
|
||||
"access_crm_meeting","crm.meeting","model_crm_meeting","base.group_sale_salesman",1,1,1,0
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
<data>
|
||||
|
||||
<menuitem id="base.menu_aftersale" name="After-Sale Services"
|
||||
groups="base.group_extended,base.group_sale_manager,base.group_sale_salesman"
|
||||
groups="base.group_extended,base.group_system"
|
||||
parent="base.menu_base_partner" sequence="7" />
|
||||
|
||||
<!-- Claims Menu -->
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
"access_crm_claim_user","crm.claim.user","model_crm_claim","base.group_sale_salesman",1,1,1,0
|
||||
"access_crm_claim_report_manager","crm.claim.report.manager","model_crm_claim_report","base.group_sale_manager",1,1,1,1
|
||||
"access_crm_claim_extended","crm.claim.extended","model_crm_claim","base.group_extended",1,1,1,1
|
||||
"access_crm_claim_system","crm.claim.system","model_crm_claim","base.group_system",1,0,0,0
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
<!-- MENU -->
|
||||
|
||||
<menuitem id="base.menu_fundrising" name="Fund Raising"
|
||||
groups="base.group_extended,base.group_sale_manager,base.group_sale_salesman"
|
||||
groups="base.group_extended,base.group_system"
|
||||
parent="base.menu_base_partner" sequence="8" />
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_case_category_act_fund_all1">
|
||||
|
||||
@@ -3,3 +3,4 @@
|
||||
"access_crm_fundraising_user","crm.fundraising.user","model_crm_fundraising","base.group_sale_salesman",1,1,1,0
|
||||
"access_crm_fundraising_report_user","crm.fundraising.report.user","model_crm_fundraising_report","base.group_sale_salesman",1,0,0,0
|
||||
"access_crm_fundraising_report_manager","crm.fundraising.report.manager","model_crm_fundraising_report","base.group_sale_manager",1,1,1,1
|
||||
"access_crm_fundraising_system","crm.fundraising.system","model_crm_fundraising","base.group_system",1,0,0,0
|
||||
|
||||
|
@@ -3,3 +3,4 @@
|
||||
"access_crm_helpdesk_user","crm.helpdesk.user","model_crm_helpdesk","base.group_sale_salesman",1,1,1,1
|
||||
"access_report_crm_helpdesk_manager","report.crm.helpdesk.manager","model_crm_helpdesk_report","base.group_sale_manager",1,1,1,1
|
||||
"access_crm_helpdesk_extended","crm.helpdesk.extended","model_crm_helpdesk","base.group_extended",1,1,1,1
|
||||
"access_crm_helpdesk_system","crm.helpdesk.system","model_crm_helpdesk","base.group_system",1,0,0,0
|
||||
|
||||
|
+2
-4
@@ -125,9 +125,7 @@ class hr_employee(osv.osv):
|
||||
'work_email': fields.related('address_id', 'email', type='char', size=240, string='Work E-mail', readonly=True),
|
||||
'work_location': fields.char('Office Location', size=32),
|
||||
'notes': fields.text('Notes'),
|
||||
'parent_id': fields.many2one('hr.employee', 'Manager', select=True),
|
||||
# 'parent_id': fields.related('department_id', 'manager_id', string='Manager', type='many2one'),
|
||||
# 'category_id': fields.many2one('hr.employee.category', 'Category'),
|
||||
'parent_id': fields.related('department_id', 'manager_id', relation='hr.employee', string='Manager', type='many2one', store=True, select=True),
|
||||
'category_ids': fields.many2many('hr.employee.category', 'employee_category_rel','category_id','emp_id','Category'),
|
||||
'child_ids': fields.one2many('hr.employee', 'parent_id', 'Subordinates'),
|
||||
'resource_id': fields.many2one('resource.resource', 'Resource', ondelete='cascade'),
|
||||
@@ -179,4 +177,4 @@ class hr_department(osv.osv):
|
||||
hr_department()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
+34
-11
@@ -1,11 +1,20 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<data noupdate="1">
|
||||
|
||||
<!-- Employee Category -->
|
||||
|
||||
<record id="category_experience" model="hr.employee.category">
|
||||
<field name="name">Experience</field>
|
||||
</record>
|
||||
|
||||
<record id="category_ranking" model="hr.employee.category">
|
||||
<field name="name">Ranking</field>
|
||||
</record>
|
||||
|
||||
<record id="category_ceo" model="hr.employee.category">
|
||||
<field name="name">CEO</field>
|
||||
<field name="parent_id" ref="category_ranking"/>
|
||||
</record>
|
||||
|
||||
<record id="category_cto" model="hr.employee.category">
|
||||
@@ -14,7 +23,7 @@
|
||||
</record>
|
||||
|
||||
<record id="category_managers" model="hr.employee.category">
|
||||
<field name="name">Managers(Tech. Heads)</field>
|
||||
<field name="name">Managers (Tech. Heads)</field>
|
||||
<field name="parent_id" ref="category_cto"/>
|
||||
</record>
|
||||
|
||||
@@ -23,19 +32,24 @@
|
||||
<field name="parent_id" ref="category_managers"/>
|
||||
</record>
|
||||
|
||||
<record id="category_sr_exec" model="hr.employee.category">
|
||||
<field name="name">Sr. Executives(Team Leads)</field>
|
||||
<record id="category_employee" model="hr.employee.category">
|
||||
<field name="name">Employees</field>
|
||||
<field name="parent_id" ref="category_project_managers"/>
|
||||
</record>
|
||||
|
||||
<record id="category_sr_exec" model="hr.employee.category">
|
||||
<field name="name">Sr. Executives (5 years)</field>
|
||||
<field name="parent_id" ref="category_experience"/>
|
||||
</record>
|
||||
|
||||
<record id="category_jr_exec" model="hr.employee.category">
|
||||
<field name="name">Jr. Executives(Developers)</field>
|
||||
<field name="parent_id" ref="category_sr_exec"/>
|
||||
<field name="name">Jr. Executives (6 months)</field>
|
||||
<field name="parent_id" ref="category_experience"/>
|
||||
</record>
|
||||
|
||||
<record id="category_trainee" model="hr.employee.category">
|
||||
<field name="name">Trainee(Intership)</field>
|
||||
<field name="parent_id" ref="category_jr_exec"/>
|
||||
<field name="name">Trainee</field>
|
||||
<field name="parent_id" ref="category_experience"/>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -44,12 +58,21 @@
|
||||
<record id="employee1" model="hr.employee">
|
||||
<field name="name">Fabien Pinckaers</field>
|
||||
<field name="calendar_id" ref="resource.timesheet_group1"/>
|
||||
<!--<field name="regime">45</field>-->
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="category_id" ref="hr.category_ceo"/>
|
||||
<!--<field name="holiday_max">25</field>-->
|
||||
<field name="category_ids" eval="[(6, 0, [ref('category_sr_exec'),ref('category_ceo')])]"/>
|
||||
</record>
|
||||
|
||||
<record id="employee2" model="hr.employee">
|
||||
<field name="name">Quentin Paolino</field>
|
||||
<field name="calendar_id" ref="resource.timesheet_group1"/>
|
||||
<field name="category_ids" eval="[(6, 0, [ref('category_jr_exec'),ref('category_managers')])]"/>
|
||||
</record>
|
||||
|
||||
<record id="employee3" model="hr.employee">
|
||||
<field name="name">Antoine Philippe</field>
|
||||
<field name="calendar_id" ref="resource.timesheet_group1"/>
|
||||
<field name="category_ids" eval="[(6, 0, [ref('category_trainee')])]"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -104,6 +104,14 @@
|
||||
<field name="department_id" ref="dep_it"/>
|
||||
</record>
|
||||
|
||||
<!-- assign department on employee -->
|
||||
<record id="employee2" model="hr.employee">
|
||||
<field name="department_id" ref="hr.dep_technical"/>
|
||||
</record>
|
||||
|
||||
<record id="employee3" model="hr.employee">
|
||||
<field name="department_id" ref="hr.dep_technical"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -59,11 +59,8 @@
|
||||
</group>
|
||||
<group col="2" colspan="2">
|
||||
<separator string="Position" colspan="2"/>
|
||||
<field name="job_id" widget="selection"/>
|
||||
<field name="job_id" widget="selection" domain="[('state','!=','old')]"/>
|
||||
<field name="department_id" widget="selection"/>
|
||||
<!--<separator string="Managers" colspan="2"/>
|
||||
<field name="parent_id" />
|
||||
<field name="coach_id" />-->
|
||||
</group>
|
||||
</page>
|
||||
<page string="Categories">
|
||||
@@ -343,8 +340,8 @@
|
||||
<group col="6" colspan="4">
|
||||
<field name="state"/>
|
||||
<button name="job_recruitement" string="In Recruitement" states="open" type="object" icon="gtk-go-forward"/>
|
||||
<button name="job_open" string="Open" states="old" type="object" icon="terp-camera_test"/>
|
||||
<button name="job_old" string="Old" states="open,recruit" type="object" icon="gtk-cancel"/>
|
||||
<button name="job_open" string="Open" states="old,recruit" type="object" icon="terp-camera_test"/>
|
||||
<button name="job_old" string="Old" states="open,recruit" type="object" icon="gtk-cancel"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
<field name="employee_id"/>
|
||||
<field name="name"/>
|
||||
<field name="action"/>
|
||||
<field name="day" invisible="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
<tree string="Expenses" colors="blue:state=='draft'">
|
||||
<field name="date"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="department_id" groups="base.group_extended"/>
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
<tree colors="blue:state in ('draft');black:state in ('confirm','accepted','invoiced','paid');gray:state in('cancelled')" string="Expenses Analysis">
|
||||
<field name="date" invisible="1"/>
|
||||
<field name="employee_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="year" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="day" invisible="1"/>
|
||||
@@ -51,27 +52,27 @@
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Expenses Analysis">
|
||||
<group>
|
||||
<filter icon="terp-go-year" string=" 365 Days "
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Expenses during last 7 year"/>
|
||||
<filter icon="terp-go-month" string=" 30 Days "
|
||||
name="month"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Expenses during last month"/>
|
||||
<filter icon="terp-go-week" string=" 7 Days " separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Expenses during last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<group>
|
||||
<filter icon="terp-go-year" string=" 365 Days "
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')),('date','>',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Expenses during last 7 year"/>
|
||||
<filter icon="terp-go-month" string=" 30 Days "
|
||||
name="month"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
|
||||
help="Expenses during last month"/>
|
||||
<filter icon="terp-go-week" string=" 7 Days " separator="1"
|
||||
domain="[('date','<=', time.strftime('%%Y-%%m-%%d')), ('date','>',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]" help="Expenses during last 7 days"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Draft" icon="terp-document-new" domain="[('state','=','draft')]" help = "Draft Expenses"/>
|
||||
<filter string="Waiting" icon="terp-gtk-media-pause" domain="[('state', '=' ,'confirm')]"
|
||||
help = "Confirm Expenses"/>
|
||||
help = "Confirm Expenses"/>
|
||||
<filter string="Accepted" icon="terp-camera_test" domain="[('state','=','accepted')]"
|
||||
help = "Accepted Expenses"/>
|
||||
help = "Accepted Expenses"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="department_id"/>
|
||||
</group>
|
||||
<newline/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="0" string="Group By...">
|
||||
<filter string="Employee" name="employee" icon="terp-personal" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Department" icon="terp-personal+" context="{'group_by':'department_id'}"/>
|
||||
|
||||
@@ -137,6 +137,7 @@
|
||||
<field name="name"/>
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="manager_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
@@ -194,6 +195,7 @@
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="manager_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="type" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
</tree>
|
||||
@@ -215,6 +217,7 @@
|
||||
<field name="name"/>
|
||||
<field name="holiday_status_id"/>
|
||||
<field name="manager_id" invisible="1"/>
|
||||
<field name="user_id" invisible="1"/>
|
||||
<field name="type"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
|
||||
@@ -425,11 +425,13 @@
|
||||
<tree colors="blue:state in ('draft');black:state in ('confirm','new','hr_check','accont_check');gray:state in('done','cancel')" string="Payslip">
|
||||
<field name="number"/>
|
||||
<field name="employee_id"/>
|
||||
<field name="register_id" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="date"/>
|
||||
<field name="grows"/>
|
||||
<field name="net"/>
|
||||
<field name="state"/>
|
||||
<field name="company_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
@@ -529,10 +531,10 @@
|
||||
</group>
|
||||
<newline/>
|
||||
<group col="8" colspan="4" expand="0" string="Group By...">
|
||||
<filter string="Register" icon="terp-folder-yellow" name="register_id" context="{'register_id':self}"/>
|
||||
<filter string="Employees" icon="terp-partner" name="employee_id" context="{'employee_id':self}"/>
|
||||
<filter string="Periods" name="period_id" icon="terp-go-month" context="{'period_id':self}"/>
|
||||
<filter string="Staes" name="state" icon="terp-stock_effects-object-colorize" context="{'state':self}"/>
|
||||
<filter string="Register" icon="terp-folder-yellow" name="register_id" context="{'group_by':'register_id'}"/>
|
||||
<filter string="Employees" icon="terp-partner" name="employee_id" context="{'group_by':'employee_id'}"/>
|
||||
<filter string="Companies" name="company_id" icon="terp-go-month" context="{'group_by':'company_id'}"/>
|
||||
<filter string="States" name="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
|
||||
@@ -34,7 +34,6 @@
|
||||
<newline/>
|
||||
<field name="product_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)" required="1" domain="[('type','=','service')]"/>
|
||||
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
|
||||
|
||||
<field domain="[('type','=','normal'),('state', '<>', 'close')]" name="account_id" select="1"/>
|
||||
<field name="amount"/>
|
||||
<field name="general_account_id"/>
|
||||
@@ -85,8 +84,8 @@
|
||||
<field name="search_view_id" ref="hr_timesheet_line_search"/>
|
||||
</record>
|
||||
|
||||
<menuitem id="menu_project_working_hours" parent="base.menu_project_management_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
|
||||
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
|
||||
<menuitem id="menu_project_working_hours" parent="base.menu_project_management_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
|
||||
<menuitem id="menu_hr_working_hours" parent="hr_attendance.menu_hr_time_tracking" action="act_hr_timesheet_line_evry1_all_form"/>
|
||||
|
||||
<record id="hr_timesheet_employee_extd_form" model="ir.ui.view">
|
||||
<field name="name">hr.timesheet.employee.extd_form</field>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="action_timesheet_report_all" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets by Month</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">timesheet.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="domain">[('user_id','=',uid), ('month', '=' , time.strftime('%m')), ('year', '=', time.strftime('%Y'))]</field>
|
||||
<field name="view_id" ref="hr_timesheet_sheet.view_timesheet_report_graph"/>
|
||||
</record>
|
||||
<record id="action_timesheet_report_all" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets by Month</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">timesheet.report</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">graph,tree</field>
|
||||
<field name="domain">[('user_id','=',uid), ('month', '=' , time.strftime('%m')), ('year', '=', time.strftime('%Y'))]</field>
|
||||
<field name="view_id" ref="hr_timesheet_sheet.view_timesheet_report_graph"/>
|
||||
</record>
|
||||
|
||||
<record id="action_hr_timesheet_sheet_graph" model="ir.actions.act_window">
|
||||
<record id="action_hr_timesheet_sheet_graph" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">hr_timesheet_sheet.sheet</field>
|
||||
@@ -23,12 +23,12 @@
|
||||
<record id="board_hr_timesheet_form" model="ir.ui.view">
|
||||
<field name="name">board.hr.timesheet.form</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="inherit_id" ref="hr.board_hr_form"/>
|
||||
<field name="inherit_id" ref="hr.board_hr_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/hpaned/child2" position="inside">
|
||||
<action colspan="4" height="220" name="%(action_hr_timesheet_sheet_graph)d" string="Timesheets by Month" />
|
||||
</xpath>
|
||||
<xpath expr="/form/hpaned/child2" position="inside">
|
||||
<action colspan="4" height="220" name="%(action_hr_timesheet_sheet_graph)d" string="Timesheets by Month" />
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
<record id="hr_timesheet_sheet_tree" model="ir.ui.view">
|
||||
@@ -39,6 +39,7 @@
|
||||
<tree colors="blue:state in ('draft');black:state in ('confirm','new');gray:state in('done')" string="Timesheets">
|
||||
<field name="date_from"/>
|
||||
<field name="user_id"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="total_attendance"/>
|
||||
<field name="total_timesheet"/>
|
||||
@@ -46,7 +47,7 @@
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- Add in projectboard
|
||||
<record id="act_hr_timesheet_sheet" model="ir.actions.act_window">
|
||||
<field name="name">Timesheets</field>
|
||||
@@ -54,16 +55,16 @@
|
||||
<field name="domain">[('state','<>','done'),('user_id','in',department_users_get())]</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="hr_timesheet_sheet_tree"/>
|
||||
</record>
|
||||
<record id="board_project_timesheet_form" model="ir.ui.view">
|
||||
</record>
|
||||
<record id="board_project_timesheet_form" model="ir.ui.view">
|
||||
<field name="name">board.project.timesheet.form</field>
|
||||
<field name="model">board.board</field>
|
||||
<field name="inherit_id" ref="project.board_project_manager_form"/>
|
||||
<field name="inherit_id" ref="project.board_project_manager_form"/>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/form/hpaned/child1" position="inside">
|
||||
<action colspan="4" height="150" name="%(act_hr_timesheet_sheet)d" string="User's timesheets" width="510"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/hpaned/child1" position="inside">
|
||||
<action colspan="4" height="150" name="%(act_hr_timesheet_sheet)d" string="User's timesheets" width="510"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>-->
|
||||
</data>
|
||||
|
||||
@@ -338,6 +338,7 @@
|
||||
<tree colors="blue:state in ('draft');black:state in ('confirm','new');gray:state in('done')" string="Timesheets">
|
||||
<field name="date_from"/>
|
||||
<field name="user_id"/>
|
||||
<field name="department_id" invisible="1"/>
|
||||
<field name="name"/>
|
||||
<field name="total_attendance"/>
|
||||
<field name="total_timesheet"/>
|
||||
@@ -346,8 +347,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Timesheet Button on Employee Form -->
|
||||
<act_window domain="[('user_id', '=', user_id)]" id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
|
||||
<!-- Timesheet Button on Employee Form -->
|
||||
<act_window domain="[('user_id', '=', user_id)]" id="act_hr_employee_2_hr_timesheet" name="Timesheets" res_model="hr_timesheet_sheet.sheet" src_model="hr.employee"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,3 @@
|
||||
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
|
||||
"access_ir_attachment_sale_manager","ir_attachment manager","base.model_ir_attachment","base.group_sale_manager",1,1,1,1
|
||||
"access_ir_attachment_partner_manager","ir_attachment_partner manager","base.model_ir_attachment","base.group_partner_manager",1,1,1,1
|
||||
|
||||
|
||||
"access_document_directory_system","document.directory system","document.model_document_directory","base.group_sale_manager",1,1,1,1
|
||||
|
||||
|
+25
-32
@@ -647,42 +647,35 @@ class project_work(osv.osv):
|
||||
def create(self, cr, uid, vals, *args, **kwargs):
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
if (not 'task_id' in vals) or (not 'hours' in vals):
|
||||
return super(project_work, self).create(cr, uid, vals, *args, **kwargs)
|
||||
if not vals['hours']:
|
||||
vals['hours'] = 0.00
|
||||
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
|
||||
if user_uom != default_uom:
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (duration, vals['task_id']))
|
||||
return super(project_work,self).create(cr, uid, vals, *args, **kwargs)
|
||||
if vals.get('hours', False):
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
if user_uom != default_uom:
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s where id=%s', (duration, vals['task_id']))
|
||||
return super(project_work, self).create(cr, uid, vals, *args, **kwargs)
|
||||
|
||||
def write(self, cr, uid, ids, vals, context=None):
|
||||
project_obj = self.pool.get('project.project')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
|
||||
if context is None:
|
||||
context = {}
|
||||
if not vals['hours']:
|
||||
vals['hours'] = 0.00
|
||||
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
|
||||
if user_uom == default_uom:
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, work.hours, work.task_id.id))
|
||||
else:
|
||||
for work in self.browse(cr, uid, ids, context):
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
del_work = uom_obj._compute_qty(cr, uid, default_uom, work.hours, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, del_work, work.task_id.id))
|
||||
|
||||
return super(project_work,self).write(cr, uid, ids, vals, context)
|
||||
if vals.get('hours', False):
|
||||
old_hours = self.browse(cr, uid, ids, context=context)
|
||||
user_uom, default_uom = project_obj._get_user_and_default_uom_ids(cr, uid)
|
||||
duration = vals['hours']
|
||||
for old in old_hours:
|
||||
if vals.get('hours') != old.hours:
|
||||
# this code is only needed when we update the hours of the project
|
||||
# TODO: it may still a second calculation if the task.id is changed
|
||||
# at this task.
|
||||
if user_uom == default_uom:
|
||||
for work in self.browse(cr, uid, ids, context=context):
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, work.hours, work.task_id.id))
|
||||
else:
|
||||
for work in self.browse(cr, uid, ids, context=context):
|
||||
duration = uom_obj._compute_qty(cr, uid, default_uom, duration, user_uom)
|
||||
del_work = uom_obj._compute_qty(cr, uid, default_uom, work.hours, user_uom)
|
||||
cr.execute('update project_task set remaining_hours=remaining_hours - %s + (%s) where id=%s', (duration, del_work, work.task_id.id))
|
||||
return super(project_work,self).write(cr, uid, ids, vals, context=context)
|
||||
|
||||
def unlink(self, cr, uid, ids, *args, **kwargs):
|
||||
context = kwargs.get('context', {})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,7 +15,7 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
@@ -24,5 +24,6 @@
|
||||
#----------------------------------------------------------
|
||||
|
||||
import sale_analytic_plans
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Sales Analytic Distribution Management',
|
||||
'version': '1.0',
|
||||
@@ -37,4 +36,4 @@
|
||||
'active': False,
|
||||
'certificate': '0066055860861',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -18,22 +18,23 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class sale_order_line(osv.osv):
|
||||
_inherit = 'sale.order.line'
|
||||
_columns = {
|
||||
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||
'analytics_id': fields.many2one('account.analytic.plan.instance', 'Analytic Distribution'),
|
||||
}
|
||||
def invoice_line_create(self, cr, uid, ids, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
line_obj = self.pool.get('account.invoice.line')
|
||||
create_ids = super(sale_order_line,self).invoice_line_create(cr, uid, ids, context=context)
|
||||
i = 0
|
||||
for line in self.browse(cr, uid, ids, context):
|
||||
line_obj.write(cr, uid, [create_ids[i]], {'analytics_id':line.analytics_id.id})
|
||||
i = i+1
|
||||
line_obj.write(cr, uid, [create_ids[i]], {'analytics_id': line.analytics_id.id})
|
||||
i = i + 1
|
||||
return create_ids
|
||||
|
||||
sale_order_line()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,11 +15,11 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import sale_crm
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -19,7 +19,6 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Creates Sale orders from Opportunity',
|
||||
'version': '1.0',
|
||||
@@ -45,8 +44,9 @@ crm modules.
|
||||
'security/sale_crm_security.xml',
|
||||
],
|
||||
'demo_xml': [],
|
||||
'test': ['test/sale_crm.yml'],
|
||||
'installable': True,
|
||||
'active': False,
|
||||
'certificate': '0064360130141',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -28,7 +28,7 @@ class sale_order(osv.osv):
|
||||
}
|
||||
|
||||
def _get_section(self, cr, uid, context=None):
|
||||
return context.get('context_section_id',False)
|
||||
return context.get('context_section_id', False)
|
||||
|
||||
_defaults = {
|
||||
'section_id': _get_section
|
||||
@@ -36,4 +36,4 @@ class sale_order(osv.osv):
|
||||
|
||||
sale_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -25,7 +25,7 @@
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="view_sales_order_filter_inherit" model="ir.ui.view">
|
||||
<field name="name">sale.order.list.select</field>
|
||||
<field name="model">sale.order</field>
|
||||
@@ -42,7 +42,6 @@
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -0,0 +1,50 @@
|
||||
-
|
||||
In order to test the sale_crm module in the Open-ERP,
|
||||
I create an opportunity and create a sale order through 'Convert to Sale' wizard .
|
||||
-
|
||||
I create an opportunity
|
||||
-
|
||||
!record {model: crm.lead, id: crm_lead_opportunity0}:
|
||||
country_id: base.be
|
||||
name: Opportunity-1
|
||||
planned_revenue: 50000.0
|
||||
probability: 70.0
|
||||
partner_address_id: base.res_partner_address_7
|
||||
partner_id: base.res_partner_4
|
||||
planned_revenue: 0.0
|
||||
probability: 0.0
|
||||
section_id: crm.section_sales_department
|
||||
type: opportunity
|
||||
categ_id: crm.categ_oppor1
|
||||
-
|
||||
Then I click on the 'Convert to Sale' wizard
|
||||
-
|
||||
I place a sale order for product keyboard having quantity 50
|
||||
-
|
||||
!record {model: crm.make.sale, id: crm_make_sale_0}:
|
||||
partner_id: base.res_partner_4
|
||||
sale_order_line:
|
||||
- name: '[KEYA] Keyboard - AZERTY'
|
||||
price_unit: 7.0
|
||||
product_uom: product.product_uom_unit
|
||||
product_uom_qty: 50.0
|
||||
delay: 7.0
|
||||
product_id: product.product_product_24
|
||||
type: make_to_stock
|
||||
shop_id: sale.shop
|
||||
-
|
||||
Then I click on the 'Ok' button of wizard
|
||||
-
|
||||
!python {model: crm.make.sale}: |
|
||||
self.makeOrder(cr, uid, [ref("crm_make_sale_0")], {"lang": "en_US", "tz": False,
|
||||
"active_model": "crm.lead", "section_id": False, "default_type": "opportunity",
|
||||
"search_default_user_id": 1, "search_default_current": 1, "active_ids": [1],
|
||||
"active_id": (1)})
|
||||
-
|
||||
I verify that a sale order has been generated from an opportunity
|
||||
-
|
||||
!python {model: sale.order}: |
|
||||
crm_obj = self.pool.get('crm.lead')
|
||||
crm = self.browse(cr, uid, ref("crm_lead_opportunity0"))
|
||||
so = self.search(cr, uid, [('origin','=', 'Opportunity: %s' % str(crm.id))])
|
||||
assert so, "Sale order has not been created "
|
||||
@@ -19,9 +19,10 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
|
||||
from osv import fields, osv
|
||||
from tools.translate import _
|
||||
import time
|
||||
import decimal_precision as dp
|
||||
|
||||
class crm_make_sale(osv.osv_memory):
|
||||
@@ -29,7 +30,7 @@ class crm_make_sale(osv.osv_memory):
|
||||
|
||||
_name = "crm.make.sale"
|
||||
_description = "Make sale"
|
||||
|
||||
|
||||
def _selectPartner(self, cr, uid, context=None):
|
||||
"""
|
||||
This function gets default value for partner_id field.
|
||||
@@ -38,17 +39,16 @@ class crm_make_sale(osv.osv_memory):
|
||||
@param uid: the current user’s ID for security checks,
|
||||
@param context: A standard dictionary for contextual values
|
||||
@return : default value of partner_id field.
|
||||
"""
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
active_id = context and context.get('active_id', False) or False
|
||||
if not active_id:
|
||||
return False
|
||||
lead_obj = self.pool.get('crm.lead')
|
||||
lead = lead_obj.read(cr, uid, active_id, ['partner_id'])
|
||||
return lead['partner_id']
|
||||
|
||||
return lead['partner_id']
|
||||
|
||||
def makeOrder(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
This function create Quotation on given case.
|
||||
@@ -61,26 +61,26 @@ class crm_make_sale(osv.osv_memory):
|
||||
"""
|
||||
if not context:
|
||||
context = {}
|
||||
|
||||
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
case_obj = self.pool.get('crm.lead')
|
||||
sale_obj = self.pool.get('sale.order')
|
||||
partner_obj = self.pool.get('res.partner')
|
||||
sale_line_obj = self.pool.get('sale.order.line')
|
||||
|
||||
|
||||
result = mod_obj._get_id(cr, uid, 'sale', 'view_sales_order_filter')
|
||||
id = mod_obj.read(cr, uid, result, ['res_id'])
|
||||
|
||||
|
||||
data = context and context.get('active_ids', []) or []
|
||||
|
||||
for make in self.browse(cr, uid, ids):
|
||||
|
||||
for make in self.browse(cr, uid, ids):
|
||||
default_partner_addr = partner_obj.address_get(cr, uid, [make.partner_id.id],
|
||||
['invoice', 'delivery', 'contact'])
|
||||
default_pricelist = partner_obj.browse(cr, uid, make.partner_id.id,
|
||||
context).property_product_pricelist.id
|
||||
fpos_data = partner_obj.browse(cr, uid, make.partner_id.id, context).property_account_position
|
||||
new_ids = []
|
||||
|
||||
|
||||
for case in case_obj.browse(cr, uid, data):
|
||||
if case.partner_id and case.partner_id.id:
|
||||
partner_id = case.partner_id.id
|
||||
@@ -94,10 +94,10 @@ class crm_make_sale(osv.osv_memory):
|
||||
fpos = fpos_data and fpos_data.id or False
|
||||
partner_addr = default_partner_addr
|
||||
pricelist = default_pricelist
|
||||
|
||||
|
||||
if False in partner_addr.values():
|
||||
raise osv.except_osv(_('Data Insufficient!'),_('Customer has no addresses defined!'))
|
||||
|
||||
|
||||
vals = {
|
||||
'origin': 'Opportunity: %s' % str(case.id),
|
||||
'section_id': case.section_id and case.section_id.id or False,
|
||||
@@ -110,11 +110,11 @@ class crm_make_sale(osv.osv_memory):
|
||||
'date_order': time.strftime('%Y-%m-%d'),
|
||||
'fiscal_position': fpos,
|
||||
}
|
||||
|
||||
|
||||
if partner_id:
|
||||
partner = partner_obj.browse(cr, uid, partner_id, context=context)
|
||||
vals['user_id'] = partner.user_id and partner.user_id.id or uid
|
||||
|
||||
|
||||
if make.analytic_account.id:
|
||||
vals['project_id'] = make.analytic_account.id
|
||||
new_id = sale_obj.create(cr, uid, vals)
|
||||
@@ -139,10 +139,10 @@ class crm_make_sale(osv.osv_memory):
|
||||
new_ids.append(new_id)
|
||||
message = _('Opportunity ') + " '" + case.name + "' "+ _("is converted to Sales Quotation.")
|
||||
self.log(cr, uid, case.id, message)
|
||||
|
||||
|
||||
if make.close:
|
||||
case_obj.case_close(cr, uid, data)
|
||||
|
||||
|
||||
if not new_ids:
|
||||
return {}
|
||||
if len(new_ids)<=1:
|
||||
@@ -171,30 +171,29 @@ class crm_make_sale(osv.osv_memory):
|
||||
'shop_id': fields.many2one('sale.shop', 'Shop', required=True),
|
||||
'partner_id': fields.many2one('res.partner', 'Customer', required=True),
|
||||
'sale_order_line': fields.one2many('sale.order.make.line', 'opportunity_order_id', 'Product Line'),
|
||||
'analytic_account': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'close': fields.boolean('Close Case', help='Check this to close the case after having created the sale order.'),
|
||||
'analytic_account': fields.many2one('account.analytic.account', 'Analytic Account'),
|
||||
'close': fields.boolean('Close Case', help='Check this to close the case after having created the sale order.'),
|
||||
}
|
||||
_defaults = {
|
||||
'partner_id': _selectPartner,
|
||||
'close': 1
|
||||
}
|
||||
|
||||
|
||||
|
||||
crm_make_sale()
|
||||
|
||||
class sale_order_make_line(osv.osv_memory):
|
||||
|
||||
|
||||
def product_id_change(self, cr, uid, ids, product, qty=0,
|
||||
uom=False, qty_uos=0, uos=False, name='', partner_id=False,
|
||||
lang=False, update_tax=True, packaging=False, flag=False):
|
||||
if not partner_id:
|
||||
raise osv.except_osv(_('No Customer Defined !'), _('You have to select a customer in the sale form !\nPlease set one customer before choosing a product.'))
|
||||
date_order = time.strftime('%Y-%m-%d')
|
||||
date_order = time.strftime('%Y-%m-%d')
|
||||
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
|
||||
pricelist = part.property_product_pricelist and part.property_product_pricelist.id or False
|
||||
fiscal_position = part.property_account_position and part.property_account_position.id or False
|
||||
return self.pool.get('sale.order.line').product_id_change(cr, uid, ids, pricelist, product, qty, uom, qty_uos, uos, name, partner_id, lang, update_tax, date_order, packaging, fiscal_position, flag)
|
||||
|
||||
|
||||
_name = 'sale.order.make.line'
|
||||
_description = 'Opportunity Sale Order Line'
|
||||
_columns = {
|
||||
@@ -223,8 +222,6 @@ class sale_order_make_line(osv.osv_memory):
|
||||
'product_packaging': False
|
||||
}
|
||||
|
||||
sale_order_make_line()
|
||||
sale_order_make_line()
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -58,20 +58,20 @@
|
||||
</field>
|
||||
<newline/>
|
||||
|
||||
|
||||
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
<label string="" colspan="2"/>
|
||||
<button special="cancel" string="_Close" icon="gtk-cancel"/>
|
||||
<button name="makeOrder" string="_Ok" type="object" icon='gtk-ok'/>
|
||||
<button name="makeOrder" string="_Create" type="object" icon='gtk-ok'/>
|
||||
</group>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<!-- crm make sale's action -->
|
||||
|
||||
|
||||
<record id="action_crm_make_sale" model="ir.actions.act_window">
|
||||
<field name="name">Make Quotation</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
@@ -80,6 +80,6 @@
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -15,9 +15,10 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sale_journal
|
||||
import report
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
'security/ir.model.access.csv',
|
||||
'sale_journal_view.xml',
|
||||
'report/sale_journal_report_view.xml',
|
||||
'report/picking_journal_report_view.xml',
|
||||
],
|
||||
'demo_xml': ['sale_journal_demo.xml'],
|
||||
'test': [
|
||||
|
||||
@@ -20,5 +20,6 @@
|
||||
##############################################################################
|
||||
|
||||
import sale_journal_report
|
||||
import picking_journal_report
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,86 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import tools
|
||||
|
||||
class sale_journal_picking_report(osv.osv):
|
||||
"""
|
||||
Picking list by journal and by invoice
|
||||
"""
|
||||
_name = "sale.journal.picking.report"
|
||||
_description = "Picking lists"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year', size=64, required=False, readonly=True),
|
||||
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
|
||||
('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
|
||||
|
||||
'invoice_state':fields.selection([
|
||||
("invoiced", "invoiced"),
|
||||
("2binvoiced", "to be invoiced"),
|
||||
("none", "None")
|
||||
], "Invoice state", readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft', 'draft'),
|
||||
('auto', 'waiting'),
|
||||
('confirmed', 'confirmed'),
|
||||
('assigned', 'assigned'),
|
||||
('done', 'done'),
|
||||
('cancel', 'cancel'),
|
||||
], 'State', readonly=True),
|
||||
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
|
||||
'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
|
||||
'quantity': fields.float('Quantities', readonly=True),
|
||||
'price_total': fields.float('Total Price', readonly=True),
|
||||
'price_average': fields.float('Average Price', readonly=True),
|
||||
'count': fields.integer('# of Lines', readonly=True),
|
||||
}
|
||||
_order = 'journal_id, name desc, price_total desc'
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'sale_journal_picking_report')
|
||||
|
||||
cr.execute("""
|
||||
create or replace view sale_journal_picking_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
to_char(s.date, 'YYYY') as name,
|
||||
to_char(s.date, 'MM') as month,
|
||||
s.state,
|
||||
s.invoice_state,
|
||||
s.invoice_type_id,
|
||||
s.journal_id,
|
||||
sum(l.product_qty) as quantity,
|
||||
count(*) as count,
|
||||
sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
|
||||
(sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
|
||||
from stock_picking s
|
||||
right join stock_move l on (s.id=l.picking_id)
|
||||
left join sale_order_line ol on (l.sale_line_id=ol.id)
|
||||
group by s.journal_id, s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state
|
||||
order by s.invoice_type_id, s.invoice_state, s.state
|
||||
)
|
||||
""")
|
||||
|
||||
sale_journal_picking_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,105 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- picking by journal and invoice's tree view-->
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_journal_picking_report_tree">
|
||||
<field name="name">sale.journal.picking.report.tree</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Picking Journal">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="invoice_state" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="invoice_type_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="quantity" />
|
||||
<field name="count" />
|
||||
<field name="price_average"/>
|
||||
<field name="price_total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- picking journal's graph view -->
|
||||
|
||||
<record id="view_sale_journal_picking_graph" model="ir.ui.view">
|
||||
<field name="name">sale.journal.picking.report.graph</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Picking journal Statistics" type="bar">
|
||||
<field name="journal_id"/>
|
||||
<field name="invoice_type_id"/>
|
||||
<field name="price_total"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Picking journal search view -->
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_journal_picking_report_search">
|
||||
<field name="name">sale.journal.picking.report.search</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Picking journal">
|
||||
<group col="8" colspan="4">
|
||||
<filter icon="terp-go-year" string="This Year" name="year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice or by journal method in this year"/>
|
||||
<filter icon="terp-go-month" string="This Month" name="month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by invoice or by journal method in this month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-gtk-media-pause"
|
||||
string="Pending"
|
||||
domain="[('state','=','waiting')]"/>
|
||||
<filter icon="terp-camera_test"
|
||||
string="Confirmed"
|
||||
domain="[('state','=','confirmed')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="invoice_state" select="1"/>
|
||||
<field name="state" select="1"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="12">
|
||||
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Invoice" icon="terp-dolar" context="{'group_by':'invoice_type_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Invoice state" icon="terp-stock_effects-object-colorize" context="{'group_by':'invoice_state'}"/>
|
||||
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open">
|
||||
<field name="name">Statistics on picking to invoice</field>
|
||||
<field name="res_model">sale.journal.picking.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
|
||||
</record>
|
||||
|
||||
<!-- Action for picking journal view -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open_menu_all">
|
||||
<field name="name">Picking Journal</field>
|
||||
<field name="res_model">sale.journal.picking.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_sale_journal_picking_report_search"/>
|
||||
<field name="context">{'search_default_month':1, 'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Picking journal" id="menu_invoice_type_picking_stats_open_all" parent="stock.next_id_61"
|
||||
action="action_sale_journal_picking_report_open_menu_all" sequence="8"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
@@ -72,70 +72,4 @@ class sale_journal_report(osv.osv):
|
||||
|
||||
sale_journal_report()
|
||||
|
||||
#==========================================
|
||||
#picking report
|
||||
#==========================================
|
||||
|
||||
|
||||
class sale_journal_picking_report(osv.osv):
|
||||
"""
|
||||
Picking list by journal and by invoice
|
||||
"""
|
||||
_name = "sale.journal.picking.report"
|
||||
_description = "Picking lists"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'name': fields.char('Year', size=64, required=False, readonly=True),
|
||||
'month': fields.selection([('01', 'January'), ('02', 'February'), ('03', 'March'), ('04', 'April'), ('05', 'May'), ('06', 'June'),
|
||||
('07', 'July'), ('08', 'August'), ('09', 'September'), ('10', 'October'), ('11', 'November'), ('12', 'December')], 'Month', readonly=True),
|
||||
|
||||
'invoice_state':fields.selection([
|
||||
("invoiced", "invoiced"),
|
||||
("2binvoiced", "to be invoiced"),
|
||||
("none", "None")
|
||||
], "Invoice state", readonly=True),
|
||||
'state': fields.selection([
|
||||
('draft', 'draft'),
|
||||
('auto', 'waiting'),
|
||||
('confirmed', 'confirmed'),
|
||||
('assigned', 'assigned'),
|
||||
('done', 'done'),
|
||||
('cancel', 'cancel'),
|
||||
], 'State', readonly=True),
|
||||
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoicing method', readonly=True),
|
||||
'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', readonly=True),
|
||||
'quantity': fields.float('Quantities', readonly=True),
|
||||
'price_total': fields.float('Total Price', readonly=True),
|
||||
'price_average': fields.float('Average Price', readonly=True),
|
||||
'count': fields.integer('# of Lines', readonly=True),
|
||||
}
|
||||
_order = 'journal_id, name desc, price_total desc'
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'sale_journal_picking_report')
|
||||
|
||||
cr.execute("""
|
||||
create or replace view sale_journal_picking_report as (
|
||||
select
|
||||
min(l.id) as id,
|
||||
to_char(s.date, 'YYYY') as name,
|
||||
to_char(s.date, 'MM') as month,
|
||||
s.state,
|
||||
s.invoice_state,
|
||||
s.invoice_type_id,
|
||||
s.journal_id,
|
||||
sum(l.product_qty) as quantity,
|
||||
count(*) as count,
|
||||
sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0)) as price_total,
|
||||
(sum(l.product_qty*ol.price_unit*(1.0-ol.discount/100.0))/sum(l.product_qty))::decimal(16,2) as price_average
|
||||
from stock_picking s
|
||||
right join stock_move l on (s.id=l.picking_id)
|
||||
left join sale_order_line ol on (l.sale_line_id=ol.id)
|
||||
group by s.journal_id, s.invoice_type_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state, s.invoice_state
|
||||
order by s.invoice_type_id, s.invoice_state, s.state
|
||||
)
|
||||
""")
|
||||
|
||||
sale_journal_picking_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -84,106 +84,5 @@
|
||||
<menuitem name="Sales by Journal" id="menu_sale_journal_report_open_all"
|
||||
parent="base.next_id_64" action="action_sale_journal_report_open_menu_all" sequence="2" groups="base.group_sale_manager"/>
|
||||
|
||||
<!-- picking by journal and invoice's tree view-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_journal_picking_report_tree">
|
||||
<field name="name">sale.journal.picking.report.tree</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Picking Journal">
|
||||
<field name="name" invisible="1"/>
|
||||
<field name="month" invisible="1"/>
|
||||
<field name="invoice_state" invisible="1"/>
|
||||
<field name="state" invisible="1"/>
|
||||
<field name="invoice_type_id" invisible="1"/>
|
||||
<field name="journal_id" invisible="1"/>
|
||||
<field name="quantity" />
|
||||
<field name="count" />
|
||||
<field name="price_average"/>
|
||||
<field name="price_total"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- picking journal's graph view -->
|
||||
|
||||
<record id="view_sale_journal_picking_graph" model="ir.ui.view">
|
||||
<field name="name">sale.journal.picking.report.graph</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">graph</field>
|
||||
<field name="arch" type="xml">
|
||||
<graph string="Picking journal Statistics" type="bar">
|
||||
<field name="journal_id"/>
|
||||
<field name="invoice_type_id"/>
|
||||
<field name="price_total"/>
|
||||
</graph>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!-- Picking journal search view -->
|
||||
|
||||
<record model="ir.ui.view" id="view_sale_journal_picking_report_search">
|
||||
<field name="name">sale.journal.picking.report.search</field>
|
||||
<field name="model">sale.journal.picking.report</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Picking journal">
|
||||
<group col="8" colspan="4">
|
||||
<filter icon="terp-go-year" string="This Year" name="year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice or by journal method in this year"/>
|
||||
<filter icon="terp-go-month" string="This Month" name="month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by invoice or by journal method in this month"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-document-new"
|
||||
string="Draft"
|
||||
domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-gtk-media-pause"
|
||||
string="Pending"
|
||||
domain="[('state','=','waiting')]"/>
|
||||
<filter icon="terp-camera_test"
|
||||
string="Confirmed"
|
||||
domain="[('state','=','confirmed')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="month" select="1"/>
|
||||
<field name="invoice_state" select="1"/>
|
||||
<field name="state" select="1"/>
|
||||
</group>
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="4" col="12">
|
||||
<filter string="Journal" icon="terp-folder-orange" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Invoice" icon="terp-dolar" context="{'group_by':'invoice_type_id'}"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter string="Invoice state" icon="terp-stock_effects-object-colorize" context="{'group_by':'invoice_state'}"/>
|
||||
<filter string="state" icon="terp-stock_effects-object-colorize" context="{'group_by':'state'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open">
|
||||
<field name="name">Statistics on picking to invoice</field>
|
||||
<field name="res_model">sale.journal.picking.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
|
||||
</record>
|
||||
|
||||
<!-- Action for picking journal view -->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sale_journal_picking_report_open_menu_all">
|
||||
<field name="name">Picking Journal</field>
|
||||
<field name="res_model">sale.journal.picking.report</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,graph</field>
|
||||
<field name="search_view_id" ref="view_sale_journal_picking_report_search"/>
|
||||
<field name="context">{'search_default_month':1, 'group_by_no_leaf':1,'group_by':[]}</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Picking journal" id="menu_invoice_type_picking_stats_open_all" parent="stock.next_id_61"
|
||||
action="action_sale_journal_picking_report_open_menu_all" sequence="8" groups="stock.group_stock_manager"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
@@ -43,10 +43,10 @@ class sale_journal(osv.osv):
|
||||
_name = 'sale_journal.sale.journal'
|
||||
_description = 'Sale Journal'
|
||||
_columns = {
|
||||
'name': fields.char('Journal', size=64, required=True),
|
||||
'code': fields.char('Code', size=16, required=True),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=True),
|
||||
'date': fields.date('Journal date', required=True),
|
||||
'name': fields.char('Journal', size=64, required=True, states={'close':[('readonly',True)]}),
|
||||
'code': fields.char('Code', size=16, required=True, states={'close':[('readonly',True)]}),
|
||||
'user_id': fields.many2one('res.users', 'Responsible', required=True, states={'close':[('readonly',True)]}),
|
||||
'date': fields.date('Journal date', required=True, states={'close':[('readonly',True)]}),
|
||||
'date_created': fields.date('Creation date', readonly=True, required=True),
|
||||
'date_close': fields.date('Close date ', readonly=True),
|
||||
'sale_stats_ids': fields.one2many("sale.journal.report", "journal_id", 'Sale stats', readonly=True),
|
||||
@@ -167,19 +167,19 @@ class picking_journal(osv.osv):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_cancel', cr)
|
||||
return True
|
||||
|
||||
|
||||
def button_open(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'open'})
|
||||
return True
|
||||
|
||||
|
||||
def button_draft(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'draft'})
|
||||
return True
|
||||
|
||||
|
||||
def button_close(self, cr, uid, ids, context={}):
|
||||
self.write(cr, uid, ids, {'state':'close', 'date_close':time.strftime('%Y-%m-%d')})
|
||||
return True
|
||||
|
||||
|
||||
def button_reset(self, cr, uid, ids, context=None):
|
||||
self.write(cr, uid, ids, {'state': 'draft'})
|
||||
for (id,name) in self.name_get(cr, uid, ids):
|
||||
@@ -188,15 +188,15 @@ class picking_journal(osv.osv):
|
||||
return True
|
||||
|
||||
def button_picking_confirm(self, cr, uid, ids, context={}):
|
||||
|
||||
|
||||
self.write(cr, uid, ids, {'state':'confirm'})
|
||||
for id in ids:
|
||||
pick_ids = self.pool.get('stock.picking').search(cr, uid, [('journal_id','=',id)])
|
||||
for pickid in pick_ids:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
|
||||
wf_service.trg_validate(uid, 'stock.picking', pickid, 'button_confirm', cr)
|
||||
return True
|
||||
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context=None):
|
||||
"""Overrides orm copy method
|
||||
@param self: The object pointer
|
||||
@@ -211,7 +211,7 @@ class picking_journal(osv.osv):
|
||||
default = {}
|
||||
default.update({'picking_stats_ids': []})
|
||||
return super(picking_journal, self).copy(cr, uid, id, default=default, context=context)
|
||||
|
||||
|
||||
picking_journal()
|
||||
|
||||
#==============================================
|
||||
@@ -236,7 +236,7 @@ res_partner()
|
||||
class picking(osv.osv):
|
||||
_inherit = "stock.picking"
|
||||
_columns = {
|
||||
'journal_id': fields.many2one('sale_journal.picking.journal', 'Journal', domain=[('state','!=', 'close')],help="Picking Journal"),
|
||||
'journal_id': fields.many2one('sale_journal.picking.journal', 'Picking Journal', domain=[('state','!=', 'close')],help="Picking Journal"),
|
||||
'sale_journal_id': fields.many2one('sale_journal.sale.journal', 'Sale Journal'),
|
||||
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type', readonly=True)
|
||||
}
|
||||
@@ -264,5 +264,7 @@ class sale(osv.osv):
|
||||
itype = self.pool.get('res.partner').browse(cr, uid, part).property_invoice_type.id
|
||||
result['value']['invoice_type_id'] = itype
|
||||
return result
|
||||
|
||||
sale()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -155,7 +155,7 @@
|
||||
<field name="origin" position="after">
|
||||
<group colspan="2" col="2">
|
||||
<separator string="Journal" colspan="4"/>
|
||||
<field name="journal_id" select="1"/>
|
||||
<field name="journal_id" select="1" widget="selection" domain="[('state','in', ('draft', 'open'))]"/>
|
||||
<field name="invoice_type_id" select="1" widget="selection"/>
|
||||
</group>
|
||||
</field>
|
||||
@@ -501,7 +501,7 @@
|
||||
<field name="inherit_id" ref="stock.view_stock_delivery_filter"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after">
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -513,7 +513,7 @@
|
||||
<field name="inherit_id" ref="stock.view_picking_out_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after">
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -525,7 +525,7 @@
|
||||
<field name="inherit_id" ref="stock.view_picking_in_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/search/group[@string='Group By...']/filter[@string='Partner']" position="after">
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
@@ -537,7 +537,7 @@
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="/search/group[@string='Group By...']/filter[@string='Origin']" position="after">
|
||||
<filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
<filter string="Picking Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
@@ -14,22 +14,22 @@
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
{
|
||||
"name" : "Sale Order Layout Improvement",
|
||||
"name" : "Sale Order Layout",
|
||||
"version" : "1.0",
|
||||
"depends" : ["base", "sale"],
|
||||
"depends" : ["sale", "account_invoice_layout"],
|
||||
"author" : "OpenERP SA",
|
||||
"description": """
|
||||
This module provides some features to improve the layout of the Sale Order.
|
||||
This module provides features to improve the layout of the Sale Order.
|
||||
|
||||
It gives you the possibility to
|
||||
* order all the lines of an sale order
|
||||
* add titles, comment lines, sub total lines
|
||||
* draw horizontal lines and put page breaks
|
||||
* draw horizontal lines and put page breaks
|
||||
|
||||
""",
|
||||
"website" : "http://www.openerp.com",
|
||||
@@ -37,12 +37,10 @@
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : [
|
||||
# "security/ir.model.access.csv",
|
||||
"sale_layout_view.xml",
|
||||
"sale_layout_report.xml",
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -1,7 +1,7 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2008 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
@@ -19,12 +19,14 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields,osv
|
||||
from tools import config
|
||||
import decimal_precision as dp
|
||||
from tools.translate import _
|
||||
|
||||
class sale_order_line(osv.osv):
|
||||
|
||||
|
||||
def _amount_line(self, cr, uid, ids, field_name, arg, context=None):
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
cur_obj = self.pool.get('res.currency')
|
||||
@@ -84,7 +86,7 @@ class sale_order_line(osv.osv):
|
||||
if vals['layout_type'] == 'break':
|
||||
vals['name'] = ' '
|
||||
if vals['layout_type'] != 'article':
|
||||
vals['product_uom_qty']= 0
|
||||
vals['product_uom_qty']= 0
|
||||
return super(sale_order_line, self).create(cr, user, vals, context)
|
||||
|
||||
def write(self, cr, user, ids, vals, context=None):
|
||||
@@ -100,7 +102,7 @@ class sale_order_line(osv.osv):
|
||||
default = {}
|
||||
default['layout_type'] = self.browse(cr, uid, id).layout_type
|
||||
return super(sale_order_line, self).copy(cr, uid, id, default, context)
|
||||
|
||||
|
||||
|
||||
_name = "sale.order.line"
|
||||
_order = "order_id, sequence asc"
|
||||
@@ -115,17 +117,17 @@ class sale_order_line(osv.osv):
|
||||
('line','Separator Line'),
|
||||
('break','Page Break'),]
|
||||
,'Layout Type', select=True, required=True),
|
||||
'sequence': fields.integer('Sequence Number'),
|
||||
'sequence': fields.integer('Sequence Number'),
|
||||
'price_unit': fields.float('Unit Price', required=True, digits_compute= dp.get_precision('Sale Price'), readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'product_uom_qty': fields.float('Quantity (UoM)', digits=(16,2)),
|
||||
'product_uom': fields.many2one('product.uom', 'Product UoM'),
|
||||
}
|
||||
'product_uom': fields.many2one('product.uom', 'Product UoM'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'layout_type': lambda *a: 'article',
|
||||
}
|
||||
sale_order_line()
|
||||
|
||||
sale_order_line()
|
||||
|
||||
class one2many_mod2(fields.one2many):
|
||||
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||
@@ -155,6 +157,7 @@ class sale_order(osv.osv):
|
||||
'abstract_line_ids': fields.one2many('sale.order.line', 'order_id', 'Order Lines',readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'order_line': one2many_mod2('sale.order.line', 'order_id', 'Order Lines',readonly=True, states={'draft':[('readonly',False)]}),
|
||||
}
|
||||
sale_order()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
sale_order()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -0,0 +1,56 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_dates
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2010-08-09 12:40:22+0000\n"
|
||||
"PO-Revision-Date: 2010-08-09 12:40:22+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,shortdesc:sale_order_dates.module_meta_information
|
||||
msgid "Sale Order Dates"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,commitment_date:0
|
||||
msgid "Commitment Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.model,name:sale_order_dates.model_sale_order
|
||||
msgid "Sale Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,effective_date:0
|
||||
msgid "Effective Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,description:sale_order_dates.module_meta_information
|
||||
msgid "Add commitment, requested and effective dates on the sale order.\n"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,requested_date:0
|
||||
msgid "Requested Date"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,56 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_dates
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2010-08-09 12:45:51+0000\n"
|
||||
"PO-Revision-Date: 2010-08-09 12:45:51+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,shortdesc:sale_order_dates.module_meta_information
|
||||
msgid "Sale Order Dates"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,commitment_date:0
|
||||
msgid "Commitment Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.model,name:sale_order_dates.model_sale_order
|
||||
msgid "Sale Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,effective_date:0
|
||||
msgid "Effective Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,description:sale_order_dates.module_meta_information
|
||||
msgid "Add commitment, requested and effective dates on the sale order.\n"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,requested_date:0
|
||||
msgid "Requested Date"
|
||||
msgstr ""
|
||||
@@ -0,0 +1,56 @@
|
||||
# Translation of OpenERP Server.
|
||||
# This file contains the translation of the following modules:
|
||||
# * sale_order_dates
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: OpenERP Server 6.0dev\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"POT-Creation-Date: 2010-08-09 12:18:27+0000\n"
|
||||
"PO-Revision-Date: 2010-08-09 12:18:27+0000\n"
|
||||
"Last-Translator: <>\n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: \n"
|
||||
"Plural-Forms: \n"
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.ui.view:0
|
||||
msgid "Invalid XML for View Architecture!"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: constraint:ir.model:0
|
||||
msgid "The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,shortdesc:sale_order_dates.module_meta_information
|
||||
msgid "Sale Order Dates"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,commitment_date:0
|
||||
msgid "Commitment Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.model,name:sale_order_dates.model_sale_order
|
||||
msgid "Sale Order"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,effective_date:0
|
||||
msgid "Effective Date"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: model:ir.module.module,description:sale_order_dates.module_meta_information
|
||||
msgid "Add commitment, requested and effective dates on the sale order.\n"
|
||||
msgstr ""
|
||||
|
||||
#. module: sale_order_dates
|
||||
#: field:sale.order,requested_date:0
|
||||
msgid "Requested Date"
|
||||
msgstr ""
|
||||
@@ -19,11 +19,12 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import fields, osv
|
||||
import time
|
||||
from datetime import datetime
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
from osv import fields, osv
|
||||
|
||||
class sale_order_dates(osv.osv):
|
||||
_inherit = 'sale.order'
|
||||
_name = 'sale.order'
|
||||
@@ -59,7 +60,7 @@ class sale_order_dates(osv.osv):
|
||||
'requested_date': fields.date('Requested Date'),
|
||||
'effective_date': fields.function(_get_effective_date, method=True, type='date', store=True,string='Effective Date'),
|
||||
}
|
||||
|
||||
sale_order_dates()
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -241,7 +241,7 @@
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'assigned' )],'move_lines') ]]</para>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'confirmed' or line.state=='done' or line.state=='assigned')],'move_lines') ]]</para>
|
||||
<blockTable colWidths="257.0,58.0,61.0,46.0,26.0,74.0" style="Move_Line_Contect_Assign_State">[[ picking.move_lines or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
@@ -267,13 +267,17 @@
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="terp_default_2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
|
||||
<para style="terp_default_5cm_Above_Space">[[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('section') ]]</para>
|
||||
<para style="terp_default_Bold_9">Non Assigned Products: [[ ( move_lines.state == 'assigned' or move_lines.state == 'done' or move_lines.state == 'confirmed' ) and removeParentNode('para') ]]</para>
|
||||
<para style="terp_default_1cm_above_space">[[ (move_lines.state == 'done' or move_lines.state == 'confirmed') and removeParentNode('para') ]]</para>
|
||||
</section>
|
||||
<para style="terp_default_Bold_9">[[ ([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting' )]) and 'Non Assigned Products:' or removeParentNode('para') ]]</para>
|
||||
<section>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state != 'assigned' )],'move_lines') and removeParentNode('section') ]]</para>
|
||||
<para style="terp_default_8">[[ repeatIn([line for line in picking.move_lines if (line.state == 'draft' or line.state=='waiting')],'move_lines') ]]</para>
|
||||
<blockTable colWidths="257.0,57.0,62.0,46.0,26.0,74.0" style="Move_Line_Content_Other_State">[[ picking.move_lines or removeParentNode('blockTable')]]
|
||||
<tr>
|
||||
<td>
|
||||
|
||||
@@ -1583,7 +1583,7 @@ class stock_move(osv.osv):
|
||||
'address_id': picking.address_id.id,
|
||||
'invoice_state': 'none',
|
||||
'date': picking.date,
|
||||
'sale_id': picking.sale_id.id
|
||||
'sale_id':' sale_id' in picking._columns.keys() and picking.sale_id.id or False
|
||||
})
|
||||
for move, (loc, auto, delay, journal, company_id, ptype) in todo:
|
||||
new_id = move_obj.copy(cr, uid, move.id, {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<data>
|
||||
<report auto="False" id="report_product_history" model="product.product" name="stock.product.history" string="Future Stock Forecast"/>
|
||||
<report id="report_picking_list" model="stock.picking" name="stock.picking.list" string="Picking list" rml="stock/report/picking.rml"/>
|
||||
<report id="report_packing_list" model="stock.picking" name="stock.picking.list2" string="Packing list" rml="stock/report/packing.rml"/>
|
||||
<!--<report id="report_packing_list" model="stock.picking" name="stock.picking.list2" string="Packing list" rml="stock/report/packing.rml"/>-->
|
||||
<report id="report_move_labels" model="stock.move" name="stock.move.label" string="Item Labels" xml="stock/report/lot_move_label.xml" xsl="stock/report/lot_move_label.xsl"/>
|
||||
<report auto="False" id="report_location_overview" model="stock.location" name="lot.stock.overview" string="Location Overview" rml="stock/report/lot_overview.rml" groups="base.group_extended"/>
|
||||
<report auto="False" id="report_lot_location" model="stock.location" name="lot.location" rml="stock/report/lot_location.rml" string="Lots by location"/>
|
||||
|
||||
@@ -355,55 +355,6 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<!--wizard
|
||||
id="action_lot4"
|
||||
model="stock.production.lot"
|
||||
name="stock.traceability.lot.downstream"
|
||||
string="Downstream traceability"/-->
|
||||
|
||||
<!--wizard
|
||||
id="action4"
|
||||
model="stock.tracking"
|
||||
name="stock.traceability.upstream"
|
||||
string="Upstream traceability"/-->
|
||||
|
||||
<!--wizard
|
||||
id="action2"
|
||||
model="stock.tracking"
|
||||
name="stock.traceability.downstream"
|
||||
string="Downstream traceability"/-->
|
||||
|
||||
<!--record id="action3" model="ir.actions.act_window">
|
||||
<field name="name">Downstream traceability</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
<field name="domain">[('id','in',active_ids)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field eval="stock_move_tree2" name="view_id"/>
|
||||
</record>
|
||||
<record id="ir_move_traceability_upstream" model="ir.values">
|
||||
<field eval="'tree_but_action'" name="key2"/>
|
||||
<field eval="'stock.move'" name="model"/>
|
||||
<field name="name">Downstream traceability</field>
|
||||
<field eval="'ir.actions.act_window,'+str(action3)" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record>
|
||||
<record id="action5" model="ir.actions.act_window">
|
||||
<field name="name">Upstream traceability</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">stock.move</field>
|
||||
<field name="domain">[('id','in',active_ids)]</field>
|
||||
<field name="view_type">tree</field>
|
||||
<field eval="stock_move_tree" name="view_id"/>
|
||||
</record>
|
||||
<record id="ir_move_traceability_downstream" model="ir.values">
|
||||
<field eval="'tree_but_action'" name="key2"/>
|
||||
<field eval="'stock.move'" name="model"/>
|
||||
<field name="name">Upstream traceability</field>
|
||||
<field eval="'ir.actions.act_window,'+str(action5)" name="value"/>
|
||||
<field eval="True" name="object"/>
|
||||
</record-->
|
||||
|
||||
<record id="view_location_form" model="ir.ui.view">
|
||||
<field name="name">stock.location.form</field>
|
||||
<field name="model">stock.location</field>
|
||||
@@ -415,7 +366,6 @@
|
||||
<newline/>
|
||||
<field name="usage"/>
|
||||
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
|
||||
<!--<field name="account_id" groups="base.group_extended"/>-->
|
||||
<field name="location_id"/>
|
||||
<field name="address_id" context="{'contact_display':'partner'}"/>
|
||||
<field name="icon" groups="base.group_extended"/>
|
||||
@@ -627,7 +577,7 @@
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="General Information">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines, 'address_out_id': address_id}">
|
||||
<field colspan="4" name="move_lines" nolabel="1" widget="one2many_list" default_get="{'move_line':move_lines}">
|
||||
<tree colors="grey:scraped == True" string="Stock Moves">
|
||||
<field name="name" string="Move Name"/>
|
||||
<field name="product_id"/>
|
||||
@@ -1596,7 +1546,7 @@
|
||||
<separator colspan="4" string="Move Information"/>
|
||||
<field name="location_id" widget="selection"/>
|
||||
<field name="location_dest_id" widget="selection"/>
|
||||
<field colspan="4" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, parent.address_id)"/>
|
||||
<field colspan="4" name="product_id" on_change="onchange_product_id(product_id, location_id, location_dest_id, address_id)"/>
|
||||
<field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
|
||||
<field name="product_uom" widget="selection"/>
|
||||
<field name="product_uos_qty" groups="product.product_uos"/>
|
||||
@@ -1653,7 +1603,7 @@
|
||||
<filter icon="terp-go-today" string="Today" domain="[('date_planned','<=',time.strftime('%%Y-%%m-%%d 23:59:59')),('date_planned','>=',time.strftime('%%Y-%%m-%%d 00:00:00'))]" help="Orders planned for today"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-gtk-go-back-rtl" name="receive" string="To Do" domain="[('state','in',('confirmed','assigned'))]" help="Stock to be received"/>
|
||||
<filter icon="terp-check" name="received" string="Done" domain="[('state','=','done'))]"/>
|
||||
<filter icon="terp-check" name="received" string="Done" domain="[('state','=','done')]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<filter icon="terp-accessories-archiver-minus" string="Back Order" domain="[('backorder_id','!=',False)]" help="Back Order"/>
|
||||
<separator orientation="vertical"/>
|
||||
|
||||
@@ -49,4 +49,3 @@ This module may be useful for different purposes:
|
||||
'certificate': '0046505115101',
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -38,9 +38,7 @@
|
||||
"access_survey_response_answer","survey.response.answer","model_survey_response_answer","base.group_hr_manager",1,1,1,1
|
||||
"access_survey_res_users","res.users","base.model_res_users","base.group_hr_manager",1,1,1,1
|
||||
"access_survey_request","survey.request","model_survey_request","base.group_hr_manager",1,1,1,1
|
||||
"access_survey_name_wiz_user","survey.name.wiz.user","model_survey_name_wiz","base.group_survey_user",1,1,1,0
|
||||
"access_survey_history_survey_manager","survey.history manager","model_survey_history","base.group_survey_manager",1,0,0,0
|
||||
"access_survey_name_wiz_system","survey.name.wiz.system","model_survey_name_wiz","base.group_system",1,0,0,0
|
||||
"access_survey_type_system","survey.type system","model_survey_type","base.group_system",1,0,0,0
|
||||
"access_survey_question_system","survey.question system","model_survey_question","base.group_system",1,0,0,0
|
||||
"access_survey_history_system","survey.history.system","model_survey_history","base.group_system",1,0,0,0
|
||||
|
||||
|
Reference in New Issue
Block a user