bzr revid: uco@tinyerp.com-20100730045634-5qpkdzycvk474yv2
This commit is contained in:
uco (Open ERP)
2010-07-30 10:26:34 +05:30
56 changed files with 2837 additions and 1571 deletions
+4 -4
View File
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 5.0.0\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-07-22 20:15+0000\n"
"PO-Revision-Date: 2010-07-29 06:54+0000\n"
"Last-Translator: lyyser <logard.1961@gmail.com>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-23 04:07+0000\n"
"X-Launchpad-Export-Date: 2010-07-30 03:36+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -6042,12 +6042,12 @@ msgstr ""
#. module: account
#: wizard_view:account.balance.account.balance.report,init:0
msgid "Select Fiscal Year(s)(Maximum Three Years)"
msgstr ""
msgstr "Vali finantsaasta(d) (maksimum kolm aastat)"
#. module: account
#: wizard_field:account.balance.account.balance.report,init,select_account:0
msgid "Select Reference Account(for % comparision)"
msgstr ""
msgstr "Valige võrdluskonto (% võrdluseks)"
#. module: account
#: model:ir.actions.wizard,name:account.wizard_account_balance_report
+1 -1
View File
@@ -203,7 +203,7 @@ class account_voucher(osv.osv):
}
self.write(cr, uid, ids, res)
else:
raise osv.except_osv('Invalid action !', 'You cannot post to Pro-Forma a voucher with Total amount = 0 !')
raise osv.except_osv(_('Invalid action !'), _('You can not post to Pro-Forma a voucher with Total amount = 0 !'))
return True
def proforma_voucher(self, cr, uid, ids, context={}):
@@ -22,6 +22,38 @@
from osv import fields, osv
from tools.translate import _
class account_invoice(osv.osv):
_inherit = 'account.invoice'
def search(self, cr, user, args, offset=0, limit=None, order=None, context=None, count=False):
"""
Returns a list of ids based on search domain {args}
@param cr: A database cursor
@param user: ID of the user currently logged in
@param args: list of conditions to be applied in search opertion
@param offset: default from first record, you can start from nth record
@param limit: number of records to be obtained as a result of search opertion
@param order: ordering on any field(s)
@param context: context arguments, like lang, time zone
@param count:
@return: Returns a list of ids based on search domain
"""
ttype = context.get('ttype', False)
if ttype and ttype in ('rec_voucher', 'bank_rec_voucher'):
args += [('type','in', ['out_invoice', 'in_refund'])]
elif ttype and ttype in ('pay_voucher', 'bank_pay_voucher'):
args += [('type','in', ['in_invoice', 'out_refund'])]
elif ttype and ttype in('journal_sale_vou', 'journal_pur_voucher', 'journal_voucher'):
raise osv.except_osv(_('Invalid action !'), _('You can not reconcile sales, purchase, or journal entry with invoice !'))
args += [('type','=', 'do_not_allow_search')]
res = super(account_invoice, self).search(cr, user, args, offset, limit, order, context, count)
return res
account_invoice()
class account_move_line(osv.osv):
_inherit = "account.move.line"
_columns = {
@@ -158,11 +190,12 @@ class account_voucher(osv.osv):
move_line_id = move_line_pool.create(cr, uid, move_line)
line_ids += [move_line_id]
if line.invoice_id:
if line.invoice_id and inv.type in ('pay_voucher', 'bank_pay_voucher', 'rec_voucher', 'bank_rec_voucher'):
rec_ids += [move_line_id]
for move_line in line.invoice_id.move_id.line_id:
if line.account_id.id == move_line.account_id.id:
rec_ids += [move_line.id]
rec_ids += [move_line.id]
if rec_ids:
move_line_pool.reconcile_partial(cr, uid, rec_ids)
@@ -196,7 +229,7 @@ class account_voucher_line(osv.osv):
res = super(account_voucher_line, self).move_line_get_item(cr, uid, line, context)
res['invoice'] = line.invoice_id or False
return res
def onchange_invoice_id(self, cr, uid, ids, invoice_id, currency_id):
currency_pool = self.pool.get('res.currency')
invoice_pool = self.pool.get('account.invoice')
@@ -10,10 +10,10 @@
<field name="payment_ids" position="replace">
<field name="voucher_line_ids" default_get="{'lines': voucher_line_ids}" colspan="4" nolabel="1" height="275">
<tree string="Voucher Lines" editable="top">
<field name="partner_id" on_change="onchange_partner(partner_id,type,parent.type, parent.currency_id)"/>
<field name="partner_id" on_change="onchange_partner(partner_id, type, parent.type, parent.currency_id)"/>
<field name="account_id" on_change="onchange_line_account(account_id, type, parent.type)"/>
<field name="name"/>
<field name="invoice_id" on_change="onchange_invoice_id(invoice_id, parent.currency_id)" domain="[('partner_id','=',partner_id),('state','=','open'),('residual','&gt;',0.0)]"/>
<field name="invoice_id" context="{'ttype':parent.type}" on_change="onchange_invoice_id(invoice_id, parent.currency_id)" domain="[('partner_id','=',partner_id),('state','=','open'),('residual','&gt;',0.0)]"/>
<field name="type"/>
<field name="amount"/>
<field name="account_analytic_id"/>
+1 -1
View File
@@ -1092,7 +1092,7 @@ class calendar_event(osv.osv):
('confirmed', 'Confirmed'),
('cancelled', 'Cancelled')], 'State', readonly=True),
'exdate': fields.text('Exception Date/Times', help="This property \
defines the list of date/time exceptions for arecurring calendar component."),
defines the list of date/time exceptions for a recurring calendar component."),
'exrule': fields.char('Exception Rule', size=352, help="defines a \
rule or repeating pattern for an exception to a recurrence set"),
'rrule': fields.function(_get_rulestring, type='char', size=124, method=True, \
+185
View File
@@ -0,0 +1,185 @@
# Indonesian translation for openobject-addons
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
msgid ""
msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-08-28 16:01+0000\n"
"PO-Revision-Date: 2010-07-29 09:25+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: Indonesian <id@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-07-30 03:37+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_module_quality
#: field:module.quality.check,final_score:0
msgid "Final Score (%)"
msgstr ""
#. module: base_module_quality
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
#. module: base_module_quality
#: model:ir.module.module,shortdesc:base_module_quality.module_meta_information
msgid "Base module quality"
msgstr ""
#. module: base_module_quality
#: field:module.quality.check,name:0
msgid "Rated Module"
msgstr ""
#. module: base_module_quality
#: view:module.quality.detail:0
msgid "Detail"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,note:0
msgid "Note"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,state:0
msgid "State"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,detail:0
msgid "Details"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,ponderation:0
msgid "Ponderation"
msgstr ""
#. module: base_module_quality
#: help:module.quality.detail,ponderation:0
msgid ""
"Some tests are more critical than others, so they have a bigger weight in "
"the computation of final rating"
msgstr ""
#. module: base_module_quality
#: view:module.quality.check:0
#: field:module.quality.check,check_detail_ids:0
msgid "Tests"
msgstr ""
#. module: base_module_quality
#: selection:module.quality.detail,state:0
msgid "Skipped"
msgstr ""
#. module: base_module_quality
#: help:module.quality.detail,state:0
msgid ""
"The test will be completed only if the module is installed or if the test "
"may be processed on uninstalled module."
msgstr ""
#. module: base_module_quality
#: constraint:ir.ui.view:0
msgid "Invalid XML for View Architecture!"
msgstr ""
#. module: base_module_quality
#: model:ir.model,name:base_module_quality.model_module_quality_check
msgid "module.quality.check"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,name:0
msgid "Name"
msgstr ""
#. module: base_module_quality
#: wizard_field:quality_detail_save,init,module_file:0
msgid "Save report"
msgstr ""
#. module: base_module_quality
#: wizard_field:quality_detail_save,init,name:0
msgid "File name"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,score:0
msgid "Score (%)"
msgstr ""
#. module: base_module_quality
#: help:quality_detail_save,init,name:0
msgid "Save report as .html format"
msgstr ""
#. module: base_module_quality
#: view:module.quality.detail:0
#: field:module.quality.detail,summary:0
msgid "Summary"
msgstr ""
#. module: base_module_quality
#: model:ir.actions.wizard,name:base_module_quality.quality_detail_save
msgid "Report Save"
msgstr ""
#. module: base_module_quality
#: wizard_view:quality_detail_save,init:0
msgid "Standard entries"
msgstr ""
#. module: base_module_quality
#: view:module.quality.detail:0
msgid "Save Report"
msgstr ""
#. module: base_module_quality
#: code:addons/base_module_quality/wizard/module_quality_check.py:0
#: model:ir.actions.wizard,name:base_module_quality.create_quality_check_id
#, python-format
msgid "Quality Check"
msgstr ""
#. module: base_module_quality
#: model:ir.model,name:base_module_quality.model_module_quality_detail
msgid "module.quality.detail"
msgstr ""
#. module: base_module_quality
#: selection:module.quality.detail,state:0
msgid "Done"
msgstr ""
#. module: base_module_quality
#: code:addons/base_module_quality/speed_test/speed_test.py:0
#: view:module.quality.check:0
#: view:module.quality.detail:0
#, python-format
msgid "Result"
msgstr ""
#. module: base_module_quality
#: wizard_button:quality_detail_save,init,end:0
msgid "Cancel"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,message:0
msgid "Message"
msgstr ""
#. module: base_module_quality
#: field:module.quality.detail,quality_check_id:0
msgid "Quality"
msgstr ""
+3 -2
View File
@@ -236,12 +236,13 @@ class crm_lead(osv.osv, crm_case):
context.update({'active_ids': ids})
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_action')
value = {}
view_id = False
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
for case in self.browse(cr, uid, ids):
context.update({'active_id': case.id})
if not case.partner_id:
@@ -267,7 +268,7 @@ class crm_lead(osv.osv, crm_case):
'name': _('Create Opportunity'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.lead2opportunity',
'res_model': 'crm.lead2opportunity.action',
'view_id': False,
'context': context,
'views': [(view_id, 'form')],
+1 -1
View File
@@ -310,7 +310,7 @@
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sales Team"/>
help="My Sales Team(s)"/>
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[]"
+1 -1
View File
@@ -298,7 +298,7 @@
<field name="section_id" select="1" widget="selection">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sale Team" />
help="My Sales Team(s)" />
</field>
<field name="user_id" select="1"/>
</group>
+2 -2
View File
@@ -35,7 +35,7 @@
<field name="date_action"/>
<field name="title_action"/>
<field name="priority" string="Priority"/>
<button string="Merge with Other Opportunity"
<button string="Merge with other Opportunity"
name="%(merge_opportunity_act)d" icon="gtk-add" type="action" />
<newline/>
<field name="type" invisible="1"/>
@@ -302,7 +302,7 @@
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
context="{'invisible_section': False}"
help="My Sales Team" />
help="My Sales Team(s)" />
<filter icon="terp-personal+"
context="{'invisible_section': False}"
domain="[]"
+1 -1
View File
@@ -284,7 +284,7 @@
select="1" widget="selection" string="Sales Team">
<filter icon="terp-personal+"
domain="['|', ('section_id.user_id','=',uid), ('section_id.member_ids', 'in', [uid])]"
help="My Sale Team" />
help="My Sales Team(s)" />
</field>
<newline/>
<group expand="0" string="Group By..." colspan="4">
+65 -2
View File
@@ -222,7 +222,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
res = mod_obj.read(cr, uid, result, ['res_id'])
value = {}
data_obj = self.pool.get('ir.model.data')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_action')
view_id = False
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
@@ -232,7 +232,7 @@ class crm_lead2opportunity_partner(osv.osv_memory):
'name': _('Create Opportunity'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.lead2opportunity',
'res_model': 'crm.lead2opportunity.action',
'view_id': False,
'context': context,
'views': [(view_id, 'form')],
@@ -297,5 +297,68 @@ Leads Could not convert into Opportunity"))
crm_lead2opportunity_partner()
class crm_lead2opportunity_action(osv.osv_memory):
'''
Merge with Existing Opportunity or Convert to Opportunity
'''
_name = 'crm.lead2opportunity.action'
_description = 'Convert/Merge Opportunity'
_columns = {
'name': fields.selection([('convert', 'Convert to Opportunity'), ('merge', 'Merge with existing Opportunity')],'Select Action', required=True),
}
_defaults = {
'name': 'convert',
}
def do_action(self, cr, uid, ids, context=None):
"""
This function opens form according to selected Action
@param self: The object pointer
@param cr: the current row, from the database cursor,
@param uid: the current user’s ID for security checks,
@param ids: List of Lead to Opportunity IDs
@param context: A standard dictionary for contextual values
@return : Dictionary value for Opportunity form
"""
value = {}
data_obj = self.pool.get('ir.model.data')
view_id = False
for this in self.browse(cr, uid, ids, context=context):
if this.name == 'convert':
data_id = data_obj._get_id(cr, uid, 'crm', 'view_crm_lead2opportunity_create')
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
value = {
'name': _('Create Opportunity'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.lead2opportunity',
'view_id': False,
'context': context,
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
elif this.name == 'merge':
data_id = data_obj._get_id(cr, uid, 'crm', 'merge_opportunity_form')
if data_id:
view_id = data_obj.browse(cr, uid, data_id, context=context).res_id
value = {
'name': _('Merge with Existing Opportunity'),
'view_type': 'form',
'view_mode': 'form,tree',
'res_model': 'crm.merge.opportunity',
'view_id': False,
'context': context,
'views': [(view_id, 'form')],
'type': 'ir.actions.act_window',
'target': 'new',
}
return value
crm_lead2opportunity_action()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -3,7 +3,7 @@
<!-- Lead to Opportunity view -->
<record id="view_crm_lead2opportunity_create" model="ir.ui.view">
<record id="view_crm_lead2opportunity_create" model="ir.ui.view">
<field name="name">crm.lead2opportunity.create</field>
<field name="model">crm.lead2opportunity</field>
<field name="type">form</field>
@@ -61,5 +61,25 @@
</field>
</record>
<record id="view_crm_lead2opportunity_action" model="ir.ui.view">
<field name="name">crm.lead2opportunity.action.form</field>
<field name="model">crm.lead2opportunity.action</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Select Action">
<separator string="Select Action" colspan="4" />
<label string="If you select Merge with existing Opportunity, the lead details(with the communication history) will be merged with existing Opportunity of Selected partner." colspan="4"/>
<newline/>
<field name="name" colspan="4"/>
<separator colspan="4" />
<group col="4" colspan="4">
<label colspan="2"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="do_action" string="Next" type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
</data>
</openerp>
+23 -9
View File
@@ -18,7 +18,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from crm import crm
from osv import osv, fields
from tools.translate import _
@@ -42,14 +42,15 @@ class crm_merge_opportunity(osv.osv_memory):
if record_id:
opp_obj = self.pool.get('crm.lead')
opp = opp_obj.browse(cr, uid, record_id, context=context)
if opp.type != 'opportunity':
raise osv.except_osv(_('Warning!'), _('Can only perform this Operation for "Opportunities".'))
if not opp.partner_id:
raise osv.except_osv(_('Warning!'), _('Opportunity must have Partner assigned before merging with other Opportunity.'))
#Search for Opportunity for the same partner
opp_ids = opp_obj.search(cr, uid, [('partner_id', '=', opp.partner_id.id), ('type', '=', 'opportunity')])
if not len(opp_ids) > 1:
raise osv.except_osv(_('Warning!'), _("There are no other Opportunities for the partner '%s'.") % (opp.partner_id.name))
opp_ids = opp_obj.search(cr, uid, [('partner_id', '=', opp.partner_id.id), ('type', '=', 'opportunity'), ('state', 'in', ('open', 'pending'))])
# Removing current opportunity
if record_id in opp_ids:
opp_ids.remove(record_id)
if not opp_ids:
raise osv.except_osv(_('Warning!'), _("There are no other 'Open' or 'Pending' Opportunities for the partner '%s'.") % (opp.partner_id.name))
pass
@@ -97,12 +98,21 @@ class crm_merge_opportunity(osv.osv_memory):
if history.history:
new_history = message_obj.copy(cr, uid, history.id, default={'res_id': opp.id})
opp_obj._history(cr, uid, [current_opp], _('Merged into Opportunity: %s') % (opp.id))
opp_obj.case_cancel(cr, uid, [record_id])
if this.state == 'unchanged':
pass
elif this.state == 'done':
opp_obj.case_close(cr, uid, [record_id])
elif this.state == 'draft':
opp_obj.case_reset(cr, uid, [record_id])
elif this.state in ['cancel', 'open', 'pending']:
act = 'case_' + this.state
getattr(opp_obj, act)(cr, uid, [record_id])
return {}
_columns = {
'opportunity_ids' : fields.many2many('crm.lead', 'merge_opportunity_rel', 'merge_id', 'opportunity_id', 'Opportunities', domain=[('type', '=', 'opportunity')]),
'state': fields.selection(crm.AVAILABLE_STATES + [('unchanged', 'Unchanged')], string='Set State To', required=True),
}
def default_get(self, cr, uid, fields, context=None):
@@ -122,12 +132,16 @@ class crm_merge_opportunity(osv.osv_memory):
if record_id:
opp_obj = self.pool.get('crm.lead')
opp = opp_obj.browse(cr, uid, record_id, context=context)
opp_ids = opp_obj.search(cr, uid, [('partner_id', '=', opp.partner_id.id), ('type', '=', 'opportunity')])
opp_ids = opp_obj.search(cr, uid, [('partner_id', '=', opp.partner_id.id), ('type', '=', 'opportunity'), ('state', 'in', ('open', 'pending'))])
# Removing current opportunity
opp_ids.remove(record_id)
if record_id in opp_ids:
opp_ids.remove(record_id)
if 'opportunity_ids' in fields:
res.update({'opportunity_ids': opp_ids})
if 'state' in fields:
res.update({'state': u'cancel'})
return res
crm_merge_opportunity()
@@ -14,7 +14,7 @@
<field name="opportunity_ids" nolabel="1" colspan="4" width="550" height="300"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<label string="" colspan="2"/>
<field name="state" />
<button string="_Cancel" icon="gtk-cancel" special="cancel" />
<button name="action_merge" type="object"
string="_Merge" icon="gtk-ok" />
-6
View File
@@ -67,7 +67,6 @@
<field name="date_closed" string="Closure Date"/>
<field name="categ_id" string="Type" select="1"/>
<field name="stage_id" invisible="1"/>
<field name="som" invisible="1"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
@@ -209,7 +208,6 @@
<field name="id" select="1"/>
<field name="active"/>
<field name="canal_id"/>
<field name="som"/>
<separator colspan="4" string="Dates"/>
<field name="create_date"/>
<field name="date_closed"/>
@@ -312,10 +310,6 @@
<filter string="Closure" icon="terp-go-month"
domain="[]" help="Date Closed"
context="{'group_by':'date_closed'}" />
<separator orientation="vertical"/>
<filter string="State of Mind"
icon="terp-face-plain"
domain="[]" context="{'group_by':'som'}" />
</group>
</search>
</field>
@@ -202,7 +202,6 @@
<field name="id" select="1"/>
<field name="priority" string="Priority"/>
<field name="canal_id"/>
<field name="som"/>
</group>
<group col="2" colspan="2">
<separator colspan="4" string="Dates"/>
@@ -36,7 +36,6 @@
states="open,pending"
string="Send Reminder" type="object"
icon="gtk-go-forward" />
<field name="som"/>
<field name="date" select="1"/>
<field name="date_deadline"/>
</group>
@@ -176,7 +175,6 @@
<field name="user_id"/>
<field name="section_id"/>
<field name="priority"/>
<field name="som" invisible="1"/>
<field name="state"/>
<button name="case_open" string="Open"
states="draft,pending" type="object"
@@ -259,9 +257,6 @@
context="{'group_by':'state'}" />
<filter string="Priority" icon="terp-rating-rated"
domain="[]" context="{'group_by':'priority'}" />
<filter string="State of Mind"
icon="terp-face-plain"
domain="[]" context="{'group_by':'som'}" />
<separator orientation="vertical"/>
<filter string="Date" icon="terp-go-month"
domain="[]" help="Request Date"
@@ -1,8 +1,8 @@
- |
In order to test hr_attendance module in OpenERP, I create new attendance and perform Sign In/Sign Out operation.
- |
First I create Employee "Mark Johnson".
-
In order to test hr_attendance module in OpenERP, I will first create new attendance reasons and perform Sign In/Sign Out operations.
-
I create a new employee "Mark Johnson".
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
@@ -10,56 +10,56 @@
gender: male
name: Mark Johnson
user_id: base.user_root
- |
Given that I have Attendance Reason "Good Morning" for Sign In.
-
!record {model: hr.action.reason, id: hr_action_reason_goodmorning0}:
name: Good Morning
-
I create a new attendance reason "Login" for Sign In.
-
!record {model: hr.action.reason, id: hr_action_reason_login0}:
name: Login
action_type: sign_in
- |
I also create another Attendance Reason for Sign Out.
-
!record {model: hr.action.reason, id: hr_action_reason_goodnight0}:
name: Good Night
-
I create second attendance reason "Logout" for Sign Out.
-
!record {model: hr.action.reason, id: hr_action_reason_logout0}:
name: Logout
action_type: sign_out
- |
Now , When I came in office , I create Atendances and perform "Sign In" action with proper reason.
-
-
Now, at the time of login, I create an attendance with "Sign In" action and proper reason.
-
!record {model: hr.attendance, id: hr_attendance_0}:
action: sign_in
action_desc: 'hr_action_reason_goodmorning0'
action_desc: 'hr_action_reason_login0'
employee_id: 'hr_employee_employee0'
name: '2010-05-18 19:08:08'
- |
I check that Employee is in "Present" state.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
I check that Employee state is "Present".
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'present'
- |
When I left office , I create attendance and perform "Sign Out".
-
-
At the time of logout, I create an attendance with "Sign Out" action.
-
!record {model: hr.attendance, id: hr_attendance_1}:
action: sign_out
employee_id: 'hr_employee_employee0'
name: '2010-05-18 19:10:55'
- |
I check that Employee is in "Absent" state.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'absent'
I check that Employee state is Absent.
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'absent'
- |
I can also fill my attendance using "Sign In/Sign Out" wizard.
-
-
I will use "Sign In/Sign Out" wizard for attendances.
-
!record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}:
name: Mark Johnson
state: absent
- |
I click on "Sign In" button of this wizard to perform present action.
-
-
I click on "Sign In" button of this wizard to login.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
@@ -68,21 +68,21 @@
self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")], {"active_id": ref("hr_employee_employee0")})
- |
I check that Employee is in "Present" state.
-
I check that Employee state is "Present".
-
!assert {model: hr.employee, id: hr_employee_employee0}:
- state == 'present'
- |
I forgot to "Sign Out" in Yesterday and want to sign in Today using This wizard.
-
- state == 'present'
-
I forgot to "Sign Out" Yesterday and want to sign in Today using This wizard.
-
!record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}:
name: Mark Johnson
state: present
- |
I click on "Sign In" button of this wizard. that will Open new form which ask for Last Sign Out date.
-
-
I click on "Sign In" button of this wizard, this will Open a new form which ask for Last Sign Out date.
-
!python {model: hr.sign.in.out}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
@@ -90,15 +90,15 @@
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_sign_in_out_markjohnson0')], {'name': employee['name'], 'state': employee['state'], 'emp_id': emp_id[0]})
self.si_check(cr, uid, [ref("hr_sign_in_out_markjohnson0")])
- |
I select Last Sign Out date in "hr sign out ask" wizard.
-
-
I select Last Sign Out date.
-
!record {model: hr.sign.in.out.ask, id: hr_sign_in_out_ask_markjohnson0}:
last_time: !eval time.strftime('%Y-%m-%d %H:%M:%S')
name: Mark Johnson
- |
Now I click on "Sign In" button of this wizard.
-
name: Mark Johnson
-
Now I click on "Sign In" button of this wizard.
-
!python {model: hr.sign.in.out.ask}: |
obj_attendance = self.pool.get('hr.employee')
emp_id = obj_attendance.search(cr, uid, [('user_id', '=', uid), ('name', '=', "Mark Johnson")])
@@ -106,4 +106,11 @@
employee = obj_attendance.read(cr, uid, emp_id)[0]
self.write(cr, uid, [ref('hr_sign_in_out_ask_markjohnson0')], {'emp_id': emp_id[0]})
#self.sign_in(cr, uid, [ref("hr_sign_in_out_ask_markjohnson0")], {"active_ids": [ref("hr_attendance.menu_hr_attendance_sigh_in_out")]})
-
Finally i will check the state of the employee is present.
-
!record {model: hr.sign.in.out, id: hr_sign_in_out_markjohnson0}:
name: Mark Johnson
state: present
+23 -22
View File
@@ -1,9 +1,8 @@
- |
In order to test hr_contract module in OpenERP,
I will create contract for "Mark Johnson" employee.
- |
I create Employee "Mark Johnson" to assign contract.
-
In order to test hr_contract module in OpenERP, I will create a new employee and create contract for the same.
-
I create a new employee "Mark Johnson".
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
@@ -11,29 +10,31 @@
gender: male
name: Mark Johnson
user_id: base.user_root
- |
Given that I have Contract wage period "monthly" and
specify "hours in period" is "176.00"
-
children: 2
marital: hr.hr_employee_marital_status_married
place_of_birth: Belgium
vehicle: 'No'
vehicle_distance: 12
-
I create a new Contract wage period.
-
!record {model: hr.contract.wage.type.period, id: hr_contract_wage_type_period_monthly0}:
factor_days: 178.0
factor_days: 176.0
name: monthly
- |
Given that I have Contract wage type "Monthly Gross Wage".
select wage period "monthly" and type "Gross". with hour cost "1.9"
-
-
I create a new Contract Wage Type.
-
!record {model: hr.contract.wage.type, id: hr_contract_wage_type_monthlygrosswage0}:
factor_type: 1.9
name: Monthly Gross Wage
period_id: 'hr_contract_wage_type_period_monthly0'
type: gross
- |
Now I start by creating contract for "Mark Johnson".
Select wage type "Monthly Gross Wage" and Wage period "monthly"
which I had given.
-
-
I create a new contract for "Mark Johnson".
-
!record {model: hr.contract, id: hr_contract_contract0}:
advantages_gross: 0.0
employee_id: 'hr_employee_employee0'
+55 -58
View File
@@ -1,8 +1,8 @@
- |
In order to test the hr_holiday in OpenERP, I will Allocate leaves for Employee and manage leaves and leaves requests.
- |
For that First I create new user "user1" to make leave request.
-
-
In order to test the hr_holiday module in OpenERP, I will Allocate leaves for Employee and manage leaves and leaves requests.
-
I create new user "user1" to who makes leave request.
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
context_lang: en_US
@@ -13,7 +13,7 @@
login: user1
name: user1
password: user1
- |
-
I create a new employee “Mark Johnshon” as Manager to validate employee leave.
-
!record {model: hr.employee, id: hr_employee_employee0}:
@@ -22,90 +22,87 @@
gender: male
name: Mark Johnson
user_id: base.user_root
- |
Create another employee "Phil Graves" as "user1" who make leave request.
-
-
I Create another employee "Phil Graves" as "user1".
-
!record {model: hr.employee, id: hr_employee_philgraves0}:
address_home_id: base.res_partner_address_8
name: Phil Graves
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
Given that I have Leave type for employee.
-
!record {model: hr.holidays.status, id: hr_holidays_status_fullleave0}:
-
I create a new Leave type "Sick Leave".
-
!record {model: hr.holidays.status, id: hr_holidays_status_sick0}:
color_name: red
name: Full Leave.
limit: 1
name: Sick Leave.
limit: 12
- |
After that I allocate leave request for employee "Phil Graves".
-
-
I allocate leave request for employee "Phil Graves".
-
!record {model: hr.holidays, id: hr_holidays_allocateleaveforuser0}:
allocation_type: employee
employee_id: 'hr_employee_philgraves0'
holiday_status_id: hr_holidays_status_fullleave0
name: Allocate leave for user1
holiday_status_id: hr_holidays_status_sick0
name: Sick Leaves for Phil Graves
number_of_days_temp: 12.0
date_from: '05/20/2010 13:59:00'
date_to: '05/22/2010 13:59:00'
type: add
- |
I click on "Confirm" button to confirm allocate leave for employee.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_allocateleaveforuser0}
- |
I click on "Validate" button to validate leave for employee.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0}
I confirmed the allocation by clicking on "Confirm" button.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_allocateleaveforuser0}
- |
Now employee "Phil Graves" want to leave. so, I connect as user1 which is username of this employee and want to make leave request.
-
-
I validate the allocation by clicking on "To Approve" button.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_allocateleaveforuser0}
-
I connect as "user1", and create a new leave request for employee "Phil Graves".
-
!record {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
allocation_type: employee
date_from: '2010-05-20 11:48:00'
date_to: '2010-05-21 11:48:00'
employee_id: 'hr_employee_philgraves0'
holiday_status_id: 'hr_holidays_status_fullleave0'
name: I want to leave for go to hospital
notes: I want to leave for go to hospital. so please accept my leave.
holiday_status_id: 'hr_holidays_status_sick0'
name: Appointment with Doctor
notes: My appointment with the doctor is confirmed. so please accept my leave.
number_of_days_temp: 2.0
type: remove
user_id: 'res_users_user0'
- |
I check that Leave Request is on "Draft" state.
-
I check that Leave Request is in "Draft" state.
-
!assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
- state == 'draft'
- |
I confirm my leave Request by click on "Confirm" button.
-
- state == 'draft'
-
I confirm leave Request by click on "Confirm" button.
-
!workflow {model: hr.holidays, action: confirm, ref: hr_holidays_iwanttoleaveforgotohospital0}
- |
I connect as Admin user and Open Leave request of "Phil Graves".
and "validate" it by click on "validate" button.
-
-
I connect as "Admin" user and Open Leave request of "Phil Graves" and "validate" it by click on "Approve" button.
-
!workflow {model: hr.holidays, action: validate, ref: hr_holidays_iwanttoleaveforgotohospital0}
- |
I check that "Leave Manager" field is automaticly filled by the user who validate the leave'.
-
I check that "Leave Manager" field is automatically filled by the user who validate the leave'.
-
!python {model: hr.holidays}: |
ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)])
obj = self.browse(cr, uid, ref('hr_holidays_iwanttoleaveforgotohospital0'))
assert ids2[0] == obj.manager_id.id
- |
-
I check that Leave request state is "Validated".
-
-
!assert {model: hr.holidays, id: hr_holidays_iwanttoleaveforgotohospital0}:
- state == "validate"
- |
I can also see Summary of Employee's holiday by using 'Print Summary of Employee's Holidays'.
This will allow you to choose if you want to print either the Confirmed & Validated holidays or only the Validated ones.
- state == "validate"
-
I can also see Summary of Employee's holiday by using 'Employee's Holidays' Report. This report will allows to choose to print holidays with state Confirmed, Validated or both.
@@ -27,7 +27,6 @@
<record id="hr_case_traineemca0" model="hr.applicant">
<field model="res.partner.canal" name="canal_id" search="[('name','=','E-mail')]"/>
<field name="partner_address_id" ref="base.res_partner_address_14"/>
<field name="som" ref="base.som_fury"/>
<field eval="time.strftime('%Y-%m-10 18:15:00')" name="date"/>
<field name="type_id" ref="degree_bac5"/>
<field name="partner_id" ref="base.res_partner_15"/>
@@ -47,7 +46,6 @@
</record>
<record id="hr_case_fresher0" model="hr.applicant">
<field model="res.partner.canal" name="canal_id" search="[('name','=','direct')]"/>
<field name="som" ref="base.som_happy"/>
<field eval="time.strftime('%Y-%m-15 16:10:00')" name="date"/>
<field eval="time.strftime('%Y-%m-18')" name="date_deadline"/>
<field name="type_id" ref="degree_licenced"/>
@@ -119,7 +117,6 @@
<record id="hr_case_traineemca1" model="hr.applicant">
<field model="res.partner.canal" name="canal_id" search="[('name','=','E-mail')]"/>
<field name="partner_address_id" ref="base.res_partner_address_14"/>
<field name="som" ref="base.som_fury"/>
<field eval="time.strftime('%Y-%m-12 17:49:19')" name="date"/>
<field name="type_id" ref="degree_bac5"/>
<field name="partner_id" ref="base.res_partner_15"/>
+31 -34
View File
@@ -1,9 +1,9 @@
- |
In order to test hr_timesheet Module in OpenERP, I make "Sign In or Sign Out for Project" to encode and
track time spent on the different projects.
-
In order to test hr_timesheet Module in OpenERP, I make "Sign In/Sign Out for Project" to encode and
track time spent on the different projects.
- |
Now, I create a new employee “Mark Johnson” to test Timesheet.
-
I create a new employee “Mark Johnson” to test Timesheet.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
@@ -13,8 +13,8 @@
name: Mark Johnson
user_id: base.user_root
- |
I create new user "user1" which is assigned to employee.
-
I create new user "user1".
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
@@ -29,8 +29,8 @@
name: user1
password: user1
- |
I create another employee "Francline" as "user1".
-
I create another new employee "Francline" as "user1".
-
!record {model: hr.employee, id: hr_employee_fracline1}:
address_home_id: base.res_partner_address_8
@@ -38,16 +38,16 @@
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
Given that I have Timesheet journal for employee.
-
I create Timesheet journal for employee.
-
!record {model: account.analytic.journal, id: analytic_journal}:
code: TS
name: Timesheet Journal
type: general
- |
Given that I have product for "Consultancy - Senior Developer".
-
I create a product as "Consultancy - Senior Developer".
-
!record {model: product.product, id: product_consultant}:
categ_id: product.product_category_10
@@ -62,42 +62,41 @@
uom_id: product.uom_hour
uom_po_id: product.uom_hour
- |
I assing product and journal to "Mark Johnson"
-
I assigned product and journal to "Mark Johnson"
-
!record {model: hr.employee, id: hr_employee_employee0}:
product_id: product_consultant
journal_id: analytic_journal
- |
And also assing product and journal to "francline" employee.
-
I assigned product and journal to "Francline".
-
!record {model: hr.employee, id: hr_employee_fracline1}:
product_id: product_consultant
journal_id: analytic_journal
- |
Now , When I came in office , I create Attendances and perform "Sign In" action with proper reason.
-
I create attendance and perform "Sign In" action with proper reason.
-
!record {model: hr.attendance, id: hr_attendance_0}:
action: sign_in
employee_id: 'hr_employee_fracline1'
name: '2010-05-26 10:08:08'
- |
When I left office , I create attendance and perform "Sign Out".
-
I create attendance and perform "Sign Out" action.
-
!record {model: hr.attendance, id: hr_attendance_1}:
action: sign_out
employee_id: 'hr_employee_fracline1'
name: '2010-05-26 15:10:55'
- |
I start by "Sign In/Sign Out by Project" wizard and click on "Sign In/Sign Out" button of this wizard.
-
On "Sign In/Sign Out by Project" wizard i click on "Sign In/Sign Out" button of this wizard.
-
!python {model: hr.sign.in.project}: |
uid = ref('res_users_user0')
self.check_state(cr, uid, [ref("hr_employee_fracline1")], {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]})
- |
-
I select start date and Perform start work on project.
-
!python {model: hr.sign.in.project}: |
@@ -105,8 +104,8 @@
new_id = self.create(cr, uid, {'emp_id': 'hr_employee_fracline1', 'name': 'Francline', 'server_date': '2010-06-08 19:50:54', 'state': 'absent'})
self.sign_in_result(cr, uid, [new_id], context)
- |
My work is done and I want to stop work.for that I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard.
-
To stop work I click on "Sign In/Sign Out" button of "Sign In/Sign Out by Project" wizard.
Which check state in hr attendace form for user.
-
!python {model: hr.sign.in.project}: |
@@ -115,11 +114,9 @@
self.check_state(cr, uid, ids, {"active_ids": [ref("hr_timesheet.menu_hr_timesheet_sign_in")]
})
- |
This will Open "hr sign out project" form. I select analytical project2 development account.
-
For that I Creating a analytic account.
-
-
I Create an analytic account "Project2".
-
!record {model: account.analytic.account, id: account_analytic_account_project0}:
company_id: base.main_company
name: Project2
@@ -127,8 +124,8 @@
quantity_max: 0.0
state: open
- |
My work for this project is over and I stop work by click on "Stop Work" button of this wizard.
-
My work for this project is over and I stop working by clicking on "Stop Work" button of this wizard.
-
!python {model: hr.sign.out.project}: |
import time
@@ -1,55 +1,36 @@
- |
In order, to test hr_timesheet_sheet module in OpenERP, I create timesheet and check validation process done by
manager.
- |
Now, I create a new employee “Mark Johnson” to test Timesheet.
-
In order to test hr_timesheet_sheet module in OpenERP, I create timesheet and check validation process done by manager.
-
I will create a company and set maximum allowed difference between timesheet and attendance to 1 hour
-
!record {model: res.company, id: res_company_openERP}:
currency_id: base.ARS
name: OpenERP SA
partner_id: base.res_partner_desertic_hispafuentes
timesheet_max_difference: 1.0
-
I create a new employee “Mark Johnson”.
-
!record {model: hr.employee, id: hr_employee_employee0}:
address_home_id: base.res_partner_address_1
company_id: base.main_company
company_id: res_company_openERP
gender: male
marital: hr.hr_employee_marital_status_single
name: Mark Johnson
user_id: base.user_root
- |
I create new user "user1".
-
!record {model: res.users, id: res_users_user0}:
company_id: base.main_company
context_lang: en_US
groups_id:
- hr.group_hr_user
- hr_attendance.group_hr_attendance
- base.group_user
- base.group_extended
- hr.group_hr_manager
login: user1
name: user1
password: user1
- |
create another employee "Francline" as "user1".
-
!record {model: hr.employee, id: hr_employee_fracline0}:
address_home_id: base.res_partner_address_8
name: Francline
parent_id: 'hr_employee_employee0'
user_id: 'res_users_user0'
- |
Given that I have Timesheet journal for employee.
-
-
I create new Timesheet journal for employee.
-
!record {model: account.analytic.journal, id: analytic_journal}:
code: TS
name: Timesheet Journal
type: general
- |
Given that I have product for "Consultancy - Senior Developer".
-
-
I create a new product "Consultancy - Senior Developer".
-
!record {model: product.product, id: product_consultant}:
categ_id: product.product_category_10
default_code: DEV
@@ -63,77 +44,110 @@
uom_id: product.uom_hour
uom_po_id: product.uom_hour
- |
I assing product and journal to "Mark Johnson"
-
-
I assign this product and journal to "Mark Johnson"
-
!record {model: hr.employee, id: hr_employee_employee0}:
product_id: product_consultant
product_id: product_consultant
journal_id: analytic_journal
- |
And also assing product and journal to "francline" employee.
-
!record {model: hr.employee, id: hr_employee_fracline0}:
product_id: product_consultant
journal_id: analytic_journal
- |
I connect as "francline" and create my current timesheet.
-
-
I create my current timesheet for "Mark Johnson".
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
date_current: '2010-05-26'
date_from: '2010-05-01'
date_to: '2010-05-31'
name: Week-22(2010)
state: new
user_id: 'res_users_user0'
- |
Now , When I came in office , I create Attendances and perform "Sign In" action with proper reason.
-
user_id: base.user_root
-
Now , at the time of login, I create Attendances and perform "Sign In" action.
-
!record {model: hr.attendance, id: hr_attendance_0}:
action: sign_in
employee_id: 'hr_employee_fracline0'
employee_id: 'hr_employee_employee0'
name: '2010-05-26 10:08:08'
- |
When I left office , I create attendance and perform "Sign Out".
-
-
At the time of logout, I create attendance and perform "Sign Out".
-
!record {model: hr.attendance, id: hr_attendance_1}:
action: sign_out
employee_id: 'hr_employee_fracline0'
employee_id: 'hr_employee_employee0'
name: '2010-05-26 15:10:55'
-
I create Timesheet Entry for time spend on today work.
-
I create Timesheet Entry for time spend on today work.
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}:
timesheet_ids:
- account_id: account.analytic_sednacom
date: '05/26/2010'
name: 'Develop yaml for hr module'
unit_amount: 5.00
unit_amount: 3.00
amount: -90.00
product_id: hr_timesheet.product_consultant
general_account_id: account.a_expense
user_id: res_users_user0
journal_id: hr_timesheet.analytic_journal
- |
I confirm my timesheet at end of period by click on "Confirm" button which is signal of workflow.
-
!python {model: hr_timesheet_sheet.sheet}: |
uid = ref('res_users_user0')
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')])
- |
I check that state is "Confirmed".
-
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
- state == 'confirm'
- |
"Mark Johnson" check timesheet and time spend on project by "francline" employee.
And then accept it request by click on "Accept" button.If "Maximal difference between timesheet and attendances" is more than 1 then manage can "Refuse" his request.
user_id: base.user_root
journal_id: hr_timesheet.analytic_journal
-
!python {model: hr_timesheet_sheet.sheet}: |
self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'})
I confirm my timesheet at end of period by click on "Confirm" button,
if the difference between timesheet hour and attendance hour is more than 1 hour it will give message.
-
!python {model: hr_timesheet_sheet.sheet}: |
uid = ref('base.user_root')
for sheet in self.browse(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')]):
di = sheet.user_id.company_id.timesheet_max_difference
if (abs(sheet.total_difference) < di) or not di:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'hr_timesheet_sheet.sheet', sheet.id, 'confirm', cr)
else:
print "Please verify that the total difference of the sheet is lower than %.2f" %di
-
I Modified the timesheet record.
-
!record {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet.sheet1}:
timesheet_ids:
- account_id: account.analytic_sednacom
date: '05/26/2010'
name: 'Develop yaml for hr module'
unit_amount: 2.0
amount: -90.00
product_id: hr_timesheet.product_consultant
general_account_id: account.a_expense
user_id: base.user_root
journal_id: hr_timesheet.analytic_journal
-
I tried again to confirm the timesheet after modification.
-
!python {model: hr_timesheet_sheet.sheet}: |
uid = ref('base.user_root')
self.button_confirm(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {"lang": 'en_US', "active_ids":
[ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form")], "tz": False, "active_model":
"ir.ui.menu", "department_id": False, "section_id": False, "search_default_my_timesheet":
1, "search_default_user_id": 1, "project_id": False, "active_id": ref("hr_timesheet_sheet.menu_act_hr_timesheet_sheet_form"),
})
-
This time timesheet confirmed successfully.
I check that state is "Confirmed".
-
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
- state == 'confirm'
-
The manager will accept This request by click on "Accept" button.
-
!python {model: hr_timesheet_sheet.sheet}: |
self.write(cr, uid, [ref('hr_timesheet_sheet_sheet_deddk0')], {'state': 'done'})
-
I check that state is "Done".
-
!assert {model: hr_timesheet_sheet.sheet, id: hr_timesheet_sheet_sheet_deddk0}:
- state == 'done'
+8 -7
View File
@@ -152,17 +152,17 @@ where prp.id in %s''',(tuple(ids),))
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of Projects."),
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account', help="Link this project to an analytic account if you need financial management on projects. It enables you to connect projects with budgets, planning, cost and revenue analysis, timesheets on projects, etc."),
'priority': fields.integer('Sequence', help="Gives the sequence order when displaying a list of task"),
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team."),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose."),
'warn_manager': fields.boolean('Warn Manager', help="If you check this field, the project manager will receive a request each time a task is completed by his team.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'members': fields.many2many('res.users', 'project_user_rel', 'project_id', 'uid', 'Project Members', help="Project's member. Not used in any computation, just for information purpose.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'tasks': fields.one2many('project.task', 'project_id', "Project tasks"),
'planned_hours': fields.function(_progress_rate, multi="progress", method=True, string='Planned Time', help="Sum of planned hours of all tasks related to this project and its child projects."),
'effective_hours': fields.function(_progress_rate, multi="progress", method=True, string='Time Spent', help="Sum of spent hours of all tasks related to this project and its child projects."),
'total_hours': fields.function(_progress_rate, multi="progress", method=True, string='Total Time', help="Sum of total hours of all tasks related to this project and its child projects."),
'progress_rate': fields.function(_progress_rate, multi="progress", method=True, string='Progress', type='float', help="Percent of tasks closed according to the total of tasks todo."),
'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer."),
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed."),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed."),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages'),
'warn_customer': fields.boolean('Warn Partner', help="If you check this, the user will have a popup when closing a task that propose a message to send by email to the customer.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_header': fields.text('Mail Header', help="Header added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'warn_footer': fields.text('Mail Footer', help="Footer added at the beginning of the email for the warning message sent to the customer when a task is closed.", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'type_ids': fields.many2many('project.task.type', 'project_task_type_rel', 'project_id', 'type_id', 'Tasks Stages', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
}
_order = "sequence"
@@ -480,7 +480,8 @@ class task(osv.osv):
'ref_doc1': 'project.task,%d'% (task.id,),
'ref_doc2': 'project.project,%d'% (project.id,),
})
elif project.warn_manager and cntx.get('mail_send',True):
elif (project.warn_manager or project.warn_customer) and cntx.get('mail_send',True):
cntx.update({'send_manager': project.warn_manager, 'send_partner': project.warn_customer})
mail_send = True
message = _('Task ') + " '" + task.name + "' "+ _("is Done.")
self.log(cr, uid, task.id, message)
+6 -6
View File
@@ -20,9 +20,9 @@
<group colspan="6" col="6">
<field name="name" string="Project Name" select="1"/>
<field name="parent_id" string="Parent Project"/>
<field name="user_id" string="Project Manager" select="1"/>
<field name="date_start"/>
<field name="date"/>
<field name="user_id" string="Project Manager" select="1" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="date_start" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="date" attrs="{'readonly':[('state','in',['close', 'cancelled'])]}"/>
<field name="progress_rate" widget="progressbar"/>
</group>
<notebook colspan="4">
@@ -48,8 +48,8 @@
<button name="set_template" string="Set as Template" type="object" states="open" icon="gtk-convert"/>
<button name="set_open" string="Reactivate Project" type="object" states="pending,cancelled,close" icon="gtk-ok"/>
<button name="set_pending" string="Pending" type="object" states="open" icon="gtk-media-pause"/>
<button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/>
<button name="set_done" string="Done" type="object" states="open,pending" icon="gtk-jump-to"/>
<button name="set_cancel" string="Cancel" type="object" states="open,pending" icon="gtk-cancel"/>
<button name="reset_project" string="Reset as Project" type="object" states="template" icon="gtk-convert"/>
<button
string="New Project Based on Template"
@@ -247,8 +247,8 @@
<field name="name" select="1"/>
<field name="project_id" required="1" select="1" domain="[('user_id','=',uid)]"/>
<field name="total_hours" widget="float_time"/>
<field name="date_deadline"/>
<field name="user_id" select="1"/>
<field name="date_deadline" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}"/>
<field name="user_id" select="1" attrs="{'readonly':[('state','in',['done', 'cancelled'])]}"/>
<field name="progress" widget="progressbar"/>
</group>
<notebook colspan="4">
+6 -3
View File
@@ -48,7 +48,10 @@
if not new_prj:
raise Exception( "New project based on template not created")
new_id = new_prj['res_id']
state = self.read(cr, uid, [new_id], ['state'])[0]['state']
new_prj = self.read(cr, uid, [new_id], ['name', 'state'])[0]
state = new_prj['state']
name = new_prj['name']
print "Project '%s' created"%name
assert state == 'open', "Project in %s state. Project created from template project must be in open state"%state
-
Reset project template to normal project
@@ -275,7 +278,7 @@
name: Training on yml
user_id: base.user_root
-
Check for effective hours and remaining hours
Check for effective hours and remaining hours, remaining_hours must be 5, effective_hours must be 45
-
!assert {model: project.task, id: project_task_technicaltraining0, severity: error, string: After work task of 5 hours effective_hours must be equal to 45 and remaining_hours is 5}:
- planned_hours == 30
@@ -312,6 +315,6 @@
-
Check if project in close state
-
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error}:
!assert {model: project.project, id: project_project_openerptrainingprogramme0, severity: error, string: "Project must be in closed state"}:
- state == "close"
@@ -43,8 +43,10 @@
{"lang": "en_US", "active_model": "ir.ui.menu", "active_ids": [ref("project.menu_action_view_task")],
"tz": False, "active_id": ref("project.menu_action_view_task"), })
-
Test the delegate wizard
-
Creating a project.task.delegate record
Creating a delegate task 'Publish the References' of 15 hours, renaming parent task to 'CHECK Publish the References' of 1 hour
-
!record {model: project.task.delegate, id: project_task_publish_book_delegate}:
name: Publish the References
@@ -56,14 +58,19 @@
user_id: base.user_demo
-
Performing an osv_memory action validate on module project.task.delegate
Validating the delegate task
-
!python {model: project.task.delegate}: |
self.validate(cr, uid, [ref("project_task_publish_book_delegate")],
{"lang": "en_US", "active_model": "project.task", "tz": False, "record_id":
4, "active_ids": [ref("project_task_publish_book")], "active_id": ref("project_task_publish_book"),
})
-
Check if parent task 'CHECK Publish the References' is in pending state
-
!assert {model: project.task, id: project_task_publish_book, severity: error, string: "Task must be in pending state after delegation"}:
- state == "pending"
-
Creating a delegate task 'Prepare a book that gives functional overview of OpenERP'
-
@@ -160,7 +167,7 @@
-
Check if 'Prepare a technical reference for creating your modules' in pending state
-
!assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task is in pending state}:
!assert {model: project.task, id: project_task_delegate_developer_book, severity: error, string: Task must be in pending state}:
- state == "pending"
-
+40 -18
View File
@@ -32,15 +32,28 @@ class project_close_task(osv.osv_memory):
_name = "close.task"
_description = "Project Close Task"
_columns = {
'email': fields.char('E-Mail', size=64, help="Email Address"),
'manager_email': fields.char('Manager E-Mail ID', size=64, help="Email Address of Project's Manager"),
'partner_email': fields.char('Partner E-Mail ID', size=64, help="Email Address of Partner"),
'description': fields.text('Description'),
}
def _get_email(self, cr, uid, context=None):
def _get_manager_email(self, cr, uid, context=None):
if context is None:
context = {}
email = ''
if 'task_id' in context:
if context.get('send_manager', False) and ('task_id' in context):
project_id = self.pool.get('project.task').read(cr, uid, context['task_id'], ['project_id'])['project_id'][0]
project = self.pool.get('project.project').browse(cr, uid, project_id)
manager_id = project.user_id or False
if manager_id and manager_id.user_email:
email = manager_id.user_email
return email
def _get_partner_email(self, cr, uid, context=None):
if context is None:
context = {}
email = ''
if context.get('send_partner', False) and ('task_id' in context):
task = self.pool.get('project.task').browse(cr, uid, context['task_id'])
partner_id = task.partner_id or task.project_id.partner_id
if partner_id and len(partner_id.address) and partner_id.address[0].email:
@@ -56,7 +69,8 @@ class project_close_task(osv.osv_memory):
return ''
_defaults = {
'email': _get_email,
'manager_email': _get_manager_email,
'partner_email': _get_partner_email,
'description': _get_desc,
}
@@ -71,12 +85,19 @@ class project_close_task(osv.osv_memory):
if not 'task_id' in context:
return {}
close_task = self.read(cr, uid, ids[0], [])
to_adr = close_task['email']
to_adr = []
description = close_task['description']
if 'task_id' in context:
task_obj = self.pool.get('project.task')
for task in task_obj.browse(cr, uid, [context['task_id']], context=context):
if context.get('send_manager', False) and not close_task.get('manager_email', False):
raise osv.except_osv(_('Error'), _("Please specify the email address of Manager."))
elif context.get('send_partner', False) and not close_task.get('partner_email', False):
raise osv.except_osv(_('Error'), _("Please specify the email address of partner."))
else:
task_obj = self.pool.get('project.task')
task = task_obj.browse(cr, uid, context['task_id'], context=context)
project = task.project_id
subject = "Task '%s' closed" % task.name
if task.user_id and task.user_id.address_id and task.user_id.address_id.email:
@@ -84,8 +105,7 @@ class project_close_task(osv.osv_memory):
signature = task.user_id.signature
else:
raise osv.except_osv(_('Error'), _("Couldn't send mail because your email address is not configured!"))
if to_adr:
val = {
val = {
'name': task.name,
'user_id': task.user_id.name,
'task_id': "%d/%d" % (project.id, task.id),
@@ -93,15 +113,17 @@ class project_close_task(osv.osv_memory):
'date_end': task.date_end,
'state': task.state
}
header = (project.warn_header or '') % val
footer = (project.warn_footer or '') % val
body = u'%s\n%s\n%s\n\n-- \n%s' % (header, description, footer, signature)
email(from_adr, [to_adr], subject, body.encode('utf-8'), email_bcc=[from_adr])
task_obj.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
message = _('Task ') + " '" + task.name + "' "+ _("is Done.")
self.log(cr, uid, task.id, message)
else:
raise osv.except_osv(_('Error'), _("Please specify the email address of partner."))
header = (project.warn_header or '') % val
footer = (project.warn_footer or '') % val
body = u'%s\n%s\n%s\n\n-- \n%s' % (header, description, footer, signature)
to_adr.append(context.get('send_manager', '') and close_task.get('manager_email', '') or '')
to_adr.append(context.get('send_partner', '') and close_task.get('partner_email', '') or '')
email(from_adr, to_adr, subject, body.encode('utf-8'), email_bcc=[from_adr])
task_obj.write(cr, uid, [task.id], {'state': 'done', 'date_end':time.strftime('%Y-%m-%d %H:%M:%S'), 'remaining_hours': 0.0})
message = _('Task ') + " '" + task.name + "' "+ _("is Done.")
self.log(cr, uid, task.id, message)
return {}
project_close_task()
@@ -12,7 +12,9 @@
<separator string="" colspan="4"/>
<group colspan="4" col="6">
<newline/>
<field name="email"/>
<field name="manager_email" invisible="not context.get('send_manager',False)"/>
<newline/>
<field name="partner_email" invisible="not context.get('send_partner',False)"/>
<newline/>
<field name="description" />
</group>
+2 -2
View File
@@ -406,8 +406,8 @@ project_issue()
class project(osv.osv):
_inherit = "project.project"
_columns = {
'resource_calendar_id' : fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.'),
'resource_calendar_id' : fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'project_escalation_id' : fields.many2one('project.project','Project Escalation', help='If any issue is escalated from the current Project, it will be listed under the project selected here.', states={'close':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'reply_to' : fields.char('Reply-To Email Address', size=256)
}
+23 -23
View File
@@ -93,19 +93,19 @@ class project_phase(osv.osv):
_columns = {
'name': fields.char("Name", size=64, required=True),
'date_start': fields.date('Start Date', help="Starting Date of the phase"),
'date_end': fields.date('End Date', help="Ending Date of the phase"),
'constraint_date_start': fields.datetime('Start Date', help='force the phase to start after this date'),
'constraint_date_end': fields.datetime('End Date', help='force the phase to finish before this date'),
'date_start': fields.date('Start Date', help="Starting Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'date_end': fields.date('End Date', help="Ending Date of the phase", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_start': fields.date('Start Date', help='force the phase to start after this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'constraint_date_end': fields.date('End Date', help='force the phase to finish before this date', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'project_id': fields.many2one('project.project', 'Project', required=True),
'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases'),
'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases'),
'next_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'prv_phase_id', 'next_phase_id', 'Next Phases', states={'cancelled':[('readonly',True)]}),
'previous_phase_ids': fields.many2many('project.phase', 'project_phase_rel', 'next_phase_id', 'prv_phase_id', 'Previous Phases', states={'cancelled':[('readonly',True)]}),
'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of phases."),
'duration': fields.float('Duration', required=True, help="By default in days"),
'product_uom': fields.many2one('product.uom', 'Duration UoM', required=True, help="UoM (Unit of Measure) is the unit of measurement for Duration"),
'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks"),
'resource_ids': fields.one2many('project.resource.allocation', 'phase_id', "Project Resources"),
'responsible_id': fields.many2one('res.users', 'Responsible'),
'duration': fields.float('Duration', required=True, help="By default in days", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'product_uom': fields.many2one('product.uom', 'Duration UoM', required=True, help="UoM (Unit of Measure) is the unit of measurement for Duration", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks", states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'resource_ids': fields.one2many('project.resource.allocation', 'phase_id', "Project Resources",states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'responsible_id': fields.many2one('res.users', 'Responsible', states={'done':[('readonly',True)], 'cancelled':[('readonly',True)]}),
'state': fields.selection([('draft', 'Draft'), ('open', 'In Progress'), ('pending', 'Pending'), ('cancelled', 'Cancelled'), ('done', 'Done')], 'State', readonly=True, required=True,
help='If the phase is created the state \'Draft\'.\n If the phase is started, the state becomes \'In Progress\'.\n If review is needed the phase is in \'Pending\' state.\
\n If the phase is over, the states is set to \'Done\'.')
@@ -130,7 +130,7 @@ class project_phase(osv.osv):
if project:
project_id = project_obj.browse(cr, uid, project, context=context)
if project_id.date_start:
result['date_start'] = mx.DateTime.strptime(project_id.date_start, "%Y-%m-%d").strftime('%Y-%m-%d %H:%M:%S')
result['date_start'] = mx.DateTime.strptime(project_id.date_start, "%Y-%m-%d").strftime('%Y-%m-%d')
return {'value': result}
return {'value': {'date_start': []}}
@@ -147,15 +147,15 @@ class project_phase(osv.osv):
resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)])
if resource_id:
# cal_id = resource_obj.browse(cr, uid, resource_id[0], context=context).calendar_id.id
res = resource_obj.read(cr, uid, resource_id[0], ['calendar_id'], context=context)[0]
res = resource_obj.read(cr, uid, resource_id, ['calendar_id'], context=context)[0]
cal_id = res.get('calendar_id', False) and res.get('calendar_id')[0] or False
if cal_id:
calendar_id = cal_id
default_uom_id = self._get_default_uom_id(cr, uid)
avg_hours = uom_obj._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id)
work_times = cal_obj.interval_min_get(cr, uid, calendar_id, date_end, avg_hours or 0.0, resource_id and resource_id[0] or False)
dt_start = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S')
self.write(cr, uid, [phase.id], {'date_start': dt_start, 'date_end': date_end.strftime('%Y-%m-%d %H:%M:%S')}, context=context)
dt_start = work_times[0][0].strftime('%Y-%m-%d')
self.write(cr, uid, [phase.id], {'date_start': dt_start, 'date_end': date_end.strftime('%Y-%m-%d')}, context=context)
def _check_date_end(self, cr, uid, phase, date_start, context=None):
if context is None:
@@ -170,15 +170,15 @@ class project_phase(osv.osv):
resource_id = resource_obj.search(cr, uid, [('user_id', '=', phase.responsible_id.id)], context=context)
if resource_id:
# cal_id = resource_obj.browse(cr, uid, resource_id[0], context=context).calendar_id.id
res = resource_obj.read(cr, uid, resource_id[0], ['calendar_id'], context=context)[0]
res = resource_obj.read(cr, uid, resource_id, ['calendar_id'], context=context)[0]
cal_id = res.get('calendar_id', False) and res.get('calendar_id')[0] or False
if cal_id:
calendar_id = cal_id
default_uom_id = self._get_default_uom_id(cr, uid)
avg_hours = uom_obj._compute_qty(cr, uid, phase.product_uom.id, phase.duration, default_uom_id)
work_times = cal_obj.interval_get(cr, uid, calendar_id, date_start, avg_hours or 0.0, resource_id and resource_id[0] or False)
dt_end = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S')
self.write(cr, uid, [phase.id], {'date_start': date_start.strftime('%Y-%m-%d %H:%M:%S'), 'date_end': dt_end}, context=context)
dt_end = work_times[-1][1].strftime('%Y-%m-%d')
self.write(cr, uid, [phase.id], {'date_start': date_start.strftime('%Y-%m-%d'), 'date_end': dt_end}, context=context)
def write(self, cr, uid, ids, vals, context=None):
resource_calendar_obj = self.pool.get('resource.calendar')
@@ -203,17 +203,17 @@ class project_phase(osv.osv):
# Change the date_start and date_end
# for previous and next phases respectively based on valid condition
if vals.get('date_start', False) and vals['date_start'] < phase.date_start:
dt_start = mx.DateTime.strptime(vals['date_start'], '%Y-%m-%d %H:%M:%S')
dt_start = mx.DateTime.strptime(vals['date_start'], '%Y-%m-%d')
work_times = resource_calendar_obj.interval_get(cr, uid, calendar_id, dt_start, avg_hours or 0.0, resource_id and resource_id[0] or False)
if work_times:
vals['date_end'] = work_times[-1][1].strftime('%Y-%m-%d %H:%M:%S')
vals['date_end'] = work_times[-1][1].strftime('%Y-%m-%d')
for prv_phase in phase.previous_phase_ids:
self._check_date_start(cr, uid, prv_phase, dt_start, context=context)
if vals.get('date_end', False) and vals['date_end'] > phase.date_end:
dt_end = mx.DateTime.strptime(vals['date_end'],'%Y-%m-%d %H:%M:%S')
dt_end = mx.DateTime.strptime(vals['date_end'],'%Y-%m-%d')
work_times = resource_calendar_obj.interval_min_get(cr, uid, calendar_id, dt_end, avg_hours or 0.0, resource_id and resource_id[0] or False)
if work_times:
vals['date_start'] = work_times[0][0].strftime('%Y-%m-%d %H:%M:%S')
vals['date_start'] = work_times[0][0].strftime('%Y-%m-%d')
for next_phase in phase.next_phase_ids:
self._check_date_end(cr, uid, next_phase, dt_end, context=context)
return super(project_phase, self).write(cr, uid, ids, vals, context=context)
@@ -261,7 +261,7 @@ class project(osv.osv):
_inherit = "project.project"
_columns = {
'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases"),
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report"),
'resource_calendar_id': fields.many2one('resource.calendar', 'Working Time', help="Timetable working hours to adjust the gantt diagram report", states={'close':[('readonly',True)]} ),
}
project()
@@ -269,14 +269,14 @@
<field name="name">Information Gathering and Understanding</field>
<field name="product_uom" ref="product.uom_day"/>
<field eval="10" name="sequence"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(18-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_start" eval="(DateTime.now()-timedelta(70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(18-70)).strftime('%Y-%m-%d')"/>
<field name="date_start" eval="(DateTime.now()-timedelta(70)).strftime('%Y-%m-%d')"/>
<field name="state">draft</field>
<field name="responsible_id" ref="res_users_demouser1"/>
<field eval="15.0" name="duration"/>
<field name="project_id" ref="project_project_openerpwebsitedevelopment0"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(2-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(15-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(2-70)).strftime('%Y-%m-%d')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(15-70)).strftime('%Y-%m-%d')"/>
</record>
<record id="project_phase_planning0" model="project.phase">
@@ -284,59 +284,59 @@
<field name="name">Planning</field>
<field name="product_uom" ref="product.uom_day"/>
<field eval="10" name="sequence"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(28-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(10-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(28-70)).strftime('%Y-%m-%d')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(10-70)).strftime('%Y-%m-%d')"/>
<field name="state">draft</field>
<field name="responsible_id" ref="res_users_manager0"/>
<field eval="15.0" name="duration"/>
<field name="project_id" ref="project_project_openerpwebsitedevelopment0"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(13-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(25-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(13-70)).strftime('%Y-%m-%d')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(25-70)).strftime('%Y-%m-%d')"/>
</record>
<record id="project_phase_webdesign0" model="project.phase">
<field eval="[(6, 0, [ref('project_phase_informationgatheringandunderstanding0'), ref('project_phase_planning0')])]" name="previous_phase_ids"/>
<field eval="[(6, 0, [ref('project_phase_planning0')])]" name="previous_phase_ids"/>
<field name="name">Web Design </field>
<field name="product_uom" ref="product.uom_day"/>
<field eval="10" name="sequence"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(45-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(20-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(45-70)).strftime('%Y-%m-%d')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(20-70)).strftime('%Y-%m-%d')"/>
<field name="state">draft</field>
<field name="responsible_id" ref="res_users_userdesign0"/>
<field eval="20.0" name="duration"/>
<field name="project_id" ref="project_project_openerpwebsitedevelopment0"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(25-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(40-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(25-70)).strftime('%Y-%m-%d')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(40-70)).strftime('%Y-%m-%d')"/>
</record>
<record id="project_phase_developmentintegrationandtesting0" model="project.phase">
<field eval="[(6, 0, [ref('project_phase_informationgatheringandunderstanding0'), ref('project_phase_planning0'), ref('project_phase_webdesign0')])]" name="previous_phase_ids"/>
<field eval="[(6, 0, [ref('project_phase_webdesign0')])]" name="previous_phase_ids"/>
<field name="name">Development, Integration and Testing</field>
<field name="product_uom" ref="product.uom_day"/>
<field eval="10" name="sequence"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(57-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(30-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(57-70)).strftime('%Y-%m-%d')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(30-70)).strftime('%Y-%m-%d')"/>
<field name="state">draft</field>
<field name="responsible_id" ref="res_users_manager0"/>
<field eval="22.0" name="duration"/>
<field name="project_id" ref="project_project_openerpwebsitedevelopment0"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(35-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(52-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(35-70)).strftime('%Y-%m-%d')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(52-70)).strftime('%Y-%m-%d')"/>
</record>
<record id="project_phase_websitedeployment0" model="project.phase">
<field eval="[(6, 0, [ref('project_phase_informationgatheringandunderstanding0'), ref('project_phase_planning0'), ref('project_phase_webdesign0'), ref('project_phase_developmentintegrationandtesting0')])]" name="previous_phase_ids"/>
<field eval="[(6, 0, [ref('project_phase_developmentintegrationandtesting0')])]" name="previous_phase_ids"/>
<field name="name">Website Deployment</field>
<field name="product_uom" ref="product.uom_day"/>
<field eval="10" name="sequence"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(63-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(55-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_end" eval="(DateTime.now()+timedelta(63-70)).strftime('%Y-%m-%d')"/>
<field name="date_start" eval="(DateTime.now()+timedelta(55-70)).strftime('%Y-%m-%d')"/>
<field name="state">draft</field>
<field name="responsible_id" ref="res_users_manager0"/>
<field eval="5.0" name="duration"/>
<field name="project_id" ref="project_project_openerpwebsitedevelopment0"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(58-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(60-70)).strftime('%Y-%m-%d %H:%M:%S')"/>
<field name="constraint_date_start" eval="(DateTime.now()+timedelta(58-70)).strftime('%Y-%m-%d')"/>
<field name="date_end" eval="(DateTime.now()+timedelta(60-70)).strftime('%Y-%m-%d')"/>
</record>
<!-- Project Resource Allocation -->
@@ -16,7 +16,7 @@
Create phase 'Develop GUI' in Outlook
-
!record {model: project.phase, id: project_phase_phase0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 200.0
name: phase123
product_uom: product.uom_day
@@ -36,7 +36,6 @@
-
!record {model: project.task, id: project_task_t0}:
name: t1
occupation_rate: 1.0
planned_hours: 20.0
remaining_hours: 20.0
state: draft
@@ -49,7 +48,6 @@
-
!record {model: project.task, id: project_task_t1}:
name: t2
occupation_rate: 1.0
planned_hours: 25.0
remaining_hours: 25.0
state: draft
@@ -61,7 +59,6 @@
-
!record {model: project.task, id: project_task_t2}:
name: t3
occupation_rate: 1.0
planned_hours: 30.0
remaining_hours: 30.0
state: draft
@@ -74,7 +71,6 @@
-
!record {model: project.task, id: project_task_3}:
name: t4
occupation_rate: 1.0
planned_hours: 25.0
remaining_hours: 25.0
state: draft
@@ -10,7 +10,7 @@
Create a project phase 'Defining Client's Basic Idea of Project'
-
!record {model: project.phase, id: project_phase_definingclientsbasicideaofproject0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 15.0
name: "Defining Client's Basic Idea of Project"
product_uom: product.uom_day
@@ -22,7 +22,7 @@
Create project phase 'Establishing Project Feasibility'
-
!record {model: project.phase, id: project_phase_establishingprojectfeasibility0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 30.0
name: Establishing Project Feasibility
product_uom: product.uom_day
@@ -33,7 +33,7 @@
Create project phase 'Preparation of Engineering Designs'
-
!record {model: project.phase, id: project_phase_preparationofengineeringdesigns0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 100.0
name: Preparation of Engineering Designs
product_uom: product.uom_hour
@@ -45,7 +45,7 @@
Create project phase 'Procurement of Works and Goods'
-
!record {model: project.phase, id: project_phase_procurementofworksandgoods0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 24.0
name: Procurement of Works and Goods
product_uom: product.uom_hour
@@ -57,7 +57,7 @@
Create project phase 'Project Construction'
-
!record {model: project.phase, id: project_phase_projectconstruction0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 4320.0
name: Project Construction
product_uom: product.uom_hour
@@ -69,7 +69,7 @@
Create project phase 'Project Completion'
-
!record {model: project.phase, id: project_phase_projectcompletion0}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 240.0
name: Project Completion
product_uom: product.uom_hour
@@ -17,7 +17,7 @@
Create phase 'Develop GUI' in Thunderbird
-
!record {model: project.phase, id: project_phase_phase1}:
date_start: '2010-06-02 00:00:00'
date_start: '2010-06-02'
duration: 100.0
name: phase22
product_uom: product.uom_day
@@ -103,20 +103,20 @@ class project_compute_phases(osv.osv_memory):
# Recalculate date_start and date_end
# according to constraints on date start and date end on phase
if phase.constraint_date_start and str(s_date) < phase.constraint_date_start:
start_date = datetime.datetime.strptime(phase.constraint_date_start, '%Y-%m-%d %H:%M:%S')
start_date = datetime.datetime.strptime(phase.constraint_date_start, '%Y-%m-%d')
else:
start_date = s_date
if phase.constraint_date_end and str(e_date) > phase.constraint_date_end:
end_date= datetime.datetime.strptime(phase.constraint_date_end, '%Y-%m-%d %H:%M:%S')
date_start = phase.constraint_date_end[:-3]
end_date= datetime.datetime.strptime(phase.constraint_date_end, '%Y-%m-%d')
date_start = phase.constraint_date_end
else:
end_date = e_date
date_start = end_date
# Write the calculated dates back
ctx = context.copy()
ctx.update({'scheduler': True})
phase_obj.write(cr, uid, [phase.id], {'date_start': start_date.strftime('%Y-%m-%d %H:%M:%S'),
'date_end': end_date.strftime('%Y-%m-%d %H:%M:%S')},
phase_obj.write(cr, uid, [phase.id], {'date_start': start_date.strftime('%Y-%m-%d'),
'date_end': end_date.strftime('%Y-%m-%d')},
context=ctx)
# Recursive call till all the next phases scheduled
for phase in phase.next_phase_ids:
@@ -92,7 +92,7 @@ class project_schedule_task(osv.osv_memory):
if task_ids:
task_ids.sort()
tasks = task_obj.browse(cr, uid, task_ids, context=context)
start_date = str(phase.date_start)[:-9]
start_date = str(phase.date_start)
if not phase.date_start:
if not phase.project_id.date_start:
start_date = datetime.datetime.now().strftime("%Y-%m-%d")
+1 -1
View File
@@ -81,7 +81,7 @@ class purchase_order(osv.osv):
res={}
purchase_obj=self.browse(cr, uid, ids, context=context)
for purchase in purchase_obj:
res[purchase.id] = False
res[purchase.id] = time.strftime('%Y-%m-%d %H:%M:%S')
if purchase.order_line:
min_date=purchase.order_line[0].date_planned
for line in purchase.order_line:
+7 -2
View File
@@ -70,12 +70,17 @@
],
'demo_xml': ['sale_demo.xml','board_sale_demo.xml'],
'test': [
'test/shipping_manual_sale_order.yml',
'test/prepaid_sale_order.yml',
'test/data_test.yml',
'test/manual_order_policy.yml',
'test/prepaid_order_policy.yml',
'test/picking_order_policy.yml',
'test/postpaid_order_policy.yml',
'test/advance_invoice.yml',
'test/so_make_line_invoice.yml',
'test/so_make_invoice.yml',
'test/sale_procurement.yml',
'test/invoice_on_ordered_qty.yml',
'test/invoice_on_shipped_qty.yml',
],
'installable': True,
'active': False,
+5 -12
View File
@@ -79,11 +79,11 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Sales orders">
<field name="date_order"/>
<field name="name"/>
<field name="partner_id"/>
<field name="partner_shipping_id"/>
<field name="user_id" />
<field name="date_order"/>
<field name="partner_shipping_id"/>
<field name="picked_rate" widget="progressbar"/>
<field name="invoiced_rate" widget="progressbar"/>
<field name="amount_untaxed" sum="Total Untaxed amount"/>
@@ -93,14 +93,6 @@
</field>
</record>
<act_window name="Deposit"
res_model="sale.advance.payment.inv"
src_model="sale.order"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_sale_advance_payment_inv"/>
<record id="view_order_form" model="ir.ui.view">
<field name="name">sale.order.form</field>
<field name="model">sale.order</field>
@@ -205,7 +197,7 @@
<field name="amount_tax"/>
<field name="amount_total"/>
<button name="button_dummy" states="draft" string="Compute" type="object" icon="gtk-execute"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Deposit" type="action" icon="gtk-execute"/>
<button name="%(action_view_sale_advance_payment_inv)d" string="Deposit" type="action" icon="gtk-execute" attrs="{'invisible':[('state','!=','draft')]}"/>
</group>
<group col="13" colspan="4">
<field name="state"/>
@@ -282,8 +274,9 @@
<filter string="Customer" icon="terp-personal" domain="[]" context="{'group_by':'partner_id'}"/>
<filter string="Salesman" icon="terp-personal" domain="[]" context="{'group_by':'user_id'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
<filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Order Date" icon="terp-go-month" domain="[]" context="{'group_by':'date_order'}"/>
</group>
</search>
</field>
+155 -265
View File
@@ -1,269 +1,23 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
In order to test the Deposit wizard of sale module in the Open-ERP,
I create a Sale Order for LG Viewty Smart for qty 100 having order_policy manual.
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
procure_method: make_to_order
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
-
!record {model: product.product, id: product_product_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-03'
!record {model: sale.order, id: sale_order_so5}:
date_order: '2010-07-17'
invoice_quantity: order
name: SO004
order_line:
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
product_uom_qty: 100.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 500.0
product_uos_qty: 100.0
th_weight: 0.0
type: make_to_order
order_policy: prepaid
order_policy: manual
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
@@ -271,28 +25,164 @@
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
I use the Advance Payment wizard.
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so5}
-
I use the Advance Payment wizard.
-
!record {model: sale.advance.payment.inv, id: sale_advance_payment_inv_0}:
amount: 1000.0
product_id: product.product_product_pc3
qtty: 3.0
-
Performing an osv_memory action create_invoices on module sale.advance.payment.inv
Then I click on the "Create Partial Invoice" button
-
!python {model: sale.advance.payment.inv}: |
self.create_invoices(cr, uid, [ref("sale_advance_payment_inv_0")], {"lang": 'en_US',
"active_model": 'sale.order', "active_ids": [ref("sale_order_so0")], "tz":
False, "active_id": ref("sale_order_so0"), })
"active_model": 'sale.order', "active_ids": [ref("sale_order_so5")], "tz":
False, "active_id": ref("sale_order_so5"), })
-
I will verify whether the invoice has been generated.
I verify whether the invoice has been generated.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
so = self.browse(cr, uid, ref("sale_order_so5"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 3000.0
date: '2010-07-17'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_5}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
I verify that invoice has transit from Open to Done state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I click on "Create Invoice" button of Sales order to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so5}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so5"))
assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so5"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst2}:
amount: 14000.0
date: '2010-07-17'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst2")], {"lang": "en_US", "active_model": "account.invoice",
"tz":False,"record_id": so.invoice_ids[1].id, "active_ids": [so.invoice_ids[1].id], "type":
"out_invoice", "active_id": so.invoice_ids[1].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[1].id], "type": "out_invoice", "active_id": so.invoice_ids[1].id})
-
I verify that an invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so5"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so5"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
@@ -1,42 +1,42 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
In order to test the sale module, I need to configure details regarding product,customer and account.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
-
I create View Account Type.
-
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
-
I create Income Account Type.
-
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
-
I create Expense Account Type.
-
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
-
I create Cash Account Type.
-
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
-
I create Minimal Chart Account.
-
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
@@ -46,9 +46,9 @@
parent_right: 12
type: view
user_type: account_account_type_view0
-
-
I create Payable Account.
-
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
@@ -60,11 +60,12 @@
reconcile: true
type: payable
user_type: account_account_type_expense0
-
-
I create Receivable Account.
-
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
@@ -73,11 +74,12 @@
reconcile: true
type: receivable
user_type: account_account_type_income0
-
-
I create Cash Account.
-
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
@@ -85,9 +87,9 @@
parent_right: 7
type: other
user_type: account_account_type_cash0
-
-
I create Purchases Account.
-
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
@@ -98,9 +100,9 @@
parent_right: 9
type: other
user_type: account_account_type_expense0
-
-
I create Sales Account.
-
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
@@ -111,9 +113,9 @@
parent_right: 11
type: other
user_type: account_account_type_income0
-
-
I create Purchase Journal.
-
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
@@ -123,9 +125,9 @@
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
-
I create Sale Journal.
-
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
@@ -135,81 +137,80 @@
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
-
I create Bank Journal.
-
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
-
I create ir.property for account payable.
-
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
-
I create ir.property for account receivable.
-
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
-
I create Partner category Customers.
-
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
-
I create contact address for Cleartrail.
-
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
-
I create invoice address for Cleartrail.
-
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
-
I create delivery address for Cleartrail.
-
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
-
I define product category Mobile Products Sellable.
-
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
@@ -239,138 +240,53 @@
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_agrolait
min_qty: 2.0
qty: 5.0
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy prepaid.
-
!record {model: sale.order, id: sale_order_so1}:
date_order: '2010-05-03'
invoice_quantity: order
name: Test_SO001
order_line:
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 500.0
th_weight: 0.0
type: make_to_order
order_policy: prepaid
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so1}
-
I will verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so1"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 85000.0
date: '2010-05-10'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
-
I will verify the picking associated with the sale order sale_order_so1
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.picking_ids,"Picking has not been generated for sale_order_so1"
-
Products are delivered to the Cleartrail Customer.
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
I define Slider Mobile template.
-
!record {model: product.template, id: product_template_slidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: Slider Mobile
procure_method: make_to_order
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define Slider Mobile.
-
!record {model: product.product, id: product_product_slidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200
mes_type: fixed
name: Slider Mobile
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 500.0.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 510.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_agrolait
min_qty: 2.0
qty: 5.0
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
+151
View File
@@ -0,0 +1,151 @@
-
In order to test the Sale module in OpenERP,
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Ordered quantities'
in order to create an invoice based on the ordered quantity
-
!record {model: sale.order, id: sale_order_so8}:
date_order: '2010-07-17'
invoice_quantity: order
name: Test_SO006
order_line:
- name: Slider Mobile
price_unit: 200
product_uom: product.product_uom_unit
product_uom_qty: 200.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 200.0
type: make_to_order
order_policy: manual
invoice_quantity: order
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so8}
-
I verify that the picking has been generated for the sale order
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert so.picking_ids,"Picking has not been generated for sale_order_so8"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-17 17:52:09'
-
Then I done the picking
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': '100',
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I click on Create Invoice button to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so8}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so8"
-
I verify that an invoice is created on the basis of ordered quantity
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
for so_lines in so.order_line:
qty=so_lines.product_uom_qty
ids = self.search(cr, uid, [('origin', '=', so.name)])
inv_brw = self.browse(cr,uid,ids)[0]
for inv_lines in inv_brw.invoice_line:
qty1=inv_lines.quantity
invoice_id = self.search(cr, uid, [('qty1','=', 'qty') and ('origin', '=', so.name)])
assert invoice_id, "Quantities are not same"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 40000.0
date: '2010-07-17'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I check that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so8"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
+154
View File
@@ -0,0 +1,154 @@
-
In order to test the Sale module in OpenERP,
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice' and Invoice on 'Shipped quantities'
in order to create an invoice based on the shipping quantity
-
!record {model: sale.order, id: sale_order_so6}:
date_order: '2010-07-17'
invoice_quantity: order
name: Test_SO006
order_line:
- name: Slider Mobile
price_unit: 200
product_uom: product.product_uom_unit
product_uom_qty: 200.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 200.0
type: make_to_order
order_policy: manual
invoice_quantity: procurement
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so6}
-
I verify that the picking has been generated for the sale order
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so6"))
assert so.picking_ids,"Picking has not been generated for sale_order_so6"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-17 17:52:09'
-
Then I done the picking
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': '100',
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I click on Create Invoice button to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so6}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so6"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so6"
-
I verify that an invoice is created on the basis of shipped quantity
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', so.name)])
pick_brw = picking_obj.browse(cr,uid, ids)[0]
for lines in pick_brw.move_lines:
qty=lines.product_qty
inv_id = self.search(cr, uid, [('origin', '=', so.name)])
inv_brw = self.browse(cr,uid,inv_id)[0]
for inv_lines in inv_brw.invoice_line:
qty1=inv_lines.quantity
invoice_id = self.search(cr, uid, [('qty1','=', 'qty') and ('origin', '=', so.name)])
assert invoice_id, "Quantities are not same"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 20000.0
date: '2010-07-17'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so6"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I check that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so6"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
+339
View File
@@ -0,0 +1,339 @@
-
In order to test the Sale module in OpenERP,
I create a Sale Order for Slider Mobile for 500 quantity having Shipping Policy 'Shipping & Manual Invoice'
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-07-17'
invoice_quantity: order
name: Test_SO002
order_line:
- name: Slider Mobile
price_unit: 200
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 500.0
type: make_to_order
order_policy: manual
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I click on Create Invoice button to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
I verify that its Journal Entries has been created
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
inv_brw = self.browse(cr, uid, invoice_id)[0]
assert inv_brw.move_id, "Journal Entries has not been created"
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 100000.0
date: '2010-07-17'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify the invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so0"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I verify that the picking has been generated for the sale order
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
-
I verify that delivery order has been generated for sale order
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
assert (picking_id),"Delivery order has not been generated"
-
I verify that a procurement has been generated for so
-
!python {model: procurement.order}: |
from tools.translate import _
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
assert proc_ids, _('No Procurements!')
-
Then I click on the "Run Procurement" button
-
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
for proc in proc_ids:
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
-
I verify that a procurement state is "running"
-
!python {model: procurement.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
assert proc_ids, _('Procurement is not in the running state!')
-
I verify that a purchase order has been generated
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
so = self.browse(cr, uid, ref("sale_order_so0"))
pur_obj=self.pool.get('purchase.order')
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
assert pur_id, _('Purchase order has not been generated')
-
I click on the "Confirm" button to confirm the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
pur_obj=self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
-
I click on the "Approved by supplier" button to approve the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
-
I verify that a picking related to purchase order has been generated.
-
!python {model: sale.order}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so0"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
assert(po.picking_ids),"Picking for purchase order has not been generated"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-17 17:52:09'
-
I click on the "Validate" button
-
!python {model: stock.picking}: |
modules = self.pool.get('ir.module.module')
sale_order_obj = self.pool.get('sale.order')
pur_obj = self.pool.get('purchase.order')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
import netsvc
wf_service = netsvc.LocalService("workflow")
for pick in pick_ser_id:
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
-
I verify that picking for purchase order has been done.
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so0"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
assert ids, _('Picking is not in the done state!')
-
Then I done the picking
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking for sale order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
Then I done the delivery order
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that delivery state is done
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
I verify that a "Picked" has been set to true
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert (so.shipped == True), "Picked has not been set to True"
-
I verify that a sale order is in done state
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert (so.state == 'done'), "Sale order is not in the done state."
+329
View File
@@ -0,0 +1,329 @@
-
In order to test the Sale module in OpenERP,
I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice from Picking'
-
!record {model: sale.order, id: sale_order_so7}:
date_order: '2010-07-15'
invoice_quantity: order
name: Test_SO007
order_line:
- name: Slider Mobile
price_unit: 200
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 500.0
th_weight: 0.0
type: make_to_order
order_policy: picking
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so7}
-
I verify that picking has been generated for the sale order.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so7"))
assert so.picking_ids,"Picking has not been generated for sale_order_so7"
-
Then I done the picking
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
Then I create invoice from picking
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
invoice_date: '2010-07-15'
journal_id: account.sales_journal
type: out_invoice
-
Then I click on 'Create Invoices' button
-
!python {model: stock.invoice.onshipping}: |
sale_obj=self.pool.get('sale.order')
sale_id=sale_obj.browse(cr, uid, ref("sale_order_so7"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', sale_id.name)])
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"search_default_available": 1, "tz": False, "active_model": "stock.picking",
"contact_display": "partner", "active_ids": ids, "active_id": ids[0]})
-
I check that an invoice has been created.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so7"))
assert(sale_id.invoice_ids), "Invoice has not been created"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 255000.0
date: '2010-07-15'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I check that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so7"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I verify that a procurement has been generated for so
-
!python {model: procurement.order}: |
from tools.translate import _
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
assert proc_ids, _('No Procurements!')
-
Then I click on the "Run Procurement" button
-
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
import netsvc
wf_service = netsvc.LocalService("workflow")
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
for proc in proc_ids:
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
-
I verify that a procurement state is "running"
-
!python {model: procurement.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
assert proc_ids, _('Procurement is not in the running state!')
-
I verify that a purchase order has been generated
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
so = self.browse(cr, uid, ref("sale_order_so7"))
pur_obj=self.pool.get('purchase.order')
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
assert pur_id, _('Purchase order has not been generated')
-
I click on the "Confirm" button to confirm the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj=self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so7"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
-
I click on the "Approved by supplier" button to approve the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so7"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
-
I verify that a picking related to purchase order has been generated.
-
!python {model: sale.order}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so7"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
assert(po.picking_ids),"Picking for purchase order has not been generated"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-15 17:52:09'
-
I click on the "Validate" button
-
!python {model: stock.picking}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
pur_obj = self.pool.get('purchase.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
import netsvc
wf_service = netsvc.LocalService("workflow")
for pick in pick_ser_id:
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
-
I verify that picking for purchase order has been done.
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so7"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
assert ids, _('Picking is not in the done state!')
-
I verify that delivery order has been generated for sale order
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
assert (picking_id),"Delivery order has not been generated"
-
I verify that delivery has been done
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that delivery state is done
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so7"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
I verify that a "Picked" has been set to true
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so7"))
assert (so.shipped == True), "Picked has not been set to True"
-
I verify that a sale order is in done state
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so7"))
assert (so.state == 'done'), "Sale order is not in the done state."
+330
View File
@@ -0,0 +1,330 @@
-
In order to test the Sale module in OpenERP,
I create a Sale Order for Slider Mobile for qty 500 having Shipping Policy is 'Invoice on order after Delivery'
-
!record {model: sale.order, id: sale_order_so8}:
date_order: '2010-07-15'
invoice_quantity: order
name: Test_SO008
order_line:
- name: Slider Mobile
price_unit: 200.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 500.0
type: make_to_order
order_policy: postpaid
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so8}
-
I verify that the picking has been generated for the sale order
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert so.picking_ids,"Picking has not been generated for sale_order_so8"
-
Then I done the picking
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state == 'done'), "Picking for SO is not in done state."
-
I verify that delivery order has been generated for sale order
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
assert (picking_id),"Delivery order has not been generated"
-
I click on the Products Sent button and then on the Validate button
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that delivery state is done
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','delivery')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
I verify that a procurement has been generated for so
-
!python {model: procurement.order}: |
from tools.translate import _
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
assert proc_ids, _('No Procurements!')
-
Then I click on the "Run Procurement" button
-
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
import netsvc
wf_service = netsvc.LocalService("workflow")
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
for proc in proc_ids:
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
-
I verify that a procurement state is "running"
-
!python {model: procurement.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
-
I verify that a purchase order has been generated
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
so = self.browse(cr, uid, ref("sale_order_so8"))
pur_obj=self.pool.get('purchase.order')
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
assert pur_id, _('Purchase order has not been generated')
-
I click on the "Confirm" button to confirm the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj=self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so8"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
-
I click on the "Approved by supplier" button to approve the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so8"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
-
I verify that a picking related to purchase order has been generated.
-
!python {model: sale.order}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so8"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
assert(po.picking_ids),"Picking for purchase order has not been generated"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-15 17:52:09'
-
I click on the "Validate" button
-
!python {model: stock.picking}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
pur_obj = self.pool.get('purchase.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
import netsvc
wf_service = netsvc.LocalService("workflow")
for pick in pick_ser_id:
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
-
I verify that picking for purchase order has been done.
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so8"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
assert ids, _('Picking is not in the done state!')
-
I verify that a "Picked" has been set to true
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert (so.shipped == True), "Picking is not done."
-
I verify that an invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert so.invoice_ids, "Invoice has not been generated"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 100000.0
date: '2010-07-15'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so8"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so8"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I verify that sale order is in done state
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so8"))
assert (so.state == 'done'), "Sale order is not in the done state."
+284
View File
@@ -0,0 +1,284 @@
-
I create a Sale Order for LG Viewty Smart for qty 500 having Shipping Policy is 'Payment Before Delivery'
-
!record {model: sale.order, id: sale_order_so1}:
date_order: '2010-07-20'
invoice_quantity: order
name: Test_SO001
order_line:
- name: Slider Mobile
price_unit: 200
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 500.0
th_weight: 0.0
type: make_to_order
order_policy: prepaid
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so1}
-
I verify whether the invoice has been generated for SO since Shipping policy is 'Payment Before Delivery'
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so1"
-
I verify there are no pickings attached to this sale order
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','!=',so.name),(('type','=','out')and('type','=','delivery'))])
assert picking_id,"There is a picking attached to this sale order"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 85000.0
date: '2010-07-20'
journal_id: sale.account_journal_bankjournal0
name: tst
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id, })
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify the invoice is in done state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I check that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so1"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I verify the picking associated with the sale order sale_order_so1
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert so.picking_ids,"Picking has not been generated"
-
Products are delivered to the Cleartrail Customer.
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
-
I verify that a procurement has been generated for so
-
!python {model: procurement.order}: |
from tools.translate import _
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
assert proc_ids, _('No Procurements!')
-
Then I click on the "Run Procurement" button
-
!python {model: procurement.order}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
proc_ids = self.search(cr, uid, [('origin','=',so.name)])
for proc in proc_ids:
wf_service.trg_validate(uid, 'procurement.order',proc,'button_check', cr)
-
I verify that a procurement state is "running"
-
!python {model: procurement.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
proc_ids = self.search(cr, uid, [('origin','=',so.name) and ('state','=','running')])
assert proc_ids, _('Procurement is not in the running state!')
-
I verify that a purchase order has been generated
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
so = self.browse(cr, uid, ref("sale_order_so1"))
pur_obj=self.pool.get('purchase.order')
pur_id=pur_obj.search(cr, uid, [('origin','=',so.name)])
assert pur_id, _('Purchase order has not been generated')
-
I click on the "Confirm" button to confirm the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
pur_obj=self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_confirm', cr)
-
I click on the "Approved by supplier" button to approve the purchase order
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so1"))
import netsvc
wf_service = netsvc.LocalService("workflow")
pur_ids = pur_obj.search(cr, uid, [('origin','=',so.name)])
for pur in pur_ids:
wf_service.trg_validate(uid, 'purchase.order',pur,'purchase_approve', cr)
-
I verify that a picking related to purchase order has been generated.
-
!python {model: sale.order}: |
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so1"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
assert(po.picking_ids),"Picking for purchase order has not been generated"
-
Then I click on the "Products Received" button of Incoming Shipments
-
!record {model: stock.partial.picking, id: stock_partial_picking_0}:
date: '2010-07-20 17:52:09'
-
I click on the "Validate" button
-
!python {model: stock.picking}: |
modules = self.pool.get('ir.module.module')
sale_order_obj = self.pool.get('sale.order')
pur_obj = self.pool.get('purchase.order')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if (mod_brw.state == 'installed'):
so = sale_order_obj.browse(cr, uid, ref("sale_order_so1"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
pick_ser_id = self.search(cr, uid, [('purchase_id', '=', po.id )])
import netsvc
wf_service = netsvc.LocalService("workflow")
for pick in pick_ser_id:
wf_service.trg_validate(uid, 'stock.picking',pick,'button_done', cr)
-
I verify that picking for purchase order has been done.
-
!python {model: sale.order}: |
from tools.translate import _
modules = self.pool.get('ir.module.module')
mod_pur = modules.search(cr, uid, [('name','=','purchase')])
mod_brw = modules.browse(cr,uid,mod_pur)[0]
if(mod_brw.state == 'installed'):
pur_obj = self.pool.get('purchase.order')
so = self.browse(cr, uid, ref("sale_order_so1"))
pur_id = pur_obj.search(cr, uid, [('origin','=',so.name)])
po = pur_obj.browse(cr, uid, pur_id)[0]
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('purchase_id', '=', po.id ) and ('state', '=', 'done')])
assert ids, _('Picking is not in the done state!')
-
I verify that a "Picked" has been set to true
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert (so.shipped == True), "Picking is not done."
-
I verify that a sale order is in done state
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so1"))
assert (so.state == 'done'), "Sale order is not in the done state."
@@ -1,384 +0,0 @@
-
In order to test the sale module, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
company_id: base.main_company
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
company_id: base.main_company
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
company_id: base.main_company
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define New Chocolate Slider Mobile template.
-
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
procure_method: make_to_order
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define New Chocolate Slider Mobile.
-
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-12'
invoice_quantity: order
name: Test_SO002
order_line:
- name: New Chocolate Slider Mobile
price_unit: 200.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
state: draft
delay: 7.0
product_id: sale.product_product_newchocolateslidermobile0
product_uos_qty: 500.0
type: make_to_order
order_policy: manual
partner_id: sale.res_partner_cleartrail0
partner_invoice_id: sale.res_partner_address_2
partner_order_id: sale.res_partner_address_1
partner_shipping_id: sale.res_partner_address_3
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the Sale Order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
I click on Create Invoice button to create the invoice.
-
!workflow {model: sale.order, action: manual_invoice, ref: sale_order_so0}
-
I verify whether the invoice has been generated for SO
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 100000.0
date: '2010-05-10'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "tz":
False, "active_model": 'account.invoice', "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify the invoice are in paid state or not.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
assert (invoice.state) =='paid', "Invoice for SO is not in done state."
-
I verify the picking associated with the sale order sale_order_so0.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so0"))
assert so.picking_ids,"Picking has not been generated for sale_order_so0"
-
Products are delivered to the Cleartrail Customer.
-
!python {model: stock.picking }: |
import time
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
pick.force_assign(cr, uid)
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
move = pick.move_lines[0]
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id.id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, [pick.id],partial_datas)
-
I verify that picking order is in done state.
-
!python {model: stock.picking }: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so0"))
picking_id = self.search(cr, uid, [('origin','=',so.name),('type','=','out')])
if picking_id:
pick = self.browse(cr,uid,picking_id[0])
assert (pick.state) =='done', "Picking for SO is not in done state."
+204 -300
View File
@@ -1,307 +1,29 @@
-
In order to test the sale module in the Open-ERP, I need to configure details regarding product & customer.
-
I am going to sell my Mobile products to the customer with name Cleartrail
-
I create View Account Type.
-
!record {model: account.account.type, id: account_account_type_view0}:
close_method: none
code: View
name: View
sign: 1
-
I create Income Account Type.
-
!record {model: account.account.type, id: account_account_type_income0}:
close_method: unreconciled
code: Income
name: Income
sign: 1
-
I create Expense Account Type.
-
!record {model: account.account.type, id: account_account_type_expense0}:
close_method: unreconciled
code: Expense
name: Expense
sign: 1
-
I create Cash Account Type.
-
!record {model: account.account.type, id: account_account_type_cash0}:
close_method: balance
code: Cash
name: Cash
sign: 1
-
I create Minimal Chart Account.
-
!record {model: account.account, id: account_account_minimalchart0}:
code: '0'
company_id: base.main_company
currency_mode: current
name: Minimal Chart
parent_left: 1
parent_right: 12
type: view
user_type: account_account_type_view0
-
I create Payable Account.
-
!record {model: account.account, id: account_account_payable1}:
code: AP
company_id: base.main_company
currency_mode: current
name: Payable
parent_id: account_account_minimalchart0
parent_left: 2
parent_right: 3
reconcile: true
type: payable
user_type: account_account_type_expense0
-
I create Receivable Account.
-
!record {model: account.account, id: account_account_receivable0}:
code: AR
currency_mode: current
name: Receivable
parent_id: account_account_minimalchart0
parent_left: 4
parent_right: 5
reconcile: true
type: receivable
user_type: account_account_type_income0
-
I create Cash Account.
-
!record {model: account.account, id: account_account_cash0}:
code: C
currency_mode: current
name: Cash
parent_id: account_account_minimalchart0
parent_left: 6
parent_right: 7
type: other
user_type: account_account_type_cash0
-
I create Purchases Account.
-
!record {model: account.account, id: account_account_purchases0}:
code: P
company_id: base.main_company
currency_mode: current
name: Purchases
parent_id: account_account_minimalchart0
parent_left: 8
parent_right: 9
type: other
user_type: account_account_type_expense0
-
I create Sales Account.
-
!record {model: account.account, id: account_account_sales0}:
code: S
company_id: base.main_company
currency_mode: current
name: Sales
parent_id: account_account_minimalchart0
parent_left: 10
parent_right: 11
type: other
user_type: account_account_type_income0
-
I create Purchase Journal.
-
!record {model: account.journal, id: account_journal_purchasejournal0}:
code: PUJ
company_id: base.main_company
default_credit_account_id: account_account_purchases0
default_debit_account_id: account_account_purchases0
name: Purchase Journal
sequence_id: account.sequence_purchase_journal
type: purchase
view_id: account.account_journal_view
-
I create Sale Journal.
-
!record {model: account.journal, id: account_journal_salejournal0}:
code: SAJ
company_id: base.main_company
default_credit_account_id: account_account_sales0
default_debit_account_id: account_account_sales0
name: Sale Journal
sequence_id: account.sequence_sale_journal
type: sale
view_id: account.account_journal_view
-
I create Bank Journal.
-
!record {model: account.journal, id: account_journal_bankjournal0}:
code: BNK
default_credit_account_id: account_account_cash0
default_debit_account_id: account_account_cash0
name: Bank Journal
sequence_id: account.sequence_journal
type: cash
view_id: account.account_journal_bank_view
-
I create ir.property for account payable.
-
!record {model: ir.property, id: ir_property_propertyaccountexpensecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_payable
name: property_account_expense_categ
value_reference: account.account,5
-
I create ir.property for account receivable.
-
!record {model: ir.property, id: ir_property_propertyaccountincomecateg0}:
company_id: base.main_company
fields_id: account.field_res_partner_property_account_receivable
name: property_account_income_categ
value_reference: account.account,6
-
I create Partner category Customers.
-
!record {model: res.partner.category, id: res_partner_category_customers0}:
name: Customers
-
I create Cleartrail Customer.
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create contact address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_1}:
partner_id: res_partner_cleartrail0
street: onam plaza, 14 B palasia A B Road
type: contact
-
I create invoice address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
street: sarda house 24 B palasia, A B Road
type: invoice
-
I create delivery address for Cleartrail.
-
!record {model: res.partner.address, id: res_partner_address_3}:
partner_id: res_partner_cleartrail0
street: sangam house 15 B palasia, A B Road
type: delivery
-
Customer Cleartrail has specific instrument requirement regarding the stockable products.
-
I define product category Mobile Products Sellable.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I define product category Mobile Services.
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I define LG Viewty Smart product template.
-
!record {model: product.template, id: product_template_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
procure_method: make_to_order
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define LG Viewty Smart product.
-
!record {model: product.product, id: product_product_lgviewtysmart0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 170.0
mes_type: fixed
name: LG Viewty Smart
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 160.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 170.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 160.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define New Chocolate Slider Mobile template.
-
!record {model: product.template, id: product_template_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
procure_method: make_to_order
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I define New Chocolate Slider Mobile.
-
!record {model: product.product, id: product_product_newchocolateslidermobile0}:
categ_id: product_category_allproductssellable0
cost_method: standard
list_price: 200.0
mes_type: fixed
name: New Chocolate Slider Mobile
pricelist_purchase: 'Default Purchase Pricelist (0.00) : 189.00\n'
pricelist_sale: 'Public Pricelist (0.00) : 200.00\n'
procure_method: make_to_order
property_account_expense: sale.account_account_payable1
property_account_income: sale.account_account_receivable0
seller_delay: '1'
standard_price: 189.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
I create a Sale Order for LG Viewty Smart for qty 500 having order_policy manual.
In order to test the invoices based on sale order lines of sales module in OpenERP
I create a Sale Order for two products LG Viewty Smart and Slider mobile for qty 100 having order_policy manual.
-
!record {model: sale.order, id: sale_order_so3}:
date_order: '2010-05-12'
date_order: '2010-07-12'
invoice_quantity: order
name: Test_SO003
order_line:
- name: New Chocolate Slider Mobile
- name: Slider Mobile
price_unit: 200.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
product_uom_qty: 100.0
state: draft
delay: 7.0
product_id: sale.product_product_newchocolateslidermobile0
product_uos_qty: 500.0
product_id: sale.product_product_slidermobile0
product_uos_qty: 100.0
type: make_to_order
- name: LG Viewty Smart
price_unit: 170.0
product_uom: product.product_uom_unit
product_uom_qty: 500.0
product_uom_qty: 100.0
state: draft
delay: 7.0
product_id: sale.product_product_lgviewtysmart0
product_uos_qty: 500.0
product_uos_qty: 100.0
th_weight: 0.0
type: make_to_order
order_policy: manual
@@ -317,23 +39,205 @@
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
-
I create an invoice on sale order line.
I click on the "Create Invoice" button of sale order line
-
!record {model: sale.order.line.make.invoice, id: sale_order_line_make_invoice_0}:
{}
-
invoice is created for specific sale order line.
-
!python {model: sale.order.line.make.invoice}: |
!python {model: sale.order.line}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
sol = so.order_line[0]
self.make_invoices(cr, uid, [ref("sale_order_line_make_invoice_0")], {"lang":
'en_US', "active_model": "sale.order.line", "active_ids": [ref(sol.id)], "tz":
False, "active_id": ref(sol.id), })
sol = so.order_line[0]
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
})
-
I verify that invoice regarding sale order line has been created.
I verify that "Invoiced" has been set to True.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
sol = sale_id.order_line[0]
assert(sol.invoiced == True), "Invoiced has not been set to true"
-
I verify that an invoice for sale order line has been created.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so3"))
assert so.invoice_ids, "Invoices has not been generated for sale_order_so0"
assert so.invoice_ids, "Invoices has not been generated for sale_order_so3"
-
I click on the Create button of invoice
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
Creating an account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst0}:
amount: 20000.0
date: '2010-07-12'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst0")], {"lang": "en_US", "active_model": "account.invoice",
"tz":False,"record_id": so.invoice_ids[0].id, "active_ids": [so.invoice_ids[0].id], "type":
"out_invoice", "active_id": so.invoice_ids[0].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_0}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_0")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[0].id], "type": "out_invoice", "active_id": so.invoice_ids[0].id, })
-
I verify that an invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
-
I click on the "Create Invoice" button of sale order and verify that it gives a warning message
-
!python {model: sale.order}: |
sale_order_obj = self.pool.get('sale.order')
import netsvc
wf_service = netsvc.LocalService("workflow")
try:
wf_service.trg_validate(uid, 'sale.order',ref("sale_order_so3"),'manual_invoice', cr)
except:
pass
-
I create an invoice for another sale order line.
-
I click on the "Create Invoice" button of sale order line
-
!python {model: sale.order.line}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
sol = so.order_line[1]
self.create_sale_order_line_invoice(cr, uid, [sol.id], {"lang": "en_US",
"tz": False, "active_model": "ir.ui.menu", "active_ids": [ref("sale.menu_invoicing_sales_order_lines")],
"search_default_uninvoiced": 1, "active_id": ref("sale.menu_invoicing_sales_order_lines"),
})
-
I verify that invoice for sale order line has been created.
-
!python {model: sale.order}: |
so = self.browse(cr, uid, ref("sale_order_so3"))
assert so.invoice_ids[1], "Invoices has not been generated for sale_order_so3"
-
I verify that "Invoiced" has been set to True.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
sol = sale_id.order_line[1]
assert(sol.invoiced == True), "Invoiced has not been set to true"
-
I verify that "Paid" has been set to False.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
assert(sale_id.invoiced == False), "Paid has not been set to true"
-
I open the Invoice for the SO.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
import netsvc
wf_service = netsvc.LocalService("workflow")
invoice_ids = so.invoice_ids
for invoice in invoice_ids:
wf_service.trg_validate(uid, 'account.invoice',invoice.id,'invoice_open', cr)
-
I verify that an invoice state has transit from draft to open state
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','open')])
assert invoice_id, "Invoice is not in the open state"
-
Creating a account invoice pay entry.
-
!record {model: account.invoice.pay, id: account_invoice_pay_tst1}:
amount: 17000.0
date: '2010-07-12'
journal_id: sale.account_journal_bankjournal0
name: test
period_id: account.period_5
-
I pay the invoice.
-
!python {model: account.invoice.pay}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
self.wo_check(cr, uid, [ref("account_invoice_pay_tst1")], {"lang": "en_US", "active_model": "account.invoice",
"tz":False,"record_id": so.invoice_ids[1].id, "active_ids": [so.invoice_ids[1].id], "type":
"out_invoice", "active_id": so.invoice_ids[1].id})
-
Creating an account invoice pay writeoff entry.
-
!record {model: account.invoice.pay.writeoff, id: account_invoice_pay_writeoff_1}:
analytic_id: account.analytic_customers
comment: Write-Off
writeoff_acc_id: account.a_sale
writeoff_journal_id: sale.account_journal_bankjournal0
-
Pay and Reconcile the Invoice.
-
!python {model: account.invoice.pay.writeoff}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
self.pay_and_reconcile_writeoff(cr, uid, [ref("account_invoice_pay_writeoff_1")],
{"lang": 'en_US', "tz": False, "active_model": 'account.invoice', "active_ids":
[so.invoice_ids[1].id], "type": "out_invoice", "active_id": so.invoice_ids[1].id})
-
I verify the invoice is in done state.
-
!python {model: account.invoice}: |
sale_order_obj = self.pool.get('sale.order')
so = sale_order_obj.browse(cr, uid, ref("sale_order_so3"))
invoice_id = self.search(cr, uid, [('origin','=',so.name) and ('state','=','paid')])
assert invoice_id, "Invoice for SO is not in done state."
-
I verify that Paid has been set to true.
-
!python {model: sale.order}: |
sale_id=self.browse(cr, uid, ref("sale_order_so3"))
assert(sale_id.invoiced == True), "Paid has not been set to true"
+8 -8
View File
@@ -26,14 +26,14 @@
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<act_window name="Make Invoices"
res_model="sale.make.invoice"
src_model="sale.order"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_sale_order_make_invoice"/>
<!-- <act_window name="Make Invoices"-->
<!-- res_model="sale.make.invoice"-->
<!-- src_model="sale.order"-->
<!-- view_mode="form"-->
<!-- target="new"-->
<!-- key2="client_action_multi"-->
<!-- id="action_view_sale_order_make_invoice"/>-->
</data>
</openerp>
@@ -20,6 +20,14 @@
</field>
</record>
<record id="action_view_sale_advance_payment_inv" model="ir.actions.act_window">
<field name="name">Deposit</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">sale.advance.payment.inv</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="target">new</field>
</record>
<record id="view_sale_open_invoice" model="ir.ui.view">
<field name="name">Open Invoice</field>
+1 -1
View File
@@ -37,7 +37,7 @@
<filter icon="terp-personal+"
domain="[('section_id.user_id','=',uid)]"
groups="base.group_extended"
help="My Sales Team"/>
help="My Sales Team(s)"/>
</field>
</field>
</field>
+2 -2
View File
@@ -480,7 +480,7 @@
</record>
<record id="view_sale_journal_search_form" model="ir.ui.view">
<!--record id="view_sale_journal_search_form" model="ir.ui.view">
<field name="name">sale.order.journal.search</field>
<field name="model">sale.order</field>
<field name="type">search</field>
@@ -491,7 +491,7 @@
<separator orientation="vertical"/>
</xpath>
</field>
</record>
</record-->
<record id="view_picking_delivery_jorunal_search_form" model="ir.ui.view">
+10 -11
View File
@@ -1,21 +1,20 @@
# translation of fr_FR.po to Français
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * sale_layout
# French translation for openobject-addons
# Copyright (c) 2010 Rosetta Contributors and Canonical Ltd 2010
# This file is distributed under the same license as the openobject-addons package.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2010.
#
# Numerigraphe <informatique@numerigraphe.com>, 2009.
msgid ""
msgstr ""
"Project-Id-Version: fr_FR\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-11-26 08:45+0000\n"
"PO-Revision-Date: 2010-01-19 05:23+0000\n"
"Last-Translator: Numérigraphe <Unknown>\n"
"Language-Team: Français\n"
"PO-Revision-Date: 2010-07-29 08:56+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: French <fr@li.org>\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-05-21 03:45+0000\n"
"X-Launchpad-Export-Date: 2010-07-30 03:37+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: sale_layout