commit
7e7bd1bc77
|
@ -0,0 +1,17 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<projectDescription>
|
||||
<name>pso-newaddons</name>
|
||||
<comment></comment>
|
||||
<projects>
|
||||
</projects>
|
||||
<buildSpec>
|
||||
<buildCommand>
|
||||
<name>org.python.pydev.PyDevBuilder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.python.pydev.pythonNature</nature>
|
||||
</natures>
|
||||
</projectDescription>
|
|
@ -9,7 +9,7 @@
|
|||
people to intelligently and efficiently manage tasks, issues,
|
||||
and requests. It manages key tasks such as communication,
|
||||
identification, prioritization, assignment, resolution and notification.""",
|
||||
"depends" : ["crm","report_crm", "process"],
|
||||
"depends" : ["crm","report_crm", "process", "account"],
|
||||
"init_xml" : [
|
||||
"crm_config_view.xml",
|
||||
"crm_bugs_view.xml",
|
||||
|
@ -40,7 +40,7 @@
|
|||
"crm_helpdesk_menu.xml", "crm_lead_menu.xml",
|
||||
"crm_meeting_menu.xml",
|
||||
"security/ir.model.access.csv",
|
||||
# "process/crm_configuration_process.xml",
|
||||
"process/crm_configuration_process.xml",
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
|
|
|
@ -0,0 +1,113 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
Process
|
||||
-->
|
||||
|
||||
<record id="process_process_contractworkflow0" model="process.process">
|
||||
<field eval=""""Contracts flow for services companies."""" name="note"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Contract Workflow"""" name="name"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Process Node
|
||||
-->
|
||||
|
||||
<record id="process_node_leads0" model="process.node">
|
||||
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_leads_all"/>
|
||||
<field name="model_id" ref="crm.model_crm_case"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Leads"""" name="name"/>
|
||||
<field eval=""""Premier Contact Leads"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_contractworkflow0"/>
|
||||
<field eval=""""object.state in ('draft', 'open', 'pending', 'done', 'cancel')"""" name="model_states"/>
|
||||
<field eval="1" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_opportunities0" model="process.node">
|
||||
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_oppor11"/>
|
||||
<field name="model_id" ref="crm.model_crm_case"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Opportunities"""" name="name"/>
|
||||
<field eval=""""Business Opportunities"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_contractworkflow0"/>
|
||||
<field eval=""""object.state in ('draft', 'open', 'pending', 'done', 'cancel')"""" name="model_states"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_accord0" model="process.node">
|
||||
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act_leads_all"/>
|
||||
<field name="model_id" ref="crm.model_crm_case"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Accord"""" name="name"/>
|
||||
<field eval=""""Accord Client Contract"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_contractworkflow0"/>
|
||||
<field eval=""""object.state=='done'"""" name="model_states"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_contractanalytic0" model="process.node">
|
||||
<field name="menu_id" ref="account.account_analytic_def_account"/>
|
||||
<field name="model_id" ref="account.model_account_analytic_account"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Contract Analytic"""" name="name"/>
|
||||
<field eval=""""Analytic accounts"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_contractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_contractpricelist0" model="process.node">
|
||||
<field name="menu_id" ref="product.menu_product_pricelist_action2"/>
|
||||
<field name="model_id" ref="product.model_product_pricelist"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Contract Pricelist"""" name="name"/>
|
||||
<field eval=""""Contract Volume (pricelist)"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_contractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Process Transition
|
||||
-->
|
||||
|
||||
<record id="process_transition_leadopportunity0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Lead Opportunity"""" name="name"/>
|
||||
<field eval=""""Creating business opportunities from leads"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_opportunities0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_leads0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_opportunitiesaccord0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Opportunities Accord"""" name="name"/>
|
||||
<field eval=""""When leads are confirmed"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_accord0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_opportunities0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_accordanalytic0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Accord Analytic"""" name="name"/>
|
||||
<field eval=""""Goes into the Analytic"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_contractanalytic0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_accord0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_accordpricelist0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Accord Pricelist"""" name="name"/>
|
||||
<field eval=""""Goes into the Pricelist"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_contractpricelist0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_accord0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -12,12 +12,13 @@
|
|||
* User Authentification
|
||||
* Document Indexation
|
||||
""",
|
||||
"depends" : ["base", "process"],
|
||||
"depends" : ["base", "process", "hr"],
|
||||
"init_xml" : ["document_data.xml"],
|
||||
"update_xml" : [
|
||||
"document_view.xml",
|
||||
"security/document_security.xml",
|
||||
"security/ir.model.access.csv",
|
||||
"process/document_process.xml"
|
||||
],
|
||||
"demo_xml" : ["document_demo.xml"],
|
||||
"active": False,
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="process_node_papers0" model="process.node">
|
||||
<field name="menu_id" ref="document.menu_document_directories"/>
|
||||
<field name="model_id" ref="document.model_document_directory"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Papers"""" name="name"/>
|
||||
<field eval=""""Employee get papers and matrieal"""" name="note"/>
|
||||
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_papersandmaterials0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Papers and materials"""" name="name"/>
|
||||
<field eval=""""Employee get papers and necessary materials"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_papers0"/>
|
||||
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
Different reports are also provided, mainly for attendance statistics.
|
||||
""",
|
||||
"depends" : ["base", "process"],
|
||||
"depends" : ["base", "crm_configuration", "process"],
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [
|
||||
"hr_demo.xml",
|
||||
|
@ -52,6 +52,7 @@
|
|||
"hr_view.xml",
|
||||
"hr_wizard.xml",
|
||||
"hr_department_view.xml",
|
||||
"process/hr_process.xml"
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!--
|
||||
Process
|
||||
-->
|
||||
|
||||
<record id="process_process_employeecontractworkflow0" model="process.process">
|
||||
<field eval=""""Employee Contract flow for services companies."""" name="note"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Employee Contract Workflow"""" name="name"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Process Node
|
||||
-->
|
||||
|
||||
<record id="process_node_jobshiring0" model="process.node">
|
||||
<field name="menu_id" ref="crm_configuration.menu_crm_case_categ0_act11"/>
|
||||
<field name="model_id" ref="crm.model_crm_case"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Jobs hiring"""" name="name"/>
|
||||
<field eval=""""Jobs hiring to new employees"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
|
||||
<field eval=""""object.state in ('draft', 'open', 'pending', 'done', 'cancel')"""" name="model_states"/>
|
||||
<field eval="1" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_employee0" model="process.node">
|
||||
<field name="menu_id" ref="hr.menu_open_view_employee_list"/>
|
||||
<field name="model_id" ref="hr.model_hr_employee"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Employee"""" name="name"/>
|
||||
<field eval=""""Employee Complete Form"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_employeecontact0" model="process.node">
|
||||
<field name="menu_id" ref="hr.menu_open_view_employee_list"/>
|
||||
<field name="model_id" ref="hr.model_hr_employee"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Employee Contact"""" name="name"/>
|
||||
<field eval=""""Fill up employee's contact information"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_openerpuser0" model="process.node">
|
||||
<field name="menu_id" ref="base.menu_users"/>
|
||||
<field name="model_id" ref="base.model_res_users"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Openerp user"""" name="name"/>
|
||||
<field eval=""""Create OpenERP User"""" name="note"/>
|
||||
<field name="process_id" ref="process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<!--
|
||||
Process Transition
|
||||
-->
|
||||
|
||||
<record id="process_transition_employeejob0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Employee Job"""" name="name"/>
|
||||
<field eval=""""After confirming job, he will be a employee"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_employee0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_jobshiring0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_contactofemployee0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Contact of employee"""" name="name"/>
|
||||
<field eval=""""Fill up contact information"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_employeecontact0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_employee0"/>
|
||||
</record>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -32,7 +32,7 @@
|
|||
"hr_view.xml",
|
||||
"hr_holidays_report.xml",
|
||||
"hr_holidays_wizard.xml",
|
||||
# "process/hr_holidays_process.xml"
|
||||
"process/hr_holidays_process.xml"
|
||||
],
|
||||
# "demo_xml" : ["hr_bel_holidays_2008.xml",],
|
||||
"demo_xml" : [],
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="process_node_secretariatsocial0" model="process.node">
|
||||
<field name="menu_id" ref="hr_holidays.menu_open_ask_holidays"/>
|
||||
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Secretariat Social"""" name="name"/>
|
||||
<field eval=""""Secretariat social"""" name="note"/>
|
||||
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_node_holidays0" model="process.node">
|
||||
<field name="menu_id" ref="hr_holidays.menu_open_ask_holidays"/>
|
||||
<field name="model_id" ref="hr_holidays.model_hr_holidays"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Holidays"""" name="name"/>
|
||||
<field eval=""""Employee Get holidays"""" name="note"/>
|
||||
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
|
||||
<field eval=""""object.state in ('draft', 'validate', 'confirm', 'refuse', 'cancel')"""" name="model_states"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_employeesocial0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Employee Social"""" name="name"/>
|
||||
<field eval=""""Social Activity"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_secretariatsocial0"/>
|
||||
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_employeeholidays0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Employee Holidays"""" name="name"/>
|
||||
<field eval=""""Employee get holidays"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_holidays0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_secretariatsocial0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -35,7 +35,7 @@
|
|||
"website" : "http://tinyerp.com/module_hr.html",
|
||||
"depends" : ["project", "hr_timesheet_sheet"],
|
||||
"update_xml" : ["hr_timesheet_project_view.xml",
|
||||
# "process/hr_timesheet_project_process.xml",
|
||||
"process/hr_timesheet_project_process.xml",
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import lunch
|
||||
import wizard
|
||||
import report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
{
|
||||
"name": "Lunch Module",
|
||||
"author": "Tiny",
|
||||
"version": "0.1",
|
||||
"depends": ["base", "process", "hr"],
|
||||
"init_xml": [],
|
||||
"update_xml": ['lunch_wizard.xml', 'lunch_view.xml', 'lunch_report.xml',
|
||||
'process/lunch_process.xml'
|
||||
],
|
||||
"demo_xml": ['lunch_demo.xml'],
|
||||
"installable": True,
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,171 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
from osv import osv, fields
|
||||
import time
|
||||
|
||||
class lunch_category(osv.osv):
|
||||
_name = 'lunch.category'
|
||||
_description = "Category"
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', required=True, size=50),
|
||||
}
|
||||
|
||||
_order = 'name'
|
||||
|
||||
lunch_category()
|
||||
|
||||
class lunch_product(osv.osv):
|
||||
_name = 'lunch.product'
|
||||
|
||||
def _category_name_get(self, cr, uid, context={}):
|
||||
obj = self.pool.get('lunch.category')
|
||||
cat_ids= obj.search(cr,uid,[])
|
||||
res = obj.read(cr,uid,cat_ids,['name', 'category'])
|
||||
return [(str(r['id']), r['name']) for r in res]+ [('0','')]
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=50, required=True),
|
||||
'category_id': fields.selection(_category_name_get, 'Category', size=32),
|
||||
'description': fields.char('Description', size=128, required=False),
|
||||
'price': fields.float('Price', digits=(16,2)),
|
||||
'active': fields.boolean('Active'),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
'active': lambda *a : True,
|
||||
}
|
||||
|
||||
lunch_product()
|
||||
|
||||
class lunch_cashbox(osv.osv):
|
||||
_name='lunch.cashbox'
|
||||
|
||||
def amount_available(self, cr, uid, ids, field_name, arg, context):
|
||||
cr.execute("SELECT box,sum(amount) from lunch_cashmove where active = 't' group by box")
|
||||
r = dict(cr.fetchall())
|
||||
for i in ids :
|
||||
r.setdefault(i,0)
|
||||
return r
|
||||
|
||||
_columns={
|
||||
'manager':fields.many2one('res.users','Manager'),
|
||||
'name':fields.char('Name',size=30,required=True, unique = True),
|
||||
'sum_remain': fields.function(amount_available, method=True, string='Remained Total'),
|
||||
}
|
||||
|
||||
lunch_cashbox()
|
||||
|
||||
|
||||
|
||||
|
||||
class lunch_cashmove(osv.osv):
|
||||
_name= 'lunch.cashmove'
|
||||
|
||||
_columns={
|
||||
'name': fields.char('Name',size=128),
|
||||
'user_cashmove': fields.many2one('res.users','User Name', required=True),
|
||||
'amount': fields.float('Amount', digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,required=True),
|
||||
'active':fields.boolean('Active'),
|
||||
'create_date': fields.datetime('Created date', readonly=True),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'active': lambda *a: True,
|
||||
}
|
||||
|
||||
lunch_cashmove()
|
||||
|
||||
|
||||
|
||||
class lunch_order(osv.osv):
|
||||
_name='lunch.order'
|
||||
_rec_name= "user_id"
|
||||
|
||||
def _price_get(self, cr, uid, ids, name, args, context=None):
|
||||
res = {}
|
||||
for o in self.browse(cr, uid, ids):
|
||||
res[o.id] = o.product.price
|
||||
return res
|
||||
|
||||
_columns={
|
||||
'user_id': fields.many2one('res.users','User Name', required=True,
|
||||
readonly=True, states={'draft':[('readonly',False)]}),
|
||||
'product':fields.many2one('lunch.product','Product', required=True,
|
||||
readonly=True, states={'draft':[('readonly',False)]}, change_default=True),
|
||||
'date': fields.date('Date',readonly=True,states={'draft':[('readonly',False)]}),
|
||||
'cashmove':fields.many2one('lunch.cashmove', 'CashMove' , readonly=True ),
|
||||
'descript':fields.char('Description Order', readonly=True, size=50,
|
||||
states={'draft':[('readonly',False)]}),
|
||||
'state': fields.selection([('draft','Draft'), ('confirmed','Confirmed'),],
|
||||
'State', readonly=True, select=True),
|
||||
'price': fields.function(_price_get, method=True, string="Price"),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'user_id': lambda self,cr,uid,context: uid,
|
||||
'date': lambda self,cr,uid,context: time.strftime('%Y-%m-%d'),
|
||||
'state': lambda self,cr,uid,context: 'draft',
|
||||
}
|
||||
|
||||
def confirm(self,cr,uid,ids,box,context):
|
||||
cashmove_ref= self.pool.get('lunch.cashmove')
|
||||
for order in self.browse(cr,uid,ids):
|
||||
if order.state == 'confirmed':
|
||||
continue
|
||||
new_id= cashmove_ref.create(cr,uid,{'name': order.product.name+' order',
|
||||
'amount':-order.product.price,
|
||||
'user_cashmove':order.user_id.id,
|
||||
'box':box,
|
||||
'active':True,
|
||||
})
|
||||
self.write(cr,uid,[order.id],{'cashmove':new_id, 'state':'confirmed'})
|
||||
return {}
|
||||
|
||||
def lunch_order_cancel(self,cr,uid,ids,context):
|
||||
orders= self.browse(cr,uid,ids)
|
||||
for order in orders:
|
||||
if not order.cashmove:
|
||||
continue
|
||||
self.pool.get('lunch.cashmove').unlink(cr, uid, [order.cashmove.id])
|
||||
self.write(cr,uid,ids,{'state':'draft'})
|
||||
return {}
|
||||
|
||||
def onchange_product(self, cr, uid, ids, product):
|
||||
if not product:
|
||||
return {'value': {'price': 0.0}}
|
||||
price = self.pool.get('lunch.product').read(cr, uid, product, ['price'])['price']
|
||||
return {'value': {'price': price}}
|
||||
|
||||
lunch_order()
|
||||
|
||||
class report_lunch_amount(osv.osv):
|
||||
_name='report.lunch.amount'
|
||||
_description = "Amount available by user and box"
|
||||
_auto = False
|
||||
_rec_name= "user"
|
||||
|
||||
_columns = {
|
||||
'user_id': fields.many2one('res.users','User Name',readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True, digits=(16,2)),
|
||||
'box':fields.many2one('lunch.cashbox','Box Name',size=30,readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
cr.execute("""
|
||||
create or replace view report_lunch_amount as (
|
||||
select
|
||||
min(lc.id) as id,
|
||||
lc.user_cashmove as user_id,
|
||||
sum(amount) as amount,
|
||||
lc.box as box
|
||||
from
|
||||
lunch_cashmove lc
|
||||
where
|
||||
active = 't'
|
||||
group by lc.user_cashmove, lc.box
|
||||
)""")
|
||||
|
||||
report_lunch_amount()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,20 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data noupdate="1">
|
||||
|
||||
<record model="lunch.category" id="categ_sandwich">
|
||||
<field name="name">Sandwich</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.product" id="product_club">
|
||||
<field name="name">Club</field>
|
||||
<field name="category_id" eval="str(ref('categ_sandwich'))"/>
|
||||
<field name="price">2.75</field>
|
||||
</record>
|
||||
|
||||
<record model="lunch.cashbox" id="cashbox_cashbox">
|
||||
<field name="name">Cashbox</field>
|
||||
<field name="manager" ref="base.user_admin"/>
|
||||
</record>
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<terp>
|
||||
<data>
|
||||
<report
|
||||
id="report_lunch_order"
|
||||
string="Print Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order"
|
||||
rml="lunch/report/order.rml"
|
||||
auto="False"
|
||||
/>
|
||||
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,232 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
|
||||
<menuitem name="Lunch" parent="menu_tools" id="menu_lunch" />
|
||||
<menuitem name="Configuration" parent="menu_lunch" id="menu_lunch_category_root" sequence="1"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_order_form">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Order">
|
||||
<group colspan="2" col="4">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<field name="product" select="1" on_change="onchange_product(product)"/>
|
||||
<field name="price"/>
|
||||
<field name="descript"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state" select="2"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_order_tree">
|
||||
<field name="name">Order</field>
|
||||
<field name="model">lunch.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="user_id"/>
|
||||
<field name="product"/>
|
||||
<field name="date"/>
|
||||
<field name="cashmove"/>
|
||||
<field name="state"/>
|
||||
<field name="descript"/>
|
||||
<field name="price" sum="Total price"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_order_form">
|
||||
<field name="name">Make order</field>
|
||||
<field name="res_model">lunch.order</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
</record>
|
||||
<menuitem name="Make order" parent="menu_lunch" id="menu_lunch_order_form" action="action_lunch_order_form"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_order_day_form">
|
||||
<field name="name"> Order of the day</field>
|
||||
<field name="res_model">lunch.order</field>
|
||||
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
|
||||
|
||||
</record>
|
||||
<menuitem name="Order of the day" parent="menu_lunch_order_form" id="menu_lunch_order_day_form" action="action_lunch_order_day_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_form">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashBox">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashbox_tree">
|
||||
<field name="name">CashBox</field>
|
||||
<field name="model">lunch.cashbox</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashBox" colors="red:sum_remain<=0">
|
||||
<field name="name" select="1"/>
|
||||
<field name="manager" select="1"/>
|
||||
<field name="sum_remain" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashbox_form">
|
||||
<field name="name"> CashBox </field>
|
||||
<field name="res_model">lunch.cashbox</field>
|
||||
</record>
|
||||
<menuitem name="CashBox" parent="menu_lunch_category_root" id="menu_lunch_cashbox_form" action="action_lunch_cashbox_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="CashMove">
|
||||
<field name="name" select="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="2"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_cashmove_tree">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="model">lunch.cashmove</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="CashMove" editable="top">
|
||||
<field name="name" select="1" required="1"/>
|
||||
<field name="user_cashmove" select="1"/>
|
||||
<field name="amount" select="1" sum="Total amount"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="create_date"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_cashmove_form">
|
||||
<field name="name">CashMove</field>
|
||||
<field name="res_model">lunch.cashmove</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Cash Moves" parent="menu_lunch" id="menu_lunch_cashmove_form" action="action_lunch_cashmove_form"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Category">
|
||||
<separator string="Category related to Products" colspan="4"/>
|
||||
<field name="name" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_category_tree">
|
||||
<field name="name">Category</field>
|
||||
<field name="model">lunch.category</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Order">
|
||||
<field name="name" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_category_form">
|
||||
<field name="name"> Category of product </field>
|
||||
<field name="res_model">lunch.category</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_form">
|
||||
<field name="name">Products</field>
|
||||
<field name="type">form</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
<field name="active" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_lunch_product_tree">
|
||||
<field name="name">Products</field>
|
||||
<field name="model">lunch.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Products">
|
||||
<field name="name" select="1"/>
|
||||
<field name="category_id" select="1"/>
|
||||
<field name="description" select="1"/>
|
||||
<field name="price" select="1"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_lunch_product_form">
|
||||
<field name="name">Product</field>
|
||||
<field name="res_model">lunch.product</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Tools/Lunch/Configuration/Products" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
|
||||
<menuitem name="Products" parent="menu_lunch_category_root" id="menu_lunch_product_form" action="action_lunch_product_form" sequence="1"/>
|
||||
<menuitem name="Category of product" parent="menu_lunch_product_form" id="menu_lunch_category_form" action="action_lunch_category_form" />
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Box Amount by User">
|
||||
<field name="box" select="1"/>
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="amount" select="1" sum="Total box" />
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_report_lunch_amount_form">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="model">report.lunch.amount</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Box Amount by User">
|
||||
<field name="user_id" select="1"/>
|
||||
<field name="box" select="1"/>
|
||||
<field name="amount" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_report_lunch_amount_tree">
|
||||
<field name="name">Lunch amount</field>
|
||||
<field name="res_model">report.lunch.amount</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
<menuitem name="Box Amount by User" parent="menu_lunch" action="action_report_lunch_amount_tree" id="menu_lunch_report_amount_tree"/>
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" ?>
|
||||
<terp>
|
||||
<data>
|
||||
<wizard
|
||||
string="Confirm Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.confirm"
|
||||
keyword="client_action_multi"
|
||||
id="lunch_order_confirm"/>
|
||||
|
||||
<wizard
|
||||
string="Cancel Order"
|
||||
model="lunch.order"
|
||||
name="lunch.order.cancel"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_id_cancel"/>
|
||||
|
||||
<wizard
|
||||
string="Set CashBox to Zero"
|
||||
model="lunch.cashbox"
|
||||
name="lunch.cashbox.clean"
|
||||
keyword="client_action_multi"
|
||||
id="wizard_clean_cashbox"/>
|
||||
</data>
|
||||
|
||||
|
||||
</terp>
|
|
@ -0,0 +1,25 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="process_node_lunchbox0" model="process.node">
|
||||
<field name="menu_id" ref="lunch.menu_lunch_product_form"/>
|
||||
<field name="model_id" ref="lunch.model_lunch_product"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""Lunchbox"""" name="name"/>
|
||||
<field eval=""""Employee get lunchbox if he wants lunch"""" name="note"/>
|
||||
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_employeelunch0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Employee lunch"""" name="name"/>
|
||||
<field eval=""""Employee get lunch"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_lunchbox0"/>
|
||||
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,4 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import order
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
|
||||
|
||||
class order(report_sxw.rml_parse):
|
||||
|
||||
def sum_price(self, orders):
|
||||
res = 0.0
|
||||
for o in orders:
|
||||
res += o.price
|
||||
return res
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(order, self).__init__(cr, uid, name, context)
|
||||
|
||||
self.localcontext.update({
|
||||
'time': time,
|
||||
'sum_price': self.sum_price,
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.lunch.order', 'lunch.order',
|
||||
'addons/lunch/report/order.rml',parser=order, header=False)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="34.0" y1="42.0" width="527" height="758"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="GRID" colorName="black"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="15.0" leading="19"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="16.0" leading="20"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman"/>
|
||||
<paraStyle name="P4" fontName="Times-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P5" fontName="Times-BoldItalic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P6" fontName="Times-BoldItalic" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P7" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" fontSize="9.0" leading="11"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P11" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="P12" fontName="Times-BoldItalic" fontSize="6.0" leading="8"/>
|
||||
<paraStyle name="P13" fontName="Times-Italic" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||
<paraStyle name="P14" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Header" fontName="Times-Roman"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Footnote" rightIndent="0.0" leftIndent="14.0" fontName="Times-Roman" fontSize="10.0" leading="13"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">
|
||||
<font face="Times-Roman">Printed at : [[time.strftime("%Hh%M")]]</font>
|
||||
</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P3">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="149.0,135.0,103.0,140.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P4">Name</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Order</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Description</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">Unit Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</section>
|
||||
<blockTable colWidths="148.0,135.0,103.0,140.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">[[repeatIn(objects, 'o') ]]</para>
|
||||
<para style="P7">[[ o.user_id.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[o.product.name ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ o.descript ]]</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[['%.2f' % o.price ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P11">[[ '%.2f' % sum_price(objects) ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import confirm
|
||||
import cancel
|
||||
import reset_box
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
cancel_form = """<?xml version="1.0"?>
|
||||
<form string="Cancel Order">
|
||||
<label string="Are you sure you want to cancel this order ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
cancel_fields = {
|
||||
}
|
||||
|
||||
def _cancel(self,cr,uid,data,context):
|
||||
return pooler.get_pool(cr.dbname).get('lunch.order').lunch_order_cancel(cr,uid,data['ids'],context)
|
||||
|
||||
class order_cancel(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':cancel_form, 'fields':cancel_fields, 'state':[('end','No'),('cancel','Yes')]}
|
||||
},
|
||||
'cancel': {
|
||||
'actions': [_cancel],
|
||||
'result': {'type':'state', 'state':'end'}
|
||||
}
|
||||
}
|
||||
order_cancel('lunch.order.cancel')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
confirm_order_form = """<?xml version="1.0"?>
|
||||
<form title="Confirm">
|
||||
<separator string="Orders Confirmation" colspan="4"/>
|
||||
<field name="confirm_cashbox"/>
|
||||
<newline/>
|
||||
</form>
|
||||
"""
|
||||
|
||||
confirm_order_fields = {
|
||||
'confirm_cashbox': {'string':'Name of box', 'type':'many2one', 'required':True, 'relation':'lunch.cashbox' },
|
||||
}
|
||||
|
||||
def _confirm(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
order_ref = pool.get('lunch.order')
|
||||
order_ref.confirm(cr,uid,data['ids'],data['form']['confirm_cashbox'],context)
|
||||
return {}
|
||||
|
||||
class order_confirm(wizard.interface):
|
||||
states = {
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form', 'arch' : confirm_order_form, 'fields' : confirm_order_fields, 'state' : [('end', 'Cancel'),('go', 'Confirm Order') ]},
|
||||
},
|
||||
'go' : {
|
||||
'actions' : [_confirm],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
order_confirm('lunch.order.confirm')
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
set_to_zero_form = """<?xml version="1.0"?>
|
||||
<form string="Reset cashbox">
|
||||
<label string="Are you sure you want to reset this cashbox ?"/>
|
||||
</form>"""
|
||||
|
||||
|
||||
|
||||
confirm_setting_zero_fields = {}
|
||||
|
||||
def _set_to_zero(self,cr,uid,data,context):
|
||||
pool= pooler.get_pool(cr.dbname)
|
||||
cashmove_ref = pool.get('lunch.cashmove')
|
||||
cr.execute("select user_cashmove, box,sum(amount) from lunch_cashmove where active= 't' and box in (%s) group by user_cashmove, box"%','.join(map(str,data['ids'])))
|
||||
res= cr.fetchall()
|
||||
cr.execute("update lunch_cashmove set active = 'f' where active= 't' and box in (%s)"%','.join(map(str,data['ids'])))
|
||||
## to_unactive= {}.fromkeys([r[0] for r in cr.fetchall]).keys()
|
||||
## print to_unactive
|
||||
## cashmove_ref.write(cr,uid,to_unactive,{'active':False})
|
||||
##
|
||||
for (user_id,box_id,amount) in res:
|
||||
cashmove_ref.create(cr,uid,{'name': 'Summary for user'+ str(user_id),
|
||||
'amount': amount,
|
||||
'user_cashmove': user_id,
|
||||
'box': box_id,
|
||||
'active': True,
|
||||
})
|
||||
return {}
|
||||
|
||||
|
||||
class cashbox_set_to_zero(wizard.interface):
|
||||
|
||||
states = {
|
||||
|
||||
'init': {
|
||||
'action':[],
|
||||
'result':{'type' : 'form',
|
||||
'arch' : set_to_zero_form,
|
||||
'fields' : confirm_setting_zero_fields,
|
||||
'state' : [('end', 'Cancel'),('zero', 'Set to Zero') ]},
|
||||
|
||||
},
|
||||
'zero' : {
|
||||
'actions' : [_set_to_zero],
|
||||
'result' : {'type' : 'state', 'state' : 'end'}
|
||||
},
|
||||
}
|
||||
|
||||
cashbox_set_to_zero('lunch.cashbox.clean')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import partner
|
||||
import wizard
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
{
|
||||
"name" : "Partner extension to synchronize TinyERP with ldap",
|
||||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"depends" : ["base", "hr", "process"],
|
||||
"category" : "Generic Modules/Inventory Control",
|
||||
"description": "Synchronise partners through a LDAP module. Has been used to synchronise partners in Outlook and Tiny ERP.",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ["wizard.xml",
|
||||
"process/partner_ldap_process.xml"
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
class address_ldap(osv.osv):
|
||||
_inherit = 'res.partner.address'
|
||||
|
||||
_columns = {
|
||||
'dn' : fields.char('Distinguished name', size=128),
|
||||
}
|
||||
|
||||
address_ldap()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="process_node_ldap0" model="process.node">
|
||||
<field name="model_id" ref="base.model_res_partner_address"/>
|
||||
<field eval=""""state"""" name="kind"/>
|
||||
<field eval=""""LDAP"""" name="name"/>
|
||||
<field eval=""""LDAP (all services)"""" name="note"/>
|
||||
<field name="process_id" ref="hr.process_process_employeecontractworkflow0"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_employeeldap0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Employee LDAP"""" name="name"/>
|
||||
<field eval=""""Employee get all services of that company"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_ldap0"/>
|
||||
<field model="process.node" name="source_node_id" ref="hr.process_node_employee0"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_ldapuser0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""LDAP User"""" name="name"/>
|
||||
<field eval=""""Create your own openerp user"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="hr.process_node_openerpuser0"/>
|
||||
<field model="process.node" name="source_node_id" ref="process_node_ldap0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0" ?>
|
||||
<terp>
|
||||
<data>
|
||||
<wizard string="Synchronize with ldap" model="res.partner.address" name="partners.sync_ldap" id="wizard_ldap_sync" />
|
||||
<menuitem name="Partners/Synchronize With Ldap" action="wizard_ldap_sync" type="wizard" />
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,4 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import synchronize
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,149 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id$
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sys
|
||||
if sys.version_info[:2] < (2, 4):
|
||||
from sets import Set as set
|
||||
|
||||
import time
|
||||
import ldap
|
||||
import ldap.modlist
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
BASE_DN = 'ou=addressbook,dc=localdomain'
|
||||
|
||||
def terp2ldap(data):
|
||||
res = {}
|
||||
for ldap_name, terp in LDAP_TERP_MAPPER.items():
|
||||
if callable(terp) and terp(data):
|
||||
res[ldap_name] = [terp(data)]
|
||||
elif isinstance(terp, basestring) and data[terp]:
|
||||
res[ldap_name] = ['%s' % data[terp]]
|
||||
return res
|
||||
|
||||
def get_lastname(dico):
|
||||
lnames = dico['name'].split(' ', 1)[1:]
|
||||
if lnames:
|
||||
return ' '.join(lnames)
|
||||
else:
|
||||
return dico['name']
|
||||
|
||||
def get_street(dico):
|
||||
return ' '.join([dico[x] for x in ('street', 'street2') if dico[x]])
|
||||
|
||||
def get_name(attribute):
|
||||
def func(dico):
|
||||
return dico[attribute][1]
|
||||
return func
|
||||
|
||||
|
||||
LDAP_TERP_MAPPER = {
|
||||
'displayname': 'name',
|
||||
'mail': 'email',
|
||||
'o': get_name('partner_id'),
|
||||
'telephoneNumber': 'phone',
|
||||
'street': get_street,
|
||||
'postalcode': 'zip',
|
||||
'l': 'city',
|
||||
'cn': 'name',
|
||||
'sn': get_lastname,
|
||||
'uid': 'id',
|
||||
}
|
||||
|
||||
|
||||
class sync_ldap(wizard.interface):
|
||||
|
||||
_login_arch = '''<?xml version="1.0" ?>
|
||||
<form string="LDAP Credentials">
|
||||
<field name="ldap_host" colspan="4" />
|
||||
<field name="dn" colspan="4" />
|
||||
<field name="password" colspan="4" />
|
||||
</form>
|
||||
'''
|
||||
|
||||
_login_fields = {
|
||||
'ldap_host': {'string': 'LDAP Host', 'type': 'char', 'size': 128},
|
||||
'dn': {'string': 'Distinguished name', 'type': 'char', 'size': 128},
|
||||
'password': {'string': 'Password', 'type': 'char', 'size': 128},
|
||||
}
|
||||
|
||||
def _do_sync(self, cr, uid, data, context):
|
||||
l = ldap.open(data['form']['ldap_host'])
|
||||
l.simple_bind_s(data['form']['dn'], data['form']['password'])
|
||||
ldap_objs = dict(l.search_s(BASE_DN, ldap.SCOPE_ONELEVEL, 'objectclass=*',
|
||||
LDAP_TERP_MAPPER.keys()))
|
||||
address = pooler.get_pool(cr.dbname).get('res.partner.address')
|
||||
terp_objs = dict([(x['id'], x) for x in address.read(cr, uid, address.search(cr, uid, []))])
|
||||
ldap_set = [int(x['uid'][0]) for x in ldap_objs.values()]
|
||||
terp_set = terp_objs.keys()
|
||||
for to_delete in ldap_set:
|
||||
if to_delete in terp_set:
|
||||
continue
|
||||
l.delete_s('uid=%s,%s' % (to_delete, BASE_DN))
|
||||
for to_add in terp_set:
|
||||
if to_add in ldap_set:
|
||||
continue
|
||||
new_dn = 'uid=%s,%s' % (to_add, BASE_DN)
|
||||
ldap_data = {'objectclass' : ['organizationalPerson', 'inetOrgPerson']}
|
||||
ldap_data.update(terp2ldap(terp_objs[to_add]))
|
||||
l.add_s(new_dn, ldap.modlist.addModlist(ldap_data))
|
||||
address.write(cr, uid, [to_add], {'dn' : new_dn})
|
||||
for to_update in terp_set:
|
||||
if to_update not in ldap_set:
|
||||
continue
|
||||
current_dn = 'uid=%s,%s' % (to_update, BASE_DN)
|
||||
modlist = ldap.modlist.modifyModlist(ldap_objs[current_dn], terp2ldap(terp_objs[to_update]))
|
||||
if modlist:
|
||||
l.modify_s(current_dn, modlist)
|
||||
return {}
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {
|
||||
'type' : 'form',
|
||||
'arch' : _login_arch,
|
||||
'fields' : _login_fields,
|
||||
'state' : (('end', 'Cancel'),('sync', 'Synchronize'))
|
||||
},
|
||||
},
|
||||
'sync' : {
|
||||
'actions' : [ _do_sync ],
|
||||
'result' : { 'type' : 'state', 'state' : 'end' },
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
sync_ldap('partners.sync_ldap')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -4,7 +4,7 @@
|
|||
"version" : "1.0",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://tinyerp.com/module_sale.html",
|
||||
"depends" : ["sale", "crm", "product", "account"],
|
||||
"depends" : ["sale", "crm_configuration", "product", "account"],
|
||||
"category" : "Generic Modules/Sales & Purchases",
|
||||
"description": """
|
||||
This module adds a shortcut on one or several cases in the CRM.
|
||||
|
@ -18,7 +18,9 @@
|
|||
""",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
"update_xml" : ["sale_crm_wizard.xml"],
|
||||
"update_xml" : ["sale_crm_wizard.xml",
|
||||
"process/sale_crm_process.xml"
|
||||
],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<record id="process_node_contractsale0" model="process.node">
|
||||
<field name="menu_id" ref="sale.menu_sale_order"/>
|
||||
<field name="model_id" ref="sale.model_sale_order"/>
|
||||
<field eval=""""subflow"""" name="kind"/>
|
||||
<field eval=""""Contract Sale"""" name="name"/>
|
||||
<field eval=""""Contract Command (sale)"""" name="note"/>
|
||||
<field name="process_id" ref="crm_configuration.process_process_contractworkflow0"/>
|
||||
<field eval=""""object.state in ('draft', 'manual', 'waiting_date', 'progress', 'shipping_except', 'invoice_except', 'done', 'cancel')"""" name="model_states"/>
|
||||
<field eval="0" name="flow_start"/>
|
||||
</record>
|
||||
|
||||
<record id="process_transition_accordsale0" model="process.transition">
|
||||
<field eval="[(6,0,[])]" name="role_ids"/>
|
||||
<field eval="[(6,0,[])]" name="transition_ids"/>
|
||||
<field eval=""""Accord Sale"""" name="name"/>
|
||||
<field eval=""""Goes into the Sale"""" name="note"/>
|
||||
<field model="process.node" name="target_node_id" ref="process_node_contractsale0"/>
|
||||
<field model="process.node" name="source_node_id" ref="crm_configuration.process_node_accord0"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -0,0 +1,6 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import sandwich
|
||||
import report
|
||||
import wizard
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
{
|
||||
"name" : "Sandwich Module",
|
||||
"author" : "Tiny",
|
||||
"version" : "1.0",
|
||||
"category" : "Generic Modules/Others",
|
||||
"depends" : ["base", "product"],
|
||||
"demo_xml" : ["sandwich_demo.xml"],
|
||||
"update_xml" : ["sandwich_view.xml", "sandwich_report.xml", "sandwich_wizard.xml"],
|
||||
"active": False,
|
||||
"installable": True
|
||||
}
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import sandwich_report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
import time
|
||||
from report import report_sxw
|
||||
|
||||
#
|
||||
# sandwich command report
|
||||
#
|
||||
class sandwich_order_print(report_sxw.rml_parse):
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(sandwich_order_print, self).__init__(cr, uid, name, context)
|
||||
self.localcontext.update( {
|
||||
'time': time,
|
||||
})
|
||||
|
||||
report_sxw.report_sxw('report.sandwich.order.print','sandwich.order','addons/sandwich/report/sandwich_report.rml',parser=sandwich_order_print)
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,142 @@
|
|||
<?xml version="1.0"?>
|
||||
<document filename="test.pdf">
|
||||
<template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<pageTemplate id="first">
|
||||
<frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Tableau1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<blockBackground colorName="#c0c0c0" start="0,0" stop="0,0"/>
|
||||
<blockBackground colorName="#c0c0c0" start="1,0" stop="1,0"/>
|
||||
<blockBackground colorName="#c0c0c0" start="2,0" stop="2,0"/>
|
||||
<blockBackground colorName="#c0c0c0" start="3,0" stop="3,0"/>
|
||||
<blockBackground colorName="#c0c0c0" start="4,0" stop="4,0"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
|
||||
<paraStyle name="P2" fontName="Times-Roman" fontSize="12.0" leading="15"/>
|
||||
<paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="LEFT"/>
|
||||
<paraStyle name="P4" fontName="Times-Roman" fontSize="12.0" leading="15"/>
|
||||
<paraStyle name="P5" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="P6" fontName="Times-Roman" fontSize="12.0" leading="15"/>
|
||||
<paraStyle name="P7" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT"/>
|
||||
<paraStyle name="P8" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P9" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P10" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
</stylesheet>
|
||||
<story>
|
||||
<para style="P1">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<blockTable colWidths="280.0,202.0" repeatRows="1" style="Tableau2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="Table Contents">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ o.partner['name'] ]]</para>
|
||||
<para style="P2">[[ o.partner.address[0]['street'] ]]</para>
|
||||
<para style="P2">[[ o.partner.address[0]['street2'] ]]</para>
|
||||
<para style="P2">[[ o.partner.address[0]['zip'] ]], [[ o.partner.address[0]['city'] ]]</para>
|
||||
<para style="P2">[[ o.partner.address[0].state_id['name'] ]]</para>
|
||||
<para style="P2">[[ o.partner.address[0].country_id['name'] ]]</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Phone : [[ o.partner.address[0]['phone'] ]]</para>
|
||||
<para style="P2">FAX : [[ o.partner.address[0]['fax'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P2">Document : [[ o['name'] ]]</para>
|
||||
<para style="P2">Date : [[ o['date'] ]]</para>
|
||||
<para style="P3">Printing date : [[ time.strftime('%d/%m/%Y') ]]</para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="192.0,71.0,87.0,69.0,64.0" style="Tableau1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P5">Item</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Quantity</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">User</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Unit price</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="Table Heading">Total Price</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P6"><b>[[ repeatIn(o.order_lines, 'a') ]]</b>
|
||||
[[ a.product_id['name'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ a['quantity'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">[[ a.user_id['login'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ a.product_id['price'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P9">[[ a.product_id['price'] * a['quantity'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">[[ o['note'] ]]</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P10">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
|
@ -0,0 +1,101 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
import time
|
||||
|
||||
from osv import osv, fields
|
||||
import pooler
|
||||
|
||||
#
|
||||
# Type of type of products (food, drink, lsd, other...)
|
||||
#
|
||||
class sandwich_product_type(osv.osv):
|
||||
_name = 'sandwich.product.type'
|
||||
_columns = {
|
||||
'name': fields.char('Name of the type', size=20, required=True),
|
||||
'description': fields.char('Type\'s description', size=255),
|
||||
}
|
||||
sandwich_product_type()
|
||||
|
||||
|
||||
#
|
||||
# Type Of Sandwich
|
||||
#
|
||||
class sandwich_product(osv.osv):
|
||||
_name = 'sandwich.product'
|
||||
_columns = {
|
||||
'name': fields.char('Product name', size=50, required=True),
|
||||
'price': fields.float('Product price'),
|
||||
'product_type_id': fields.many2one('sandwich.product.type','Type of product'),
|
||||
}
|
||||
sandwich_product()
|
||||
|
||||
|
||||
#
|
||||
# Sandwich command
|
||||
#
|
||||
class sandwich_order(osv.osv):
|
||||
_name = 'sandwich.order'
|
||||
_columns = {
|
||||
'name': fields.char('Name', size=50, required=True),
|
||||
'date': fields.date('Order date'),
|
||||
'order_lines': fields.one2many('sandwich.order.line','order_id','Order lines'),
|
||||
'note': fields.text('Notes'),
|
||||
'partner': fields.many2one('res.partner','Partner', required=True),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
}
|
||||
sandwich_order()
|
||||
|
||||
|
||||
#
|
||||
# Sandwich lines of command
|
||||
#
|
||||
class sandwich_order_line(osv.osv):
|
||||
_name = 'sandwich.order.line'
|
||||
_columns = {
|
||||
'name': fields.char('Description', size=50, required=True),
|
||||
'product_id': fields.many2one('sandwich.product', 'Product'),
|
||||
'user_id': fields.many2one('res.users', 'User id', required=True),
|
||||
'quantity': fields.integer('Quantity', required=True),
|
||||
'order_id': fields.many2one('sandwich.order', 'Order'),
|
||||
'date': fields.date('Date'),
|
||||
'product_type_id':fields.many2one('sandwich.product.type','Product type',change_default=True),
|
||||
}
|
||||
_defaults = {
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d'),
|
||||
'user_id': lambda self, cr, uid, c: uid,
|
||||
'quantity': lambda *a: 1
|
||||
}
|
||||
|
||||
def onchange_user_id(self, cr, uid, id, user_id, product_type_id, context={}, *args):
|
||||
# print id, user_id, product_type_id, context
|
||||
if (not user_id) or (not product_type_id):
|
||||
return {}
|
||||
cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
return {'value': res}
|
||||
# else
|
||||
return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
|
||||
|
||||
def onchange_product_type_id(self, cr, uid, id, user_id, product_type_id, context={}):
|
||||
if (not product_type_id) or (not user_id):
|
||||
return {}
|
||||
cr.execute('SELECT product_id,name,quantity FROM sandwich_order_line WHERE user_id=%d AND product_type_id=%d ORDER BY date DESC LIMIT 1', (user_id, product_type_id))
|
||||
res = cr.dictfetchone()
|
||||
if res:
|
||||
return {'value': res}
|
||||
# else
|
||||
return {'value': {'product_id': False, 'name': '', 'quantity': 1}}
|
||||
|
||||
def onchange_product_id(self, cr, uid, id, product_id, context={}):
|
||||
if not product_id:
|
||||
return {}
|
||||
res = pooler.get_pool(cr.dbname).get('sandwich.product').read(cr, uid, [ product_id ], ['name','product_type_id'])
|
||||
return {'value': res}
|
||||
#return {'value': {'name': name or product_id.name, 'product_type_id': product_id.product_type_id}}
|
||||
|
||||
sandwich_order_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,81 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data noupdate="1">
|
||||
<record model="sandwich.product.type" id="sandwich">
|
||||
<field name="name">sandwich</field>
|
||||
<field name="description">something to eat</field>
|
||||
</record>
|
||||
<record model="sandwich.product.type" id="drink">
|
||||
<field name="name">drink</field>
|
||||
<field name="description">Something to drink</field>
|
||||
</record>
|
||||
<record model="sandwich.product.type" id="candy">
|
||||
<field name="name">candy</field>
|
||||
<field name="description">so sweeeeeet, but so bad for your teeth...</field>
|
||||
</record>
|
||||
|
||||
<record model="sandwich.product" id="club">
|
||||
<field name="name">club</field>
|
||||
<field name="price">2.00</field>
|
||||
<field name="product_type_id" ref="sandwich"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="chicken_curry">
|
||||
<field name="name">chicken-curry</field>
|
||||
<field name="price">2.00</field>
|
||||
<field name="product_type_id" ref="sandwich"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="tuna">
|
||||
<field name="name">Tuna</field>
|
||||
<field name="price">2.50</field>
|
||||
<field name="product_type_id" ref="sandwich"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="cheese">
|
||||
<field name="name">cheese</field>
|
||||
<field name="price">1.50</field>
|
||||
<field name="product_type_id" ref="sandwich"/>
|
||||
</record>
|
||||
|
||||
<record model="sandwich.product" id="little_coke">
|
||||
<field name="name">Little Coke 0.5l</field>
|
||||
<field name="price">1.05</field>
|
||||
<field name="product_type_id" ref="drink"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="coke">
|
||||
<field name="name">Coke 1.0l</field>
|
||||
<field name="price">2.00</field>
|
||||
<field name="product_type_id" ref="drink"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="big_coke">
|
||||
<field name="name">Big Coke 2.0l</field>
|
||||
<field name="price">3.50</field>
|
||||
<field name="product_type_id" ref="drink"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="cecemel">
|
||||
<field name="name">Cecemel</field>
|
||||
<field name="price">1.35</field>
|
||||
<field name="product_type_id" ref="drink"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="water">
|
||||
<field name="name">water</field>
|
||||
<field name="price">0.75</field>
|
||||
<field name="product_type_id" ref="drink"/>
|
||||
</record>
|
||||
|
||||
<record model="sandwich.product" id="mars">
|
||||
<field name="name">Mars</field>
|
||||
<field name="price">0.80</field>
|
||||
<field name="product_type_id" ref="candy"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="snicker">
|
||||
<field name="name">Snickers</field>
|
||||
<field name="price">0.80</field>
|
||||
<field name="product_type_id" ref="candy"/>
|
||||
</record>
|
||||
<record model="sandwich.product" id="twix">
|
||||
<field name="name">Twix</field>
|
||||
<field name="price">1.00</field>
|
||||
<field name="product_type_id" ref="candy"/>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,11 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
<report id="sandwich_order_print"
|
||||
string="Sandwichs order"
|
||||
model="sandwich.order"
|
||||
name="sandwich.order.print"
|
||||
rml="sandwich/report/sandwich_report.rml"
|
||||
auto="False"/>
|
||||
</data>
|
||||
</terp>
|
|
@ -0,0 +1,191 @@
|
|||
<terp>
|
||||
<data>
|
||||
|
||||
<menuitem name="Tools" id="menu_tools" icon="STOCK_PREFERENCES"/>
|
||||
|
||||
<record model="ir.ui.view" id="sandwich_product_type_view_form">
|
||||
<field name="name">sandwich.product.type</field>
|
||||
<field name="model">sandwich.product.type</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product type definition">
|
||||
<field name="name" select="1"/>
|
||||
<field name="description" select="1" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="sandwich_product_type_view_tree">
|
||||
<field name="name">sandwich.product.type</field>
|
||||
<field name="model">sandwich.product.type</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product type definition">
|
||||
<field name="name"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_product_type">
|
||||
<field name="res_model">sandwich.product.type</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Sandwich" id="menu_tools_sandwich" parent="menu_tools"/>
|
||||
<menuitem name="Configuration" id="menu_tools_sandwich_configuration" parent="menu_tools_sandwich"/>
|
||||
<menuitem name="Type of Product" id="menu_tools_sandwich_type_product" parent="menu_tools_sandwich_configuration" action="action_sandwich_product_type"/>
|
||||
|
||||
<record model="ir.ui.view" id="sandwich_product_view_tree">
|
||||
<field name="name">sandwich.product</field>
|
||||
<field name="model">sandwich.product</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product definition">
|
||||
<field name="name"/>
|
||||
<field name="price"/>
|
||||
<field name="product_type_id"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="sandwich_product_view_form">
|
||||
<field name="name">sandwich.product</field>
|
||||
<field name="model">sandwich.product</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product definition">
|
||||
<field name="name" select="1"/>
|
||||
<field name="price" select="1" />
|
||||
<field name="product_type_id" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_product">
|
||||
<field name="res_model">sandwich.product</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Product" id="menu_tools_sandwich_product" parent="menu_tools_sandwich_configuration" action="action_sandwich_product"/>
|
||||
|
||||
<record model="ir.ui.view" id="sandwich_order_line_view_tree">
|
||||
<field name="name">sandwich.order.line.tree</field>
|
||||
<field name="model">sandwich.order.line</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Product order lines">
|
||||
<field name="date"/>
|
||||
<field name="product_id"/>
|
||||
<field name="quantity"/>
|
||||
<field name="user_id" />
|
||||
<field name="name"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="sandwich_order_line_view_form">
|
||||
<field name="name">sandwich.order.line.form</field>
|
||||
<field name="model">sandwich.order.line</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Product order lines">
|
||||
<field name="product_type_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
|
||||
<field name="user_id" select="1" on_change="onchange_user_id(user_id,product_type_id)"/>
|
||||
<field name="product_id" select="1" onchange="onchange_product_id(product_id)" domain="[('product_type_id','=',product_type_id)]"/>
|
||||
<field name="quantity" select="1"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_order_line">
|
||||
<field name="res_model">sandwich.order.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="domain">[]</field>
|
||||
<field name="view_id" ref="sandwich_order_line_view_form"/>
|
||||
</record>
|
||||
|
||||
<menuitem name="Order Lines" id="menu_tools_sandwich_orderlines" parent="menu_tools_sandwich" action="action_sandwich_order_line"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_my_order_line">
|
||||
<field name="name">My order lines</field>
|
||||
<field name="res_model">sandwich.order.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('user_id','=',uid)]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="My Order Lines" id="menu_tools_sandwich_my_orderlines" parent="menu_tools_sandwich_orderlines" action="action_sandwich_my_order_line"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_my_order_line_of_the_day">
|
||||
<field name="name">My order lines of the day</field>
|
||||
<field name="res_model">sandwich.order.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('user_id','=',uid),('date','=',time.strftime('%Y-%m-%d'))]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="My Order Lines of the Day" id="menu_tools_sandwich_my_orderlines_day" parent="menu_tools_sandwich_my_orderlines" action="action_sandwich_my_order_line_of_the_day"/>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_sandwich_order_line_of_the_day">
|
||||
<field name="name">Order lines of the day</field>
|
||||
<field name="res_model">sandwich.order.line</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Order Lines of the Day" id="menu_tools_sandwich_orderlines_day" parent="menu_tools_sandwich_orderlines" action="action_sandwich_order_line_of_the_day"/>
|
||||
|
||||
<record model="ir.ui.view" id="sandwich_order_view_tree">
|
||||
<field name="name">sandwich.order.tree</field>
|
||||
<field name="model">sandwich.order</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Ordering of this day sandwich">
|
||||
<field name="order_lines"/>
|
||||
<field name="name"/>
|
||||
<field name="note"/>
|
||||
<field name="partner"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.ui.view" id="sandwich_order_view_form">
|
||||
<field name="name">sandwich.order.form</field>
|
||||
<field name="model">sandwich.order</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Ordering of this day sandwich">
|
||||
<notebook>
|
||||
<page string="Sandwich Order">
|
||||
<separator string="Informations" colspan="4"/>
|
||||
<field name="name" colspan="4" select="1"/>
|
||||
<field name="partner" select="1"/>
|
||||
<field name="date" select="1"/>
|
||||
<separator string="Order lines" colspan="4"/>
|
||||
<field name="order_lines" colspan="4"/>
|
||||
</page>
|
||||
<page string="notes">
|
||||
<field name="note" colspan="4" nolabel="1" select="1"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_sandwich_order">
|
||||
<field name="name">Today's orders</field>
|
||||
<field name="res_model">sandwich.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" eval="False"/>
|
||||
<field name="domain">[('date','=',time.strftime('%Y-%m-%d'))]</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Today's Orders" id="menu_tools_sandwich_today_order" parent="menu_tools_sandwich" action="action_sandwich_order"/>
|
||||
|
||||
</data>
|
||||
</terp>
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
<?xml version="1.0"?>
|
||||
<terp>
|
||||
<data>
|
||||
<wizard string="Reload / Complete order" id="sandwich_order_wizard" model="sandwich.order" name="sandwich.order.wizard"/>
|
||||
<wizard string="Send remind request" id="sandwich_order_recall_wizard" model="sandwich.order" name="sandwich.order.recall.wizard"/>
|
||||
|
||||
<record model="ir.actions.wizard" id="wiz_sandwich_create">
|
||||
<field name="name">Create Order of the day</field>
|
||||
<field name="wiz_name">sandwich.order_create</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Create Order" id="menu_tools_sandwich_createorder" parent="menu_tools_sandwich" action="wiz_sandwich_create" type="wizard"/>
|
||||
|
||||
</data>
|
||||
</terp>
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import sandwich_wizard
|
||||
import order_create
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# $Id: makesale.py 1183 2005-08-23 07:43:32Z pinky $
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from mx.DateTime import now
|
||||
|
||||
import wizard
|
||||
import netsvc
|
||||
import ir
|
||||
import pooler
|
||||
|
||||
sale_form = """<?xml version="1.0"?>
|
||||
<form string="Make an order">
|
||||
<field name="name" required="True" />
|
||||
<field name="partner_id" required="True" />
|
||||
</form>"""
|
||||
|
||||
sale_fields = {
|
||||
'name' : {'string' : 'Order name', 'type': 'char'},
|
||||
'partner_id' : {'string':'Suplier', 'relation':'res.partner', 'type':'many2one'},
|
||||
}
|
||||
|
||||
class make_sale(wizard.interface):
|
||||
def _makeOrder(self, cr, uid, data, context):
|
||||
order = pooler.get_pool(cr.dbname).get('sandwich.order')
|
||||
line = pooler.get_pool(cr.dbname).get('sandwich.order.line')
|
||||
oid = order.create(cr, uid, {
|
||||
'name': data['form']['name'],
|
||||
'partner': data['form']['partner_id'],
|
||||
})
|
||||
name=data['form']['name']
|
||||
cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (oid,))
|
||||
value = {
|
||||
'domain': "[('id','in',["+str(oid)+"])]",
|
||||
'name': "Create Sandwich Orders:"+name,
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'sandwich.order',
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_id': oid
|
||||
}
|
||||
return value
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'form', 'arch' : sale_form, 'fields' : sale_fields, 'state' : [('end', 'Cancel'),('order', 'Make an order')]}
|
||||
},
|
||||
'order' : {
|
||||
'actions': [],
|
||||
'result': {'type': 'action', 'action': _makeOrder, 'state':'end'},
|
||||
}
|
||||
}
|
||||
make_sale('sandwich.order_create')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,131 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# Copyright (c) 2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||
#
|
||||
# WARNING: This program as such is intended to be used by professional
|
||||
# programmers who take the whole responsability of assessing all potential
|
||||
# consequences resulting from its eventual inadequacies and bugs
|
||||
# End users who are looking for a ready-to-use solution with commercial
|
||||
# garantees and support are strongly adviced to contract a Free Software
|
||||
# Service Company
|
||||
#
|
||||
# This program is Free Software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
|
||||
#
|
||||
# This class fill in the order with kind of automatically generated order lines, based on the last order for a user concerning a type of product
|
||||
#
|
||||
class sandwich_order_wizard(wizard.interface):
|
||||
|
||||
def _sandwich_order_wizard_order(self, cr, uid, data, context):
|
||||
if not len(data['ids']):
|
||||
return {}
|
||||
cr.execute('update sandwich_order_line set order_id=%d where order_id is null', (data['ids'][0],))
|
||||
for order in pooler.get_pool(cr.dbname).get('sandwich.order').browse(cr, uid, data['ids']):
|
||||
for user_id in data['form']['user_id'][0][2]:
|
||||
for producttype in data['form']['product_type_id'][0][2]:
|
||||
if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('product_type_id','=',producttype),('order_id','=',order.id)]):
|
||||
vals = {
|
||||
'user_id': user_id,
|
||||
'order_id': order.id,
|
||||
'date': order.date,
|
||||
'product_type_id': producttype
|
||||
}
|
||||
vals.update( pooler.get_pool(cr.dbname).get('sandwich.order.line').onchange_user_id(cr, uid, uid, user_id, producttype)['value'] )
|
||||
pooler.get_pool(cr.dbname).get('sandwich.order.line').create(cr, uid, vals)
|
||||
return {}
|
||||
|
||||
_sandwich_order_wizard_form = '''<?xml version="1.0"?>
|
||||
<form string="Complete order">
|
||||
<separator string="Set orders for the day" colspan="4"/>
|
||||
<field name="user_id"/>
|
||||
<field name="product_type_id"/>
|
||||
</form> '''
|
||||
|
||||
_sandwich_order_wizard_fields = {
|
||||
'user_id': {'string': 'User', 'type': 'many2many','relation':'res.users'},
|
||||
'product_type_id': {'string': 'Product', 'type': 'many2many', 'relation':'sandwich.product.type'},
|
||||
}
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type': 'form', 'arch':_sandwich_order_wizard_form, 'fields':_sandwich_order_wizard_fields, 'state':[('end','Cancel'),('complete','Complete order')]}
|
||||
},
|
||||
'complete': {
|
||||
'actions': [_sandwich_order_wizard_order],
|
||||
'result': {'type': 'state', 'state': 'end'}
|
||||
}
|
||||
}
|
||||
|
||||
sandwich_order_wizard('sandwich.order.wizard')
|
||||
|
||||
#
|
||||
# This class send a request message to users who don't have their order filled in for this day
|
||||
#
|
||||
class sandwich_order_recall_wizard(wizard.interface):
|
||||
def _sandwich_order_recall_wizard_send(self, cr, uid, data, context):
|
||||
for user_id in data['form']['user_id'][0][2]:
|
||||
if not pooler.get_pool(cr.dbname).get('sandwich.order.line').search(cr, uid, [('user_id','=',user_id),('order_id','=',data['id'])]):
|
||||
request = pooler.get_pool(cr.dbname).get('res.request')
|
||||
request.create(cr, uid, {
|
||||
'name' : "Please order your lunch of the day",
|
||||
'priority' : '0',
|
||||
'state' : 'active',
|
||||
'body' : """Hello,
|
||||
|
||||
It seems like you have forgotten to order your sandwich (or meal).
|
||||
As it will be ordered soon, it seems to be a rather nice idea to complete your
|
||||
order for today ASAP. If you do not, you'll probably get the same meal as yesterday...
|
||||
|
||||
Thanks,
|
||||
|
||||
--
|
||||
Tiny ERP
|
||||
""",
|
||||
'act_from' : uid,
|
||||
'act_to' : user_id,
|
||||
})
|
||||
return {}
|
||||
|
||||
_sandwich_order_recall_wizard_form = '''<?xml version="1.0"?>
|
||||
<form string="Recall orders to users">
|
||||
<separator string="List of user to remind the order" colspan="4"/>
|
||||
<field name="user_id" colspan="4"/>
|
||||
</form>'''
|
||||
|
||||
_sandwich_order_recall_wizard_fields = {
|
||||
'user_id': {'string': 'Baaaad users !', 'type': 'many2many', 'relation': 'res.users'},
|
||||
}
|
||||
|
||||
states = {
|
||||
'init' : {
|
||||
'actions' : [],
|
||||
'result' : {'type': 'form', 'arch': _sandwich_order_recall_wizard_form, 'fields': _sandwich_order_recall_wizard_fields, 'state': [('end','Cancel'),('send','Send')]},
|
||||
},
|
||||
'send' : {
|
||||
'actions' : [_sandwich_order_recall_wizard_send],
|
||||
'result' : {'type': 'state', 'state': 'end'},
|
||||
}
|
||||
}
|
||||
|
||||
sandwich_order_recall_wizard('sandwich.order.recall.wizard')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue