[FIX]  Sales report

bzr revid: nel@tinyerp.com-20100602122855-uhp1n4n5jd7p3mhd
This commit is contained in:
nel@tinyerp.com 2010-06-02 14:28:55 +02:00
commit e4dde6638e
114 changed files with 2620 additions and 2017 deletions

View File

@ -530,9 +530,8 @@ class account_move_line(osv.osv):
date = datetime.now().strftime('%Y-%m-%d')
part = self.pool.get('res.partner').browse(cr, uid, partner_id)
if part.property_payment_term and part.property_payment_term.line_ids:
payterm = part.property_payment_term.line_ids[0]
res = self.pool.get('account.payment.term').compute(cr, uid, payterm.id, 100, date)
if part.property_payment_term:
res = self.pool.get('account.payment.term').compute(cr, uid, part.property_payment_term.id, 100, date)
if res:
val['date_maturity'] = res[0][0]
if not account_id:
@ -540,10 +539,10 @@ class account_move_line(osv.osv):
id2 = part.property_account_receivable.id
if journal:
jt = self.pool.get('account.journal').browse(cr, uid, journal).type
if jt=='sale':
if jt == 'sale':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id2)
elif jt=='purchase':
elif jt == 'purchase':
val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id1)
if val.get('account_id', False):
d = self.onchange_account_id(cr, uid, ids, val['account_id'])

View File

@ -951,23 +951,8 @@ class account_invoice(osv.osv):
return taxes.values()
def _log_event(self, cr, uid, ids, factor=1.0, name='Open Invoice'):
invs = self.read(cr, uid, ids, ['type','partner_id','amount_untaxed'])
for inv in invs:
part=inv['partner_id'] and inv['partner_id'][0]
pc = pr = 0.0
cr.execute('select sum(quantity*price_unit) from account_invoice_line where invoice_id=%s', (inv['id'],))
total = inv['amount_untaxed']
if inv['type'] in ('in_invoice','in_refund'):
partnertype='supplier'
eventtype = 'purchase'
pc = total*factor
else:
partnertype = 'customer'
eventtype = 'sale'
pr = total*factor
if self.pool.get('res.partner.event.type').check(cr, uid, 'invoice_open'):
self.pool.get('res.partner.event').create(cr, uid, {'name':'Invoice: '+name, 'som':False, 'description':name+' '+str(inv['id']), 'document':name, 'partner_id':part, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'canal_id':False, 'user_id':uid, 'partner_type':partnertype, 'probability':1.0, 'planned_revenue':pr, 'planned_cost':pc, 'type':eventtype})
return len(invs)
#TODO: implement messages system
return True
def name_get(self, cr, uid, ids, context=None):
if not len(ids):

View File

@ -74,13 +74,13 @@
<page string="Accounting" position="inside">
<group col="2" colspan="2">
<separator string="Customer Accounting Properties" colspan="2"/>
<field name="property_account_receivable" />
<field name="property_account_receivable" groups="account.group_account_user" />
<field name="property_account_position" widget="selection"/>
<field name="property_payment_term" widget="selection"/>
</group>
<group col="2" colspan="2">
<separator string="Supplier Accounting Properties" colspan="2"/>
<field name="property_account_payable"/>
<field name="property_account_payable" groups="account.group_account_user"/>
</group>
<group col="2" colspan="2">
<separator string="Customer Credit" colspan="2"/>
@ -132,11 +132,13 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="Project">
<field name="contract_ids" colspan="4" nolabel="1" />
</page>
</notebook>
<xpath expr="//notebook[last()]" position="after">
<notebook colspan="4">
<page string="Project">
<field name="contract_ids" colspan="4" nolabel="1" />
</page>
</notebook>
</xpath>
</field>
</record>

View File

@ -36,10 +36,12 @@ class account_invoice_report(osv.osv):
('10','October'), ('11','November'), ('12','December')], 'Month',readonly=True),
'product_id':fields.many2one('product.product', 'Product', readonly=True),
'product_qty':fields.float('Qty', readonly=True),
'uom_name': fields.char('Default UoM', size=128, readonly=True),
'payment_term': fields.many2one('account.payment.term', 'Payment Term',readonly=True),
'period_id': fields.many2one('account.period', 'Force Period', domain=[('state','<>','done')],readonly=True),
'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position',readonly=True),
'currency_id': fields.many2one('res.currency', 'Currency', readonly=True),
'categ_id': fields.many2one('product.category','Category of Product', readonly=True),
'journal_id': fields.many2one('account.journal', 'Journal',readonly=True),
'partner_id':fields.many2one('res.partner', 'Partner', readonly=True),
'company_id':fields.many2one('res.company', 'Company', readonly=True),
@ -81,46 +83,64 @@ class account_invoice_report(osv.osv):
to_char(s.date_invoice, 'MM') as month,
to_char(s.date_invoice, 'YYYY-MM-DD') as day,
l.product_id as product_id,
sum(l.quantity * u.factor) as product_qty,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity * u.factor * -1
else
l.quantity * u.factor
end) as product_qty,
s.partner_id as partner_id,
s.payment_term as payment_term,
s.period_id as period_id,
u.name as uom_name,
s.currency_id as currency_id,
s.journal_id as journal_id,
s.fiscal_position as fiscal_position,
s.user_id as user_id,
s.company_id as company_id,
sum(l.quantity*l.price_unit) as price_total,
(sum(l.quantity*l.price_unit)/sum(l.quantity * u.factor))::decimal(16,2) as price_average,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity*l.price_unit * -1
else
l.quantity*l.price_unit
end) as price_total,
sum(case when s.type in ('out_refund','in_invoice') then
l.quantity*l.price_unit * -1
else
l.quantity*l.price_unit
end) / sum(l.quantity * u.factor)::decimal(16,2) as price_average,
count(*) as nbr,
s.type as type,
s.state,
pt.categ_id,
s.date_due as date_due,
s.address_contact_id as address_contact_id,
s.address_invoice_id as address_invoice_id,
s.account_id as account_id,
s.partner_bank as partner_bank,
s.residual as residual,
sum(case when s.type in ('out_refund','in_invoice') then
s.residual * -1
else
s.residual
end) as residual,
case when s.state != 'paid' then null else
extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
extract(epoch from avg(am.date_created-l.create_date))/(24*60*60)::decimal(16,2)
end as delay_to_pay
from
account_invoice_line l
left join
account_invoice s on (s.id=l.invoice_id)
left join product_uom u on (u.id=l.uos_id),
from account_invoice_line l
left join account_invoice s on (s.id=l.invoice_id)
left join product_template pt on (pt.id=l.product_id)
left join product_uom u on (u.id=l.uos_id),
account_move_line am left join account_invoice i on (i.move_id=am.move_id)
where
am.account_id=i.account_id
where am.account_id=i.account_id
group by
s.type,
s.date_invoice,
s.partner_id,
l.product_id,
u.name,
l.uos_id,
s.user_id,
s.state,
s.residual,
pt.categ_id,
s.company_id,
s.payment_term,
s.period_id,

View File

@ -16,8 +16,10 @@
<field name="company_id" invisible="1"/>
<field name="partner_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_qty" invisible="1"/>
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
<field name="categ_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_qty"/>
<field name="price_average" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="state" invisible="1"/>
@ -97,16 +99,17 @@
<group expand="1" string="Group By...">
<filter string="Salesman" name='User' icon="terp-account" context="{'group_by':'user_id'}"/>
<filter string="Partner" icon="terp-account" context="{'group_by':'partner_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id'}"/>
<filter string="Product" icon="terp-account" context="{'group_by':'product_id','set_visible':True}"/>
<separator orientation="vertical"/>
<filter string="Company" icon="terp-account" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
<filter string="State" icon="terp-account" context="{'group_by':'state'}"/>
<filter string="Type" icon="terp-account" context="{'group_by':'type'}"/>
<separator orientation="vertical"/>
<filter string="Default UoM" icon="terp-account" context="{'group_by':'uom_name'}"/>
<filter string="Journal" icon="terp-account" context="{'group_by':'journal_id'}"/>
<filter string="Account" icon="terp-account" context="{'group_by':'account_id'}"/>
<filter string="Bank Account" icon="terp-account" context="{'group_by':'partner_bank'}"/>
<separator orientation="vertical"/>
<filter string="Category of Product" icon="terp-account" context="{'group_by':'categ_id'}"/>
<filter string="Currency" icon="terp-account" context="{'group_by':'currency_id'}"/>
<filter string="Force Period" icon="terp-account" context="{'group_by':'period_id'}"/>
<newline/>

View File

@ -56,15 +56,15 @@
<field name="server_action_id"/>
<field name="filter_id"/>
</page>
<page string="E-Mail Actions">
<page string="Email Actions">
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="Template of Email to Send"/>
<separator colspan="4" string="Email Information"/>
<field name="act_mail_to_watchers"/>
<field name="act_mail_to_user"/>
<field colspan="4" name="act_mail_to_email"/>
<!-- </group>-->
<!-- <group col="4" colspan="2">-->
<separator colspan="4" string="E-Mail Reminders (includes the content of the object)"/>
<separator colspan="4" string="Email Reminders"/>
<field name="act_remind_partner"/>
<field name="act_remind_attach"/>
<field name="act_remind_user"/>
@ -73,7 +73,7 @@
</group>
<field colspan="4" name="act_email_cc"/>
<!-- </group>-->
<separator colspan="4" string="Mail Body"/>
<separator colspan="4" string="Email Body"/>
<field colspan="4" name="act_mail_body" height="250"
nolabel="1" attrs="{'required':[('act_remind_user','=',True)]}" />
<separator colspan="4" string="Special Keywords to Be Used in The Body"/>
@ -82,9 +82,9 @@
<label align="0.0" string="%%(object_description)s = Object description" colspan="2"/>
<label align="0.0" string="%%(object_date)s = Creation date" colspan="2"/>
<label align="0.0" string="%%(partner)s = Partner name" colspan="2"/>
<label align="0.0" string="%%(partner_email)s = Partner email" colspan="2"/>
<label align="0.0" string="%%(partner_email)s = Partner Email" colspan="2"/>
<label align="0.0" string="%%(object_user)s = Responsible name" colspan="2"/>
<label align="0.0" string="%%(object_user_email)s = Responsible email" colspan="2"/>
<label align="0.0" string="%%(object_user_email)s = Responsible Email" colspan="2"/>
<label align="0.0" string="%%(object_user_phone)s = Responsible phone" colspan="2"/>
</page>
</notebook>

View File

@ -410,7 +410,10 @@ property or property parameter."),
event.add('location').value = event_obj.location
if event_obj.rrule:
event.add('rrule').value = event_obj.rrule
if event_obj.user_id:
event_org = event.add('organizer')
event_org.params['CN'] = [event_obj.user_id.name]
event_org.value = 'MAILTO:' + (event_obj.user_id.user_email or event_obj.user_id.name)
if event_obj.alarm_id:
# computes alarm data
valarm = event.add('valarm')
@ -440,7 +443,7 @@ property or property parameter."),
attendee_add.params['CUTYPE'] = [str(attendee.cutype)]
attendee_add.params['ROLE'] = [str(attendee.role)]
attendee_add.params['RSVP'] = [str(attendee.rsvp)]
attendee_add.value = 'MAILTO:' + attendee.email
attendee_add.value = 'MAILTO:' + (attendee.email or '')
res = cal.serialize()
return res
@ -480,8 +483,8 @@ property or property parameter."),
'company': company
}
body = html_invitation % body_vals
attach = self.get_ics_file(cr, uid, res_obj, context=context)
if mail_to and email_from:
attach = self.get_ics_file(cr, uid, res_obj, context=context)
tools.email_send(
email_from,
mail_to,

View File

@ -10,3 +10,4 @@
"access_calendar_event_export","calendar.event.export","model_calendar_event_export","base.group_user",1,1,1,1
"access_calendar_event_import","calendar.event.import","model_calendar_event_import","base.group_user",1,1,1,1
"access_calendar_event_subscribe","calendar.event.subscribe","model_calendar_event_subscribe","base.group_user",1,1,1,1
"access_basic_calendar","basic.calendar","model_basic_calendar","base.group_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
10 access_calendar_event_export calendar.event.export model_calendar_event_export base.group_user 1 1 1 1
11 access_calendar_event_import calendar.event.import model_calendar_event_import base.group_user 1 1 1 1
12 access_calendar_event_subscribe calendar.event.subscribe model_calendar_event_subscribe base.group_user 1 1 1 1
13 access_basic_calendar basic.calendar model_basic_calendar base.group_user 1 1 1 1

View File

@ -108,13 +108,13 @@ between mails and Open ERP.""",
'crm_phonecall_demo.xml'
],
'test': [
# 'test/test_crm_lead.yml',
# 'test/test_crm_meeting.yml',
# 'test/test_crm_opportunity.yml',
# 'test/test_crm_phonecall.yml',
],
'installable': True,
'active': False,
'test/test_crm_lead.yml',
'test/test_crm_meeting.yml',
'test/test_crm_opportunity.yml',
'test/test_crm_phonecall.yml',
],
'installable': True,
'active': False,
'certificate': '0079056041421',
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -203,9 +203,13 @@ class crm_case(object):
address = self.pool.get('res.partner.address').browse(cr, uid, add)
return {'value': {'email_from': address.email}}
def _history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
def _history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
mailgate_pool = self.pool.get('mailgate.thread')
return mailgate_pool._history(cr, uid, cases, keyword, history=history, email=email, details=details, email_from=email_from, message_id=message_id, context=context)
return mailgate_pool._history(cr, uid, cases, keyword, history=history,\
subject=subject, email=email, \
details=details, email_from=email_from,\
message_id=message_id, attach=attach, \
context=context)
def case_open(self, cr, uid, ids, *args):
"""Opens Case
@ -438,6 +442,7 @@ class crm_case_section(osv.osv):
'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Teams'),
'resource_calendar_id': fields.many2one('resource.calendar', "Resource's Calendar"),
'note': fields.text('Description'),
'working_hours': fields.float('Working Hours', digits=(16,2 )),
}
_defaults = {

View File

@ -82,23 +82,9 @@ this if you want the rule to send an email to the partner."),
if hasattr(obj, 'categ_id'):
ok = ok and (not action.trg_categ_id or action.trg_categ_id.id==obj.categ_id.id)
# TODO: history_line is removed
# if hasattr(obj, 'history_line'):
# ok = ok and (not action.trg_max_history or action.trg_max_history<=(len(obj.history_line)+1))
# reg_history = action.regex_history
# result_history = True
# if reg_history:
# ptrn = re.compile(str(reg_history))
# if obj.history_line:
# _result = ptrn.search(str(obj.history_line[0].description))
# if not _result:
# result_history = False
regex_h = not reg_history or result_history
ok = ok and regex_h
return ok
def do_action(self, cr, uid, action, model_obj, obj, context={}):
""" @param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@ -118,7 +104,7 @@ this if you want the rule to send an email to the partner."),
write['email_cc'] = obj.email_cc+','+obj.act_email_cc
else:
write['email_cc'] = obj.act_email_cc
model_obj.write(cr, uid, [obj.id], write, context)
emails = []

View File

@ -1,59 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="event_type_case_create" model="res.partner.event.type">
<field name="name">CRM: Create Case</field>
<field name="key">crm_case_draft</field>
</record>
<record id="event_type_case_open" model="res.partner.event.type">
<field name="name">CRM: Open Case</field>
<field name="key">crm_case_open</field>
</record>
<record id="event_type_case_pending" model="res.partner.event.type">
<field name="name">CRM: Pending Case</field>
<field name="key">crm_case_pending</field>
</record>
<record id="event_type_case_cancel" model="res.partner.event.type">
<field name="name">CRM: Cancel Case</field>
<field name="key">crm_case_cancel</field>
</record>
<record id="event_type_case_close" model="res.partner.event.type">
<field name="name">CRM: Close Case</field>
<field name="key">crm_case_done</field>
</record>
</data>
<data noupdate="1">
<record model="crm.case.section" id="section_sales_department">
<field name="name">Sales Department</field>
<field name="code">Sales</field>
</record>
<record id="event_type_case_create" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="event_type_case_open" model="res.partner.event.type">
<field eval="True" name="active"/>
</record>
<record id="event_type_case_pending" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="event_type_case_close" model="res.partner.event.type">
<field eval="True" name="active"/>
</record>
<record id="event_type_case_cancel" model="res.partner.event.type">
<field eval="False" name="active"/>
</record>
<record id="ir_cron_crm_action" model="ir.cron">
<field name="name">Check cases rules</field>

View File

@ -39,7 +39,8 @@ class crm_installer(osv.osv_memory):
'crm_caldav': fields.boolean('Calendar Synchronizing', help="Help you to synchronize the meetings with other calender clients(e.g.: Sunbird)."),
'sale_crm': fields.boolean('Create Quotation from Opportunity', help="This module relates sale to opportunity cases in the CRM."),
'fetchmail': fields.boolean('Fetch Emails', help="Fetchmail Server."),
'thunderbird': fields.boolean('Thunderbird', help="Thunderbird Interface."),
'thunderbird': fields.boolean('Thunderbird', help="Thunderbird Interface."),
'wiki_sale_faq': fields.boolean('Sale FAQ', help="Sale FAQ."),
}
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):

View File

@ -35,7 +35,8 @@
<field name="crm_claim" />
<field name="crm_helpdesk" />
<field name="crm_fundraising" />
<field name="sale_crm" invisible="1"/>
<field name="wiki_sale_faq"/>
<field name="sale_crm" invisible="1"/>
</group>
</group>
</data>

View File

@ -108,8 +108,8 @@ class crm_lead(osv.osv, crm_case):
'email_cc': fields.text('Watchers Emails', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'description': fields.text('Description'),
'write_date': fields.datetime('Update Date' , readonly=True),
'description': fields.text('Notes'),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
@ -137,7 +137,6 @@ and users by email"),
method=True, multi='day_open', type="float", store=True),
'day_close': fields.function(_compute_day, string='Days to Close', \
method=True, multi='day_close', type="float", store=True),
'function_name': fields.char('Function', size=64),
'state': fields.selection(crm.AVAILABLE_STATES, 'State', size=16, readonly=True,
help='The state is set to \'Draft\', when a case is created.\
\nIf the case is in progress the state is set to \'Open\'.\

View File

@ -47,7 +47,7 @@
name="convert_opportunity"
string="Convert"
help="Convert to Opportunity"
icon="gtk-index"
icon="gtk-index"
type="object"/>
<newline />
<field name="section_id" colspan="1"
@ -71,7 +71,7 @@
<field name="partner_name" string="Partner Name" colspan="4"/>
<newline/>
<field domain="[('domain', '=', 'contact')]" name="title"/>
<field name="function_name" />
<field name="function" />
<field name="street" colspan="4"/>
<field name="street2" colspan="4"/>
<field name="zip"/>
@ -160,16 +160,21 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="name" />
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
@ -177,7 +182,7 @@
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"

View File

@ -1,23 +1,23 @@
<?xml version="1.0"?>
<openerp>
<data>
<data>
<!-- Opportunity Categories Form View -->
<!-- Opportunity Categories Form View -->
<record id="crm_opportunity_categ_action" model="ir.actions.act_window">
<field name="name">Opportunity Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<record id="crm_opportunity_categ_action" model="ir.actions.act_window">
<field name="name">Opportunity Categories</field>
<field name="res_model">crm.case.categ</field>
<field name="view_type">form</field>
<field name="view_id" ref="crm.crm_case_categ_tree-view"/>
<field name="domain">[('object_id.model', '=', 'crm.lead')]</field>
<field name="context">{'object_id':'crm.lead'}</field>
</record>
<menuitem action="crm_opportunity_categ_action"
id="menu_crm_case_opportunity-act"
parent="crm.menu_crm_case_categ" />
<menuitem action="crm_opportunity_categ_action"
id="menu_crm_case_opportunity-act"
parent="crm.menu_crm_case_categ" />
<!-- Opportunity Stages Form View-->
<!-- Opportunity Stages Form View-->
<record id="crm_opportunity_stage_act" model="ir.actions.act_window">
<field name="name">Opportunity Stages</field>
@ -47,285 +47,304 @@
id="menu_crm_opportunity_resource_act"
parent="crm.menu_crm_case_resource_type" />
<!-- Opportunities Form View -->
<!-- Opportunities Form View -->
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunities</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Opportunities">
<group colspan="4" col="7">
<field name="name" required="1" string="Opportunity"/>
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
<button name="stage_previous"
<record model="ir.ui.view" id="crm_case_form_view_oppor">
<field name="name">Opportunities</field>
<field name="model">crm.lead</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Opportunities">
<group colspan="4" col="7">
<field name="name" required="1" string="Opportunity"/>
<label string="Stage:" align="1.0"/>
<group colspan="1" col="4">
<field name="stage_id" nolabel="1"
on_change="onchange_stage_id(stage_id)"
widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
<button name="stage_previous"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
<button name="stage_next" states="open,pending"
type="object" icon="gtk-go-forward" string="" />
</group>
<field name="user_id"/>
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" icon="gtk-redo" />
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
<button string="Schedule Call"
name="%(opportunity2phonecall_act)d" icon="gtk-redo" type="action" />
<newline/>
<field name="date_action"/>
<field name="priority" string="Priority"/>
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
colspan="2" />
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization"/>
<field name="section_id" colspan="1" widget="selection"/>
<field name="categ_id" select="1" groups="base.group_extended"
string="Category" widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
</group>
<separator colspan="4" string="Details"/>
<field name="description" nolabel="1" colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_cancel" string="Mark Lost"
states="draft,open,pending" type="object"
icon="gtk-close" />
<button name="case_close" string="Mark Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_reset" string="Reset to New"
states="done,cancel" type="object"
icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead', 'include_original' : True}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
<field name="write_date"/>
<field name="date_closed"/>
<field name="date_open"/>
</group>
<group col="2" colspan="2">
<separator string="Misc" colspan="2"/>
<field name="active"/>
<field name="day_open"/>
<field name="day_close"/>
<field name="referred"/>
</group>
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
</field>
</record>
<!-- Opportunities Tree View -->
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
<field name="name">Opportunities Tree</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done');red:date_deadline &lt; current_date">
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="stage_id"/>
<field name="categ_id" invisible="1" groups="base.group_extended"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-back" string="" />
<button name="stage_next" states="open,pending"
type="object" icon="gtk-go-forward" string="" />
</group>
<field name="user_id"/>
<button name="action_makeMeeting" type="object"
string="Schedule Meeting" icon="gtk-redo" />
<field name="planned_revenue"/>
<field name="probability"/>
<field name="date_deadline" string="Expected Closing"/>
<button string="Schedule Call"
name="%(opportunity2phonecall_act)d" icon="gtk-redo" type="action" />
<newline/>
<field name="date_action"/>
<field name="priority" string="Priority"/>
</group>
<notebook colspan="4">
<page string="Opportunity">
<group col="4" colspan="2">
<separator colspan="4" string="Contacts"/>
<field name="partner_id" select="1"
on_change="onchange_partner_id(partner_id, email_from)"
colspan="2" />
<field name="partner_address_id"
string="Contact"
on_change="onchange_partner_address_id(partner_address_id, email_from)"
colspan="1" />
<field name="email_from" string="Email" />
<field name="phone"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Categorization"/>
<field name="section_id" colspan="1" widget="selection"/>
<field name="categ_id" select="1" groups="base.group_extended"
string="Category" widget="selection"
domain="[('object_id.model', '=', 'crm.lead')]" />
</group>
<separator colspan="4" string="Details"/>
<field name="description" nolabel="1" colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
icon="gtk-go-forward" />
<field name="planned_revenue" sum="Total of Planned Revenue"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="date_action"/>
<field name="section_id" groups="base.group_extended"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_pending" string="Pending"
states="draft,open" type="object"
icon="gtk-media-pause" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
groups="base.group_extended"
icon="gtk-go-up" />
<button name="case_cancel" string="Mark Lost"
states="draft,open,pending" type="object"
icon="gtk-close" />
<button name="case_close" string="Mark Won"
<button name="case_close" string="Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_reset" string="Reset to New"
states="done,cancel" type="object"
icon="gtk-convert" />
</group>
</page>
<page string="Emails" groups="base.group_extended">
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<button colspan="2" string="Send New Email"
name="%(action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.lead'}"
icon="gtk-go-forward" type="action" />
<button colspan="2" string="Forward to Partner"
name="%(crm_lead_forward_to_partner_act)d"
icon="gtk-go-forward" type="action" />
</page>
<page string="History" groups="base.group_extended">
<group col="2" colspan="2">
<separator string="Dates" colspan="2"/>
<field name="create_date"/>
<field name="write_date"/>
<field name="date_closed"/>
<field name="date_open"/>
</group>
<group col="2" colspan="2">
<separator string="Misc" colspan="2"/>
<field name="active"/>
<field name="day_open"/>
<field name="day_close"/>
<field name="referred"/>
</group>
<separator colspan="4" string="References"/>
<field name="ref"/>
<field name="ref2"/>
<field name="log_ids" nolabel="1" colspan="4">
<tree string="Logs">
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</tree>
<form string="Logs">
<separator string="Action Information" colspan="4"/>
<field name="name" colspan="4"/>
<field name="date"/>
<field name="user_id"/>
</form>
</field>
</page>
</notebook>
</form>
</field>
</record>
<!-- Opportunities Tree View -->
<record model="ir.ui.view" id="crm_case_tree_view_oppor">
<field name="name">Opportunities Tree</field>
<field name="model">crm.lead</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done');red:date_deadline &lt; current_date">
<field name="date_deadline" invisible="1"/>
<field name="create_date"/>
<field name="name" string="Opportunity"/>
<field name="partner_id"/>
<field name="stage_id"/>
<field name="categ_id" invisible="1" groups="base.group_extended"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="planned_revenue" sum="Total of Planned Revenue"/>
<field name="probability" widget="progressbar" avg="Avg. of Probability"/>
<field name="date_action"/>
<field name="section_id" groups="base.group_extended"/>
<field name="user_id"/>
<field name="priority"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Won"
states="open,draft,pending" type="object"
icon="gtk-apply" />
<button name="case_pending" string="Pending"
states="open,draft" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Lost"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
<!-- Opportunities Search View -->
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">CRM - Opportunities Search</field>
<field name="model">crm.lead</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<filter icon="terp-project"
string="Current"
name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-project"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<filter icon="gtk-home" string="Today"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
help="Todays' Opportunities" />
<filter icon="gtk-media-rewind" string="7 Days"
help="Opportunities during last 7 days"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')),\
('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner"
domain="[('user_id','=',uid)]"
help="My Opportunities" default="1"/>
<filter icon="terp-partner"
domain="[('user_id','=', uid)]"
help="Unassigned Opportunities"/>
<button name="case_pending" string="Pending"
states="open,draft" type="object"
icon="gtk-media-pause" />
<button name="case_cancel" string="Lost"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
<field name="section_id"
default="context.get('section_id', False)" select="1"
widget="selection">
<filter icon="terp-crm"
domain="[('section_id','=',context.get('section_id',False))]"
help="My Sale Team" />
</field>
<newline/>
<group expand="1" string="Group By...">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}"/>
<filter string="Priority" icon="terp-crm" domain="[]"
context="{'group_by':'priority'}"/>
<filter string="Category" icon="terp-crm"
domain="[]" context="{'group_by':'categ_id'}"/>
</record>
<separator orientation="vertical"/>
<filter string="Salesman" icon="terp-crm"
domain="[('user_id','=',uid)]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Creation" icon="terp-project"
domain="[]" context="{'group_by':'create_date'}"/>
<filter string="Exp.Closing" icon="terp-project"
domain="[]" context="{'group_by':'date_deadline'}"/>
</group>
</search>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
<!-- Opportunities Search View -->
<record id="view_crm_case_opportunities_filter" model="ir.ui.view">
<field name="name">CRM - Opportunities Search</field>
<field name="model">crm.lead</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Opportunities">
<filter icon="terp-project"
string="Current"
name="current"
domain="[('state','in',('draft','open'))]"/>
<filter icon="terp-project"
string="Open"
domain="[('state','=','open')]"/>
<filter icon="terp-project"
string="Pending"
domain="[('state','=','pending')]"/>
<separator orientation="vertical"/>
<filter icon="gtk-home" string="Today"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d 23:59:59')), ('create_date','&gt;=', time.strftime('%%Y-%%m-%%d 23:59:59'))]"
help="Todays' Opportunities" />
<filter icon="gtk-media-rewind" string="7 Days"
help="Opportunities during last 7 days"
domain="[('create_date','&lt;', time.strftime('%%Y-%%m-%%d')),\
('create_date','&gt;=',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="name" string="Opportunity"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner"
domain="[('user_id','=', False)]"
help="Unassigned Opportunities" />
</field>
<field name="section_id"
default="context.get('section_id', False)" select="1"
widget="selection">
<filter icon="terp-crm"
domain="[('section_id','=',context.get('section_id',False))]"
help="My Sale Team" />
</field>
<newline/>
<group expand="0" string="Group By..." colspan="16">
<filter string="Stage" icon="terp-crm" domain="[]"
context="{'group_by':'stage_id'}" />
<filter string="Priority" icon="terp-crm" domain="[]"
context="{'group_by':'priority'}" />
<filter string="Category" icon="terp-crm"
domain="[]" context="{'group_by':'categ_id'}" />
<separator orientation="vertical" />
<filter string="Salesman" icon="terp-crm"
domain="[('user_id','=',uid)]" context="{'group_by':'user_id'}" />
<separator orientation="vertical" />
<filter string="Creation" icon="terp-project"
domain="[]" context="{'group_by':'create_date'}" />
<filter string="Exp.Closing" icon="terp-project"
domain="[]" context="{'group_by':'date_deadline'}" />
</group>
</search>
</field>
</record>
<!-- Opportunities Graph View -->
<record model="ir.ui.view" id="crm_case_graph_view_opportunity">
<field name="name">CRM - Opportunity Graph</field>
<field name="model">crm.lead</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Opportunity by Categories" type="bar" orientation="horizontal">
<field name="categ_id"/>
<field name="planned_revenue" operator="+"/>
<field name="state" group="True"/>
</graph>
</field>
</record>
</data>
</openerp>

View File

@ -38,6 +38,9 @@ class crm_phonecall(osv.osv, crm_case):
'name': fields.char('Name', size=64),
'active': fields.boolean('Active', required=False),
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'date_action_last': fields.datetime('Last Action', readonly=1),
'date_action_next': fields.datetime('Next Action', readonly=1),
'create_date': fields.datetime('Creation Date' , readonly=True),
'section_id': fields.many2one('crm.case.section', 'Sales Team', \
select=True, help='Sales team to which Case belongs to.\
Define Responsible user and Email account for mail gateway.'),

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-01-05 05:59+0000\n"
"PO-Revision-Date: 2010-05-17 23:03+0000\n"
"Last-Translator: Carlos Incaser <Unknown>\n"
"PO-Revision-Date: 2010-05-31 22:24+0000\n"
"Last-Translator: victor tejada yau <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-19 05:11+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: crm
@ -951,6 +951,8 @@ msgid ""
"Category related to the section.Subdivide the CRM cases independently or "
"section-wise."
msgstr ""
"Categoria relacionada a la seccion. subdividido independientemente los casos "
"CRM o modo-seccion"
#. module: crm
#: field:crm.case.rule,act_state:0
@ -1340,7 +1342,7 @@ msgstr "Calcular la segmentación"
#. module: crm
#: view:crm.lead:0
msgid "Lead Email"
msgstr ""
msgstr "Dirigir correo electronico"
#. module: crm
#: model:ir.actions.act_window,name:crm.crm_segmentation-act
@ -1563,6 +1565,8 @@ msgid ""
"Helps you to organise the jobs hiring process: evaluation, meetings, email "
"integration..."
msgstr ""
"Te ayuda a organizar los procesos para emplear trabajos: evaluacion, "
"reunion, integracion de correo electronico"
#. module: crm
#: view:crm.fundraising:0
@ -1619,7 +1623,7 @@ msgstr "Convertido"
#: view:crm.lead:0
#: view:crm.opportunity:0
msgid "Reply to Last Email"
msgstr ""
msgstr "Responder el ultimo correo electronico"
#. module: crm
#: view:crm.segmentation:0
@ -1629,7 +1633,7 @@ msgstr "Descripción de segmentación"
#. module: crm
#: help:crm.meeting,location:0
msgid "Gives Location of Meeting"
msgstr ""
msgstr "Dando la ubicacion de la reunion"
#. module: crm
#: view:crm.case:0
@ -1644,7 +1648,7 @@ msgstr "Historial"
#. module: crm
#: model:ir.model,name:crm.model_crm_job
msgid "Job Cases"
msgstr ""
msgstr "casos de trabajos"
#. module: crm
#: view:crm.job:0
@ -1654,7 +1658,7 @@ msgstr "Trabajos - selección de personal"
#. module: crm
#: field:crm.case.rule,regex_name:0
msgid "Regular Expression on Case Name"
msgstr ""
msgstr "Expresion regular en nombre de caso"
#. module: crm
#: field:crm.case,state:0
@ -1719,7 +1723,7 @@ msgstr "¡No se ha encontrado Email en la dirección de su compañía!"
#. module: crm
#: view:crm.fundraising:0
msgid "Search Funds"
msgstr ""
msgstr "buscar fondos"
#. module: crm
#: view:crm.claim:0
@ -1729,7 +1733,7 @@ msgstr "Tipo de reclamación"
#. module: crm
#: view:crm.case:0
msgid "Helpdesk Support Tree"
msgstr ""
msgstr "Arbol de soporte tecnico"
#. module: crm
#: view:res.partner.events:0
@ -1760,12 +1764,14 @@ msgstr "Referencia"
#. module: crm
#: field:crm.meeting,exrule:0
msgid "Exception Rule"
msgstr ""
msgstr "Exception de regla"
#. module: crm
#: help:crm.case.rule,act_mail_to_partner:0
msgid "Check this if you want the rule to send an email to the partner."
msgstr ""
"Verifica esto si tu quieres enviar la norma en un correo electronico a el "
"socio"
#. module: crm
#: model:crm.case.category2,name:crm.category_lead2
@ -1810,7 +1816,7 @@ msgstr "Importe de venta"
#: view:crm.lead:0
#: view:crm.opportunity:0
msgid "Add a CC"
msgstr ""
msgstr "Agregar un CC"
#. module: crm
#: selection:crm.segmentation.line,expr_operator:0
@ -1838,7 +1844,7 @@ msgstr "Alarma"
#. module: crm
#: field:crm.case.rule,act_mail_to_watchers:0
msgid "Mail to watchers (CC)"
msgstr ""
msgstr "correo a los observadores (CC)"
#. module: crm
#: view:crm.fundraising:0
@ -1903,7 +1909,7 @@ msgstr ""
#. module: crm
#: model:ir.actions.wizard,name:crm.wizard_crm_set_rrule
msgid "Set RRULE"
msgstr ""
msgstr "Establecer RRULE"
#. module: crm
#: model:crm.case.stage,name:crm.stage_oppor4
@ -1981,7 +1987,7 @@ msgstr ""
#: code:addons/crm/crm.py:0
#, python-format
msgid "Email Fail!"
msgstr ""
msgstr "Correo electronico fallo"
#. module: crm
#: model:crm.case.categ,name:crm.categ_phone1

View File

@ -35,7 +35,7 @@ class crm_lead_report(osv.osv):
_name = "crm.lead.report"
_auto = False
_description = "CRM Lead Report"
def _get_data(self, cr, uid, ids, field_name, arg, context={}):
""" @param cr: the current row, from the database cursor,
@ -89,7 +89,10 @@ class crm_lead_report(osv.osv):
('11', 'November'), ('12', 'December')], 'Month', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'create_date': fields.datetime('Create Date', readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'day': fields.char('Day', size=128, readonly=True),
'email': fields.integer('# of Emails', size=128, readonly=True),
'expected_closing_days': fields.integer('# of Expected Closing Days', size=128, readonly=True),
'delay_open': fields.float('Delay to open',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to open the case"),
'delay_close': fields.float('Delay to close',digits=(16,2),readonly=True, group_operator="avg",help="Number of Days to close the case"),
'categ_id': fields.many2one('crm.case.categ', 'Category',\
domain="[('section_id','=',section_id),\
@ -98,11 +101,10 @@ class crm_lead_report(osv.osv):
domain="[('section_id','=',section_id),\
('object_id.model', '=', 'crm.lead')]", readonly=True),
'partner_id': fields.many2one('res.partner', 'Partner' , readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'company_id': fields.many2one('res.company', 'Company', readonly=True),
'type':fields.selection([
('lead','Lead'),
('opportunity','Opportunity'),
],'Type', help="Type is used to separate Leads and Opportunities"),
}
def init(self, cr):
@ -132,13 +134,28 @@ class crm_lead_report(osv.osv):
0 as avg_answers,
0.0 as perc_done,
0.0 as perc_cancel,
(select count(id) from mailgate_message where thread_id=c.id) as email,
date_trunc('day',c.create_date) as create_date,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close
sum(cast(to_char(date_trunc('day',c.date_open) - date_trunc('day',c.date_deadline),'DD') as int)) as expected_closing_days,
avg(extract('epoch' from (c.date_closed-c.create_date)))/(3600*24) as delay_close,
avg(extract('epoch' from (c.date_open-c.create_date)))/(3600*24) as delay_open
from
crm_lead c
group by to_char(c.create_date, 'YYYY'), to_char(c.create_date, 'MM'),\
c.state, c.user_id,c.section_id,c.stage_id,categ_id,c.partner_id,c.company_id, c.type
,c.create_date,to_char(c.create_date, 'YYYY-MM-DD')
group by
to_char(c.create_date, 'YYYY'),
to_char(c.create_date, 'MM'),
c.state,
c.user_id,
c.id,
c.section_id,
c.stage_id,
categ_id,
c.partner_id,
c.company_id,
c.type,
c.create_date,
to_char(c.create_date, 'YYYY-MM-DD')
)""")
crm_lead_report()

View File

@ -144,7 +144,7 @@
<field name="model">crm.lead.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Opportunities">
<tree string="Opportunities Analysis">
<field name="name" invisible="1"/>
<field name="month" invisible="1"/>
<field name="section_id" invisible="1" groups="base.group_extended"/>
@ -153,7 +153,10 @@
<field name="partner_id" invisible="1"/>
<field name="day" invisible="1"/>
<field name="nbr" string="#Opportunities" sum="#Opportunities"/>
<field name="delay_close" sum='Avg Closing Delay'/>
<field name="email" sum="# of Emails"/>
<field name="expected_closing_days" sum='# of Expected Closing Days'/>
<field name="delay_open" sum='Delay to open'/>
<field name="delay_close" sum='Delay to close'/>
<field name="state" invisible="1"/>
<field name="stage_id" invisible="1"/>
<field name="categ_id" invisible="1"/>
@ -188,8 +191,8 @@
<field name="act_window_id" ref="action_report_crm_lead"/>
</record>
<record id="action_report_crm_opportunity" model="ir.actions.act_window">
<field name="name">Opportunities</field>
<record id="action_report_crm_opportunity" model="ir.actions.act_window">
<field name="name">Opportunities Analysis</field>
<field name="res_model">crm.lead.report</field>
<field name="view_type">form</field>
<field name="context">{"search_default_User":1,"search_default_This Month":1,'group_by_no_leaf':1,'group_by':[]}</field>
@ -216,7 +219,7 @@
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_lead" />
<menuitem name="Opportunities" id="menu_report_crm_opportunities_tree"
<menuitem name="Opportunities Analysis" id="menu_report_crm_opportunities_tree"
groups="base.group_extended"
parent="base.next_id_64" action="action_report_crm_opportunity" />

View File

@ -27,10 +27,12 @@ class res_partner(osv.osv):
_columns = {
'opportunity_ids': fields.one2many('crm.lead', 'partner_id',\
'Opportunities', domain=[('type', '=', 'opportunity')]),
'Opportunities', readonly=True, \
domain=[('type', '=', 'opportunity')]),
'meeting_ids': fields.one2many('crm.meeting', 'partner_id',\
'Meetings'),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id', 'Phonecalls'),
'Meetings', readonly=True),
'phonecall_ids': fields.one2many('crm.phonecall', 'partner_id',\
'Phonecalls', readonly=True),
}
res_partner()

View File

@ -10,52 +10,54 @@
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<notebook position="inside">
<page string="CRM">
<field name="meeting_ids" colspan="4" nolabel="1" />
<field name="phonecall_ids" colspan="4" nolabel="1" />
<field name="opportunity_ids" colspan="4" nolabel="1" domain="[('type', '=', 'opportunity')]">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
<field name="create_date"/>
<field name="partner_name"/>
<field name="name"/>
<field name="email_from"/>
<field name="phone"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</page>
</notebook>
<xpath expr="//notebook[last()]" position="after">
<notebook colspan="4">
<page string="CRM">
<field name="meeting_ids" colspan="4" nolabel="1" />
<field name="phonecall_ids" colspan="4" nolabel="1" />
<field name="opportunity_ids" colspan="4" nolabel="1" domain="[('type', '=', 'opportunity')]">
<tree string="Opportunities" colors="blue:state=='pending';grey:state in ('cancel', 'done')">
<field name="create_date"/>
<field name="partner_name"/>
<field name="name"/>
<field name="email_from"/>
<field name="phone"/>
<field name="categ_id" invisible="1"/>
<field name="type_id" invisible="1"/>
<field name="referred" invisible="1"/>
<field name="stage_id"/>
<button name="stage_previous" string="Previous"
states="open,pending" type="object" icon="gtk-go-back" />
<button name="stage_next" string="Next"
states="open,pending" type="object"
icon="gtk-go-forward" />
<field name="section_id"
invisible="context.get('invisible_section', True)" />
<field name="user_id" />
<field name="state" />
<button name="case_open" string="Open"
states="draft,pending" type="object"
icon="gtk-go-forward" />
<button name="case_close" string="Close"
states="open,draft,pending" type="object"
icon="gtk-close" />
<button string="Convert to Opportunity"
name="convert_opportunity"
states="draft,open,pending" icon="gtk-index"
type="object" />
<button name="case_escalate" string="Escalate"
states="open,draft,pending" type="object"
icon="gtk-go-up" />
<button name="case_cancel" string="Cancel"
states="draft,open,pending" type="object"
icon="gtk-cancel" />
</tree>
</field>
</page>
</notebook>
</xpath>
</field>
</record>

View File

@ -117,7 +117,7 @@ class Contact
"email_from" => new xmlrpcval($post['email'], "string"),
"phone" => new xmlrpcval($post['phone'], "string"),
"partner_name" => new xmlrpcval($post['name'], "string"),
"function_name" => new xmlrpcval($post["jobtitle"], "string"),
"function" => new xmlrpcval($post["jobtitle"], "string"),
"zip" => new xmlrpcval($post['zip'], "string"),
"stage_id" => new xmlrpcval(6, "int"),
"city" => new xmlrpcval($post['city'], "string"),

View File

@ -26,3 +26,4 @@
"access_crm_lead2opportunity_partner","crm.lead2opportunity.partner","model_crm_lead2opportunity_partner","crm.group_crm_user",1,1,1,1
"access_crm_installer","crm.installer.rule","model_crm_installer","crm.group_crm_user",1,1,1,1
"access_crm_lead_forward_to_partner","crm.lead.forward.to.partner","model_crm_lead_forward_to_partner","crm.group_crm_user",2,2,2,2
"access_mailgate_thread","mailgate.thread","model_mailgate_thread","crm.group_crm_user",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
26 access_crm_lead2opportunity_partner crm.lead2opportunity.partner model_crm_lead2opportunity_partner crm.group_crm_user 1 1 1 1
27 access_crm_installer crm.installer.rule model_crm_installer crm.group_crm_user 1 1 1 1
28 access_crm_lead_forward_to_partner crm.lead.forward.to.partner model_crm_lead_forward_to_partner crm.group_crm_user 2 2 2 2
29 access_mailgate_thread mailgate.thread model_mailgate_thread crm.group_crm_user 1 1 1 1

View File

@ -212,7 +212,7 @@ class crm_lead_forward_to_partner(osv.osv_memory):
lead = lead_proxy.browse(cr, uid, lead_id, context=context)
if lead.type == 'lead':
field_names = [
'partner_name', 'title', 'function_name', 'street', 'street2',
'partner_name', 'title', 'function', 'street', 'street2',
'zip', 'city', 'country_id', 'state_id', 'email_from',
'phone', 'fax', 'mobile'
]

View File

@ -155,7 +155,7 @@ class crm_lead2partner(osv.osv_memory):
'email': lead.email_from,
'fax': lead.fax,
'title': lead.title,
'function': lead.function_name,
'function': lead.function,
'street': lead.street,
'street2': lead.street2,
'zip': lead.zip,

View File

@ -99,7 +99,7 @@ class crm_send_new_email(osv.osv_memory):
model = hist.model_id.model
model_pool = self.pool.get(model)
res_ids = model_pool.search(cr, uid, [('thread_id','=', hist.thread_id.id)])
res_id = res_ids and res_ids[0] or False
res_id = res_ids and res_ids[0] or False
case = model_pool.browse(cr, uid, res_id)
emails = [obj.email_to] + (obj.email_cc or '').split(',')
emails = filter(None, emails)
@ -107,7 +107,11 @@ class crm_send_new_email(osv.osv_memory):
body = case_pool.format_body(body)
email_from = getattr(obj, 'email_from', False)
case_pool._history(cr, uid, [case], _('Send'), history=True, email=obj.email_to, details=body, email_from=email_from, message_id=message_id)
case_pool._history(cr, uid, [case], _('Send'), history=True, \
email=obj.email_to, details=body, \
subject=obj.subject, email_from=email_from, \
message_id=message_id, attach=attach)
x_headers = dict()
#x_headers = {

View File

@ -174,31 +174,38 @@
<group colspan="4">
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.claim'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.claim'}"
icon="gtk-go-forward" type="action" />
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree" height="280">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'crm.claim'}"
icon="gtk-go-forward" type="action" />
</page>
</notebook>

View File

@ -195,18 +195,25 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.fundraising'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"

View File

@ -135,18 +135,25 @@
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.helpdesk'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"

View File

@ -26,7 +26,7 @@
'category': 'Generic Modules/Others',
'description': """This is a complete document management system:
* User Authentication
* Document Indexation
* Document Indexation :- .pptx and .docx files are not support in windows platform.
ATTENTION:
- When you install this module in a running company that have already PDF files stored into the database,

View File

@ -75,7 +75,7 @@ class document_file(osv.osv):
'user_id': fields.many2one('res.users', 'Owner', select=1),
'group_ids': fields.many2many('res.groups', 'document_group_rel', 'item_id', 'group_id', 'Groups'),
# the directory id now is mandatory. It can still be computed automatically.
'parent_id': fields.many2one('document.directory', 'Directory', select=1, required=True),
'parent_id': fields.many2one('document.directory', 'Directory', select=1),
'file_size': fields.integer('File Size', required=True),
'file_type': fields.char('Content Type', size=128),
# If ir.attachment contained any data before document is installed, preserve
@ -88,11 +88,16 @@ class document_file(osv.osv):
'create_uid': fields.many2one('res.users', 'Creator', readonly=True),
'store_method': fields.selection([('db', 'Database'), ('fs', 'Filesystem'), ('link', 'Link')], "Storing Method"),
'datas': fields.function(_data_get, method=True, fnct_inv=_data_set, string='File Content', type="binary", nodrop=True),
'url': fields.char('File URL',size=64),
'store_fname': fields.char('Stored Filename', size=200),
'res_model': fields.char('Attached Model', size=64), #res_model
'res_id': fields.integer('Attached ID'), #res_id
'partner_id':fields.many2one('res.partner', 'Partner', select=1),
'title': fields.char('Resource Title', size=64),
'type':fields.selection([
('url','URL'),
('binary','Binary'),
],'Type', help="Type is used to separate URL and binary File"),
}
def __get_def_directory(self, cr, uid, context=None):
@ -103,6 +108,7 @@ class document_file(osv.osv):
'user_id': lambda self, cr, uid, ctx:uid,
'file_size': lambda self, cr, uid, ctx:0,
'store_method': lambda *args: 'db',
'type': 'binary',
'parent_id': __get_def_directory
}
_sql_constraints = [
@ -155,7 +161,6 @@ class document_file(osv.osv):
def create(self, cr, uid, vals, context=None):
if not context:
context = {}
vals['title'] = vals['name']
vals['parent_id'] = context.get('parent_id', False) or vals.get('parent_id', False)
if not vals['parent_id']:
vals['parent_id'] = self.pool.get('document.directory')._get_root_directory(cr,uid, context)
@ -168,8 +173,6 @@ class document_file(osv.osv):
result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context)
if len(result):
obj = result[0]
if obj.get('name', False):
vals['title'] = (obj.get('name', ''))[:60]
if obj_model._name == 'res.partner':
vals['partner_id'] = obj['id']
elif obj.get('address_id', False):

View File

@ -104,11 +104,9 @@ class document_directory(osv.osv):
]
def name_get(self, cr, uid, ids, context={}):
res = []
all_ids = self.search(cr,uid,[])
if not self.search(cr,uid,[('id','in',ids)]):
ids = []
for d in self.browse(cr, uid, ids, context=context):
if d.id not in all_ids:
continue
s = ''
d2 = d
while d2 and d2.parent_id:

View File

@ -118,7 +118,7 @@
<record model="ir.ui.view" id="view_document_directory_tree">
<field name="name">document.directory</field>
<field name="model">document.directory</field>
<field name="type">tree</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Directories" toolbar="1">
<field name="name"/>
@ -179,71 +179,96 @@
<form string="Documents">
<group colspan="4" col="6">
<field name="name" select="1" />
<field name="title" select="1"/>
<field name="partner_id"/>
<field name="user_id"/>
<field name="parent_id"/>
<field name="type"/>
<field name="parent_id"/>
</group>
<notebook colspan="4">
<page string="Attachment">
<group col="2" colspan="2">
<separator string="Data" colspan="2"/>
<group col="2" colspan="2" attrs="{'invisible':[('type','=','url')]}">
<field name="datas" filename="datas_fname"/>
<field name="datas_fname" select="1"/>
</group>
<group col="2" colspan="2">
<separator string="Attached To" colspan="2"/>
<field name="res_model" readonly="1"/>
<field name="res_id" readonly="1"/>
</group>
<separator string="Preview" colspan="4"/>
<field
name="preview"
widget="image"
readonly="1"
nolabel="1"
colspan="4"
img_height="400"
img_width="800"/>
</group>
<group col="2" colspan="2" attrs="{'invisible':[('type','=','binary')]}">
<field name="url" widget="url"/>
</group>
</page><page string="Indexed Content">
<field name="index_content" nolabel="1" colspan="4" select="1"/>
</page><page string="Security">
<field name="group_ids" colspan="4" nolabel="1"/>
</page><page string="Others Info">
<group colspan="4" col="4">
<separator string="File Information" colspan="4"/>
<field name="file_size" readonly="1"/>
<newline/>
</group>
<group col="2" colspan="2">
<separator string="Relation" colspan="2"/>
<field name="res_name" readonly="1"/>
<field name="partner_id"/>
<field name="user_id"/>
</group>
<group col="4" colspan="4">
<separator string="History" colspan="4"/>
<group col="4" colspan="4">
<field name="create_uid"/>
<field name="create_date"/>
</group>
<group col="4" colspan="4">
<field name="write_uid"/>
<field name="write_date"/>
</group>
</group>
</page><page string="Notes">
</page>
<page string="Security">
<field name="group_ids" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field colspan="4" name="description" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record id="view_attach_filter" model="ir.ui.view">
<field name="name">IR Attachment</field>
<field name="model">ir.attachment</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="IR Attachment">
<filter icon="gtk-media-rewind" string="Recent"
help="less 1 month modified/created attachments"
domain="[('create_date','&lt;=', time.strftime('%%Y-%%m-%%d')),('create_date','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
/>
<separator orientation="vertical"/>
<field name="user_id" widget="selection">
<filter icon="terp-partner"
domain="[('user_id','=', False)]"
help="Filter on my Attachment" />
</field>
<field name="partner_id" widget="selection"/>
<newline/>
<group expand="1" string="Group By...">
<filter string="Partner" icon="terp-partner" domain="[]"
context="{'group_by':'partner_id'}" />
<filter string="Directory" icon="gtk-open" domain="[]" context="{'group_by':'parent_id'}"/>
</group>
</search>
</field>
</record>
<record model="ir.ui.view" id="view_document_file_tree">
<field name="name">ir.attachment</field>
<field name="model">ir.attachment</field>
<field name="type">tree</field>
<field name="priority" eval="1"/>
<field name="arch" type="xml">
<tree string="Documents">
<tree colors="blue:type in ('url')" string="Documents">
<field name="name"/>
<field name="title" />
<field name="partner_id"/>
<field name="type"/>
<field name="datas_fname"/>
<field name="user_id"/>
<field name="create_date"/>
<field name="write_date"/>
</tree>
</field>
</record>

View File

@ -44,7 +44,6 @@ class report_document_user(osv.osv):
('07','July'), ('08','August'), ('09','September'), ('10','October'), ('11','November'), ('12','December')],'Month',readonly=True),
'user_id':fields.integer('Owner', readonly=True),
'user':fields.char('User',size=64,readonly=True),
'file_title': fields.char('File Name',size=64,readonly=True),
'directory': fields.char('Directory',size=64,readonly=True),
'create_date': fields.datetime('Date Created', readonly=True),
'change_date': fields.datetime('Modified Date', readonly=True),
@ -66,7 +65,6 @@ class report_document_user(osv.osv):
d.name as directory,
f.create_date as create_date,
f.file_size as file_size,
min(f.title) as file_title,
min(d.type) as type,
f.write_date as change_date
from ir_attachment f
@ -83,7 +81,6 @@ class report_files_partner(osv.osv):
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'file_title': fields.char('File Name',size=64,readonly=True),
'directory': fields.char('Directory',size=64,readonly=True),
'create_date': fields.datetime('Date Created', readonly=True),
'change_date': fields.datetime('Modified Date', readonly=True),
@ -101,7 +98,6 @@ class report_files_partner(osv.osv):
select min(f.id) as id,count(*) as nbr,
to_char(f.create_date,'YYYY') as name,
min(to_char(f.create_date,'MM')) as month,
min(f.title) as file_title,
p.name as partner
from ir_attachment f
inner join res_partner p
@ -145,7 +141,6 @@ class report_document_wall(osv.osv):
'user_id':fields.many2one('res.users', 'Owner',readonly=True),
'user':fields.char('User',size=64,readonly=True),
'month': fields.char('Month', size=24,readonly=True),
'file_name':fields.char('Last Posted File Name',size=64,readonly=True),
'last':fields.datetime('Last Posted Time', readonly=True),
}
@ -153,7 +148,6 @@ class report_document_wall(osv.osv):
cr.execute("""
create or replace view report_document_wall as (
select max(f.id) as id,
min(title) as file_name,
to_char(min(f.create_date),'YYYY-MM-DD HH24:MI:SS') as last,
f.user_id as user_id, f.user_id as user,
to_char(f.create_date,'Month') as month

View File

@ -8,7 +8,6 @@
<field name="arch" type="xml">
<form string="Files">
<field name="name" select="1"/>
<field name="file_title" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="file_size"/>
@ -26,7 +25,6 @@
<tree string="Files">
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="file_title"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
<field name="file_size"/>
@ -48,7 +46,6 @@
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="month" select="1"/>
<field name="file_title" select="1"/>
<field name="user" select="1"/>
<field name="directory" select="1"/>
</group>
@ -79,13 +76,11 @@
<form string="Wall of Shame">
<field name="user_id" select="1"/>
<field name="month" select="1"/>
<field name="file_name" select="1"/>
<field name="last"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_document_wall_tree">
<field name="name">report.document.wall.tree</field>
<field name="model">report.document.wall</field>
@ -94,7 +89,6 @@
<tree string="Wall of Shame">
<field name="user_id" select="1"/>
<field name="month" select="1"/>
<field name="file_name"/>
<field name="last"/>
</tree>
</field>

View File

@ -57,6 +57,7 @@ class PptxIndex(indexer):
return ['.pptx']
def _doIndexFile(self,fname):
# pptx2txt.pl package not support in windows platform.
# Download pptx2txt package from http://sourceforge.net/projects/pptx2txt/" link.
# To install this tool, just copy pptx2txt.pl to appropriate place (e.g. /usr/bin directory)
fp = Popen(['pptx2txt.pl', fname], shell=False, stdout=PIPE).stdout
@ -88,6 +89,7 @@ class DocxIndex(indexer):
return ['.docx']
def _doIndexFile(self,fname):
# docx2txt.pl package not support in windows platform.
# Download docx2txt package from "http://sourceforge.net/projects/docx2txt/" link.
# In case, you don't want to use Makefile for installation, you can follow these steps for manual installation.
# Copy docx2txt.pl, docx2txt.sh and docx2txt.config to appropriate place (e.g. /usr/bin directory) . used following command.

View File

@ -558,8 +558,7 @@ class abstracted_fs:
if dst_obj2:
ressource_type_id = pool.get('ir.model').search(cr, uid, [('model','=',dst_obj2._name)])[0]
ressource_id = dst_obj2.id
title = dst_obj2.name
ressource_id = dst_obj2.id
ressource_model = dst_obj2._name
if dst_obj2._name == 'res.partner':
partner_id = dst_obj2.id
@ -569,8 +568,7 @@ class abstracted_fs:
ressource_type_id = False
ressource_id = False
ressource_model = False
partner_id = False
title = False
partner_id = False
pool.get('document.directory').write(cr, uid, result['directory'], {
'name' : dst_basename,
'ressource_id': ressource_id,
@ -579,8 +577,7 @@ class abstracted_fs:
})
val = {
'res_id': ressource_id,
'res_model': ressource_model,
'title': title,
'res_model': ressource_model,
'partner_id': partner_id
}
pool.get('ir.attachment').write(cr, uid, result['attachment'], val)
@ -603,7 +600,6 @@ class abstracted_fs:
'res_model': False,
'name': dst_basename,
'datas_fname': dst_basename,
'title': dst_basename,
}
if (dst_obj and (dst_obj.type in ('directory','ressource'))) or not dst_obj2:
@ -613,8 +609,7 @@ class abstracted_fs:
if dst_obj2:
val['res_model'] = dst_obj2._name
val['res_id'] = dst_obj2.id
val['title'] = dst_obj2.name
val['res_id'] = dst_obj2.id
if dst_obj2._name == 'res.partner':
val['partner_id'] = dst_obj2.id
else:

View File

@ -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/>.
#
##############################################################################

View File

@ -223,25 +223,32 @@
<page string="History">
<field name="message_ids" colspan="4" nolabel="1" mode="tree,form">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'crm.lead'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'event.registration'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<field name="log_ids" nolabel="1" colspan="4" mode="tree,form" readonly="1">
<tree string="Actions">
<separator string="Action Information" colspan="4"/>

View File

@ -69,7 +69,7 @@ class event_make_invoice(osv.osv_memory):
inv_rej_reason += "ID "+str(reg.id)+": Registration doesn't have any partner to invoice. \n"
continue
else:
val_invoice = pool_obj.get('account.invoice').onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
val_invoice = inv_obj.onchange_partner_id(cr, uid, [], 'out_invoice', reg.partner_invoice_id.id, False, False)
val_invoice['value'].update({'partner_id': reg.partner_invoice_id.id})
partner_address_id = val_invoice['value']['address_invoice_id']

View File

@ -7,6 +7,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_demo"/>
<field name="response_user">5</field>
</record>
</data>
<data>
@ -16,6 +17,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
</data>
<data>

View File

@ -148,6 +148,7 @@
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey.survey_type1"/>
<field name="responsible_id" ref="base.user_root"/>
<field name="response_user">5</field>
</record>
</data>
<data>

View File

@ -152,26 +152,33 @@
<field colspan="4" name="email_cc" string="CC"/>
</group>
<field name="message_ids" colspan="4" nolabel="1" mode="form,tree">
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</field>
<form string="Communication history">
<group col="6" colspan="4">
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'hr.applicant'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'new', 'model': 'hr.applicant'}"

View File

@ -43,7 +43,7 @@ class hr_analytic_timesheet(osv.osv):
_inherits = {'account.analytic.line': 'line_id'}
_order = "id desc"
_columns = {
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'),
'line_id' : fields.many2one('account.analytic.line', 'Analytic line', ondelete='cascade'),
'partner_id': fields.related('account_id', 'partner_id', type='many2one', string='Partner Id',relation='account.analytic.account',store=True),
}
@ -57,8 +57,7 @@ class hr_analytic_timesheet(osv.osv):
def on_change_unit_amount(self, cr, uid, id, prod_id, unit_amount, unit, context={}):
res = {}
# if prod_id and unit_amount:
if prod_id:
if prod_id and unit_amount:
# find company
company_id=self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context)
res = self.pool.get('account.analytic.line').on_change_unit_amount(cr, uid, id, prod_id, unit_amount,company_id,unit, context)

View File

@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.4\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-11-09 17:47+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-06-01 01:00+0000\n"
"Last-Translator: Pandu Pradana <p4ndupr4d4n4@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:09+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: idea
@ -27,7 +27,7 @@ msgstr ""
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Very Good"
msgstr ""
msgstr "Sangat Baik"
#. module: idea
#: view:idea.idea:0
@ -39,7 +39,7 @@ msgstr ""
#: model:ir.actions.act_window,name:idea.action_idea_idea_my_idea
#: model:ir.ui.menu,name:idea.menu_idea_idea_my_idea
msgid "My Ideas"
msgstr ""
msgstr "Ide Saya"
#. module: idea
#: constraint:ir.actions.act_window:0
@ -51,13 +51,13 @@ msgstr ""
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Not Voted"
msgstr ""
msgstr "Tidak Memberikan Suara"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea_open_my
#: model:ir.ui.menu,name:idea.menu_idea_idea_open_my
msgid "My Open Ideas"
msgstr ""
msgstr "Ide Terbuka Saya"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea
@ -69,18 +69,18 @@ msgstr ""
#. module: idea
#: field:idea.category,child_ids:0
msgid "Child Categories"
msgstr ""
msgstr "Kategori Anak"
#. module: idea
#: view:idea.idea:0
msgid "New Idea"
msgstr ""
msgstr "Ide Baru"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_category_tree
#: model:ir.ui.menu,name:idea.menu_idea_category_tree
msgid "Ideas by Categories"
msgstr ""
msgstr "Ide berdasar Kategori"
#. module: idea
#: field:idea.vote,score:0
@ -101,7 +101,7 @@ msgstr ""
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_vote_stat
msgid "Statistics on Votes"
msgstr ""
msgstr "Statistik pada Voting"
#. module: idea
#: constraint:ir.model:0
@ -112,17 +112,17 @@ msgstr ""
#. module: idea
#: model:ir.model,name:idea.model_idea_category
msgid "Category for an idea"
msgstr ""
msgstr "Kategori untuk sebuah ide"
#. module: idea
#: model:ir.module.module,shortdesc:idea.module_meta_information
msgid "Idea Manager"
msgstr ""
msgstr "Manager Ide"
#. module: idea
#: model:ir.ui.menu,name:idea.menu_idea_vote_stat
msgid "Vote Statistics"
msgstr ""
msgstr "Statistik Voting"
#. module: idea
#: selection:idea.idea,state:0
@ -161,12 +161,12 @@ msgstr "Pelaporan"
#. module: idea
#: model:ir.model,name:idea.model_idea_vote_stat
msgid "Idea Votes Statistics"
msgstr ""
msgstr "Statistik Voting Ide"
#. module: idea
#: model:ir.model,name:idea.model_idea_vote
msgid "idea.vote"
msgstr ""
msgstr "ide.voting"
#. module: idea
#: field:idea.comment,user_id:0
@ -177,7 +177,7 @@ msgstr ""
#. module: idea
#: view:idea.idea:0
msgid "Your comment"
msgstr ""
msgstr "Komentar anda"
#. module: idea
#: model:ir.ui.menu,name:idea.menu_config
@ -193,12 +193,12 @@ msgstr ""
#. module: idea
#: view:idea.stat:0
msgid "stat"
msgstr ""
msgstr "stat"
#. module: idea
#: field:idea.idea,my_vote:0
msgid "My Vote"
msgstr ""
msgstr "Voting Saya"
#. module: idea
#: constraint:ir.ui.view:0
@ -208,7 +208,7 @@ msgstr ""
#. module: idea
#: view:idea.vote:0
msgid "Votes"
msgstr ""
msgstr "Memilih"
#. module: idea
#: model:ir.module.module,description:idea.module_meta_information
@ -230,28 +230,28 @@ msgstr ""
#. module: idea
#: field:idea.idea,count_votes:0
msgid "Count of votes"
msgstr ""
msgstr "Jumlah voting"
#. module: idea
#: field:idea.vote.stat,nbr:0
msgid "Number of Votes"
msgstr ""
msgstr "Nomer Voting"
#. module: idea
#: model:ir.model,name:idea.model_idea_idea
msgid "idea.idea"
msgstr ""
msgstr "ide.ide"
#. module: idea
#: model:ir.actions.act_window,name:idea.action_idea_idea_draft_my
#: model:ir.ui.menu,name:idea.menu_idea_idea_draft_my
msgid "My Draft Ideas"
msgstr ""
msgstr "Draf ide saya"
#. module: idea
#: field:idea.idea,vote_ids:0
msgid "Vote"
msgstr ""
msgstr "Pemilihan"
#. module: idea
#: selection:idea.idea,my_vote:0
@ -264,7 +264,7 @@ msgstr ""
#: view:idea.idea:0
#: model:ir.ui.menu,name:idea.menu_idea_idea
msgid "All Ideas"
msgstr ""
msgstr "Semua Ide"
#. module: idea
#: view:idea.comment:0
@ -277,17 +277,17 @@ msgstr ""
#. module: idea
#: field:idea.idea,count_comments:0
msgid "Count of comments"
msgstr ""
msgstr "Jumlah komentar"
#. module: idea
#: field:idea.idea,title:0
msgid "Idea Summary"
msgstr ""
msgstr "Ringkasan Ide"
#. module: idea
#: view:idea.category:0
msgid "Category of ideas"
msgstr ""
msgstr "Kategori berdasarkan ide"
#. module: idea
#: field:idea.category,summary:0
@ -299,7 +299,7 @@ msgstr ""
#: model:ir.actions.act_window,name:idea.action_idea_idea_open
#: model:ir.ui.menu,name:idea.menu_idea_idea_open
msgid "Open Ideas"
msgstr ""
msgstr "Ide Terbuka"
#. module: idea
#: view:idea.idea:0
@ -317,7 +317,7 @@ msgstr ""
#. module: idea
#: field:idea.category,parent_id:0
msgid "Parent Categories"
msgstr ""
msgstr "Kategori Induk"
#. module: idea
#: field:idea.idea,user_id:0
@ -335,14 +335,14 @@ msgstr ""
#: field:idea.vote,idea_id:0
#: field:idea.vote.stat,idea_id:0
msgid "Idea"
msgstr ""
msgstr "Ide"
#. module: idea
#: selection:idea.idea,my_vote:0
#: selection:idea.vote,score:0
#: selection:idea.vote.stat,score:0
msgid "Very Bad"
msgstr ""
msgstr "Sangat Buruk"
#. module: idea
#: selection:idea.idea,state:0
@ -352,7 +352,7 @@ msgstr ""
#. module: idea
#: model:ir.ui.menu,name:idea.menu_idea_vote
msgid "All Votes"
msgstr ""
msgstr "Semua Pemilihan"
#. module: idea
#: view:idea.idea:0
@ -367,7 +367,7 @@ msgstr ""
#. module: idea
#: field:idea.idea,vote_avg:0
msgid "Average Score"
msgstr ""
msgstr "Skor Rata-rata"
#. module: idea
#: view:idea.idea:0
@ -377,4 +377,4 @@ msgstr ""
#. module: idea
#: help:idea.idea,description:0
msgid "Content of the idea"
msgstr ""
msgstr "Isi ide"

View File

@ -22,6 +22,7 @@
from osv import osv
from osv import fields
from tools.translate import _
import time
VoteValues = [('-1', 'Not Voted'), ('0', 'Very Bad'), ('25', 'Bad'), \
('50', 'Normal'), ('75', 'Good'), ('100', 'Very Good') ]
@ -150,13 +151,12 @@ class idea_idea(osv.osv):
if int(field_value) >= 0:
vote_obj.create(cr, uid, {'idea_id': id, 'user_id': uid, 'score': textual_value })
_columns = {
'user_id': fields.many2one('res.users', 'Creator', required=True, readonly=True),
'user_id': fields.many2one('res.users', 'Responsible', required=True, readonly=True),
'title': fields.char('Idea Summary', size=64, required=True),
'description': fields.text('Description', required=True, help='Content of the idea'),
'comment_ids': fields.one2many('idea.comment', 'idea_id', 'Comments'),
'create_date': fields.datetime('Creation date', readonly=True),
'created_date': fields.datetime('Creation date', readonly=True),
'vote_ids': fields.one2many('idea.vote', 'idea_id', 'Vote'),
'my_vote': fields.function(_vote_read, fnct_inv = _vote_save, string="My Vote", method=True, type="selection", selection=VoteValues),
'vote_avg': fields.function(_vote_avg_compute, method=True, string="Average Score", type="float"),
@ -174,12 +174,16 @@ class idea_idea(osv.osv):
),
'visibility':fields.boolean('Open Idea?', required=False),
'stat_vote_ids': fields.one2many('idea.vote.stat', 'idea_id', 'Statistics', readonly=True),
'vote_limit': fields.integer('Maximum Vote per User',
help="Set to one if you require only one Vote per user"),
}
_defaults = {
'user_id': lambda self,cr,uid,context: uid,
'my_vote': lambda *a: '-1',
'state': lambda *a: 'draft',
'vote_limit': lambda * a: 1,
'created_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
'visibility': lambda *a: True,
}
_order = 'id desc'
@ -278,12 +282,15 @@ class idea_vote(osv.osv):
_rec_name = 'score'
_columns = {
'user_id': fields.many2one('res.users', 'User'),
'idea_id': fields.many2one('idea.idea', 'Idea', required=True, ondelete='cascade'),
'score': fields.selection(VoteValues, 'Score', required=True)
'user_id': fields.many2one('res.users', 'By user', readonly="True"),
'idea_id': fields.many2one('idea.idea', 'Idea', readonly="True", ondelete='cascade'),
'score': fields.selection(VoteValues, 'Vote Status', readonly="True"),
'date': fields.datetime('Date', readonly="True"),
'comment': fields.text('Comment', readonly="True"),
}
_defaults = {
'score': lambda *a: DefaultVoteValue,
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
}
idea_vote()

View File

@ -50,6 +50,7 @@
<menuitem name="Categories" parent="menu_ideas" id="menu_idea_category" action="action_idea_category" />
<!-- Idea Category Action -->
<record model="ir.actions.act_window" id="action_idea_category_tree">
@ -60,8 +61,18 @@
</record>
<menuitem name="Ideas" parent="base.menu_tools" id="menu_ideas1" sequence="4"/>
<menuitem
name="Ideas by Categories" parent="menu_ideas1"
id="menu_idea_category_tree"
action="action_idea_category_tree"/>
<menuitem name="Give Vote" parent="menu_ideas1"
id="menu_give_vote"
action="action_idea_select"/>
<!-- Oepn Ideas Action -->
<!-- Open Ideas Action -->
<record model="ir.actions.act_window" id="action_idea_idea_categ_open">
<field name="name">Open Ideas</field>
@ -102,9 +113,9 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Votes">
<field name="idea_id"/>
<field name="user_id"/>
<field name="score" />
<field name="user_id" />
<field name="score"/>
<field name="date"/>
</tree>
</field>
</record>
@ -117,12 +128,39 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Votes">
<field name="idea_id" select="1" />
<field name="user_id" select="1" />
<field name="score"/>
<group colspan="4">
<field name="user_id" select="1" />
<field name="date"/>
<newline/>
<field name="score"/>
</group>
<separator string="Comments:" colspan="4"/>
<field name="comment" colspan="4" nolabel="1"/>
</form>
</field>
</record>
<!-- Search view for Idea vote -->
<record model="ir.ui.view" id="view_idea_vote_search">
<field name="name">idea.vote.search</field>
<field name="model">idea.vote</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Ideas vote">
<group col="10" colspan="4">
<field name="idea_id" widget="selection"/>
<field name="user_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="14">
<filter string="Vote date" icon="terp-crm" domain="[]" context="{'group_by':'date'}"/>
<filter string="Idea" icon="terp-crm" domain="[]" context="{'group_by':'idea_id'}"/>
<filter string="User" name="user" icon="terp-partner" domain="[]" context="{'group_by':'user_id'}"/>
</group>
</search>
</field>
</record>
<!-- New Idea Form View -->
@ -168,7 +206,8 @@
<field name="score"/>
<field name="nbr"/>
</tree>
</field>
</field>
</page>
</notebook>
<group colspan="4" col="6">
@ -177,7 +216,6 @@
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" states="open" type="action" string="Submit Vote"/>
<button name="idea_close" string="Accept" states="open" icon="gtk-jump-to"/>
<button name="idea_cancel" string="Refuse" states="open" icon="gtk-cancel"/>
</group>
</form>
</field>
@ -190,15 +228,15 @@
<field name="model">idea.idea</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="All Ideas">
<tree string="Ideas">
<field name="title"/>
<field name="category_id" />
<field name="create_date"/>
<field name="created_date"/>
<field name="vote_avg" widget="progressbar"/>
<field name="count_comments" />
<field name="count_votes" />
<field name="state"/>
<button name="%(action_idea_post_vote)d" icon="gtk-execute" type="action" states="draft,open" string="Vote"/>
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" type="action" states="open" string="Submit Vote"/>
<button name="idea_close" string="Accept" states="open" icon="gtk-jump-to"/>
<button name="idea_cancel" string="Refuse" states="open" icon="gtk-cancel"/>
</tree>
@ -233,23 +271,6 @@
</field>
</record>
<!-- Comments on Idea Tree View -->
<record model="ir.ui.view" id="view_idea_comment_tree">
<field name="name">idea.comment.tree</field>
<field name="model">idea.comment</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Comments">
<field name="create_date" />
<field name="user_id" />
<field name="content" string="Comment" />
</tree>
</field>
</record>
<!-- Idea Action -->
<record model="ir.actions.act_window" id="action_idea_idea">
<field name="name">Ideas</field>
<field name="res_model">idea.idea</field>
@ -337,9 +358,10 @@
<field name="res_model">idea.vote</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_idea_vote_search"/>
</record>
<menuitem name="All Votes" parent="menu_ideas" id="menu_idea_vote" action="action_idea_vote"/>
<menuitem name="Votes" parent="menu_ideas" id="menu_idea_vote" action="action_idea_vote"/>
</data>
</openerp>

View File

@ -1,8 +1,9 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_idea_category","idea.category","model_idea_category","base.group_user",1,0,0,0
"access_idea_idea","idea.idea","model_idea_idea","base.group_user",1,1,1,1
"access_idea_comment","idea.comment","model_idea_comment","base.group_user",1,1,1,1
"access_idea_vote","idea.vote","model_idea_vote","base.group_user",1,1,1,1
"access_idea_vote_stat","idea.vote.stat","model_idea_vote_stat","base.group_user",1,0,0,0
"access_idea_category_system","idea.category system","model_idea_category","base.group_system",1,1,1,1
"idea_post_vote","idea.post.vote","model_idea_post_vote","base.group_user",1,1,1,1
"access_idea_select","idea.select","model_idea_select","base.group_user",1,1,1,1
"access_idea_comment","idea.comment","model_idea_comment","base.group_system",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_idea_category idea.category model_idea_category base.group_user 1 0 0 0
3 access_idea_idea idea.idea model_idea_idea base.group_user 1 1 1 1
access_idea_comment idea.comment model_idea_comment base.group_user 1 1 1 1
4 access_idea_vote idea.vote model_idea_vote base.group_user 1 1 1 1
5 access_idea_vote_stat idea.vote.stat model_idea_vote_stat base.group_user 1 0 0 0
6 access_idea_category_system idea.category system model_idea_category base.group_system 1 1 1 1
7 idea_post_vote idea.post.vote model_idea_post_vote base.group_user 1 1 1 1
8 access_idea_select idea.select model_idea_select base.group_user 1 1 1 1
9 access_idea_comment idea.comment model_idea_comment base.group_system 1 1 1 1

View File

@ -8,10 +8,10 @@
name: Technical
- |
I create a New Idea of "Technical presentation for 1 hours in every day" and specify category "Technical".
-
!record {model: idea.idea, id: idea_idea_0}:
category_id: idea_category_technical0
created_date: '05/13/2010 19:16:26'
description: I want that Technical presentation are arranged for 1 hours in every
day.\nso, on that presentation, we can know all things what improvement and development
are done in our company.\n\n\n\n\n
@ -44,52 +44,50 @@
!record {model: res.users, id: res_users_user1}:
company_id: base.main_company
context_lang: en_US
groups_id:
- base.group_system
- base.group_user
login: user2
name: user2
password: user2
- |
In order to post vote I connect as user1 and open the idea page
I click on "Vote" wizard and vote the idea as "Normal"
I click on "Submit Vote" wizard button and vote the idea as "Normal"
-
!record {model: idea.post.vote, id: idea_post_vote_0}:
vote: 50
- |
Now I click on "Post Vote" button of wizard.
Now I click on "Post" button of this wizard.
-
!python {model: idea.post.vote}: |
uid = ref('res_users_user0')
self.do_vote(cr, uid, [ref("idea_post_vote_0")], {'active_id': ref('idea_idea_0')})
self.do_vote(cr, uid, [ref("idea_post_vote_0")], {'active_ids': [ref('idea_idea_0')]})
- |
To add other vote I connect as user2 and open the idea page
I click on "Vote" wizard and vote the idea as "Very Good"
To add other vote I connect as user2 and open the idea page.
I click on "Submit Vote" wizard button and vote the idea as "Very Good".
and put comment "We can learn many things from technical presentation".
-
!record {model: idea.post.vote, id: idea_post_vote_1}:
vote: 100
note: 'We can learn many things from technical presentation'
- |
I click on "Post Vote" button of this wizard.
I click on "Post" button of this wizard.
-
!python {model: idea.post.vote}: |
uid = ref('res_users_user1')
self.do_vote(cr, uid, [ref("idea_post_vote_1")], {'active_id': ref('idea_idea_0')})
self.do_vote(cr, uid, [ref("idea_post_vote_1")], {'active_ids': [ref('idea_idea_0')]})
- |
I can see that the Average score changed in "Average score" field with value 75
-
!record {model: idea.idea, id: idea_idea_0}:
vote_avg: 75
- |
I put one comment "We can learn many things from technical presentation" for the idea.
-
!record {model: idea.idea, id: idea.idea_idea_0}:
comment_ids:
- content: "We can learn many things from technical presentation"
idea_id: idea.idea_idea_0
user_id: res_users_user1
- |
I connect as Manager and close this idea by click on "Close" button.

View File

@ -70,15 +70,28 @@ class idea_post_vote(osv.osv_memory):
@param context: A standard dictionary for contextual values
"""
idea_obj = self.pool.get('idea.idea')
vote_obj = self.pool.get('idea.vote')
for idea in idea_obj.browse(cr, uid, context.get('active_ids', [])):
if idea.state in ['draft', 'close', 'cancel']:
raise osv.except_osv(_("Warning !"), _("Draft/Accepted/Cancelled ideas Could not be voted"))
for active_id in context.get('active_ids'):
vote_ids = vote_obj.search(cr, uid, [('user_id', '=', uid), ('idea_id', '=', active_id)])
vote_obj_id = vote_obj.browse(cr, uid, vote_ids)
count = 0
for vote in vote_obj_id:
count += 1
user_limit = idea.vote_limit
if count >= user_limit:
raise osv.except_osv(_('Warning !'),_("You can not give Vote for this idea more than %s times") % (user_limit))
if idea.state != 'open':
raise osv.except_osv(_('Warning !'), _('idea should be in \'Open\' state before vote for that idea.'))
raise osv.except_osv(_('Warning !'), _('Idea should be in \
\'Open\' state before vote for that idea.'))
return False
def do_vote(self, cr, uid, ids, context):
def do_vote(self, cr, uid, ids, context=None):
"""
Create idea vote.
@param cr: the current row, from the database cursor,
@ -87,30 +100,72 @@ class idea_post_vote(osv.osv_memory):
@return: Dictionary {}
"""
vote_id = context and context.get('active_id', False) or False
vote_ids = context and context.get('active_ids', []) or []
vote_pool = self.pool.get('idea.vote')
comment_pool = self.pool.get('idea.comment')
for do_vote_obj in self.read(cr, uid, ids):
score = str(do_vote_obj['vote'])
comment = do_vote_obj.get('note', False)
vote = {
'idea_id': vote_id,
'user_id': uid,
'score': score
}
if comment:
comment = {
'user_id':uid,
'idea_id':vote_id,
'content': comment,
}
comment = comment_pool.create(cr, uid, comment)
for vote_id in vote_ids:
vote = vote_pool.create(cr, uid, vote)
vote = {
'idea_id': vote_id,
'user_id': uid,
'score': score
}
if comment:
comment = {
'user_id':uid,
'idea_id':vote_id,
'content': comment,
}
comment = comment_pool.create(cr, uid, comment)
vote = vote_pool.create(cr, uid, vote)
return {}
idea_post_vote()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
class idea_select(osv.osv_memory):
""" Select idea for vote."""
_name = "idea.select"
_description = "select idea"
_columns = {
'idea_id': fields.many2one('idea.idea', 'Idea', required=True),
}
def open_vote(self, cr, uid, ids, context=None):
"""
This function load column.
@param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks,
@param ids: List of load column,
@return: dictionary of query logs clear message window
"""
idea_obj = self.browse(cr, uid, ids)
for idea in idea_obj:
idea_id = idea.idea_id.id
data_obj = self.pool.get('ir.model.data')
id2 = data_obj._get_id(cr, uid, 'idea', 'view_idea_post_vote')
if id2:
id2 = data_obj.browse(cr, uid, id2, context=context).res_id
value = {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'idea.post.vote',
'views': [(id2, 'form'), (False, 'tree'), (False, 'calendar'), (False, 'graph')],
'type': 'ir.actions.act_window',
'target': 'new',
'context': {'active_ids': [idea_id]}
}
return value
idea_select()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Post Idea for vote Form View -->
<record id="view_idea_post_vote" model="ir.ui.view">
@ -9,7 +8,7 @@
<field name="model">idea.post.vote</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Create Tasks">
<form string="Give Vote">
<group colspan="4" >
<field name="vote" colspan="4"/>
<separator string="Comment" colspan="4"/>
@ -18,12 +17,33 @@
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-ok" name="do_vote" string="Post Vote" type="object"/>
<button icon="gtk-ok" name="do_vote" string="Post" type="object"/>
</group>
</form>
</field>
</record>
<record id="view_idea_select" model="ir.ui.view">
<field name="name">idea.select.form</field>
<field name="model">idea.select</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Idea for Vote">
<group colspan="4" >
<separator string="Select Idea for Vote" colspan="4"/>
<field name="idea_id"/>
</group>
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<label string="" colspan="2"/>
<button icon="gtk-cancel" special="cancel" string="Close"/>
<button icon="gtk-go-forward" name="open_vote" string="Next" type="object"/>
</group>
</form>
</field>
</record>
<!-- Post Idea for vote Action -->
<record id="action_idea_post_vote" model="ir.actions.act_window">
@ -33,7 +53,17 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_idea_post_vote"/>
<field name="target">new</field>
</record>
</record>
<record id="action_idea_select" model="ir.actions.act_window">
<field name="name">Idea select</field>
<field name="res_model">idea.select</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_idea_select"/>
<field name="target">new</field>
<field name="context">{'model': 'idea.idea'}</field>
</record>
</data>
</openerp>

View File

@ -24,18 +24,15 @@
'version': '1.0',
'category': 'Generic Modules/Mail Service',
'description': """The generic email gateway system allows to send and receive emails
* IMAP / IMAP with SSL
* POP / POP with SSL
* SMTP / SMTP with TLS
* ACL basd access polocy
* Queing and History for Emails
* History for Emails
* Easy Integration with any Module""",
'author': 'Tiny',
'website': 'http://www.openerp.com',
'depends': ['base'],
'init_xml': [],
'update_xml': [
"mail_gateway_view.xml"
"mail_gateway_view.xml",
'security/ir.model.access.csv'
],
'demo_xml': [],
'installable': True,

View File

@ -21,6 +21,7 @@
from osv import osv, fields
import time
import base64
class one2many_domain(fields.one2many):
def set(self, cr, obj, id, field, values, user=None, context=None):
@ -30,7 +31,7 @@ class one2many_domain(fields.one2many):
user=user, context=context)
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
if not context:
if context is None:
context = {}
res = {}
msg_obj = obj.pool.get('mailgate.message')
@ -49,12 +50,12 @@ class mailgate_thread(osv.osv):
_rec_name = 'thread'
_columns = {
'thread': fields.char('Thread', size=32, required=False),
'thread': fields.char('Thread', size=32, required=False),
'message_ids': one2many_domain('mailgate.message', 'thread_id', 'Messages', domain=[('history', '=', True)], required=False),
'log_ids': one2many_domain('mailgate.message', 'thread_id', 'Logs', domain=[('history', '=', False)], required=False),
'log_ids': one2many_domain('mailgate.message', 'thread_id', 'Logs', domain=[('history', '=', False)], required=False),
}
def __history(self, cr, uid, cases, keyword, history=False, email=False, details=None, email_from=False, message_id=False, context={}):
def __history(self, cr, uid, cases, keyword, history=False, subject=None, email=False, details=None, email_from=False, message_id=False, attach=[], context={}):
"""
@param self: The object pointer
@param cr: the current row, from the database cursor,
@ -64,36 +65,52 @@ class mailgate_thread(osv.osv):
@param history: Value True/False, If True it makes entry in case History otherwise in Case Log
@param email: Email address if any
@param details: Details of case history if any
@param atach: Attachment sent in email
@param context: A standard dictionary for contextual values"""
if not context:
if context is None:
context = {}
# The mailgate sends the ids of the cases and not the object list
if all(isinstance(case_id, (int, long)) for case_id in cases) and context.get('model'):
cases = self.pool.get(context['model']).browse(cr, uid, cases, context=context)
model_obj = self.pool.get('ir.model')
att_obj = self.pool.get('ir.attachment')
obj = self.pool.get('mailgate.message')
for case in cases:
model_ids = model_obj.search(cr, uid, [('model', '=', case._name)])
data = {
'name': keyword,
'user_id': uid,
'model_id' : model_ids and model_ids[0] or False,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'thread_id': case.thread_id.id,
'message_id': message_id
'name': keyword,
'user_id': uid,
'model_id' : model_ids and model_ids[0] or False,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'thread_id': case.thread_id.id,
'message_id': message_id,
}
attachments = []
if history:
data['history'] = True
data['description'] = details or case.description
data['email_to'] = email or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
data['email_from'] = email_from or \
(case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False)
for att in attach:
attachments.append(att_obj.create(cr, uid, {'name': att[0], 'datas': base64.encodestring(att[1])}))
data = {
'name': subject or 'History',
'history': True,
'user_id': uid,
'model_id' : model_ids and model_ids[0] or False,
'res_id': case.id,
'date': time.strftime('%Y-%m-%d %H:%M:%S'),
'description': details or (hasattr(case, 'description') and case.description or False),
'email_to': email or \
(hasattr(case, 'user_id') and case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False),
'email_from': email_from or \
(hasattr(case, 'user_id') and case.user_id and case.user_id.address_id and \
case.user_id.address_id.email) or tools.config.get('email_from', False),
'partner_id': hasattr(case, 'partner_id') and (case.partner_id and case.partner_id.id or False) or False,
'thread_id': case.thread_id.id,
'message_id': message_id,
'attachment_ids': [(6, 0, attachments)]
}
res = obj.create(cr, uid, data, context)
return True
@ -112,20 +129,22 @@ class mailgate_message(osv.osv):
_order = 'date desc'
_columns = {
'name':fields.char('Message', size=64),
'model_id': fields.many2one('ir.model', 'Model'),
'thread_id':fields.many2one('mailgate.thread', 'Thread'),
'date': fields.datetime('Date'),
'name':fields.char('Message', size=64),
'model_id': fields.many2one('ir.model', 'Model'),
'res_id': fields.integer('Resource ID'),
'thread_id':fields.many2one('mailgate.thread', 'Thread'),
'date': fields.datetime('Date'),
'history': fields.boolean('Is History?', required=False),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'message': fields.text('Description'),
'email_from': fields.char('Email From', size=84),
'email_to': fields.char('Email To', size=84),
'email_cc': fields.char('Email From', size=84),
'email_bcc': fields.char('Email From', size=84),
'message_id': fields.char('Message Id', size=1024, readonly=True, help="Message Id on Email Server.", select=True),
'user_id': fields.many2one('res.users', 'User Responsible', readonly=True),
'message': fields.text('Description'),
'email_from': fields.char('Email From', size=84),
'email_to': fields.char('Email To', size=84),
'email_cc': fields.char('Email CC', size=84),
'email_bcc': fields.char('Email BCC', size=84),
'message_id': fields.char('Message Id', size=1024, readonly=True, help="Message Id on Email Server.", select=True),
'description': fields.text('Description'),
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments'),
'partner_id': fields.many2one('res.partner', 'Partner', required=False),
'attachment_ids': fields.many2many('ir.attachment', 'message_attachment_rel', 'message_id', 'attachment_id', 'Attachments'),
}
mailgate_message()

View File

@ -1,30 +1,33 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="ir.ui.view" id="view_maligate_message_form">
<field name="name">maligate.message.form</field>
<field name="model">maligate.message</field>
<record model="ir.ui.view" id="view_mailgate_message_form">
<field name="name">mailgate.message.form</field>
<field name="model">mailgate.message</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="maligate message">
<field name="name" />
<field name="date" />
<field name="user_id" />
<field name="history" />
<field name="message_id" />
<form string="mailgate message">
<group colspan="4" col="6">
<field name="name" required="1" select="1"/>
<field name="date" required="1" select="1"/>
<field name="user_id" string="Responsible" select="1"/>
</group>
<notebook colspan="4">
<page>
<page string="Details">
<group col="4" colspan="4">
<separator string="Email Details" colspan="4"/>
<field name="email_from" />
<field name="email_to" />
<field name="email_cc" />
<field name="email_bcc" />
<field name="message_id" />
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
</page>
<page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
<field name="attachment_ids" nolabel="1" colspan="4" />
<field name="attachment_ids" nolabel="1" colspan="4" readonly="1"/>
</page>
</notebook>
</form>
@ -32,18 +35,33 @@
</record>
<record model="ir.ui.view" id="view_mailgate_message_tree">
<field name="name">maligate.message.tree</field>
<field name="model">maligate.message</field>
<field name="name">mailgate.message.tree</field>
<field name="model">mailgate.message</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Mailgateway Message">
<field name="name" select="1" />
<field name="date" />
<field name="email_from" />
<field name="user_id" />
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_mailgate_message_search">
<field name="name">mailgate.message.search</field>
<field name="model">mailgate.message</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Mailgateway Message Search">
<field name="name" />
<field name="date" />
<field name="user_id" />
<field name="message_id" />
</search>
</field>
</record>
<record model="ir.ui.view" id="view_mailgate_thread_form">
<field name="name">mailgate.thread.form</field>
<field name="model">mailgate.thread</field>
@ -57,12 +75,11 @@
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Maligate Logs">
<form string="Mailgate Logs">
<field name="name" />
<field name="date" />
<field name="user_id" />
<field name="message_id" />
<field name="history" />
<field name="message_id" />
<notebook colspan="4">
<page string="Email Details">
<group col="4" colspan="4">
@ -72,6 +89,8 @@
<field name="email_cc" />
<field name="email_bcc" />
</group>
<separator string="Description" colspan="4"/>
<field name="description" nolabel="1" colspan="4" />
</page>
<page string="Attachments">
<separator string="Attachments" colspan="4"/>
@ -86,7 +105,7 @@
<field name="name" select="1" />
<field name="date" />
</tree>
<form string="Maligate Histories">
<form string="Mailgate Histories">
<field name="name" />
<field name="date" />
<field name="user_id" />
@ -153,6 +172,12 @@
<menuitem id="menu_mailgate_thread" name="Mailgateway Threads" action="action_view_mailgate_thread"
parent="base.menu_crm_configuration" sequence="20"/>
-->
<act_window domain="[('partner_id', '=', active_id), ('history', '=', True)]"
id="act_res_partner_emails" name="Emails"
res_model="mailgate.message"
src_model="res.partner"
view_id="view_mailgate_message_tree"
/>
</data>
</openerp>

View File

@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
import marketing_campaign_mailchimp
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,41 @@
# -*- 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/>.
#
##############################################################################
{
"name" : "",
"version" : "1.1",
"depends" : ['marketing_campaign'],
"author" : "Tiny",
"category": 'Generic Modules/Marketing',
"description": """
""",
'website': 'http://www.openerp.com',
'init_xml': [],
'update_xml': [
'marketing_campaign_mailchimp_view.xml',
],
'demo_xml': [],
'installable': True,
'active': False,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,131 @@
# -*- 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 urllib2
import simplejson as json
mailchimp_url = 'http://%s.api.mailchimp.com/1.2'
class marketing_campaign_mailchimp_account(osv.osv): #{{{
_name = "marketing.campaign.mailchimp.account"
_columns = {
'name': fields.char('Account Name', size=64),
'username': fields.char('Username', size=64, required=True),
'password': fields.char('Password', size=64, required=True),
'apikey': fields.char('API Key', size=128),
'data_center': fields.selection([('us1', 'US1'), ('us2', 'US2'),
('uk1', 'UK1')], 'Data Center'),
'state': fields.selection([('draft', 'Draft'), ('approved', 'Approved'),
('cancelled', 'Cancelled')], 'State', readonly=True)
}
_defaults = {
'state': lambda *a: 'draft'
}
def get_response(self, cr, uid, mailchimp_id, method, params={}):
mailchimp_account = self.browse(cr, uid, mailchimp_id)
params['output'] = 'json'
if method == 'login':
params['username'] = mailchimp_account.username
params['password'] = mailchimp_account.password
else :
params['apikey'] = mailchimp_account.apikey
params = '&'.join(map(lambda x : '%s=%s' %(x, params[x]), params))
url = mailchimp_url%mailchimp_account.data_center+ '/?method=%s'%method
req = urllib2.Request(url, params)
handle = urllib2.urlopen(req)
response = json.loads(handle.read())
return response
def button_approve(self, cr, uid, ids, context):
acc_obj = self.browse(cr, uid, ids)[0]
vals = {}
if not acc_obj.apikey:
method = 'login'
else:
method = 'ping'
response = self.get_response(cr, uid, acc_obj.id, method)
if 'error' not in response:
if method == 'login' :
vals['apikey'] = response
vals['state'] = 'approved'
self.write(cr, uid, ids, vals)
else :
raise osv.except_osv('Error!!!',
"Can't approved accoutnt : %s"%response['error'])
return True
def button_cancel(self, cr, uid, ids, context):
self.write(cr, uid, ids, {'state': 'cancelled'})
return True
marketing_campaign_mailchimp_account() #}}}
#class marketing_campaign_mailchimp_list(osv.osv_memory): #{{{
# _name = "marketing.campaign.mailchimp.list"
#
# _columns = {
# 'name': fields.char('Name', size=64),
# 'mailchimp_account_id': fields.many2one('marketing.campaign.mailchimp.account', 'Account'),
# 'list_id': fields.char('List Id', size=64,),
# }
#
# _defaults = {
# 'state': lambda *a: 'draft'
# }
#
#marketing_campaign_mailchimp_list() #}}}
class marketing_campaign_segment(osv.osv): #{{{
_inherit = "marketing.campaign.segment"
_columns = {
'synchro': fields.boolean('Mailchimp Synchro'),
'mailchimp_account_id': fields.many2one(
'marketing.campaign.mailchimp.account', 'Account'),
'mailchimp_list': fields.char('List', size=64),
}
def onchange_mailchimp(self, cr, uid, ids, mailchimp_account_id):
if mailchimp_account_id:
return {'value':{'mailchimp_list':''}}
return {'value':{}}
def onchange_mailchimp_list(self, cr, uid, ids, mailchimp_account_id,
mailchimp_list):
if mailchimp_account_id and mailchimp_list:
lists = self.pool.get('marketing.campaign.mailchimp.account').get_response(cr,
uid, mailchimp_account_id, 'lists')
list_names = [list['name'] for list in lists]
if mailchimp_list not in list_names:
raise osv.except_osv('Error!!!',"Lists doesn't exists")
else :
return {}
return {'value':{}}
marketing_campaign_segment() #}}}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,86 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--
================================================================
Marketing Segments Inherited View - mailchimp
================================================================
-->
<record model="ir.ui.view" id="view_marketing_campaign_segment_form_inherit">
<field name="name">marketing.campaign.segment.form.inherit</field>
<field name="model">marketing.campaign.segment</field>
<field name="type">form</field>
<field name="inherit_id" ref="marketing_campaign.view_marketing_campaign_segment_form"/>
<field name="arch" type="xml">
<field name="date_done" position="after">
<separator string="Mailchimp Synchronization" colspan="4"/>
<field name="synchro"/>
<group colspan="2" attrs="{'invisible':[('synchro','!=',True)]}">
<field name="mailchimp_account_id" attrs="{'required':[('synchro','=',True)]}" domain="[('state','=','approved')]" on_change="onchange_mailchimp(mailchimp_account_id)"/>
<field name="mailchimp_list" attrs="{'required':[('synchro','=',True)]}" on_change="onchange_mailchimp_list(mailchimp_account_id,mailchimp_list)"/>
</group>
</field>
</field>
</record>
<!--
================================================================
Mailchimp Account
================================================================
-->
<menuitem name="Tools" id="base.menu_tools" icon="STOCK_PREFERENCES" sequence="15"/>
<menuitem name="Mailchimps" id="menu_action_mailchimp" parent="base.menu_tools" />
<record model="ir.ui.view" id="view_marketing_campaign_mailchimp_account_tree">
<field name="name">marketing.campaign.mailchimp.account.tree</field>
<field name="model">marketing.campaign.mailchimp.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="All Accounts">
<field name="name"/>
<field name="username" />
<field name="data_center"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_marketing_campaign_mailchimp_account_form">
<field name="name">marketing.campaign.mailchimp.account.form</field>
<field name="model">marketing.campaign.mailchimp.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account">
<field name="name" select="1"/>
<newline/>
<field name="username" select="1"/>
<field name="password" select="1" password="True"/>
<field name="apikey" />
<field name="data_center" required="1"/>
<separator string="Status" colspan="4"/>
<group col="13" colspan="4">
<field name="state" nolabel="1"/>
<button name="button_approve" string="Approve" states="draft" type="object"/>
<button name="button_cancel" string="Cancel" states="draft,approved" type="object"/>
</group>
</form>
</field>
</record>
<record model="ir.actions.act_window" id="action_marketing_campaign_mailchimp_account">
<field name="name">All Mailchimp Accounts</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">marketing.campaign.mailchimp.account</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="view_id" ref="view_marketing_campaign_mailchimp_account_tree"/>
</record>
<menuitem id="menu_action_marketing_campaign_mailchimp_account" parent="menu_action_mailchimp" action="action_marketing_campaign_mailchimp_account" sequence="40"/>
</data>
</openerp>

View File

@ -12,19 +12,18 @@
<field name="arch" type="xml">
<tree string="Production">
<field name="date_planned"/>
<field name="origin"/>
<field name="bom_id" />
<field name="product_id"/>
<field name="bom_id" invisible="1"/>
<field name="product_id" invisible="1"/>
<field name="product_qty" sum='Product Qty'/>
<field name="nbr" string="#Production Orders" sum='#Production Orders'/>
<field name="state"/>
<field name="routing_id" invisible="1"/>
<field name="state" invisible="1"/>
<field name="picking_id" invisible="1"/>
<field name="priority" invisible="1"/>
<field name="year" invisible="1" />
<field name="month" invisible="1"/>
<field name="location_src_id" invisible="1"/>
<field name="location_dest_id" invisible="1"/>
<field name="company_id" groups="base.group_multi_company" invisible="1"/>
</tree>
</field>
</record>
@ -48,49 +47,56 @@
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter string="This Year" icon="terp-mrp" domain="[('year','=',time.localtime()[0])]" default="1" />
<filter string="This Month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
<separator orientation="vertical"/>
<field name="origin"/>
<field name="date_planned"/>
<filter icon="gtk-media-rewind" string=" 365 Days "
domain="[('date_start','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_start','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Production performed in last 365 Days"/>
<filter icon="gtk-media-rewind" string=" 30 Days "
name="month"
domain="[('date_start','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date_start','&gt;',(datetime.date.today()-datetime.timedelta(days=30)).strftime('%%Y-%%m-%%d'))]"
help="Production performed in last 30 days"/>
<filter icon="gtk-media-rewind"
string=" 7 Days "
separator="1"
domain="[('date_start','&lt;=', time.strftime('%%Y-%%m-%%d')), ('date_start','&gt;',(datetime.date.today()-datetime.timedelta(days=7)).strftime('%%Y-%%m-%%d'))]"
help="Production during last 7 days"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
<filter icon="terp-mrp" string="In Production" domain="[('state','=','in_production')]"/>
<filter icon="terp-mrp" string="Done" domain="[('state','=','done')]"/>
<separator orientation="vertical"/>
<field name="location_src_id" />
<field name="location_dest_id" />
</group>
<newline/>
<group expand="1" string="Group By...">
<filter string="Source Location" icon="terp-mrp" context="{'group_by':'location_src_id'}"/>
<filter string="Destination Location" icon="terp-mrp" context="{'group_by':'location_dest_id'}"/>
<filter string="Picking" icon="terp-mrp" context="{'group_by':'picking_id'}"/>
<filter string="Raw Material Location" icon="terp-mrp" context="{'group_by':'location_src_id'}"/>
<filter string="Finished Products Location" icon="terp-mrp" context="{'group_by':'location_dest_id'}"/>
<separator orientation="vertical"/>
<filter string="Routing" icon="terp-mrp" context="{'group_by':'routing_id'}"/>
<filter string="Product" name="Product" icon="terp-mrp" context="{'group_by':'product_id'}" />
<filter string="BOM" icon="terp-mrp" context="{'group_by':'bom_id'}"/>
<separator orientation="vertical"/>
<filter string="State" icon="terp-mrp" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="BOM" icon="terp-mrp" context="{'group_by':'bom_id'}"/>
<filter string="Month" icon="terp-mrp" context="{'group_by':'month'}"/>
<filter string="Company" icon="terp-mrp" context="{'group_by':'company_id'}"/>
<separator orientation="vertical"/>
<filter string="Day" icon="terp-mrp" context="{'group_by':'day'}"/>
<filter string="Month" name="month" icon="terp-mrp" context="{'group_by':'month'}"/>
<filter string="Year" icon="terp-mrp" context="{'group_by':'year'}"/>
</group>
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<filter icon="terp-mrp" string="Draft" domain="[('state','=','draft')]"/>
<filter icon="terp-mrp" string="Picking Exception" domain="[('state','=','picking_except')]"/>
<separator orientation="vertical"/>
<filter icon="terp-mrp" string="Waiting Goods" domain="[('state','=','confirmed')]"/>
<filter icon="terp-mrp" string="Ready to Produce" domain="[('state','=','ready')]"/>
<separator orientation="vertical"/>
<filter icon="terp-mrp" string="In Production" domain="[('state','=','in_production')]"/>
<filter icon="terp-mrp" string="Done" domain="[('state','=','done')]"/>
<filter icon="terp-mrp" string="Cancelled" domain="[('state','=','cancel')]"/>
<newline/>
<filter icon="terp-mrp" string="Not urgent" domain="[('priority','=','0')]"/>
<filter icon="terp-mrp" string="Normal" domain="[('priority','=','1')]"/>
<separator orientation="vertical"/>
<filter icon="terp-mrp" string="Urgent" domain="[('priority','=','2')]"/>
<filter icon="terp-mrp" string="Very Urgent" domain="[('priority','=','3')]"/>
<separator orientation="vertical"/>
<field name="priority"/>
<separator orientation="vertical"/>
<field name="company_id" groups="base.group_multi_company"/>
<newline/>
<field name="date_start"/>
<field name="date_finnished"/>
<field name="date_planned"/>
<field name="date_finnished"/>
</group>
</search>
</field>
@ -102,7 +108,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
<field name="context">{'search_default_Product': 1}</field>
<field name="context">{'search_default_Product': 1,'search_default_month':1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>

View File

@ -446,9 +446,9 @@ class product_product(osv.osv):
'outgoing_qty': fields.function(_product_outgoing_qty, method=True, type='float', string='Outgoing'),
'price': fields.function(_product_price, method=True, type='float', string='Pricelist', digits_compute=dp.get_precision('Sale Price')),
'lst_price' : fields.function(_product_lst_price, method=True, type='float', string='List Price', digits_compute=dp.get_precision('Sale Price')),
'code': fields.function(_product_code, method=True, type='char', string='Code'),
'code': fields.function(_product_code, method=True, type='char', string='Reference'),
'partner_ref' : fields.function(_product_partner_ref, method=True, type='char', string='Customer ref'),
'default_code' : fields.char('Code', size=64),
'default_code' : fields.char('Reference', size=64),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the product without removing it."),
'variants': fields.char('Variants', size=64),
'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=False),
@ -676,7 +676,20 @@ class pricelist_partnerinfo(osv.osv):
_order = 'min_quantity asc'
pricelist_partnerinfo()
class res_users(osv.osv):
_name = 'res.users'
_inherit = 'res.users'
def create(self, cr, uid, data, context={}):
user_id = super(res_users, self).create(cr, uid, data, context)
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'product', 'ir_ui_view_sc_product0')
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
copy_id = self.pool.get('ir.ui.view_sc').copy(cr, uid, view_id, default = {
'user_id': user_id}, context=context)
return user_id
res_users()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -21,32 +21,27 @@
<field name="category_id" ref="product_uom_categ_unit"/>
<field name="name">PCE</field>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
<field name="rounding">1.0</field>
</record>
<record id="product_uom_kgm" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">KGM</field>
<field name="factor">1000.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_hour" model="product.uom">
<field name="name">Hour</field>
<field eval="uom_categ_wtime" name="category_id"/>
<field name="factor">8.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_day" model="product.uom">
<field name="name">Day</field>
<field eval="uom_categ_wtime" name="category_id"/>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="product_uom_ton" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">TON</field>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<!--

View File

@ -98,7 +98,7 @@
<group colspan="2" col="2" name="status">
<separator string="Status" colspan="2"/>
<field name="categ_id"/>
<field name="categ_id" select="1" groups="base.group_extended"/>
<field name="state"/>
<field groups="base.group_extended" name="product_manager"/>
</group>

View File

@ -7,16 +7,16 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-09-08 13:21+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-05-31 12:41+0000\n"
"Last-Translator: Grzegorz Grzelak (Cirrus.pl) <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: profile_crm
#: model:ir.module.module,description:profile_crm.module_meta_information
msgid "Profile for CRM"
msgstr ""
msgstr "Profil dla CRM"

View File

@ -31,6 +31,7 @@ class report_project_task_user(osv.osv):
'day': fields.char('Day', size=128, readonly=True),
'year': fields.char('Year',size=64,required=False, readonly=True),
'user_id':fields.many2one('res.users', 'Assigned To', readonly=True),
'done_by':fields.many2one('res.users', 'Done By', readonly=True),
'date_start': fields.date('Starting Date',readonly=True),
'no_of_days': fields.integer('# of Days', size=128, readonly=True),
'description': fields.text('Description',readonly=True),
@ -41,11 +42,13 @@ class report_project_task_user(osv.osv):
'hours_effective': fields.float('Effective Hours', readonly=True),
'hours_delay': fields.float('Avg. Plan.-Eff.', readonly=True),
'remaining_hours': fields.float('Remaining Hours', readonly=True),
'progress': fields.float('Progress', readonly=True),
'total_hours': fields.float('Total Hours', readonly=True),
'closing_days': fields.float('Days to Close', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Days to close the task"),
'opening_days': fields.float('Days to Open', digits=(16,2), readonly=True, group_operator="avg",
help="Number of Days to Open the task"),
'delay_endings_days': fields.float('Overpass Delay', digits=(16,2), readonly=True, group_operator="avg"),
'nbr': fields.integer('# of tasks', readonly=True),
'priority' : fields.selection([('4','Very Low'),
('3','Low'),
@ -62,7 +65,7 @@ class report_project_task_user(osv.osv):
('cancelled', 'Cancelled'),
('done', 'Done')],
'State', readonly=True),
'company_id': fields.many2one('res.company', 'Company',readonly=True),
'company_id': fields.many2one('res.company', 'Company',readonly=True, groups="base.group_multi_company"),
'partner_id': fields.many2one('res.partner', 'Partner',readonly=True),
'type': fields.many2one('project.task.type', 'Stage',readonly=True),
@ -83,6 +86,7 @@ class report_project_task_user(osv.osv):
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY') as date_deadline,
sum(cast(to_char(date_trunc('day',t.date_end) - date_trunc('day',t.date_start),'DD') as int)) as no_of_days,
t.user_id,
sum(progress) as progress,
t.project_id,
t.state,
t.priority,
@ -90,11 +94,13 @@ class report_project_task_user(osv.osv):
t.company_id,
t.partner_id,
t.type,
w.user_id as done_by,
sum(remaining_hours) as remaining_hours,
sum(total_hours) as total_hours,
sum(planned_hours) as hours_planned,
avg(extract('epoch' from (t.date_end-t.create_date)))/(3600*24) as closing_days,
avg(extract('epoch' from (t.date_start-t.create_date)))/(3600*24) as opening_days,
avg(extract('epoch' from (t.date_deadline-t.date_end)))/(3600*24) as delay_endings_days,
sum(w.hours) as hours_effective,
((sum(planned_hours)-sum(w.hours))/count(distinct t.id))::decimal(16,2) as hours_delay
from project_task t
@ -104,6 +110,7 @@ class report_project_task_user(osv.osv):
to_char(date_start, 'MM'),
t.priority,
t.user_id,
w.user_id,
t.state,
date_trunc('day',t.date_end),
to_date(to_char(t.date_deadline, 'dd-MM-YYYY'),'dd-MM-YYYY'),

View File

@ -12,6 +12,7 @@
<field name="name" invisible="1"/>
<field name="project_id" invisible="1"/>
<field name="user_id" invisible="1"/>
<field name="done_by" invisible="1"/>
<field name="date_deadline" invisible="1"/>
<field name="state" invisible="1"/>
<field name="date_start" invisible="1"/>
@ -30,7 +31,9 @@
<field name="hours_effective" sum='Effective Hours'/>
<field name="hours_delay" sum='Avg. Plan.-Eff.'/>
<field name="opening_days" sum='Days to Open'/>
<field name="delay_endings_days" sum='OverPass delay'/>
<field name="closing_days" sum='Days to Close'/>
<field name="progress" sum='Progress' widget='progressbar'/>
</tree>
</field>
</record>
@ -54,7 +57,7 @@
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Tasks Analysis">
<group>
<group colspan="10" col="12">
<filter icon="gtk-media-rewind" string=" 365 Days "
domain="[('date_start','&lt;=', time.strftime('%%Y-%%m-%%d')),('date_start','&gt;',(datetime.date.today()-datetime.timedelta(days=365)).strftime('%%Y-%%m-%%d'))]"
help="Tasks performed in last 365 Days"/>
@ -104,12 +107,13 @@
</field>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="10" col="11">
<group expand="1" string="Group By..." colspan="10" col="12">
<filter string="User" name="User" icon="terp-project" context="{'group_by':'user_id'}" />
<filter string="Project" icon="terp-project" context="{'group_by':'project_id'}"/>
<separator orientation="vertical"/>
<filter string="Partner" icon="terp-project" context="{'group_by':'partner_id'}" />
<filter string="Task" icon="terp-project" context="{'group_by':'name'}" />
<filter string="Done By" icon="terp-project" context="{'group_by':'done_by'}" />
<separator orientation="vertical"/>
<filter string="State" icon="terp-project" context="{'group_by':'state'}"/>
<filter string="Company" icon="terp-project" context="{'group_by':'company_id'}" groups="base.group_multi_company"/>
@ -122,9 +126,11 @@
<newline/>
<group expand="0" string="Extended options..." colspan="10" col="12" groups="base.group_extended">
<field name="type" widget="selection"/>
<field name="done_by" widget="selection"/>
<separator orientation="vertical"/>
<field name="date_start"/>
<field name="date_deadline"/>
<field name="date_end"/>
<separator orientation="vertical"/>
<field name="priority"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>

View File

@ -113,7 +113,7 @@ class project_issue(osv.osv, crm.crm_case):
'thread_id': fields.many2one('mailgate.thread', 'Thread', required=False),
'id': fields.integer('ID'),
'name': fields.char('Name', size=128, required=True),
'active': fields.boolean('Active', required=False),
'active': fields.boolean('Active', required=False),
'create_date': fields.datetime('Creation Date' , readonly=True),
'write_date': fields.datetime('Update Date' , readonly=True),
'date_deadline': fields.date('Deadline'),

View File

@ -114,20 +114,27 @@
<field name="date"/>
<field name="email_to"/>
<field name="email_from"/>
</group>
<newline/>
<field name="description" colspan="4" nolabel="1"/>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="description"/>
<field name="email_to"/>
<field name="date"/>
</tree>
</group>
<notebook colspan="4">
<page string="Details">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Attachments">
<field name="attachment_ids" colspan="4" readonly="1" nolabel="1"/>
</page>
</notebook>
<button colspan="4"
string="Reply to Last Email"
name="%(crm.action_crm_send_mail)d"
context="{'mail':'reply', 'model': 'project.issue'}"
icon="gtk-undo" type="action" />
</form>
<tree string="Communication history">
<field name="date"/>
<field name="email_from" />
<field name="email_to"/>
<field name="description"/>
</tree>
</field>
<button colspan="4" string="Send New Email"
name="%(crm.action_crm_send_mail)d"
@ -177,6 +184,12 @@
<field name="arch" type="xml">
<search string="Issue Tracker Search">
<group colspan="4" col="20">
<filter string="Current" domain="[('state','in',('open','draft'))]" help="Draft and Open Issues" icon="terp-project" default="1"/>
<filter string="In Progress" domain="[('state','=','open')]" help="Open Issues" icon="terp-project"/>
<filter string="Pending" domain="[('state','=','pending')]" help="Pending Issues" icon="terp-project"/>
<separator orientation="vertical"/>
<filter icon="gtk-home" string=" Today "
separator="1"
domain="[('date','=',time.strftime('%%Y-%%m-%%d'))]"
@ -209,6 +222,9 @@
context="{'group_by':'partner_id'}" />
<filter string="Salesman" icon="terp-crm"
domain="[]" context="{'group_by':'user_id'}" />
<separator orientation="vertical" />
<filter string="Month" icon="terp-crm"
domain="[]" context="{'group_by':'create_date'}" />
<separator orientation="vertical" />
</group>
</search>

View File

@ -7,16 +7,16 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2009-09-08 14:38+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-05-31 12:41+0000\n"
"Last-Translator: Grzegorz Grzelak (Cirrus.pl) <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 04:20+0000\n"
"X-Launchpad-Export-Date: 2010-06-01 03:44+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: project_retro_planning
#: model:ir.module.module,shortdesc:project_retro_planning.module_meta_information
msgid "Project Retro planning"
msgstr ""
msgstr "Wsteczne planowanie projektu"

View File

@ -261,12 +261,10 @@ class purchase_order(osv.osv):
self.write(cr, uid, ids, {'state': 'approved', 'date_approve': time.strftime('%Y-%m-%d')})
return True
#TODO: implement messages system
def wkf_confirm_order(self, cr, uid, ids, context={}):
todo = []
for po in self.browse(cr, uid, ids):
if self.pool.get('res.partner.event.type').check(cr, uid, 'purchase_open'):
self.pool.get('res.partner.event').create(cr, uid, {'name':'Purchase Order: '+po.name, 'partner_id':po.partner_id.id, 'date':time.strftime('%Y-%m-%d %H:%M:%S'), 'user_id':uid, 'partner_type':'retailer', 'probability': 1.0, 'planned_cost':po.amount_untaxed})
for po in self.browse(cr, uid, ids):
if not po.order_line:
raise osv.except_osv(_('Error !'),_('You can not confirm purchase order without Purchase Order Lines.'))
for line in po.order_line:

View File

@ -7,11 +7,6 @@
<field name="object">purchase.order</field>
</record>
<record id="event_type_purchase_open" model="res.partner.event.type">
<field name="name">Purchase: Purchase Confirmation</field>
<field name="key">purchase_open</field>
</record>
<record id="pricelist_type_purchase" model="product.pricelist.type">
<field name="name">Purchase Pricelist</field>
<field name="key">purchase</field>

View File

@ -29,7 +29,12 @@ class sale_report(osv.osv):
_auto = False
_rec_name = 'date'
_columns = {
'date': fields.date('Date', readonly=True),
'date': fields.date('Date Order', readonly=True),
'date_confirm': fields.date('Date Confirm', readonly=True),
'shipped':fields.boolean('Shipped', readonly=True),
'paid':fields.float('Picked', readonly=True),
'shipped_qty_1':fields.integer('Shipped Qty', readonly=True),
'paid_qty':fields.float('Paid Qty', readonly=True),
'year': fields.char('Year', size=4, readonly=True),
'month':fields.selection([('01','January'), ('02','February'), ('03','March'), ('04','April'),
('05','May'), ('06','June'), ('07','July'), ('08','August'), ('09','September'),
@ -65,45 +70,39 @@ class sale_report(osv.osv):
tools.drop_view_if_exists(cr, 'sale_report')
cr.execute("""
create or replace view sale_report as (
select
min(l.id) as id,
select el.*,
(select count(1) from sale_order_line where order_id = s.id) as nbr,
s.date_order as date,
s.date_confirm as date_confirm,
to_char(s.date_order, 'YYYY') as year,
to_char(s.date_order, 'MM') as month,
to_char(s.date_order, 'YYYY-MM-DD') as day,
l.product_id as product_id,
u.name as uom_name,
sum(l.product_uom_qty * u.factor) as product_uom_qty,
s.partner_id as partner_id,
s.user_id as user_id,
s.shop_id as shop_id,
s.company_id as company_id,
extract(epoch from avg(s.date_confirm-s.create_date))/(24*60*60)::decimal(16,2) as delay,
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor))::decimal(16,2) as price_average,
count(*) as nbr,
extract(epoch from (s.date_confirm-s.create_date))/(24*60*60)::decimal(16,2) as delay,
s.state,
pt.categ_id,
s.shipped,
s.shipped::integer as shipped_qty_1,
s.pricelist_id as pricelist_id,
s.project_id as analytic_account_id
from
from
sale_order s,
(
select l.id as id,
l.product_id as product_id,
u.name as uom_name,
sum(l.product_uom_qty * u.factor) as product_uom_qty,
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty * u.factor))::decimal(16,2) as price_average,
pt.categ_id, l.order_id
from
sale_order_line l
left join sale_order s on (s.id=l.order_id)
left join product_uom u on (u.id=l.product_uom)
left join product_template pt on (pt.id=l.product_id)
group by
s.date_order,
s.partner_id,
l.product_id,
l.product_uom,
s.user_id,
pt.categ_id,
u.name,
s.state,
s.shop_id,
s.company_id,
s.pricelist_id,
s.project_id
group by l.id, l.order_id, l.product_id, u.name, pt.categ_id) el
where s.id = el.order_id
)
""")
sale_report()

View File

@ -20,12 +20,12 @@
<field name="categ_id" invisible="1"/>
<field name="nbr" sum="# of Lines"/>
<field name="product_uom_qty" sum="# of Qty"/>
<field name="shipped_qty_1"/>
<field name="uom_name" invisible="not context.get('set_visible',False)"/>
<field name="price_average" avg="Average Price"/>
<field name="price_total" sum="Total Price"/>
<field name="delay" avg="Days to Close"/>
<field name="state" invisible="1"/>
<field name="pricelist_id" invisible="1"/>
<field name="analytic_account_id" invisible="1"/>
</tree>
</field>
@ -71,6 +71,10 @@
string="Sales"
domain="[('state','not in',('draft','done','cancel'))]"/>
<separator orientation="vertical"/>
<filter icon="terp-sale"
string="Picked"
domain="[('shipped','=',True)]"/>
<separator orientation="vertical"/>
<field name="partner_id"/>
<field name="product_id"/>
<field name="user_id" widget="selection">
@ -91,7 +95,6 @@
<filter string="Partner" icon="terp-sale" context="{'group_by':'partner_id'}"/>
<filter string="State" icon="terp-sale" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Pricelist" icon="terp-sale" context="{'group_by':'pricelist_id'}"/>
<filter string="Analytic Account" icon="terp-sale" context="{'group_by':'analytic_account_id'}"/>
<filter string="Category of Product" icon="terp-sale" context="{'group_by':'categ_id'}"/>
<separator orientation="vertical"/>
@ -102,6 +105,7 @@
<newline/>
<group expand="0" string="Extended options..." groups="base.group_extended">
<field name="date"/>
<field name="date_confirm"/>
<separator orientation="vertical"/>
<field name="shop_id" widget="selection"/>
<field name="state"/>

View File

@ -49,7 +49,6 @@ def _incoterm_get(self, cr, uid, context=None):
cr.execute('select code, code||\', \'||name from stock_incoterms where active')
return cr.fetchall()
class sale_order(osv.osv):
_name = "sale.order"
_log_create = True

View File

@ -9,16 +9,6 @@
<field name="object">sale.order</field>
</record>
<!--
Partner event type
-->
<record id="event_type_sale_open" model="res.partner.event.type">
<field name="name">SALE: Sale Confirmation</field>
<field name="key">sale_open</field>
</record>
<!--
Resource: sale.shop
-->

View File

@ -192,6 +192,7 @@
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Advance Invoice" type="action" icon="gtk-execute"/>
</group>
<group col="13" colspan="4">
<field name="state"/>
@ -384,6 +385,11 @@
<field colspan="4" name="tax_id" domain="[('parent_id','=',False),('type_tax_use','&lt;&gt;','purchase')]" nolabel="1"/>
<separator colspan="4" string="States"/>
<field name="state"/>
<button colspan="1"
name="%(action_view_sale_order_line_make_invoice)d"
string="Make Invoice"
type="action"
icon="gtk-print" />
<group col="2" colspan="2">
<button name="button_done"
states="confirmed,exception"

View File

@ -14,13 +14,14 @@
</field>
</record>
<act_window name="Make Invoices"
res_model="sale.order.line.make.invoice"
src_model="sale.order.line"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_sale_order_line_make_invoice"/>
<record id="action_view_sale_order_line_make_invoice" model="ir.actions.act_window">
<field name="name">Make Invoices</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.order.line.make.invoice</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
</data>
</openerp>

View File

@ -9,7 +9,7 @@
<field name="inherit_id" ref="crm.crm_case_form_view_oppor"/>
<field name="arch" type="xml">
<field name="priority" position="after">
<button string="Convert to Quote" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
<button string="Create a Sale Order" icon="terp-sale" name="%(sale_crm_wizard)d" type="action"/>
<label colspan="2" string=""/>
</field>
</field>

View File

@ -28,7 +28,7 @@ import pooler
from tools.translate import _
sale_form = """<?xml version="1.0"?>
<form string="Convert to Quote">
<form string="Create a Sale Order">
<field name="partner_id" required="True"/>
<field name="shop_id" required="True"/>
<field name="analytic_account"/>
@ -135,10 +135,10 @@ class make_sale(wizard.interface):
if data['form']['close']:
case_obj.case_close(cr, uid, data['ids'])
if not new_ids:
return {}
if len(new_ids)<=1:
value = {
'domain': str([('id', 'in', new_ids)]),
@ -159,7 +159,7 @@ class make_sale(wizard.interface):
'type': 'ir.actions.act_window',
'res_id':new_ids
}
return value
states = {

View File

@ -18,10 +18,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import sale_journal
import sale_journal_inherit
import sale_journal_report
import sale_journal_picking_report
import report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -28,7 +28,7 @@
The sale journal modules allows you to categorise your
sales and deliveries (picking lists) between different journals.
This module is very helpful for bigger companies that
work by departments.
works by departments.
You can use journal for different purposes, some examples:
* isolate sales of different departments
@ -54,8 +54,7 @@
'update_xml': [
'security/ir.model.access.csv',
'sale_journal_view.xml',
'picking_journal_view.xml',
'picking_journal_view_report.xml'
'report/sale_journal_report_view.xml',
],
'demo_xml': ['sale_journal_demo.xml'],
'installable': True,

View File

@ -1,110 +0,0 @@
<openerp>
<data>
<record model="ir.ui.view" id="view_picking_journal_form">
<field name="name">sale_journal.picking.journal.form</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking Journal">
<notebook>
<page string="Journal">
<separator string="Journal Information" colspan="4"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="date_created"/>
<field name="date_validation"/>
<separator string="States" colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="gtk-open"/>
<button name="button_close" string="Close Journal" states="open" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Picking">
<button string="Cancel Picking" name="button_picking_cancel" states="draft,open" type="object" icon="gtk-cancel"/>
<newline/>
<field name="picking_stats_ids" colspan="4" nolabel="1"/>
</page><page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_tree">
<field name="name">sale_journal.picking.journal.tree</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking Journal">
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_search">
<field name="name">sale_journal.picking.journal.search</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking Journal">
<group col="8" colspan="4">
<filter icon="terp-hr" string="Open" domain="[('state','=','open')]" help="Open Picking Journals"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="code"/>
<field name="user_id" widget="selection"/>
<field name="date"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_definition_picking_journal">
<field name="name">Picking journals</field>
<field name="res_model">sale_journal.picking.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_picking_journal_search"/>
</record>
<menuitem name="Picking Journals" id="menu_definition_journal_picking" parent="stock.menu_stock_configuration" action="action_definition_picking_journal"/>
<record model="ir.actions.act_window" id="action_invoice_type_tree">
<field name="name">Picking by invoice_method</field>
<field name="name">sale_journal.invoice.type.tree</field>
<field name="res_model">sale_journal.invoice.type</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">tree</field>
</record>
<!--<menuitem name="Picking to Invoice" id="menu_definition_journal_picking_invoice" parent="stock.menu_action_picking_tree"/>-->
<!--<menuitem name="Picking by Invoice Method" id="menu_definition_journal_picking_invoice_method" parent="menu_definition_journal_picking_invoice" action="action_invoice_type_tree"/>-->
<record model="ir.actions.act_window" id="action_invoice_type_picking_open">
<field name="name">Picking to invoice</field>
<field name="res_model">stock.picking</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">[('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
</record>
<record model="ir.values" id="ir_open_invoice_type">
<field name="key2">tree_but_open</field>
<field name="model">sale_journal.invoice.type</field>
<field name="name">Picking to invoice</field>
<field name="value" eval="'ir.actions.act_window,%d'%action_invoice_type_picking_open"/>
<field name="object" eval="True"/>
</record>
</data>
</openerp>

View File

@ -1,151 +0,0 @@
<openerp>
<data>
#
# Pickings by invoice type
#
<record model="ir.ui.view" id="view_picking_invoice_type_stats_form">
<field name="name">sale_journal.invoice.type.stats.form</field>
<field name="model">sale_journal.invoice.type.stats</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking by invoice method">
<field name="name"/>
<field name="month"/>
<field name="invoice_state"/>
<field name="state"/>
<field name="invoice_type_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_picking_invoice_type_stats_tree">
<field name="name">sale_journal.invoice.type.stats.tree</field>
<field name="model">sale_journal.invoice.type.stats</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking by invoice method">
<field name="name"/>
<field name="month"/>
<field name="invoice_state"/>
<field name="state"/>
<field name="invoice_type_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_picking_invoice_type_stats_search">
<field name="name">sale_journal.invoice.type.stats.search</field>
<field name="model">sale_journal.invoice.type.stats</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking by invoice method">
<group col="8" colspan="4">
<filter icon="terp-sale" string="This Year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice method in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by invoice method in this month"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="month"/>
<field name="invoice_state"/>
<field name="state"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_invoice_type_picking_stats_open">
<field name="name">Statistics on picking to invoice</field>
<field name="res_model">sale_journal.invoice.type.stats</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>
<menuitem name="Picking Journal" id="menu_definition_journal_reporting" parent="stock.next_id_61"/>
<record model="ir.actions.act_window" id="action_invoice_type_picking_stats_open_menu_all">
<field name="name">Picking by invoice method</field>
<field name="res_model">sale_journal.invoice.type.stats</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_picking_invoice_type_stats_search"/>
</record>
<menuitem name="Picking by Invoice Method" id="menu_invoice_type_picking_stats_open_all" parent="menu_definition_journal_reporting" action="action_invoice_type_picking_stats_open_menu_all"/>
#
# Packing by journal
#
<record model="ir.ui.view" id="view_picking_journal_stats_form">
<field name="name">sale_journal.picking.stats.form</field>
<field name="model">sale_journal.picking.stats</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking by journals">
<field name="name"/>
<field name="month"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_stats_tree">
<field name="name">sale_journal.picking.stats.tree</field>
<field name="model">sale_journal.picking.stats</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking by journals">
<field name="name"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_stats_search">
<field name="name">sale_journal.picking.stats.search</field>
<field name="model">sale_journal.picking.stats</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking by journals">
<group col="8" colspan="4">
<filter icon="terp-sale" string="This Year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by journals in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('month','=',time.strftime('%%m'))]" help="Picking by journals in this month"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="month"/>
<field name="state"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_picking_picking_stats_open_menu_all">
<field name="name">Picking by journal</field>
<field name="res_model">sale_journal.picking.stats</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_picking_journal_stats_search"/>
</record>
<menuitem name="Picking by Journal" id="menu_picking_picking_stats_open_all" parent="menu_definition_journal_reporting" action="action_picking_picking_stats_open_menu_all"/>
</data>
</openerp>

View File

@ -0,0 +1,24 @@
# -*- 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/>.
#
##############################################################################
import sale_journal_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,141 @@
# -*- 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_report(osv.osv):
_name = "sale.journal.report"
_description = "Sales Orders by Journal"
_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),
'state': fields.selection([
('draft', 'Quotation'),
('waiting_date', 'Waiting Schedule'),
('manual', 'Manual in progress'),
('progress', 'In progress'),
('shipping_except', 'Shipping Exception'),
('invoice_except', 'Invoice Exception'),
('done', 'Done'),
('cancel', 'Cancel')
], 'Order State', readonly=True),
'journal_id':fields.many2one('sale_journal.sale.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_report')
cr.execute("""
create or replace view sale_journal_report as (
select
min(l.id) as id,
to_char(s.date_order, 'YYYY') as name,
to_char(s.date_order,'MM') as month,
s.state,
s.journal_id,
sum(l.product_uom_qty) as quantity,
count(*),
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
from sale_order s
right join sale_order_line l on (s.id=l.order_id)
group by s.journal_id , to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'), s.state
)
""")
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:

View File

@ -0,0 +1,187 @@
<openerp>
<data>
<!-- Sales by journal's view -->
<record model="ir.ui.view" id="view_sale_journal_report_tree">
<field name="name">sale.journal.report.tree</field>
<field name="model">sale.journal.report</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales by Journal">
<field name="name" invisible="1"/>
<field name="state" 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>
<!-- sales journal graph view -->
<record id="view_sale_journal_graph" model="ir.ui.view">
<field name="name">sale.journal.report.graph</field>
<field name="model">sale.journal.report</field>
<field name="type">graph</field>
<field name="arch" type="xml">
<graph string="Sales journal Statistics" type="bar">
<field name="journal_id"/>
<field name="price_total"/>
</graph>
</field>
</record>
<!-- sales by journal search view -->
<record model="ir.ui.view" id="view_sale_journal_report_search">
<field name="name">sale.journal.report.search</field>
<field name="model">sale.journal.report</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-sale" string="This Year" domain="[('name','!=','')]" help="Sale journal in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('name','=',time.strftime('%%Y-%%m-01'))]" help="Sale journal in this month"/>
<separator orientation="vertical"/>
<filter icon="terp-sale"
string="Quotations"
domain="[('state','=','draft')]"/>
<filter icon="terp-sale"
string="Waiting Schedule"
domain="[('state','=','waiting_date')]"/>
<filter icon="terp-sale"
string="In progress"
domain="[('state','=','progress')]"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="state" select="1"/>
<field name="journal_id" widget="selection"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="12">
<filter string="journal" name="journal" icon="terp-sale" context="{'group_by':'journal_id'}"/>
<filter string="State" icon="terp-sale" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<!-- Action of sales by journal view-->
<record model="ir.actions.act_window" id="action_sale_journal_report_open_menu_all">
<field name="name">Sales by Journal</field>
<field name="res_model">sale.journal.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_report_search"/>
<field name="context">{'search_default_journal': 1,'group_by_no_leaf':1,'group_by':[]}</field>
</record>
<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"/>
<!-- 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-sale" string="This Year" name="year" domain="[('name','=',time.strftime('%%Y'))]" help="Picking by invoice or by journal method in this year"/>
<filter icon="terp-sale" 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-stock"
string="Draft"
domain="[('state','=','draft')]"/>
<filter icon="terp-stock"
string="Pending"
domain="[('state','=','waiting')]"/>
<filter icon="terp-stock"
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-stock" context="{'group_by':'journal_id'}"/>
<filter string="Invoice" icon="terp-stock" context="{'group_by':'invoice_type_id'}"/>
<separator orientation="vertical"/>
<filter string="Invoice state" icon="terp-stock" context="{'group_by':'invoice_state'}"/>
<filter string="state" icon="terp-stock" 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"/>
</data>
</openerp>

View File

@ -25,7 +25,7 @@ import time
class sale_journal_invoice_type(osv.osv):
_name = 'sale_journal.invoice.type'
_description = 'Invoice Type'
_description = 'Invoice Types'
_columns = {
'name': fields.char('Invoice Type', size=64, required=True),
'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the invoice type without removing it."),
@ -48,12 +48,12 @@ class sale_journal(osv.osv):
'date': fields.date('Journal date', required=True),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_validation': fields.date('Validation date', readonly=True),
'sale_stats_ids': fields.one2many("sale_journal.sale.stats", "journal_id", 'Sale Stats', readonly=True),
'sale_stats_ids': fields.one2many("sale.journal.report", "journal_id", 'Sale Stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
('done','Done'),
], 'State', required=True),
], 'State', required=True, readonly=True),
'note': fields.text('Note'),
}
_defaults = {
@ -98,12 +98,12 @@ class picking_journal(osv.osv):
'date': fields.date('Journal date', required=True),
'date_created': fields.date('Creation date', readonly=True, required=True),
'date_validation': fields.date('Validation date', readonly=True),
'picking_stats_ids': fields.one2many("sale_journal.picking.stats", "journal_id", 'Journal Stats', readonly=True),
'picking_stats_ids': fields.one2many("sale.journal.picking.report", "journal_id", 'Journal Stats', readonly=True),
'state': fields.selection([
('draft','Draft'),
('open','Open'),
('done','Done'),
], 'Creation date', required=True),
], 'Creation date', required=True, readonly=True),
'note': fields.text('Note'),
}
_defaults = {
@ -130,5 +130,55 @@ class picking_journal(osv.osv):
return True
picking_journal()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
#==============================================
# sale journal inherit
#==============================================
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'property_invoice_type': fields.property(
'sale_journal.invoice.type',
type='many2one',
relation='sale_journal.invoice.type',
string="Invoicing Method",
method=True,
view_load=True,
group_name="Accounting Properties",
help="The type of journal used for sales and picking."),
}
res_partner()
class picking(osv.osv):
_inherit="stock.picking"
_columns = {
'journal_id': fields.many2one('sale_journal.picking.journal', '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)
}
picking()
class sale(osv.osv):
_inherit="sale.order"
_columns = {
'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal'),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
}
def action_ship_create(self, cr, uid, ids, *args):
result = super(sale, self).action_ship_create(cr, uid, ids, *args)
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in order.picking_ids]
self.pool.get('stock.picking').write(cr, uid, pids, {
'invoice_type_id': order.invoice_type_id.id,
'sale_journal_id': order.journal_id.id
})
return result
def onchange_partner_id(self, cr, uid, ids, part):
result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
if part:
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:

View File

@ -1,73 +0,0 @@
# -*- 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 osv, fields
class res_partner(osv.osv):
_inherit = 'res.partner'
_columns = {
'property_invoice_type': fields.property(
'sale_journal.invoice.type',
type='many2one',
relation='sale_journal.invoice.type',
string="Invoicing Method",
method=True,
view_load=True,
group_name="Accounting Properties",
help="The type of journal used for sales and picking."),
}
res_partner()
class picking(osv.osv):
_inherit="stock.picking"
_columns = {
'journal_id': fields.many2one('sale_journal.picking.journal', '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)
}
picking()
class sale(osv.osv):
_inherit="sale.order"
_columns = {
'journal_id': fields.many2one('sale_journal.sale.journal', 'Journal'),
'invoice_type_id': fields.many2one('sale_journal.invoice.type', 'Invoice Type')
}
def action_ship_create(self, cr, uid, ids, *args):
result = super(sale, self).action_ship_create(cr, uid, ids, *args)
for order in self.browse(cr, uid, ids, context={}):
pids = [ x.id for x in order.picking_ids]
self.pool.get('stock.picking').write(cr, uid, pids, {
'invoice_type_id': order.invoice_type_id.id,
'sale_journal_id': order.journal_id.id
})
return result
def onchange_partner_id(self, cr, uid, ids, part):
result = super(sale, self).onchange_partner_id(cr, uid, ids, part)
if part:
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:

View File

@ -1,124 +0,0 @@
# -*- 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 report_sale_journal_invoice_type_stats(osv.osv):
_name = "sale_journal.invoice.type.stats"
_description = "Stats on picking by invoice method"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, 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),
'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),
'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),
}
_order = 'state,invoice_state,name desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_invoice_type_stats')
cr.execute("""
create or replace view sale_journal_invoice_type_stats 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,
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
left 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.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
)
""")
report_sale_journal_invoice_type_stats()
class report_sale_journal_picking(osv.osv):
_name = "sale_journal.picking.stats"
_description = "Picking lists by Journal"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'state': fields.selection([
('draft','draft'),
('auto','waiting'),
('confirmed','confirmed'),
('assigned','assigned'),
('done','done'),
('cancel','cancel'),
], 'State', 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),
'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),
}
_order = 'journal_id,name desc,price_total desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_picking_stats')
cr.execute("""
create or replace view sale_journal_picking_stats as (
select
min(l.id) as id,
to_char(s.date, 'YYYY') as name,
to_char(s.date, 'MM') as month,
s.state,
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)
right join sale_order_line ol on (l.sale_line_id=ol.id)
group by s.journal_id, to_char(s.date, 'YYYY'),to_char(s.date, 'MM'),s.state
)
""")
report_sale_journal_picking()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,73 +0,0 @@
# -*- 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 report_sale_journal_sale(osv.osv):
_name = "sale_journal.sale.stats"
_description = "Sales Orders by Journal"
_auto = False
_columns = {
'name': fields.char('Year',size=64,required=False, readonly=True),
'state': fields.selection([
('draft','Quotation'),
('waiting_date','Waiting Schedule'),
('manual','Manual in progress'),
('progress','In progress'),
('shipping_except','Shipping Exception'),
('invoice_except','Invoice Exception'),
('done','Done'),
('cancel','Cancel')
], 'Order State', readonly=True),
'journal_id':fields.many2one('sale_journal.sale.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),
'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),
}
_order = 'journal_id,name desc,price_total desc'
def init(self, cr):
tools.drop_view_if_exists(cr, 'sale_journal_sale_stats')
cr.execute("""
create or replace view sale_journal_sale_stats as (
select
min(l.id) as id,
to_char(s.date_order, 'YYYY') as name,
to_char(s.date_order,'MM') as month,
s.state,
s.journal_id,
sum(l.product_uom_qty) as quantity,
count(*),
sum(l.product_uom_qty*l.price_unit) as price_total,
(sum(l.product_uom_qty*l.price_unit)/sum(l.product_uom_qty))::decimal(16,2) as price_average
from sale_order s
right join sale_order_line l on (s.id=l.order_id)
group by s.journal_id, to_char(s.date_order, 'YYYY'),to_char(s.date_order, 'MM'),s.state
)
""")
report_sale_journal_sale()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -1,385 +1,469 @@
<openerp>
<data>
<record model="ir.ui.view" id="view_sale_journal_invoice_type_form">
<field name="name">sale_journal.invoice.type.form</field>
<field name="model">sale_journal.invoice.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice Type">
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="invoicing_method" select="1"/>
<newline/>
<field name="note" colspan="4"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_invoice_type_tree">
<field name="name">sale_journal.invoice.type.tree</field>
<field name="model">sale_journal.invoice.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoice Type">
<field name="name"/>
<field name="invoicing_method"/>
</tree>
</field>
</record>
<record model="ir.actions.act_window" id="action_definition_journal_invoice_type">
<field name="res_model">sale_journal.invoice.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- <menuitem name="Invoicing Methods" id="menu_definition_journal_invoice_type" parent="sale.menu_shop_configuration" action="action_definition_journal_invoice_type"/>-->
<record model="ir.ui.view" id="view_sale_journal_form">
<field name="name">sale_journal.sale.journal.form</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sale Journal">
<notebook>
<page string="Journal">
<separator string="Journal Information" colspan="4"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="date_created"/>
<field name="date_validation"/>
<separator string="States" colspan="4"/>
<field name="state"/>
<group col="3" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="gtk-open"/>
<button name="button_close" string="Close Journal" states="open" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open" type="object" icon="gtk-convert"/>
</group>
</page>
<page string="Sales">
<button string="Confirm Sales" name="button_sale_confirm" states="draft,open" type="object" icon="gtk-execute"/>
<button string="Cancel Sales" name="button_sale_cancel" states="draft,open" type="object" icon="gtk-cancel"/>
<newline/>
<field name="sale_stats_ids" colspan="4" nolabel="1">
<tree string="Sales">
<field name="name"/>
<field name="quantity"/>
<field name="price_total"/>
<field name="price_average"/>
<field name="count"/>
<field name="state"/>
</tree>
</field>
</page><page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_tree">
<field name="name">sale_journal.sale.journal.tree</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sale Journal">
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date"/>
<field name="state"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_search">
<field name="name">sale_journal.sale.journal.search</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-sale" string="Open" domain="[('state','=','open')]" help="Open Sale Journals"/>
<separator orientation="vertical"/>
<field name="name"/>
<field name="code"/>
<field name="user_id"/>
<field name="date" />
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_definition_journal">
<field name="res_model">sale_journal.sale.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="context">{"search_default_user_id":uid}</field>
<field name="search_view_id" ref="view_sale_journal_search"/>
</record>
<!-- <menuitem name="Sales Journals" id="menu_definition_journal" parent="sale.menu_shop_configuration" action="action_definition_journal"/>-->
<menuitem id="menu_sale_journal" name="Journal" parent="base.menu_base_config" sequence="60" />
<menuitem name="Sales Journals" id="menu_definition_journal" parent="menu_sale_journal" action="action_definition_journal"/>
<record model="ir.ui.view" id="sale_journal_sale_order">
<field name="name">sale.order.journal.view.form</field>
<field name="type">form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="invoiced" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_sale_order_tree">
<field name="name">sale.order.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<field name="state" position="after">
<field name="invoice_type_id"/>
<field name="journal_id"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml">
<field name="invoice_state" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_del">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_delivery_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree_del">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_delivery_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_in">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_in_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree_in">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_in_tree" />
<field name="arch" type="xml">
<field name="invoice_state" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_out">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree_out">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_tree" />
<field name="arch" type="xml">
<field name="invoice_state" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_sale_stats_tree">
<field name="name">sale_journal.sale.stats.tree</field>
<field name="model">sale_journal.sale.stats</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales by Journal">
<field name="name"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</tree>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_sale_stats_form">
<field name="name">sale_journal.sale.stats.form</field>
<field name="model">sale_journal.sale.stats</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales by Journal">
<field name="name"/>
<field name="state"/>
<field name="journal_id"/>
<field name="quantity"/>
<field name="count"/>
<field name="price_total"/>
<field name="price_average"/>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_sale_journal_sale_stats_search">
<field name="name">sale_journal.sale.stats.search</field>
<field name="model">sale_journal.sale.stats</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-sale" string="This Year" domain="[('name','!=','')]" help="Sale journal in this year"/>
<filter icon="terp-sale" string="This Month" domain="[('name','=',time.strftime('%%Y-%%m-01'))]" help="Sale journal in this month"/>
<separator orientation="vertical"/>
<data>
<!-- sale journal invoice Type's Form view -->
<record model="ir.ui.view" id="view_sale_journal_invoice_type_form">
<field name="name">sale_journal.invoice.type.form</field>
<field name="model">sale_journal.invoice.type</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice Type">
<field name="name" select="1"/>
<field name="active" select="1"/>
<field name="invoicing_method" select="1"/>
<newline/>
<field name="note" colspan="4"/>
</form>
</field>
</record>
<!-- sale journal invoice Type's tree view -->
<record model="ir.ui.view" id="view_sale_journal_invoice_type_tree">
<field name="name">sale_journal.invoice.type.tree</field>
<field name="model">sale_journal.invoice.type</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Invoice Type">
<field name="name"/>
<field name="invoicing_method"/>
</tree>
</field>
</record>
<!-- Action for sale journal invoice Type -->
<record model="ir.actions.act_window" id="action_definition_journal_invoice_type">
<field name="res_model">sale_journal.invoice.type</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
</record>
<!-- <menuitem name="Invoicing Methods" id="menu_definition_journal_invoice_type" parent="sale.menu_shop_configuration" action="action_definition_journal_invoice_type"/> -->
<!-- sale journal Form view -->
<record model="ir.ui.view" id="view_sale_journal_form">
<field name="name">sale_journal.sale.journal.form</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Journals">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_validation" select="1"/>
</group>
<notebook colspan="4">
<page string="Sales">
<field name="sale_stats_ids" colspan="4" nolabel="1">
<tree string="Sales">
<field name="name"/>
<field name="quantity"/>
<field name="price_total"/>
<field name="price_average"/>
<field name="count"/>
<field name="state"/>
</tree>
</field>
</page>
<page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
<field name="state"/>
<group col="6" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="gtk-open"/>
<button name="button_close" string="Close Journal" states="open" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open" type="object" icon="gtk-convert"/>
<button string="Confirm Sales" name="button_sale_confirm" states="draft,open" type="object" icon="gtk-execute"/>
<button string="Cancel Sales" name="button_sale_cancel" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<!-- Sale journal tree view -->
<record model="ir.ui.view" id="view_sale_journal_tree">
<field name="name">sale_journal.sale.journal.tree</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales Journals">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="state"/>
</tree>
</field>
</record>
<!-- Sale journal search view -->
<record model="ir.ui.view" id="view_sale_journal_search">
<field name="name">sale_journal.sale.journal.search</field>
<field name="model">sale_journal.sale.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Sales by Journal">
<group col="8" colspan="4">
<filter icon="terp-sale" string="My Sale Journals" domain="[('user_id','=',uid)]" help="My Sale Journals"/>
<filter icon="terp-sale" string="Open" domain="[('state','=','open')]" help="Open Sale Journals"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
</group>
</search>
</field>
</record>
<!-- Action for sale journal view -->
<record model="ir.actions.act_window" id="action_definition_journal">
<field name="res_model">sale_journal.sale.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_sale_journal_search"/>
</record>
<menuitem id="menu_definition_journal" name="Sales Journals" parent="base.menu_base_config" action="action_definition_journal" sequence="60" />
<!-- Inherit sales order form view -->
<record model="ir.ui.view" id="sale_journal_sale_order">
<field name="name">sale.order.journal.view.form</field>
<field name="type">form</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_form" />
<field name="arch" type="xml">
<field name="user_id" position="after">
<separator string="Journal" colspan="4"/>
<field name="journal_id" select="1" widget="selection"/>
<field name="invoice_type_id" select="1" widget="selection"/>
</field>
</field>
</record>
<!-- Inherit sales order tree view-->
<record model="ir.ui.view" id="sale_journal_sale_order_tree">
<field name="name">sale.order.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">sale.order</field>
<field name="inherit_id" ref="sale.view_order_tree" />
<field name="arch" type="xml">
<field name="state" position="after">
<field name="invoice_type_id"/>
<field name="journal_id"/>
</group>
</search>
</field>
</record>
</field>
</field>
</record>
<record model="ir.actions.act_window" id="action_sale_sale_stats_open_menu_all">
<field name="name">Sales by Journal</field>
<field name="res_model">sale_journal.sale.stats</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_sale_journal_sale_stats_search"/>
</record>
<!-- Inherit stock picking's form view -->
<record model="ir.ui.view" id="sale_journal_picking_order">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<menuitem name="Reporting" id="menu_definition_report_sales" parent="base.menu_base_partner" sequence="8"/>
<menuitem name="Sales by Journal" id="menu_sale_sale_stats_open_all" parent="menu_definition_report_sales" action="action_sale_sale_stats_open_menu_all"/>
<!-- Inherit stock picking's tree view -->
<record model="ir.ui.view" id="sale_journal_picking_order_tree">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.vpicktree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<!-- Inherit stock picking delivery's form view.-->
<record model="ir.ui.view" id="sale_journal_picking_order_del">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_delivery_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<!-- Inherit stock picking delivery's tree view.-->
<record model="ir.ui.view" id="sale_journal_picking_order_tree_del">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_delivery_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_in">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_in_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree_in">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_in_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_out">
<field name="name">stock.picking.journal.view.form</field>
<field name="type">form</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_form" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="sale_journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="sale_journal_picking_order_tree_out">
<field name="name">stock.picking.journal.view.tree</field>
<field name="type">tree</field>
<field name="model">stock.picking</field>
<field name="inherit_id" ref="stock.view_picking_out_tree" />
<field name="arch" type="xml">
<field name="origin" position="after">
<field name="journal_id" select="1"/>
<field name="invoice_type_id" select="1"/>
<field name="sale_journal_id" select="1"/>
</field>
</field>
</record>
<!-- Action of sale journal report in sale journal -->
<act_window name="Monthly sales"
domain="[('journal_id', '=', active_id)]"
res_model="sale.journal.report"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_journal_sale_stats"/>
<!-- Action of stock picking in picking journal -->
<act_window name="Assigned picking"
domain="[('journal_id', '=', active_id),('state', '=', 'assigned')]"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_assigned"/>
<!-- Action of stock picking in picking journal -->
<act_window name="Confirmed picking"
domain="[('journal_id', '=', active_id),('state', '=', 'confirmed')]"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_confirmed"/>
<!-- Action of stock picking in sale journal -->
<act_window name="Assigned picking"
domain="[('sale_journal_id', '=', active_id),('state', '=', 'assigned')]"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_assigned"/>
<act_window name="Monthly sales"
domain="[('journal_id', '=', active_id)]"
res_model="sale_journal.sale.stats"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_journal_sale_stats"/>
<!-- Action of stock picking in sale journal -->
<act_window name="Assigned picking"
domain="[('journal_id', '=', active_id),('state', '=', 'assigned')]"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_assigned"/>
<act_window name="Confirmed picking"
domain="[('sale_journal_id', '=', active_id),('state', '=', 'confirmed')]"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_confirmed"/>
<act_window name="Confirmed picking"
domain="[('journal_id', '=', active_id),('state', '=', 'confirmed')]"
res_model="stock.picking"
src_model="sale_journal.picking.journal"
id="act_sale_journal_picking_journal_2_stock_picking_confirmed"/>
<!-- Action of sale order in sale journal -->
<act_window name="Draft sales"
domain="[('journal_id', '=', active_id),('state', '=', 'draft')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_draft"/>
<!-- Action of sale order in sale journal -->
<act_window name="Approved sales"
domain="[('journal_id', '=', active_id),('state', '=', 'approved')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_approved"/>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.journal.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside">
<field name="property_invoice_type"/>
</page>
</field>
</record>
<!--=====================================================-->
<!-- picking journal view-->
<!--===================================================== -->
<record model="ir.ui.view" id="view_picking_journal_form">
<field name="name">sale_journal.picking.journal.form</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Picking Journal">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<newline/>
<field name="date" select="1"/>
<field name="date_created" select="1"/>
<field name="date_validation" select="1"/>
</group>
<notebook colspan="4">
<page string="Picking">
<field name="picking_stats_ids" colspan="4" nolabel="1"/>
</page>
<page string="Notes">
<field name="note" colspan="4" nolabel="1"/>
</page>
</notebook>
<field name="state"/>
<group col="6" colspan="2">
<button name="button_open" string="Open Journal" states="draft" type="object" icon="gtk-open"/>
<button name="button_close" string="Close Journal" states="open" type="object" icon="gtk-close"/>
<button name="button_draft" string="Set to Draft" states="close,open" type="object" icon="gtk-convert"/>
<button string="Cancel Picking" name="button_picking_cancel" states="draft,open" type="object" icon="gtk-cancel"/>
</group>
</form>
</field>
</record>
<record model="ir.ui.view" id="view_picking_journal_tree">
<field name="name">sale_journal.picking.journal.tree</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Picking Journal">
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1"/>
<field name="date" select="1"/>
<field name="state"/>
</tree>
</field>
</record>
<act_window name="Assigned picking"
domain="[('sale_journal_id', '=', active_id),('state', '=', 'assigned')]"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_assigned"/>
<!-- Picking journal tree view -->
<record model="ir.ui.view" id="view_picking_journal_search">
<field name="name">sale_journal.picking.journal.search</field>
<field name="model">sale_journal.picking.journal</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Picking Journals">
<group col="8" colspan="4">
<filter icon="terp-hr" string="My Picking Journals" domain="[('user_id','=',uid)]" help="My Picking Journals"/>
<filter icon="terp-hr" string="Open" domain="[('state','=','open')]" help="Open Picking Journals"/>
<separator orientation="vertical"/>
<field name="name" select="1"/>
<field name="code" select="1"/>
<field name="user_id" select="1" widget="selection"/>
<field name="date" select="1"/>
</group>
</search>
</field>
</record>
<!-- Action of Picking journals -->
<record model="ir.actions.act_window" id="action_definition_picking_journal">
<field name="name">Picking Journals</field>
<field name="res_model">sale_journal.picking.journal</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
<field name="search_view_id" ref="view_picking_journal_search"/>
</record>
<menuitem name="Picking Journals" id="menu_definition_journal_picking" parent="stock.menu_stock_configuration" action="action_definition_picking_journal"/>
<record model="ir.actions.act_window" id="action_invoice_type_tree">
<field name="name">Picking by invoice_method</field>
<field name="res_model">sale_journal.invoice.type</field>
<field name="type">ir.actions.act_window</field>
<field name="view_type">tree</field>
</record>
<record model="ir.actions.act_window" id="action_invoice_type_picking_open">
<field name="name">Picking to invoice</field>
<field name="res_model">stock.picking</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">[('state','=','done'),('invoice_state','=','2binvoiced'),('invoice_type_id','=',active_id)]</field>
</record>
<record model="ir.values" id="ir_open_invoice_type">
<field name="key2">tree_but_open</field>
<field name="model">sale_journal.invoice.type</field>
<field name="name">Picking to invoice</field>
<field name="value" eval="'ir.actions.act_window,%d'%action_invoice_type_picking_open"/>
<field name="object" eval="True"/>
</record>
<act_window name="Confirmed picking"
domain="[('sale_journal_id', '=', active_id),('state', '=', 'confirmed')]"
res_model="stock.picking"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_stock_picking_confirmed"/>
<act_window name="Draft sales"
domain="[('journal_id', '=', active_id),('state', '=', 'draft')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_draft"/>
<act_window name="Approved sales"
domain="[('journal_id', '=', active_id),('state', '=', 'approved')]"
res_model="sale.order"
src_model="sale_journal.sale.journal"
id="act_sale_journal_sale_journal_2_sale_order_approved"/>
<record id="view_partner_property_form" model="ir.ui.view">
<field name="name">res.partner.journal.property.form.inherit</field>
<field name="model">res.partner</field>
<field name="type">form</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<page string="Sales &amp; Purchases" position="inside">
<field name="property_invoice_type"/>
</page>
</field>
</record>
</data>
</data>
</openerp>

View File

@ -1,12 +1,7 @@
"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink"
"access_sale_journal_invoice_type_stats","sale_journal.invoice.type.stats","model_sale_journal_invoice_type_stats","sale.group_sale_user",1,0,0,0
"access_sale_journal_picking_stats","sale_journal.picking.stats","model_sale_journal_picking_stats","sale.group_sale_user",1,0,0,0
"access_sale_journal_invoice_type","sale_journal.invoice.type","model_sale_journal_invoice_type","sale.group_sale_user",1,0,0,0
"access_sale_journal_invoice_type_finance_invoice","sale_journal.invoice.type invoice","model_sale_journal_invoice_type","account.group_account_invoice",1,0,0,0
"access_sale_journal_invoice_type_partner_manager","sale_journal.invoice.type partner manager","model_sale_journal_invoice_type","base.group_partner_manager",1,0,0,0
"access_sale_journal_sale_journal","sale_journal.sale.journal","model_sale_journal_sale_journal","sale.group_sale_user",1,0,0,0
"access_sale_journal_picking_journal","sale_journal.picking.journal","model_sale_journal_picking_journal","sale.group_sale_user",1,0,0,0
"access_sale_journal_sale_stats","sale_journal.sale.stats","model_sale_journal_sale_stats","sale.group_sale_user",1,0,0,0
"access_sale_journal_invoice_type_manager","sale_journal.invoice.type.manager","model_sale_journal_invoice_type","sale.group_sale_manager",1,1,1,1
"access_sale_journal_sale_journal_manager","sale_journal.sale.journal.manager","model_sale_journal_sale_journal","sale.group_sale_manager",1,1,1,1
"access_sale_journal_picking_journal_manager","sale_journal.picking.journal.manager","model_sale_journal_picking_journal","sale.group_sale_manager",1,1,1,1

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
access_sale_journal_invoice_type_stats sale_journal.invoice.type.stats model_sale_journal_invoice_type_stats sale.group_sale_user 1 0 0 0
access_sale_journal_picking_stats sale_journal.picking.stats model_sale_journal_picking_stats sale.group_sale_user 1 0 0 0
access_sale_journal_invoice_type sale_journal.invoice.type model_sale_journal_invoice_type sale.group_sale_user 1 0 0 0
2 access_sale_journal_invoice_type_finance_invoice sale_journal.invoice.type invoice model_sale_journal_invoice_type account.group_account_invoice 1 0 0 0
3 access_sale_journal_invoice_type_partner_manager sale_journal.invoice.type partner manager model_sale_journal_invoice_type base.group_partner_manager 1 0 0 0
4 access_sale_journal_sale_journal sale_journal.sale.journal model_sale_journal_sale_journal sale.group_sale_user 1 0 0 0
access_sale_journal_picking_journal sale_journal.picking.journal model_sale_journal_picking_journal sale.group_sale_user 1 0 0 0
access_sale_journal_sale_stats sale_journal.sale.stats model_sale_journal_sale_stats sale.group_sale_user 1 0 0 0
5 access_sale_journal_invoice_type_manager sale_journal.invoice.type.manager model_sale_journal_invoice_type sale.group_sale_manager 1 1 1 1
6 access_sale_journal_sale_journal_manager sale_journal.sale.journal.manager model_sale_journal_sale_journal sale.group_sale_manager 1 1 1 1
7 access_sale_journal_picking_journal_manager sale_journal.picking.journal.manager model_sale_journal_picking_journal sale.group_sale_manager 1 1 1 1

View File

@ -588,6 +588,7 @@
<field name="origin"/>
<field name="date"/>
<field name="min_date"/>
<field name="invoice_state"/>
<field name="state"/>
<button name="%(action_partial_picking)d" states="assigned" string="Validate" type="action" icon="gtk-go-forward" help="Validate Picking"/>
<button name="button_cancel" states="assigned,confirmed,draft" string="Cancel" icon="gtk-cancel" help="Cancel" confirm="This operation will cancel the picking. Do you want to continue?"/>

View File

@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@ -15,62 +15,32 @@
# 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 pooler
import netsvc
from osv import fields, osv
from tools.translate import _
class invoice_directly(wizard.interface):
def _test_action(obj, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
pick = pool.get('stock.picking').browse(cr, uid, data['id'], context=context)
if not pick.invoice_state == '2binvoiced':
return 'end_final'
return 'invoice'
class invoice_directly(osv.osv_memory):
_inherit = 'stock.partial.picking'
def _open_action(obj, cr, uid, data, context):
res = {
'name': 'stock.invoice_onshipping',
'type': 'ir.actions.wizard',
'wiz_name': 'stock.invoice_onshipping'
}
if data['form'].get('new_picking', False):
res['context'] = "{'new_picking':%d}" % (data['form']['new_picking'],)
return res
def do_partial(self, cr, uid, ids, context):
result = super(invoice_directly, self).do_partial(cr, uid, ids, context)
pick_obj = self.pool.get('stock.picking')
picking_ids = context.get('active_ids', False)
pick = pick_obj.browse(cr, uid, picking_ids, context)[0]
if pick.invoice_state=='2binvoiced':
return {
'name': 'Create Invoice',
'view_type': 'form',
'view_mode': 'form',
'res_model': 'stock.invoice.onshipping',
'type': 'ir.actions.act_window',
'target': 'new',
}
return {}
end_final = {
'actions':[],
'result': {
'type': 'state',
'state': 'end',
}
}
choice = {
'actions':[],
'result': {
'type': 'choice',
'next_state': _test_action,
}
}
call_invoice = {
'actions':[],
'result': {
'type': 'action',
'action': _open_action,
'state': 'end'
}
}
def __init__(self, *args):
service = netsvc.LocalService("wizard.stock.partial_picking")
service._service.states['split']['result']['state'] = 'test_choice'
service._service.states['invoice'] = self.call_invoice
service._service.states['test_choice'] = self.choice
service._service.states['end_final'] = self.end_final
invoice_directly('stock.picking.invoice.directly')
invoice_directly()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -207,7 +207,7 @@ class survey_browse_response(report_rml):
<td><para style="terp_tblheader_General_Centre_simple">""" + to_xml(time.strftime('%d-%m-%Y %I:%M:%S %p', time.strptime(response.date_create.split('.')[0], '%Y-%m-%d %H:%M:%S'))) + """</para></td>
<td><para style="terp_tblheader_General_Centre"></para></td>
<td><para style="terp_tblheader_General_right">Answer By:- </para></td>
<td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login) + """</para></td>
<td><para style="terp_tblheader_General_right_simple">""" + to_xml(response.user_id.login or '') + """</para></td>
</tr>
</blockTable><para style="P2"></para>"""

View File

@ -149,11 +149,10 @@ class survey_form(report_rml):
<story>"""
surv_obj = pooler.get_pool(cr.dbname).get('survey')
for survey in surv_obj.browse(cr,uid,ids):
if datas.has_key('form') and datas['form']['survey_title']:
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
rml += """
<blockTable colWidths='"""+_tbl_widths+"""' style="title_tbl">
<tr><td><para style="title">""" + to_xml(tools.ustr(survey.title)) + """</para><para style="P2"><font></font></para></td></tr>
</blockTable>"""
if survey.note:
rml += """
<para style="P2"></para>

View File

@ -225,7 +225,7 @@ class survey_question(osv.osv):
'page_id': fields.many2one('survey.page', 'Survey Page', ondelete='cascade', required=1),
'question': fields.char('Question', size=128, required=1),
'answer_choice_ids': fields.one2many('survey.answer', 'question_id', 'Answer'),
'is_require_answer': fields.boolean('Require Answer to Question (optional)'),
'is_require_answer': fields.boolean('Require Answer to Question'),
'required_type': fields.selection([('all','All'), ('at least','At Least'), ('at most','At Most'), ('exactly','Exactly'), ('a range','A Range')], 'Respondent must answer'),
'req_ans': fields.integer('#Required Answer'),
'maximum_req_ans': fields.integer('Maximum Required Answer'),
@ -250,7 +250,7 @@ class survey_question(osv.osv):
('date_and_time','Date and Time'),('descriptive_text','Descriptive Text'),
('table','Table'),
], 'Question Type', required=1,),
'is_comment_require': fields.boolean('Add Comment Field (optional)'),
'is_comment_require': fields.boolean('Add Comment Field'),
'comment_label': fields.char('Field Label', size = 255),
'comment_field_type': fields.selection([('char', 'Single Line Of Text'), ('text', 'Paragraph of Text')], 'Comment Field Type'),
'comment_valid_type': fields.selection([('do_not_validate', '''Don't Validate Comment Text.'''),
@ -269,7 +269,7 @@ class survey_question(osv.osv):
'comment_valid_err_msg': fields.text('Error message'),
'make_comment_field': fields.boolean('Make Comment Field an Answer Choice'),
'make_comment_field_err_msg': fields.text('Error message'),
'is_validation_require': fields.boolean('Validate Text (optional)'),
'is_validation_require': fields.boolean('Validate Text'),
'validation_type': fields.selection([('do_not_validate', '''Don't Validate Comment Text.'''),\
('must_be_specific_length', 'Must Be Specific Length'),\
('must_be_whole_number', 'Must Be A Whole Number'),\
@ -609,7 +609,7 @@ class survey_response(osv.osv):
reads = self.read(cr, uid, ids, ['user_id','date_create'], context)
res = []
for record in reads:
name = record['user_id'][1] + ' (' + record['date_create'].split('.')[0] + ')'
name = (record['user_id'] and record['user_id'][1] or '' )+ ' (' + record['date_create'].split('.')[0] + ')'
res.append((record['id'], name))
return res

View File

@ -24,6 +24,7 @@
<field name="state">open</field>
<field name="tot_comp_survey">1</field>
<field name="tot_start_survey">1</field>
<field name="response_user">5</field>
</record>
<record id="survey_page_who_are_you" model="survey.page">
@ -498,6 +499,7 @@
<field name="state">open</field>
<field name="tot_comp_survey">1</field>
<field name="tot_start_survey">1</field>
<field name="response_user">5</field>
</record>
<record id="survey_page_odoo_who_are_you" model="survey.page">
@ -1286,6 +1288,7 @@
<field name="responsible_id" ref="base.user_demo"/>
<field name="max_response_limit">20</field>
<field name="type" ref="survey_type2"/>
<field name="response_user">5</field>
</record>
</data>
<data>
@ -2163,6 +2166,8 @@
<field eval="1" name="send_response"/>
<field eval="[(6,0,[])]" name="users"/>
<field name="type" ref="survey_type3"/>
<field name="response_user">5</field>
<field name="max_response_limit">20</field>
</record>
</data>
<data>

View File

@ -6,8 +6,7 @@
id="report_survey_form"
model="survey"
name="survey.form"
menu="False"
string="Survey Form"/>
string="Print Survey"/>
<report auto="True"
id="survey_analysis"

Some files were not shown because too many files have changed in this diff Show More