[MERGE] merge with dev-addons3 branch

bzr revid: psi@tinyerp.co.in-20100521065718-ojw21zzvi2zu1ig6
This commit is contained in:
psi (Open ERP)
2010-05-21 12:27:18 +05:30
128 changed files with 6849 additions and 1770 deletions
+25
View File
@@ -171,6 +171,19 @@ class account_account(osv.osv):
_description = "Account"
_parent_store = True
def _get_children_and_consol(self, cr, uid, ids, context={}):
ids2=[]
temp=[]
read_data= self.read(cr, uid, ids,['id','child_id'], context)
for data in read_data:
ids2.append(data['id'])
if data['child_id']:
temp=[]
for x in data['child_id']:
temp.append(x)
ids2 += self._get_children_and_consol(cr, uid, temp, context)
return ids2
def search(self, cr, uid, args, offset=0, limit=None, order=None,
context=None, count=False):
if context is None:
@@ -297,6 +310,17 @@ class account_account(osv.osv):
return result
def _get_level(self, cr, uid, ids, field_name, arg, context={}):
res={}
accounts = self.browse(cr, uid, ids)
for account in accounts:
level = 0
if account.parent_id :
obj = self.browse(cr, uid, account.parent_id.id)
level = obj.level + 1
res[account.id] = level
return res
_columns = {
'name': fields.char('Name', size=128, required=True, select=True),
'currency_id': fields.many2one('res.currency', 'Secondary Currency', help="Forces all moves for this account to have this secondary currency."),
@@ -343,6 +367,7 @@ class account_account(osv.osv):
'check_history': fields.boolean('Display History',
help="Check this box if you want to print all entries when printing the General Ledger, "\
"otherwise it will only print its balance."),
'level': fields.function(_get_level, string='Level', method=True, store=True, type='integer'),
}
def _default_company(self, cr, uid, context={}):
+2 -2
View File
@@ -42,8 +42,8 @@ class account_analytic_line(osv.osv):
}
_defaults = {
'date': lambda *a: time.strftime('%Y-%m-%d'),
'company_id': lambda self,cr,uid,context: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=context),
}
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.analytic.line', context=c),
}
_order = 'date'
def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
+1 -1
View File
@@ -630,7 +630,7 @@ class account_bank_statement_line(osv.osv):
'statement_id': fields.many2one('account.bank.statement', 'Statement',
select=True, required=True, ondelete='cascade'),
'reconcile_id': fields.many2one('account.bank.statement.reconcile',
'Reconcile', states={'confirm':[('readonly',True)]}),
'Reconcile'),
'move_ids': fields.many2many('account.move',
'account_bank_statement_line_move_rel', 'move_id','statement_id',
'Moves'),
+49 -49
View File
@@ -141,23 +141,23 @@
<field name="priority">2</field>
<field name="arch" type="xml">
<form string="Supplier invoice">
<group col="8" colspan="4">
<field domain="[('type', '=', 'purchase')]" name="journal_id"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" context="{'default_customer': 0}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<group col="8" colspan="4">
<field domain="[('type', '=', 'purchase')]" name="journal_id"/>
<field name="number" readonly="1"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" domain="[('supplier','=', 1)]" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" context="{'default_customer': 0}"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id" groups="base.group_user"/>
@@ -201,12 +201,12 @@
<field name="state"/>
<field name="residual"/>
<group col="3" colspan="4">
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-apply"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
<button name="invoice_open" states="draft,proforma2" string="Validate" icon="gtk-apply"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name="%(action_account_state_open)d" type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
</group>
</group>
</page>
@@ -250,23 +250,23 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Invoice">
<group colspan="4" col="8">
<field name="journal_id" groups="base.group_user"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<group colspan="4" col="8">
<field name="journal_id" groups="base.group_user"/>
<field name="number"/>
<field name="type" invisible="1"/>
<field name="currency_id" domain="[('company_id','=', company_id)]" on_change="onchange_currency_id(currency_id, company_id)" width="50"/>
<button name="%(action_account_change_currency)d" type="action" icon="gtk-apply" string="Change Currency"/>
<newline/>
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank,company_id)" groups="base.group_user"/>
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
<field name="fiscal_position" groups="base.group_extended" widget="selection"/>
<newline/>
<field name="date_invoice"/>
<field name="period_id" groups="base.group_user"/>
<group colspan="2" col="1" groups="base.group_user">
<label align="0.0" string="(keep empty to use the current period)"/>
</group>
</group>
<notebook colspan="4">
<page string="Invoice">
<field domain="[('type','&lt;&gt;','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id" groups="base.group_user"/>
@@ -294,13 +294,13 @@
<field name="state"/>
<field name="residual"/>
<group col="4" colspan="4" groups="base.group_user">
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="gtk-print"/>
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
<button name="invoice_proforma2" states="draft" string="PRO-FORMA" icon="gtk-print"/>
<button name="invoice_open" states="draft,proforma2" string="Create" icon="gtk-execute"/>
<button name="%(action_account_invoice_pay)d" type='action' string='Pay Invoice' states='open' icon="gtk-ok"/>
<button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" icon="gtk-cancel"/>
<button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" icon="gtk-convert"/>
<button name='%(action_account_state_open)d' type='action' string='Re-Open' states='paid' icon="gtk-convert"/>
<button name="%(action_account_invoice_refund)d" type='action' string='Credit Note' states='paid' icon="gtk-execute"/>
</group>
</group>
</page>
@@ -484,9 +484,9 @@
<act_window domain="[('account_analytic_id', '=', active_id)]" id="act_account_analytic_account_2_account_invoice_line" name="Invoice lines" res_model="account.invoice.line" src_model="account.analytic.account"/>
<act_window domain="[('partner_id', '=', partner_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]" id="act_account_invoice_account_move_unreconciled" name="Unreconciled Receivables &amp; Payables" res_model="account.move.line" src_model="account.invoice"/>
<act_window domain="[('partner_id', '=', partner_id), ('account_id.type', 'in', ['receivable', 'payable']), ('reconcile_id','=',False)]" id="act_account_invoice_account_move_unreconciled" name="Unreconciled Receivables &amp; Payables" res_model="account.move.line" src_model="account.invoice"/>
<!-- Partners inherited form -->
<!-- Partners inherited form -->
<record id="view_invoice_partner_info_form" model="ir.ui.view">
<field name="name">res.partner.invoice.info.inherit</field>
+20 -12
View File
@@ -804,7 +804,7 @@
</field>
</record>
<record id="view_account_move_line_filter" model="ir.ui.view">
<record id="view_account_move_line_filter" model="ir.ui.view">
<field name="name">Entry Lines</field>
<field name="model">account.move.line</field>
<field name="type">search</field>
@@ -858,6 +858,7 @@
<field name="ref"/>
<field name="journal_id"/>
<field name="period_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="partner_id"/>
<field name="line_id"/>
<field name="to_check" groups="base.group_extended"/>
@@ -872,21 +873,21 @@
<field name="model">account.move</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Account Entry">
<form string="Journal Entries">
<group colspan="4" col="6">
<field name="name" select="1" readonly="True"/>
<field name="period_id"/>
<field name="journal_id" select="1"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1"/>
<field name="ref" select="1"/>
<field name="to_check"/>
<field name="type" groups="base.group_extended"/>
<field name="name" select="1" colspan="4" readonly="True"/>
<field name="journal_id" select="1"/>
<field name="period_id"/>
<field name="type"/>
<field name="ref" select="1"/>
<field name="company_id" required="1" groups="base.group_multi_company"/>
<field name="date" select="1" groups="base.group_extended"/>
<field name="to_check" groups="base.group_extended"/>
</group>
<field name="partner_id" invisible="1" select="1"/>
<field name="amount" invisible="1" select="1"/>
<field colspan="4" height="250" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<field colspan="4" height="260" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
<form string="Account Entry Line">
<separator colspan="4" string="General Information"/>
<field name="name" select="1"/>
@@ -957,6 +958,13 @@
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-account" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-account" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-account" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-account" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
@@ -973,7 +981,7 @@
<menuitem action="action_move_line_form" id="menu_action_move_line_form" parent="next_id_29"/>
<record id="action_move_line_form_encode_by_move" model="ir.actions.act_window">
<field name="name">Entries by Move</field>
<field name="name">Journal Entries</field>
<field name="res_model">account.move</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form</field>
+6 -5
View File
@@ -8,13 +8,13 @@ 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-03-15 03:12+0000\n"
"PO-Revision-Date: 2010-05-20 07:09+0000\n"
"Last-Translator: Songpon Phusing <p.songpon@gmail.com>\n"
"Language-Team: Thai <th@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-04-17 04:08+0000\n"
"X-Launchpad-Export-Date: 2010-05-21 03:38+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -51,7 +51,7 @@ msgstr ""
#. module: account
#: model:account.account.type,name:account.account_type_asset
msgid "Asset"
msgstr ""
msgstr "สินทรัพย์"
#. module: account
#: constraint:ir.actions.act_window:0
@@ -106,7 +106,7 @@ msgstr ""
#: model:ir.actions.wizard,name:account.wizard_vat_declaration
#: model:ir.ui.menu,name:account.menu_wizard_vat_declaration
msgid "Print Taxes Report"
msgstr ""
msgstr "พิมพ์รายงานภาษี"
#. module: account
#: field:account.account,parent_id:0
@@ -2133,7 +2133,8 @@ msgid "Analytic Entry"
msgstr ""
#. module: account
#: view:res.company:0 field:res.company,overdue_msg:0
#: view:res.company:0
#: field:res.company,overdue_msg:0
msgid "Overdue Payments Message"
msgstr ""
+3 -3
View File
@@ -29,7 +29,7 @@ class account_unreconcile(osv.osv_memory):
obj_move_reconcile = self.pool.get('account.move.reconcile')
if context is None:
context = {}
recs = pool.get('account.move.line').read(cr, uid, data['ids'], ['reconcile_id','reconcile_partial_id'])
recs = obj_move_line.read(cr, uid, data['ids'], ['reconcile_id','reconcile_partial_id'])
unlink_ids = []
full_recs = filter(lambda x: x['reconcile_id'], recs)
rec_ids = [rec['reconcile_id'][0] for rec in full_recs]
@@ -37,9 +37,9 @@ class account_unreconcile(osv.osv_memory):
part_rec_ids = [rec['reconcile_partial_id'][0] for rec in part_recs]
unlink_ids += rec_ids
unlink_ids += part_rec_ids
if len(unlink_ids):
pooler.get_pool(cr.dbname).get('account.move.reconcile').unlink(cr, uid, unlink_ids)
self.pool.get('account.move.reconcile').unlink(cr, uid, unlink_ids)
return {}
account_unreconcile()
+23
View File
@@ -0,0 +1,23 @@
# Thai 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-05-20 04:33+0000\n"
"Last-Translator: Songpon Phusing <p.songpon@gmail.com>\n"
"Language-Team: Thai <th@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:38+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_chart
#: model:ir.module.module,description:account_chart.module_meta_information
msgid "Remove minimal account chart"
msgstr "ทำการลบตัวอย่างผังบัญชีแบบง่าย"
+1 -2
View File
@@ -23,8 +23,7 @@
"name" : "Accounting Reports",
"version" : "1.0",
"depends" : [
"account",
"account_voucher"
"account"
],
"author" : "Tiny ERP",
"description": """Accounting Reports
+14 -13
View File
@@ -104,22 +104,22 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
else:
self.res_pl['type'] = 'Net Loss'
pl_dict = {
'code' : False,
'name' : self.res_pl['type'],
'level': False,
'balance':self.res_pl['balance'],
}
'code' : False,
'name' : self.res_pl['type'],
'level': False,
'balance':self.res_pl['balance'],
}
for typ in types:
accounts_temp = []
for account in accounts:
if (account.user_type.report_type) and (account.user_type.report_type == typ):
account_dict = {
'id' : account.id,
'code' : account.code,
'name' : account.name,
'level': account.level,
'balance':account.balance,
}
'id' : account.id,
'code' : account.code,
'name' : account.name,
'level': account.level,
'balance':account.balance,
}
if typ == 'liability' and account.type <> 'view' and (account.debit <> account.credit):
self.result_sum_dr += abs(account.debit - account.credit)
if typ == 'asset' and account.type <> 'view' and (account.debit <> account.credit):
@@ -138,6 +138,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
self.result[typ] = accounts_temp
cal_list[typ]=self.result[typ]
if cal_list:
temp={}
for i in range(0,max(len(cal_list['liability']),len(cal_list['asset']))):
@@ -164,7 +165,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
'name1' : cal_list['asset'][i]['name'],
'level1': cal_list['asset'][i]['level'],
'balance1':cal_list['asset'][i]['balance'],
}
}
self.result_temp.append(temp)
if i < len(cal_list['liability']):
temp={
@@ -176,7 +177,7 @@ class report_balancesheet_horizontal(rml_parse.rml_parse):
'name1' : '',
'level1': False,
'balance1':False,
}
}
self.result_temp.append(temp)
return None
-1
View File
@@ -20,6 +20,5 @@
##############################################################################
import voucher
import account
import report
import wizard
+1 -2
View File
@@ -46,10 +46,9 @@
"update_xml" : [
"security/ir.model.access.csv",
"voucher_sequence.xml",
"account_report.xml",
"voucher_report.xml",
"voucher_view.xml",
"voucher_wizard.xml",
"account_view.xml",
"wizard/account_voucher_open_view.xml",
],
'certificate': '0037580727101',
-219
View File
@@ -1,219 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import time
import netsvc
from osv import fields, osv
import ir
import pooler
import mx.DateTime
from mx.DateTime import RelativeDateTime
from tools import config
class account_account(osv.osv):
_inherit = "account.account"
def _get_level(self, cr, uid, ids, field_name, arg, context={}):
res={}
acc_obj=self.browse(cr,uid,ids)
for aobj in acc_obj:
level = 0
if aobj.parent_id :
obj=self.browse(cr,uid,aobj.parent_id.id)
level= obj.level + 1
res[aobj.id] = level
return res
def _get_children_and_consol(self, cr, uid, ids, context={}):
ids2=[]
temp=[]
read_data= self.read(cr, uid, ids,['id','child_id'], context)
for data in read_data:
ids2.append(data['id'])
if data['child_id']:
temp=[]
for x in data['child_id']:
temp.append(x)
ids2 += self._get_children_and_consol(cr, uid, temp, context)
return ids2
_columns = {
'journal_id':fields.many2one('account.journal', 'Journal',domain=[('type','=','situation')]),
'open_bal' : fields.float('Opening Balance',digits=(16,2)),
'level': fields.function(_get_level, string='Level', method=True, store=True, type='integer'),
'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True),
}
def compute_total(self, cr, uid, ids, yr_st_date, yr_end_date, st_date, end_date, field_names, context={}):
if not (st_date >= yr_st_date and end_date <= yr_end_date):
return {}
query = "l.date >= '%s' AND l.date <= '%s'" % (st_date, end_date)
return self.__compute(cr, uid, ids, field_names, context=context, query=query)
def create(self, cr, uid, vals, context={}):
name=self.search(cr,uid,[('name','ilike',vals['name']),('company_id','=',vals['name'])])
if name:
raise osv.except_osv('Error', 'Account is Already Created !')
obj=self.pool.get('account.account.type').browse(cr,uid,vals['user_type'])
if obj.code in ('cash','asset','expense'):
vals['type1'] = 'dr'
elif obj.code in ('equity','income','liability') :
vals['type1'] = 'cr'
else:
vals['type1'] = 'none'
journal_ids=self.pool.get('account.journal').search(cr,uid,[('name','=','Opening Journal')])
vals['journal_id'] = journal_ids and journal_ids[0] or False
account_id = super(account_account, self).create(cr, uid, vals, context)
if vals.get('type1', False) != False:
journal_id = vals.get('journal_id',False)
if journal_id and vals.has_key('open_bal'):
if vals['open_bal'] != 0.0:
journal = self.pool.get('account.journal').browse(cr, uid, [journal_id])
if journal and journal[0].sequence_id:
name = self.pool.get('ir.sequence').get_id(cr, uid, journal[0].sequence_id.id)
move=self.pool.get('account.move').search(cr,uid,[('journal_id','=',journal_id)])
if not move:
move = False
move_data = {'name': name, 'journal_id': journal_id}
move_id=self.pool.get('account.move').create(cr,uid,move_data)
move_obj=self.pool.get('account.move').browse(cr,uid,move_id)
else:
move_obj=self.pool.get('account.move').browse(cr,uid,move[0])
self_obj=self.browse(cr,uid,account_id)
move_line = {
'name':journal[0].name,
'debit':self_obj.debit or False,
'credit':self_obj.credit or False,
'account_id':account_id or False,
'move_id':move and move[0] or move_id,
'journal_id':journal_id ,
'period_id':move_obj.period_id.id,
}
if vals['type1'] == 'dr':
move_line['debit'] = vals['open_bal'] or False
elif vals['type1'] == 'cr':
move_line['credit'] = vals['open_bal'] or False
self.pool.get('account.move.line').create(cr,uid,move_line)
return account_id
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
res_temp={}
if vals.has_key('name'):
if not vals.has_key('company_id'):
vals['company_id']=self.browse(cr,uid,ids)[0].company_id.id
name=self.search(cr,uid,[('name','ilike',vals['name']),('company_id','=',vals['company_id'])])
if name:
raise osv.except_osv('Error', 'Same Account Name is Already present !')
if vals.has_key('user_type'):
obj=self.pool.get('account.account.type').browse(cr,uid,vals['user_type'])
if obj.code in ('asset','expense'):
vals['type1'] = 'dr'
elif obj.code in ('income','liability') :
vals['type1'] = 'cr'
else:
vals['type1'] = 'none'
super(account_account, self).write(cr, uid,ids, vals, context)
if vals.has_key('open_bal'):
self_obj= self.browse(cr,uid,ids)
move_pool=self.pool.get('account.move')
if vals:
for obj in self_obj:
flg=0
if obj.journal_id and obj.journal_id.type == 'situation':
move=move_pool.search(cr,uid,[('journal_id','=',obj.journal_id.id)])
if move:
move_obj=move_pool.browse(cr,uid,move[0])
move=move[0]
else:
name = self.pool.get('ir.sequence').get_id(cr, uid, obj.journal_id.sequence_id.id)
move_data = {'name': name, 'journal_id': obj.journal_id.id}
move=self.pool.get('account.move').create(cr,uid,move_data)
move_obj=move_pool.browse(cr,uid,move)
move_line_data={'name':obj.journal_id.name,
'debit':obj.debit or 0.0,
'credit':obj.credit or 0.0,
'account_id':obj.id,
'move_id':move,
'journal_id':obj.journal_id.id,
'period_id':move_obj.period_id.id,
}
if obj.type1:
if obj.type1 == 'dr':
move_line_data['debit'] = obj.open_bal
elif obj.type1 == 'cr':
move_line_data['credit'] = obj.open_bal
if move_obj and move:
for move_line in move_obj.line_id:
if move_line.account_id.id == obj.id:
if move_line_data['debit'] == 0.0 and move_line_data['credit']== 0.0:
self.pool.get('account.move.line').unlink(cr,uid,[move_line.id])
else:
self.pool.get('account.move.line').write(cr,uid,[move_line.id],move_line_data)
flg=1
if not flg:
self.pool.get('account.move.line').create(cr,uid,move_line_data)
return True
def onchange_type(self, cr, uid, ids,user_type,type1):
if not user_type:
return {'value' : {}}
type_obj=self.pool.get('account.account.type').browse(cr,uid,user_type)
if type_obj.code in ('asset','expense'):
type1 = 'dr'
elif type_obj.code in ('income','liability') :
type1 = 'cr'
else:
type1 = 'none'
return {
'value' : {'type1' : type1}
}
account_account()
class account_move(osv.osv):
_inherit = "account.move"
_columns = {
'name':fields.char('Name', size=256, required=True, readonly=True, states={'draft':[('readonly',False)]}),
}
account_move()
class res_currency(osv.osv):
_inherit = "res.currency"
_columns = {
'sub_name': fields.char('Sub Currency', size=32, required=True)
}
_defaults = {
'sub_name': lambda *a: 'cents',
}
res_currency()
class account_account_template(osv.osv):
_inherit = "account.account.template"
_columns = {
'type1':fields.selection([('dr','Debit'),('cr','Credit'),('none','None')], 'Dr/Cr',store=True),
}
account_account_template()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-22
View File
@@ -1,22 +0,0 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_account_voucher"
string="Voucher Report (Cr/Dr)"
model="account.voucher"
name="voucher.cash_receipt.drcr"
rml="account_voucher/report/report_voucher.rml"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_amt"
string="Voucher Report"
model="account.voucher"
name="voucher.cash_amount"
rml="account_voucher/report/report_voucher_amount.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</openerp>
-76
View File
@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record model="ir.ui.view" id="account_form1">
<field name="name">account.form1</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="after">
<field name="balance" string="Closing Balance"/>
<field name="type1" />
<field name="open_bal"/>
<field name="journal_id"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_form2">
<field name="name">account.form2</field>
<field name="inherit_id" ref="account.view_account_form"/>
<field name="model">account.account</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="user_type" position="replace">
<field name="user_type" select="1" on_change="onchange_type(user_type,type1)"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_tree1">
<field name="name">account.tree1</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="open_bal" select="1"/>
</field>
</field>
</record>
<record model="ir.ui.view" id="account_tree2">
<field name="name">account.tree2</field>
<field name="inherit_id" ref="account.view_account_tree"/>
<field name="model">account.account</field>
<field name="type">tree</field>
<field name="arch" type="xml">
<field name="company_currency_id" position="before">
<field name="type1"/>
</field>
</field>
</record>
<!-- sub_currency -->
<record model="ir.ui.view" id="sub_currency_form">
<field name="name">sub.currency.form</field>
<field name="inherit_id" ref="base.view_currency_form" />
<field name="model">res.currency</field>
<field name="type">form</field>
<field name="arch" type="xml">
<field name="name" position="after">
<field name="sub_name" />
</field>
</field>
</record>
<act_window name="Opening Balance Entry"
domain="[('journal_id', '=', journal_id)]"
res_model="account.move.line"
src_model="account.account"
id="act_account_acount_move_line_open1"/>
</data>
</openerp>
@@ -23,7 +23,6 @@ import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher, self).__init__(cr, uid, name, context)
@@ -364,7 +364,7 @@
<tr>
<td>
<para style="P17">
<font color="white"> </font>
<font color="white"></font>
</para>
</td>
<td>
@@ -23,7 +23,6 @@ import time
from report import report_sxw
from tools import amount_to_text_en
class report_voucher_amount(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_voucher_amount, self).__init__(cr, uid, name, context)
@@ -42,4 +41,4 @@ report_sxw.report_sxw(
'account.voucher',
'addons/account_voucher/report/report_voucher_amount.rml',
parser=report_voucher_amount,header=False
)
)
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0"?>
<openerp>
<data>
<report id="report_account_voucher"
string="Print Voucher"
model="account.voucher"
name="voucher.cash_receipt.drcr"
rml="account_voucher/report/report_voucher.rml"
auto="False"
header = "False"
menu="True"/>
<report id="report_account_voucher_amt"
string="Print Receipt"
model="account.voucher"
name="voucher.cash_amount"
rml="account_voucher/report/report_voucher_amount.rml"
auto="False"
header = "False"
menu="True"/>
</data>
</openerp>
+37 -4
View File
@@ -7,12 +7,15 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree string="Vouchers">
<field name="date"/>
<field name="number"/>
<field name="name"/>
<field name="journal_id"/>
<field name="type" invisible=" not context.get('set_visible',True)"/>
<field name="account_id" />
<field name="amount"/>
<field name="date"/>
<field name="amount" sum="Total Amount"/>
<field name="period_id"/>
<field name="state"/>
</tree>
</field>
</record>
@@ -24,7 +27,7 @@
<field name="arch" type="xml">
<form string="Voucher">
<group col="6" colspan="4">
<field name="name" select="1" colspan="4"/>
<field name="name" colspan="4"/>
<field name="journal_id" select="1" on_change="onchange_journal(journal_id,type)"/>
<field name="account_id" on_change="onchange_account(account_id)"/>
<field name="type" on_change="onchange_journal(journal_id,type)"/>
@@ -69,7 +72,37 @@
</form>
</field>
</record>
<record id="view_account_move_filter" model="ir.ui.view">
<field name="name">account.voucher.select</field>
<field name="model">account.voucher</field>
<field name="type">search</field>
<field name="arch" type="xml">
<search string="Search Vouchers">
<group col='8' colspan='4'>
<filter icon="terp-account" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
<filter icon="terp-account" string="Proforma" domain="[('state','=','proforma')]" help="Proforma Vouchers"/>
<filter icon="terp-account" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
<filter icon="terp-account" string="Cancel" domain="[('state','=','cancel')]" help="Cancel Vouchers"/>
<separator orientation="vertical"/>
<field name="date" select='1'/>
<field name="name" select='1'/>
<field name="number" select='1'/>
<field name="journal_id" select='1'/>
<field name="partner_id" select='1'/>
<field name="period_id" select='1'/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="12" col="10">
<filter string="Journal" icon="terp-account" domain="[]" context="{'group_by':'journal_id'}"/>
<filter string="Period" icon="terp-account" domain="[]" context="{'group_by':'period_id'}"/>
<filter string="Type" icon="terp-account" domain="[]" context="{'group_by':'type', 'set_visible':True}"/>
<filter string="States" icon="terp-account" domain="[]" context="{'group_by':'state'}"/>
</group>
</search>
</field>
</record>
<record model="ir.actions.act_window" id="action_voucher_list">
<field name="name">Vouchers</field>
<field name="res_model">account.voucher</field>
@@ -1,24 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<openerp>
<data>
<data>
<record id="account_open_vouchers_view" model="ir.ui.view">
<field name="name">Open Vouchers</field>
<field name="model">account.open.voucher</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Open Vouchers">
<field name="type"/>
<field name="state"/>
<field name="period_ids" colspan="4"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="action_open_window" string="Open Voucher Entries" type="object" icon="gtk-ok"/>
</group>
</form>
<form string="Open Vouchers">
<field name="type"/>
<field name="state"/>
<field name="period_ids" colspan="4"/>
<group colspan="4" col="6">
<separator colspan="6"/>
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="action_open_window" string="Open Voucher Entries" type="object" icon="gtk-ok"/>
</group>
</form>
</field>
</record>
</record>
<record id="action_account_open_vouchers" model="ir.actions.act_window">
<field name="name">Open Vouchers</field>
@@ -28,15 +28,15 @@
<field name="view_mode">tree,form</field>
<field name="view_id" ref="account_open_vouchers_view"/>
<field name="context">{'record_id':active_id}</field>
<field name="target">new</field>
<field name="target">new</field>
</record>
<menuitem
icon="STOCK_EXECUTE"
name="Open Vouchers"
action="action_account_open_vouchers"
id="menu_account_voucher_open"
parent="menu_action_voucher_list"/>
<menuitem
icon="STOCK_EXECUTE"
name="Open Vouchers"
action="action_account_open_vouchers"
id="menu_account_voucher_open"
parent="menu_action_voucher_list"/>
</data>
</openerp>
</data>
</openerp>
+2
View File
@@ -50,8 +50,10 @@
'wizard/auction_payer_sel_view.xml',
'wizard/auction_lots_sms_send_view.xml',
'wizard/auction_catalog_flagey_view.xml',
# 'wizard/auction_aie_send_view.xml',
# 'wizard/auction_aie_send_result_view.xml',
'wizard/auction_lots_buyer_map_view.xml',
# 'wizard/auction_lots_numerotate_view.xml',
'auction_view.xml',
'auction_report.xml',
+2
View File
@@ -31,8 +31,10 @@ import auction_lots_sms_send
import auction_catalog_flagey_report
#import auction_lots_cancel
#import auction_transfer_unsold_object
#import auction_aie_send
#import auction_aie_send_result
import auction_lots_buyer_map
#import auction_lots_numerotate
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+223
View File
@@ -0,0 +1,223 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
# Does not properly work concurrently !!!
#
import base64
import mimetypes
import httplib
import threading
from tools.translate import _
from osv import fields,osv
class auction_lots_send_aie(osv.osv_memory):
_name = 'auction.lots.send.aie'
_descritption = 'Send to website'
def _date_get(self, cr, uid, context={}):
selection = context and context.get('selection')
if selection:
return [('','')] + selection
return [('','')]
_columns = {
'uname': fields.char('Login', size=64),
'password': fields.char('Password', size=64),
'objects': fields.integer('# of objects', readonly=True),
'lang': fields.selection([('fr','fr'),('ned','ned'),('eng','eng'),('de','de')],'Language'),
'numerotation': fields.selection([('prov','Provisoire'),('definite','Definitive (ordre catalogue)')],'Numerotation'),
'dates': fields.selection(_date_get,'Auction Date'),
'img_send': fields.boolean('Send Image also ?'),
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_send_aie, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
if 'password' in fields and context.get('password',False):
res['password'] = context.get('password')
return res
def _catalog_send(uname, passwd, lang, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog.cgi", (('uname',uname),('password',passwd),('did',did),('lang',lang)),(('file',catalog),))
def _photo_bin_send(uname, passwd, ref, did, photo_name, photo_data):
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key, filename, data) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(data)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/photo.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
def _photos_send(cr, uid, uname, passwd, did, ids):
service = netsvc.LocalService("object_proxy")
for (ref,id) in ids:
# ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)])
datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image'])
if len(datas):
bin = base64.decodestring(datas[0]['image'])
fname = datas[0]['name']
_photo_bin_send(uname, passwd, ref, did, fname, bin)
def get_dates(self, cr, uid, ids, context={}):
import httplib
data_obj = self.pool.get('ir.model.data')
conn = httplib.HTTPConnection('www.auction-in-europe.com')
datas = self.read(cr, uid, ids[0],['uname','password'])
conn.request("GET", "/aie_upload/dates_get.php?uname=%s&passwd=%s" % (datas['uname'], datas['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1','replace').encode('utf-8','replace')))
context['selection'] = map(_date_decode, response.read().split('\n'))
self._date_get(cr, uid, context=context)
else:
raise osv.except_osv(_('Error'), _("Connection to WWW.Auction-in-Europe.com failed !"))
id1 = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_send')
res_id = data_obj.browse(cr, uid, id1, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.send.aie',
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def _send(self, cr, uid, ids, context={}):
import pickle, thread, sql_db
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
cr.close()
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
lots_ids = []
datas = self.read(cr, uid, ids[0],['uname','login','lang','numerotation','dates'])
for l in lots:
if datas['numerotation']=='prov':
l['ref']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
else:
l['ref']='%04d' % (l['obj_num'],)
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
if l['artist_id']:
l['artist_id'] = l['artist_id'][1]
else:
l['artist_id'] = ''
for n in ('obj_desc','artist_id','lot_type'):
try:
l[n]=l[n].decode('utf-8','replace').encode('latin1','replace')
except:
l[n]=''
del l['lot_num']
del l['obj_num']
del l['bord_vnd_id']
l['aie_categ'] = vals.get(l['lot_type'], False)
lots_ids.append((l['ref'], l['id']))
args = pickle.dumps(lots)
thread.start_new_thread(_catalog_send, (datas['uname'],datas['password'],datas['lang'],datas['dates'], args))
if(datas['form']['img_send']==True):
thread.start_new_thread(_photos_send, (cr.dbname, uid, datas['uname'], datas['password'],datas['dates'], lots_ids))
return {}
def send_pdf(self, cr, uid, ids, context):
threaded_calculation = threading.Thread(target=self._send, args=(cr, uid, ids, context))
threaded_calculation.start()
return {}
auction_lots_send_aie()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,139 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
# Does not properly work concurrently !!!
#
import netsvc
from tools.translate import _
from osv import fields, osv
class auction_lots_pay(osv.osv_memory):
_name = 'auction.lots.send.aie.results'
_description = 'Send results to Auction-in-europe.com'
def _date_get(self, cr, uid, context={}):
selection = context and context.get('selection')
if selection:
return [('','')] + selection
return [('','')]
_columns = {
'uname': fields.char('Login', size=64),
'password': fields.char('Password', size=64),
'objects': fields.integer('# of objects'),
'dates': fields.selection(_date_get,'Auction Date'),
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_pay, self).default_get(cr, uid, fields, context=context)
if 'uname' in fields and context.get('uname',False):
res['uname'] = context.get('uname')
if 'password' in fields and context.get('password',False):
res['password'] = context.get('password')
return res
def _catalog_send(self, uname, passwd, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog_result.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def get_dates(self, cr, uid, ids, context):
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
data_obj = self.pool.get('ir.model.data')
datas = self.read(cr, uid, ids[0],['uname','password'])
conn.request("GET", "/aie_upload/dates_get_result.php?uname=%s&passwd=%s" % (datas['uname'], datas['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1').encode('utf-8')))
context['selection'] = map(_date_decode, response.read().split('\n'))
self._date_get(cr, uid, context=context)
else:
raise osv.except_osv(_('Error'),
_("Connection to WWW.Auction-in-Europe.com failed !"))
id1 = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_send_result_send')
res_id = data_obj.browse(cr, uid, id1, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.send.aie.results',
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def send(self, cr, uid, ids, context):
import pickle
service = netsvc.LocalService("object_proxy")
datas = self.read(cr, uid, ids[0],['uname','password','dates'])
lots = service.execute(cr.dbname, uid, 'auction.lots', 'read', context['active_ids'], ['obj_num','obj_price'])
args = pickle.dumps(lots)
self._catalog_send(datas['uname'], datas['password'], datas['dates'], args)
return {}
auction_lots_pay()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Auction lots send result -->
<record id="view_auction_lots_send_result_login" model="ir.ui.view">
<field name="name">Auction lots send result - Login</field>
<field name="model">auction.lots.send.aie.results</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname"/>
<newline/>
<field name="password" password="True"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="get_dates" string="Continue"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Send results to Auction-in-europe.com"
res_model="auction.lots.send.aie.results"
src_model="auction.lots"
view_mode="form"
view_id="view_auction_lots_send_result_login"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_send_result_login"/>
<record id="view_auction_lots_send_result_send" model="ir.ui.view">
<field name="name">Auction lots send result - Send</field>
<field name="model">auction.lots.send.aie.results</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname" readonly="1"/>
<field name="password" password="True" readonly="1"/>
<newline/>
<field name="objects" readonly="1"/>
<newline/>
<field name="dates" colspan="3"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="send" string="Send on your website"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
</data>
</openerp>
@@ -0,0 +1,63 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Auction lots send result -->
<record id="view_auction_lots_send_login" model="ir.ui.view">
<field name="name">Auction lots send - Login</field>
<field name="model">auction.lots.send.aie</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname"/>
<newline/>
<field name="password" password="True"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="get_dates" string="Continue"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Send to website"
res_model="auction.lots.send.aie"
src_model="auction.lots"
view_mode="form"
view_id="view_auction_lots_send_login"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_send_login"/>
<record id="view_auction_lots_send" model="ir.ui.view">
<field name="name">Auction lots - Send</field>
<field name="model">auction.lots.send.aie</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Login">
<field name="uname" readonly="1"/>
<field name="password" password="True" readonly="1"/>
<newline/>
<field name="objects"/>
<field name="lang"/>
<field name="numerotation"/>
<field name="img_send"/>
<newline/>
<field name="dates" colspan="3"/>
<separator colspan="4"/>
<group col="2" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Cancel" />
<button name="send_pdf" string="Send on your website"
colspan="1" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
</data>
</openerp>
@@ -0,0 +1,184 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import netsvc
import sql_db
from osv import osv, fields
from tools.translate import _
class auction_lots_numerotate_per_lot(osv.osv_memory):
_name = 'auction.lots.numerotate'
_description = 'Numerotation (per lot)'
_columns = {
'bord_vnd_id': fields.many2one('auction.deposit', 'Depositer Inventory', required=True),
'lot_num': fields.integer('Inventory Number', readonly=True),
'lot_est1': fields.float('Minimum Estimation', readonly=True),
'lot_est2': fields.float('Maximum Estimation', readonly=True),
'name': fields.char('Short Description', size=64, readonly=True),
'obj_desc': fields.text('Description', readonly=True),
'obj_num': fields.integer('Catalog Number', required=True)
}
def default_get(self, cr, uid, fields, context):
"""
To get default values for the object.
@param self: The object pointer.
@param cr: A database cursor
@param uid: ID of the user currently logged in
@param fields: List of fields for which we want default values
@param context: A standard dictionary
@return: A dictionary which of fields with values.
"""
res = super(auction_lots_numerotate_per_lot, self).default_get(cr, uid, fields, context=context)
active_id = context.get('active_id',False)
active_model = context.get('active_model')
if active_id and (active_model and active_model!='auction.lots'):
return res
lots_obj = self.pool.get('auction.lots')
lots = lots_obj.browse(cr, uid, active_id)
if 'bord_vnd_id' in fields and context.get('bord_vnd_id',False):
res['bord_vnd_id'] = context.get('bord_vnd_id')
if 'lot_num' in fields and context.get('lot_num',False):
res['lot_num'] = context.get('lot_num')
if 'lot_est1' in fields:
res['lot_est1'] = lots.lot_est1
if 'lot_est2' in fields:
res['lot_est2'] = lots.lot_est2
if 'name' in fields:
res['name'] = lots.name
if 'obj_desc' in fields:
res['obj_desc'] = lots.obj_desc
if 'obj_num' in fields:
res['obj_num'] = lots.obj_num
return res
def open_init_form(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_numerotate')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def numerotate(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num','obj_num'])
data_obj = self.pool.get('ir.model.data')
lots_obj = self.pool.get('auction.lots')
res = lots_obj.search(cr,uid,[('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('UserError', 'This record does not exist !')
lots_obj.write(cr, uid, found, {'obj_num':int(datas['obj_num'])} )
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_numerotate')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context': context
}
def read_record(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num'])
lots_obj = self.pool.get('auction.lots')
res = lots_obj.search(cr, uid, [('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('UserError', 'This record does not exist !')
lots_datas = lots_obj.read(cr, uid, found,
['obj_num', 'name', 'lot_est1',
'lot_est2', 'obj_desc'])
return lots_datas[0]
def test_exist(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
data_obj = self.pool.get('ir.model.data')
datas = self.read(cr, uid, ids[0], ['bord_vnd_id','lot_num'])
res = self.pool.get('auction.lots').search(cr, uid,
[('bord_vnd_id','=',datas['bord_vnd_id']),
('lot_num','=',int(datas['lot_num']))])
found = [r for r in res if r in record_ids]
if len(found)==0:
raise osv.except_osv('Error', 'This lot does not exist !')
view_id = data_obj._get_id(cr, uid, 'auction', 'view_auction_lots_numerotate_second')
if view_id:
res_id = data_obj.browse(cr, uid, view_id, context=context).res_id
context.update(datas)
return {
'view_type': 'form',
'view_mode': 'form',
'res_model': 'auction.lots.numerotate',
'res_id' : False,
'views': [(res_id,'form')],
'type': 'ir.actions.act_window',
'target':'new',
'context' : context
}
auction_lots_numerotate_per_lot()
class auction_lots_numerotate(osv.osv_memory):
_name = 'auction.lots.numerotate_cont'
_description = 'Numerotation (automatic)'
_columns = {
'number': fields.integer('First Number', required=True)
}
def numerotate_cont(self, cr, uid, ids, context={}):
record_ids = context and context.get('active_ids',False) or False
assert record_ids, _('Active IDs not Found')
datas = self.read(cr, uid, ids[0], ['number'])
nbr = int(datas['number'])
lots_obj = self.pool.get('auction.lots')
rec_ids = lots_obj.browse(cr, uid, record_ids)
for rec_id in rec_ids:
lots_obj.write(cr, uid, [rec_id.id], {'obj_num':nbr})
nbr+=1
return {}
auction_lots_numerotate()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -0,0 +1,132 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<!-- Numerotation (per lot) -->
<record id="view_auction_numerotate" model="ir.ui.view">
<field name="name">auction.lots.numerotate.open</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<separator string="Object Reference" colspan="4"/>
<field name="bord_vnd_id"/>
<newline/>
<field name="lot_num" readonly="False" required="True"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="test_exist" string="Continue"
colspan="2" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Numerotation (per lot)"
res_model="auction.lots.numerotate"
src_model="auction.lots"
view_id="view_auction_numerotate"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_auction_lots_numerotate"/>
<record id="view_auction_lots_numerotate_second" model="ir.ui.view">
<field name="name">auction.lots.numerotate.second</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<group>
<separator string="Object Reference" colspan="4"/>
<field name="bord_vnd_id" readonly="1"/>
<field name="lot_num" readonly="1"/>
<field name="name" readonly="1" colspan="3"/>
<field name="obj_desc" readonly="1" colspan="3"/>
<field name="lot_est1" readonly="1"/>
<field name="lot_est2" readonly="1"/>
<separator string="Object Reference" colspan="4"/>
<field name="obj_num"/>
</group>
<newline/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="open_init_form" string="Back" type="object"
icon="gtk-go-back"/>
<button name="numerotate" string="Numerotate"
type="object" icon="gtk-go-forward"/>
</group>
</form>
</field>
</record>
<record id="action_auction_lots_numerotate" model="ir.actions.act_window">
<field name="name">Numerotation (per lot)</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">auction.lots.numerotate</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_auction_lots_numerotate_second"/>
<field name="target">new</field>
</record>
<record id="view_auction_numerotate_not_exist" model="ir.ui.view">
<field name="name">auction.lots.numerotate.not_exist</field>
<field name="model">auction.lots.numerotate</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation">
<label string="This lot does not exist !" colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="open_init_form" string="Retry" type="object"
icon="gtk-go-back"/>
</group>
</form>
</field>
</record>
<record id="action_auction_lots_numerotate_not_exist" model="ir.actions.act_window">
<field name="name">Numerotation - Not Exist</field>
<field name="type">ir.actions.act_window</field>
<field name="res_model">auction.lots.numerotate</field>
<field name="view_type">form</field>
<field name="view_mode">form</field>
<field name="view_id" ref="view_auction_numerotate_not_exist"/>
<field name="target">new</field>
</record>
<record id="view_auction_numerotate_cont" model="ir.ui.view">
<field name="name">Numerotation (automatic)</field>
<field name="model">auction.lots.numerotate_cont</field>
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Catalog Numerotation" >
<field name="number" colspan="4"/>
<separator colspan="4"/>
<group col="4" colspan="4">
<button icon='gtk-cancel' special="cancel"
string="Exit" />
<button name="numerotate_cont" string="Numerotation"
colspan="2" type="object" icon="gtk-go-forward" />
</group>
</form>
</field>
</record>
<act_window name="Numerotation (automatic)"
res_model="auction.lots.numerotate_cont"
src_model="auction.lots"
view_mode="form"
target="new"
key2="client_action_multi"
id="action_view_auction_numerotate_cont"/>
</data>
</openerp>
-232
View File
@@ -1,232 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
# Does not properly work concurently !!!
#
import pooler
import wizard
import netsvc
import base64
import mimetypes
import httplib
import threading
from tools.translate import _
login_form = '''<?xml version="1.0"?>
<form title="Login">
<field name="uname"></field>
<newline/>
<field name="password"></field>
</form>'''
send_form = '''<?xml version="1.0"?>
<form title="Selection">
<field name="uname"></field>
<field name="password"></field>
<newline/>
<field name="objects"></field>
<field name="lang"></field>
<field name="numerotation"></field>
<field name="img_send"></field>
<newline/>
<field name="dates" colspan="3"></field>
</form>'''
login_fields = {
'uname': {'string':'Login', 'type':'char'},
'password': {'string':'Password', 'type':'char'},
'numerotation': {'string':'Numerotation', 'type':'selection', 'selection':[('prov','Provisoire'),('definite','Definitive (ordre catalogue)')]},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
send_fields = {
'uname': {'string':'Login', 'type':'char', 'readonly':True},
'password': {'string':'Password', 'type':'char', 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'readonly':True},
'lang': {'string':'Langage', 'type':'selection', 'selection':[('fr','fr'),('ned','ned'),('eng','eng'),('de','de')]},
'numerotation': {'string':'Numerotation', 'type':'selection', 'selection':[('prov','Provisoire'),('definite','Definitive (ordre catalogue)')]},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]},
'img_send': {'string':'Send Image also ?', 'type':'boolean'}
}
def _catalog_send(uname, passwd, lang, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog.cgi", (('uname',uname),('password',passwd),('did',did),('lang',lang)),(('file',catalog),))
def _photo_bin_send(uname, passwd, ref, did, photo_name, photo_data):
def get_content_type(filename):
return mimetypes.guess_type(filename)[0] or 'application/octet-stream'
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key, filename, data) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, filename))
L.append('Content-Type: %s' % get_content_type(filename))
L.append('')
L.append(data)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/photo.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/photo.cgi", (('uname',uname),('ref',ref),('passwd',passwd),('did',did)),(('file',photo_name,photo_data),))
def _photos_send(cr,uid, uname, passwd, did, ids):
for (ref,id) in ids:
service = netsvc.LocalService("object_proxy")
# ids_attach = service.execute(db_name,uid, 'ir.attachment', 'search', [('res_model','=','auction.lots'), ('res_id', '=',id)])
datas = service.execute(cr.db_name,uid, 'auction.lots', 'read',[id], ['name','image'])
if len(datas):
bin = base64.decodestring(datas[0]['image'])
fname = datas[0]['name']
_photo_bin_send(uname, passwd, ref, did, fname, bin)
def _get_dates(self,cr,uid, datas,context={}):
global send_fields
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
conn.request("GET", "/aie_upload/dates_get.php?uname=%s&passwd=%s" % (datas['form']['uname'], datas['form']['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1','replace').encode('utf-8','replace')))
send_fields['dates']['selection'] = map(_date_decode, response.read().split('\n'))
else:
raise wizard.except_wizard(_('Error'), _("Connection to WWW.Auction-in-Europe.com failed !"))
return {'objects':len(datas['ids'])}
def _send(self,db_name,uid, datas,context={}):
import pickle, thread, sql_db
#cr = pooler.get_db(cr.dbname).cursor()
# cr=sql_db.db.cursor()
cr = pooler.get_db(db_name).cursor()
cr.execute('select name,aie_categ from auction_lot_category')
vals = dict(cr.fetchall())
cr.close()
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'], ['obj_num','lot_num','obj_desc','bord_vnd_id','lot_est1','lot_est2','artist_id','lot_type','aie_categ'])
ids = []
for l in lots:
if datas['form']['numerotation']=='prov':
l['ref']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
else:
l['ref']='%04d' % (l['obj_num'],)
l['ref2']='%s%03d' % (l['bord_vnd_id'][1],l['lot_num'])
if l['artist_id']:
l['artist_id'] = l['artist_id'][1]
else:
l['artist_id'] = ''
for n in ('obj_desc','artist_id','lot_type'):
try:
l[n]=l[n].decode('utf-8','replace').encode('latin1','replace')
except:
l[n]=''
del l['lot_num']
del l['obj_num']
del l['bord_vnd_id']
l['aie_categ'] = vals.get(l['lot_type'], False)
ids.append((l['ref'], l['id']))
args = pickle.dumps(lots)
thread.start_new_thread(_catalog_send, (datas['form']['uname'],datas['form']['password'],datas['form']['lang'],datas['form']['dates'], args))
if(datas['form']['img_send']==True):
thread.start_new_thread(_photos_send, (cr.dbname,uid, datas['form']['uname'],datas['form']['password'],datas['form']['dates'], ids))
return {}
def _send_pdf(self, cr, uid, data, context):
threaded_calculation = threading.Thread(target=_send, args=(self, cr.dbname, uid, data, context))
threaded_calculation.start()
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':login_form, 'fields': login_fields, 'state':[('date_ask','Continue'),('end','Cancel')]}
},
'date_ask': {
'actions': [_get_dates],
'result': {'type': 'form', 'arch':send_form, 'fields': send_fields, 'state':[('send','Send on your website'),('end','Cancel')]}
},
'send': {
'actions': [_send_pdf],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_pay('auction.lots.send.aie');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,137 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
#
# Does not properly work concurently !!!
#
import wizard
import netsvc
from tools.translate import _
login_form = '''<?xml version="1.0"?>
<form title="Login">
<field name="uname"></field>
<newline/>
<field name="password"></field>
</form>'''
send_form = '''<?xml version="1.0"?>
<form title="Selection">
<field name="uname"></field>
<field name="password"></field>
<newline/>
<field name="objects"></field>
<newline/>
<field name="dates" colspan="3"></field>
</form>'''
login_fields = {
'uname': {'string':'Login', 'type':'char'},
'password': {'string':'Password', 'type':'char'},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
send_fields = {
'uname': {'string':'Login', 'type':'char', 'readonly':True},
'password': {'string':'Password', 'type':'char', 'readonly':True},
'objects': {'string':'# of objects', 'type':'integer', 'readonly':True},
'dates': {'string':'Auction Date', 'type':'selection', 'selection':[]}
}
def _catalog_send(uname, passwd, did, catalog):
def post_multipart(host, selector, fields, files):
def encode_multipart_formdata(fields, files):
BOUNDARY = '----------ThIs_Is_tHe_bouNdaRY_$'
CRLF = '\r\n'
L = []
for (key, value) in fields:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"' % key)
L.append('')
L.append(value)
for (key,value) in files:
L.append('--' + BOUNDARY)
L.append('Content-Disposition: form-data; name="%s"; filename="%s"' % (key, key+'.pickle'))
L.append('Content-Type: application/octet-stream')
L.append('')
L.append(value)
L.append('--' + BOUNDARY + '--')
L.append('')
body = CRLF.join(L)
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
return content_type, body
content_type, body = encode_multipart_formdata(fields, files)
import httplib
headers = {"Content-type": content_type, "Accept": "*/*"}
conn = httplib.HTTPConnection(host)
conn.request("POST", '/bin/catalog_result.cgi', body, headers = headers)
response = conn.getresponse()
val = response.status
conn.close()
return val
return post_multipart('auction-in-europe.com', "/bin/catalog_result.cgi", (('uname',uname),('password',passwd),('did',did)),(('file',catalog),))
def _get_dates(self,cr,uid, datas, context):
global send_fields
import httplib
conn = httplib.HTTPConnection('www.auction-in-europe.com')
conn.request("GET", "/aie_upload/dates_get_result.php?uname=%s&passwd=%s" % (datas['form']['uname'], datas['form']['password']))
response = conn.getresponse()
if response.status == 200:
def _date_decode(x):
return (x.split(' - ')[0], (' - '.join(x.split(' - ')[1:]).decode('latin1').encode('utf-8')))
send_fields['dates']['selection'] = map(_date_decode, response.read().split('\n'))
else:
raise wizard.except_wizard(_('Error'),
_("Connection to WWW.Auction-in-Europe.com failed !"))
return {'objects':len(datas['ids'])}
def _send(self,cr,uid, datas, context):
import pickle
service = netsvc.LocalService("object_proxy")
lots = service.execute(cr.dbname,uid, 'auction.lots', 'read', datas['ids'], ['obj_num','obj_price'])
args = pickle.dumps(lots)
_catalog_send(datas['form']['uname'],datas['form']['password'], datas['form']['dates'], args)
return {}
class wiz_auc_lots_pay(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':login_form, 'fields': login_fields, 'state':[('date_ask','Continue'),('end','Cancel')]}
},
'date_ask': {
'actions': [_get_dates],
'result': {'type': 'form', 'arch':send_form, 'fields': send_fields, 'state':[('send','Send on your website'),('end','Cancel')]}
},
'send': {
'actions': [_send],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_pay('auction.lots.send.aie.results');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -1,154 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
import pooler
import sql_db
numerotate_form_cont = '''<?xml version="1.0"?>
<form title="%s">
<field name="number" string="%s"/>
</form>''' % ('Continuous Numerotation','First Number')
numerotate_fields_cont = {
'number': {'string':'First Number', 'type':'integer', 'required':True}
}
numerotate_not_exist = '''<?xml version="1.0"?>
<form title="%s">
<label string="This lot does not exist !" colspan="4"/>
</form>''' % ('Catalog Numerotation',)
numerotate_form = '''<?xml version="1.0"?>
<form title="%s">
<separator string="%s" colspan="4"/>
<field name="bord_vnd_id"/>
<newline/>
<field name="lot_num"/>
</form>''' % ('Catalog Numerotation','Object Reference')
numerotate_fields = {
'bord_vnd_id': {'string':'Depositer Inventory', 'type':'many2one', 'required':True, 'relation':'auction.deposit'},
'lot_num': {'string':'Lot Number', 'type':'integer', 'required':True},
}
numerotate_form2 = '''<?xml version="1.0"?>
<form title="%s">
<group>
<separator string="%s" colspan="4"/>
<field name="bord_vnd_id" readonly="1"/>
<field name="lot_num" readonly="1"/>
<field name="name" readonly="1" colspan="3"/>
<field name="obj_desc" readonly="1" colspan="3"/>
<field name="lot_est1" readonly="1"/>
<field name="lot_est2" readonly="1"/>
<separator string="%s" colspan="4"/>
<field name="obj_num"/>
</group>
</form>''' % ('Catalog Numerotation','Object Reference','Object Reference')
numerotate_fields2 = {
'bord_vnd_id': {'string':'Object Inventory', 'type':'many2one', 'relation':'auction.deposit', 'readonly':True},
'lot_num': {'string':'Inventory Number', 'type':'integer', 'readonly':True},
'lot_est1': {'string':'Minimum Estimation', 'type':'float', 'readonly':True},
'lot_est2': {'string':'Maximum Estimation', 'type':'float', 'readonly':True},
'name': {'string':'Short Description', 'type':'char', 'size':64, 'readonly':True},
'obj_desc': {'string':'Description', 'type':'text', 'readonly':True},
'obj_num': {'string':'Catalog Number', 'type':'integer', 'required':True}
}
def _read_record(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
raise wizard.except_wizard('UserError', 'This record does not exist !')
datas = pooler.get_pool(cr.dbname).get('auction.lots').read(cr,uid,found,['obj_num', 'name', 'lot_est1', 'lot_est2', 'obj_desc'])
return datas[0]
def _test_exist(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
return 'not_exist'
return 'search'
def _numerotate(self,cr,uid,datas,context={}):
form = datas['form']
res = pooler.get_pool(cr.dbname).get('auction.lots').search(cr,uid,[('bord_vnd_id','=',form['bord_vnd_id']), ('lot_num','=',int(form['lot_num']))])
found = [r for r in res if r in datas['ids']]
if len(found)==0:
raise wizard.except_wizard('UserError', 'This record does not exist !')
pooler.get_pool(cr.dbname).get('auction.lots').write(cr,uid,found,{'obj_num':int(form['obj_num'])} )
return {'lot_inv':'', 'lot_num':''}
def _numerotate_cont(self,cr,uid,datas,context={}):
nbr = int(datas['form']['number'])
refs = pooler.get_pool(cr.dbname).get('auction.lots')
rec_ids = refs.browse(cr,uid,datas['ids'])
for rec_id in rec_ids:
refs.write(cr,uid,[rec_id.id],{'obj_num':nbr})
nbr+=1
return {}
class wiz_auc_lots_numerotate(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_form, 'fields': numerotate_fields, 'state':[('end','Cancel'),('choice','Continue')]}
},
'search': {
'actions': [_read_record],
'result': {'type': 'form', 'arch':numerotate_form2, 'fields': numerotate_fields2, 'state':[('end','Exit'),('init','Back'),('set_number','Numerotate')]}
},
'choice' : {
'actions' : [],
'result' : {'type' : 'choice', 'next_state': _test_exist }
},
'not_exist' : {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_not_exist, 'fields': {}, 'state':[('end','Exit'),('init','Retry')]}
},
'set_number': {
'actions': [_numerotate],
'result': {'type': 'state', 'state':'init'}
}
}
wiz_auc_lots_numerotate('auction.lots.numerotate');
class wiz_auc_lots_numerotate(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch':numerotate_form_cont, 'fields': numerotate_fields_cont, 'state':[('end','Exit'),('set_number','Numerotation')]}
},
'set_number': {
'actions': [_numerotate_cont],
'result': {'type': 'state', 'state':'end'}
}
}
wiz_auc_lots_numerotate('auction.lots.numerotate_cont');
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+277
View File
@@ -0,0 +1,277 @@
# Thai 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-05-20 04:32+0000\n"
"Last-Translator: Songpon Phusing <p.songpon@gmail.com>\n"
"Language-Team: Thai <th@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:37+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,city:0
#: wizard_field:base_setup.base_setup,init,city:0
#: wizard_field:base_setup.base_setup,update,city:0
msgid "City"
msgstr "อำเภอ"
#. module: base_setup
#: wizard_view:base_setup.base_setup,finish:0
msgid ""
"You can start configuring the system or connect directly to the database "
"using the default setup."
msgstr "คุณอาจจะเริ่มตั้งค่าหรือใช้ค่าพื้นฐานเบื้องต้น"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,zip:0
#: wizard_field:base_setup.base_setup,init,zip:0
#: wizard_field:base_setup.base_setup,update,zip:0
msgid "Zip code"
msgstr "รหัสไปรษณีย์"
#. module: base_setup
#: wizard_view:base_setup.base_setup,init:0
msgid "Select a Profile"
msgstr "เลือกแบบ"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
msgid "Report header"
msgstr "หัวรายงาน"
#. module: base_setup
#: wizard_button:base_setup.base_setup,finish,config:0
msgid "Start Configuration"
msgstr "เริ่มการตั้งค่า"
#. module: base_setup
#: wizard_view:base_setup.base_setup,init:0
msgid ""
"You'll be able to install more modules later through the Administration menu."
msgstr "คุณสามารถลงโมดูลใหม่ๆได้ในเมนูการบริหารระบบ"
#. module: base_setup
#: wizard_view:base_setup.base_setup,init:0
msgid ""
"A profile sets a pre-selection of modules for specific needs. These profiles "
"have been setup to help you discover the different aspects of OpenERP. This "
"is just an overview, we have 300+ available modules."
msgstr ""
"รูปแบบโมดูลเป็นเพียงการตั้งค่าแนะนำในการใช้งานเพื่อตั้งค่าได้ง่ายขึ้น "
"แต่เรามีโมดูลที่สามารถหาติดตั้งได้มากกว่า 500 โมดูล"
#. module: base_setup
#: wizard_button:base_setup.base_setup,company,update:0
#: wizard_button:base_setup.base_setup,init,company:0
msgid "Next"
msgstr "ถัดไป"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,email:0
#: wizard_field:base_setup.base_setup,init,email:0
#: wizard_field:base_setup.base_setup,update,email:0
msgid "E-mail"
msgstr "อีเมล์"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,state_id:0
#: wizard_field:base_setup.base_setup,init,state_id:0
#: wizard_field:base_setup.base_setup,update,state_id:0
msgid "State"
msgstr "จังหวัด"
#. module: base_setup
#: wizard_view:base_setup.base_setup,finish:0
msgid "Your new database is now fully installed."
msgstr "ฐานข้อมูลใหม่ตั้งตั้งเสร็จสิ้น"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,profile:0
#: wizard_field:base_setup.base_setup,init,profile:0
#: wizard_field:base_setup.base_setup,update,profile:0
msgid "Profile"
msgstr "รูปแบบ"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,rml_footer1:0
#: wizard_field:base_setup.base_setup,init,rml_footer1:0
#: wizard_field:base_setup.base_setup,update,rml_footer1:0
msgid "Report Footer 1"
msgstr "หัวรายงาน 1"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,rml_footer2:0
#: wizard_field:base_setup.base_setup,init,rml_footer2:0
#: wizard_field:base_setup.base_setup,update,rml_footer2:0
msgid "Report Footer 2"
msgstr "ท้ายรายงาน 2"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
msgid "General Information"
msgstr "ข้อมูลทั่วไป"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,street2:0
#: wizard_field:base_setup.base_setup,init,street2:0
#: wizard_field:base_setup.base_setup,update,street2:0
msgid "Street2"
msgstr "ตำบล"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
msgid "Report Information"
msgstr "ข้อมูลรายงาน"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,phone:0
#: wizard_field:base_setup.base_setup,init,phone:0
#: wizard_field:base_setup.base_setup,update,phone:0
msgid "Phone"
msgstr "โทรศัพท์"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
msgid "Define Main Company"
msgstr "ตั้งบริษัทหลัก"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,name:0
#: wizard_field:base_setup.base_setup,init,name:0
#: wizard_field:base_setup.base_setup,update,name:0
msgid "Company Name"
msgstr "ชื่อบริษัท"
#. module: base_setup
#: help:base_setup.base_setup,company,rml_footer2:0
#: help:base_setup.base_setup,init,rml_footer2:0
#: help:base_setup.base_setup,update,rml_footer2:0
msgid ""
"This sentence will appear at the bottom of your reports.\n"
"We suggest you to put bank information here:\n"
"IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701"
msgstr ""
"ข้อมูลนี่จะอยู่ในท้ายกระดาษของรายงาน\n"
"เราแนะนำให้เปลี่ยนโดยใส่ข้อมูลของธนาคาร\n"
"IBAN: BE74 1262 0121 6907 - SWIFT: CPDF BE71 - VAT: BE0477.472.701"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,country_id:0
#: wizard_field:base_setup.base_setup,init,country_id:0
#: wizard_field:base_setup.base_setup,update,country_id:0
msgid "Country"
msgstr "ประเทศ"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
#: wizard_view:base_setup.base_setup,finish:0
#: wizard_view:base_setup.base_setup,init:0
#: wizard_view:base_setup.base_setup,update:0
#: model:ir.actions.wizard,name:base_setup.action_wizard_setup
#: model:ir.actions.wizard,name:base_setup.wizard_base_setup
msgid "Setup"
msgstr "ตั้งค่า"
#. module: base_setup
#: help:base_setup.base_setup,company,rml_footer1:0
#: help:base_setup.base_setup,init,rml_footer1:0
#: help:base_setup.base_setup,update,rml_footer1:0
msgid ""
"This sentence will appear at the bottom of your reports.\n"
"We suggest you to write legal sentences here:\n"
"Web: http://openerp.com - Fax: +32.81.73.35.01 - Fortis Bank: 126-2013269-07"
msgstr ""
"ข้อมูลนี่จะอยู่ในท้ายกระดาษของรายงาน\n"
"เราแนะนำให้ท่านนำข้อมูลเกี่ยวกับทางกฏหมาย\n"
"Web: http://openerp.com - Fax: +32.81.73.35.01 - Fortis Bank: 126-2013269-07"
#. module: base_setup
#: wizard_view:base_setup.base_setup,update:0
msgid "Summary"
msgstr "สรุป"
#. module: base_setup
#: wizard_button:base_setup.base_setup,update,finish:0
msgid "Install"
msgstr "ติดตั้ง"
#. module: base_setup
#: wizard_view:base_setup.base_setup,finish:0
msgid "Installation Done"
msgstr "ติดตั้งเสร็จสิ้น"
#. module: base_setup
#: help:base_setup.base_setup,company,rml_header1:0
#: help:base_setup.base_setup,init,rml_header1:0
#: help:base_setup.base_setup,update,rml_header1:0
msgid ""
"This sentence will appear at the top right corner of your reports.\n"
"We suggest you to put a slogan here:\n"
"\"Open Source Business Solutions\"."
msgstr ""
"ข้อมูลนี่จะอยู่ในด้านบนขวาของรายงานท่าน\n"
"กรุณาใส่ สโลแกน\n"
"\"Open Source Business Solutions\"."
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,rml_header1:0
#: wizard_field:base_setup.base_setup,init,rml_header1:0
#: wizard_field:base_setup.base_setup,update,rml_header1:0
msgid "Report Header"
msgstr "หัวรายงาน"
#. module: base_setup
#: wizard_view:base_setup.base_setup,company:0
msgid "Your Logo - Use a size of about 450x150 pixels."
msgstr "กรุณาใช้โลโก้ขนาด 450X150 px"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,currency:0
#: wizard_field:base_setup.base_setup,init,currency:0
#: wizard_field:base_setup.base_setup,update,currency:0
msgid "Currency"
msgstr "อัตราแลกเปลี่ยน"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,street:0
#: wizard_field:base_setup.base_setup,init,street:0
#: wizard_field:base_setup.base_setup,update,street:0
msgid "Street"
msgstr "ที่อยู่"
#. module: base_setup
#: wizard_button:base_setup.base_setup,finish,menu:0
msgid "Use Directly"
msgstr "ใช้ทันที"
#. module: base_setup
#: wizard_button:base_setup.base_setup,init,menu:0
msgid "Cancel"
msgstr "ยกเลิก"
#. module: base_setup
#: wizard_field:base_setup.base_setup,company,logo:0
#: wizard_field:base_setup.base_setup,init,logo:0
#: wizard_field:base_setup.base_setup,update,logo:0
msgid "Logo"
msgstr "โลโก้"
#. module: base_setup
#: model:ir.module.module,shortdesc:base_setup.module_meta_information
msgid "Base Setup"
msgstr "โครงสร้าง ตั้งค่า"
#. module: base_setup
#: wizard_button:base_setup.base_setup,company,init:0
#: wizard_button:base_setup.base_setup,update,company:0
msgid "Previous"
msgstr "ก่อนหน้า"
+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: 2009-09-08 15:20+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-05-19 09:15+0000\n"
"Last-Translator: Rytis Ūsalis <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 03:57+0000\n"
"X-Launchpad-Export-Date: 2010-05-20 05:23+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: board_association
@@ -40,7 +40,7 @@ msgstr ""
#. module: board_association
#: view:board.board:0
msgid "My tasks"
msgstr ""
msgstr "Mano užduotys"
#. module: board_association
#: view:board.board:0
+2 -2
View File
@@ -103,7 +103,7 @@ class crm_lead(osv.osv, crm_case):
'email_cc': fields.text('Watchers Emails', size=252 , help="These \
people will receive a copy of the future communication between partner \
and users by email"),
'description': fields.text('Description'),
'description': fields.text('Notes'),
'write_date': fields.datetime('Update Date' , readonly=True),
# Lead fields
@@ -137,7 +137,7 @@ and users by email"),
\nIf the case is in progress the state is set to \'Open\'.\
\nWhen the case is over, the state is set to \'Done\'.\
\nIf the case needs to be reviewed then the state is set to \'Pending\'.'),
}
}
_defaults = {
'active': lambda *a: 1,
+1
View File
@@ -39,6 +39,7 @@
'partner_view.xml'
],
'demo_xml': ['delivery_demo.xml'],
'test':['test/delivery_test.yml',],
'installable': True,
'active': False,
'certificate': '0033981912253',
+155
View File
@@ -0,0 +1,155 @@
-
In order to test the delivery module, I will do Configuration -> Delivery -> Delivery Method
And there are two methods for doing that
Delivery based on order quantities,
Delivery based on delivered quantities.
-
I create the partner associated with the transport.
-
I create partner.
-
!record {model: res.partner, id: res_partner_thepost0}:
address:
- country_id: base.in
name: Micro Link
credit_limit: 0.0
name: The Post
property_account_payable: account.a_pay
property_account_receivable: account.a_recv
-
I create associated product for delivery.
-
!record {model: product.product, id: product_product_deliverybypost0}:
categ_id: product.product_category_services
cost_method: standard
mes_type: fixed
name: Delivery Product
procure_method: make_to_stock
supply_method: buy
type: service
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
warranty: 0.0
-
I create the Delivery Method.
-
!record {model: delivery.carrier, id: delivery_carrier_theopenerpexperss0}:
name: The OpenERP Experss
partner_id: res_partner_thepost0
product_id: product_product_deliverybypost0
-
I create a delivery grid record and define the region for which the tariffs in the grid will be applicable.
Then set the condition for which this rule is applicable.
-
!record {model: delivery.grid, id: delivery_grid_weight0}:
carrier_id: delivery_carrier_theopenerpexperss0
line_ids:
- list_price: 120.0
max_value: 250.0
name: Weight of product
operator: <=
standard_price: 60.0
type: weight
price_type: fixed
variable_factor: weight
- list_price: 0.0
max_value: 500.0
name: Price &gt;= 500
operator: <=
standard_price: 20.0
type: price
price_type: fixed
variable_factor: weight
country_ids:
- base.id
- base.be
- base.in
- base.io
name: Weight
sequence: 1
-
To check the Delivery based on order quantities , I have created sale order and picking_policy is direct .
-
!record {model: sale.order, id: sale_order_so0}:
date_order: '2010-05-11'
invoice_quantity: order
name: Test/delivery
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I create delivery.sale.order record.
-
!record {model: delivery.sale.order, id: delivery_sale_order_0}:
carrier_id: delivery_carrier_theopenerpexperss0
-
To add the delivery charges on the quotation, I click on Delivery costs button and select the carrier.
-
!python {model: delivery.sale.order}: |
self.delivery_set(cr, uid, [ref("delivery_sale_order_0")], {"lang": "en_US", "active_model":
"sale.order", "tz": False, "order_id": 8, "active_ids": [ref("sale_order_so0")],
"active_id": ref("sale_order_so0"), })
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so0}
-
To check the Invoicing based on deliveries.I create new sale order and picking_policy is Complete Delivery.
-
!record {model: sale.order, id: sale_order_test_complete0}:
name: Test/Complete Deliver
carrier_id: delivery.delivery_carrier_theopenerpexperss0
invoice_quantity: procurement
order_line:
- name: '[PC1] Basic PC'
price_unit: 450.0
product_uom: product.product_uom_unit
product_uom_qty: 10.0
state: draft
delay: 2.0
product_id: product.product_product_pc1
product_uos_qty: 10.0
th_weight: 0.0
type: make_to_stock
partner_id: base.res_partner_4
partner_order_id: base.res_partner_address_7
partner_invoice_id: base.res_partner_address_7
partner_shipping_id: base.res_partner_address_7
pricelist_id: product.list0
order_policy: picking
-
I confirm the sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_test_complete0}
-
I Create stock.invoice.onshipping
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
journal_id: account.sales_journal
type: out_invoice
-
I Create Invoice form picking.
-
!python {model: stock.invoice.onshipping}: |
so=self.pool.get('sale.order').browse(cr,uid,ref('sale_order_test_complete0'))
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "active_model": "stock.picking", "contact_display": "partner",
"active_ids": [so.picking_ids[0].id], "active_id": so.picking_ids[0].id })
+27 -6
View File
@@ -29,7 +29,7 @@ DefaultVoteValue = '50'
class idea_category(osv.osv):
""" Category of Idea """
_name = "idea.category"
_description = "Idea Category"
@@ -38,7 +38,7 @@ class idea_category(osv.osv):
'summary': fields.text('Summary'),
'parent_id': fields.many2one('idea.category', 'Parent Categories', ondelete='set null'),
'child_ids': fields.one2many('idea.category', 'parent_id', 'Child Categories'),
'visibility':fields.boolean('Open Idea?', required=False),
'visibility':fields.boolean('Open Idea?', required=False, help="If True creator of the idea will be visible to others"),
}
_sql_constraints = [
('name', 'unique(parent_id,name)', 'The name of the category must be unique' )
@@ -150,11 +150,10 @@ class idea_idea(osv.osv):
if int(field_value) >= 0:
vote_obj.create(cr, uid, {'idea_id': id, 'user_id': uid, 'score': textual_value })
_columns = {
'user_id': fields.many2one('res.users', 'Creator', required=True, readonly=True),
'title': fields.char('Idea Summary', size=64, required=True),
'description': fields.text('Description', required=True, help='Content of the idea'),
'title': fields.char('Idea Summary', size=64, required=True, readonly=True, states={'draft':[('readonly',False)]}),
'description': fields.text('Description', help='Content of the idea', readonly=True, states={'draft':[('readonly',False)]}),
'comment_ids': fields.one2many('idea.comment', 'idea_id', 'Comments'),
'create_date': fields.datetime('Creation date', readonly=True),
'vote_ids': fields.one2many('idea.vote', 'idea_id', 'Vote'),
@@ -162,7 +161,7 @@ class idea_idea(osv.osv):
'vote_avg': fields.function(_vote_avg_compute, method=True, string="Average Score", type="float"),
'count_votes': fields.function(_vote_count, method=True, string="Count of votes", type="integer"),
'count_comments': fields.function(_comment_count, method=True, string="Count of comments", type="integer"),
'category_id': fields.many2one('idea.category', 'Category', required=True),
'category_id': fields.many2one('idea.category', 'Category', required=True, readonly=True, states={'draft':[('readonly',False)]}),
'state': fields.selection([('draft', 'Draft'),
('open', 'Opened'),
('close', 'Accepted'),
@@ -204,8 +203,30 @@ class idea_idea(osv.osv):
vals.update({
'visibility':visibility
})
res_id = super(idea_idea, self).create(cr, user, vals, context)
return res_id
def copy(self, cr, uid, id, default={}, context={}):
"""
Create the new record in idea_idea model from existing one
@param cr: A database cursor
@param user: ID of the user currently logged in
@param id: list of record ids on which copy method executes
@param default: dict type contains the values to be overridden during copy of object
@param context: context arguments, like lang, time zone
@return: Returns the id of the new record
"""
default.update({
'comment_ids':False,
'vote_ids':False,
'stat_vote_ids':False
})
res_id = super(idea_idea, self).copy(cr, uid, id, default, context)
return res_id
def write(self, cr, user, ids, vals, context=None):
"""
+17 -6
View File
@@ -133,28 +133,40 @@
<field name="arch" type="xml">
<form string="New Idea">
<group col="6" colspan="4">
<field name="title" colspan="4" select="1" />
<field name="title" select="1" />
<field name="category_id" select="1"/>
<field name="my_vote"/>
<field name="user_id" attrs="{'invisible':[('visibility','=',False)]}"/>
<field name="vote_avg" widget="progressbar"/>
<group col="4" colspan="2">
<field name="my_vote" readonly="1"/>
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" states="open" type="action" string="Submit Vote"/>
</group>
</group>
<notebook colspan="4">
<page string="Idea Detail">
<field name="description" nolabel="1" colspan="4" widget="text_wiki"/>
</page>
<page string="Comments" groups="base.group_extended">
<page string="Comments">
<field name="comment_ids" nolabel="1" colspan="4">
<form string="Comment">
<separator string="Your comment" colspan="4"/>
<field name="content" nolabel="1" />
</form>
<tree string="Comments">
<field name="create_date"/>
<field name="content"/>
</tree>
</field>
</page>
<page string="Vote" groups="base.group_extended">
<field name="vote_ids" nolabel="1" colspan="4" readonly="True"/>
<field name="vote_ids" nolabel="1" colspan="4" readonly="True">
<tree string="Votes">
<field name="user_id"/>
<field name="score" />
</tree>
</field>
</page>
<page string="Statistics">
<page string="Statistics" groups="base.group_extended">
<group col="6" colspan="4">
<field name="count_comments" />
<field name="count_votes" />
@@ -174,7 +186,6 @@
<group colspan="4" col="6">
<field name="state"/>
<button name="idea_open" string="Open" states="draft" icon="gtk-go-forward"/>
<button name="%(idea.action_idea_post_vote)d" icon="gtk-execute" states="open" type="action" string="Submit Vote"/>
<button name="idea_close" string="Accept" states="open" icon="gtk-jump-to"/>
<button name="idea_cancel" string="Refuse" states="open" icon="gtk-cancel"/>
+4 -2
View File
@@ -89,6 +89,7 @@ class idea_post_vote(osv.osv_memory):
vote_id = context and context.get('active_id', False) or False
vote_pool = self.pool.get('idea.vote')
idea_pool = self.pool.get('idea.idea')
comment_pool = self.pool.get('idea.comment')
for do_vote_obj in self.read(cr, uid, ids):
@@ -106,8 +107,9 @@ class idea_post_vote(osv.osv_memory):
'content': comment,
}
comment = comment_pool.create(cr, uid, comment)
vote = vote_pool.create(cr, uid, vote)
idea_pool._vote_save(cr, uid, vote_id, None, score, context)
#vote = vote_pool.create(cr, uid, vote)
return {}
idea_post_vote()
+31
View File
@@ -0,0 +1,31 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
# Fabien Pinckaers <fp@tiny.Be>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+43
View File
@@ -0,0 +1,43 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Indian Chart of Account",
"version" : "1.0",
"description":"""
Indian Accounting : chart of Account
""",
"author" : 'Tiny & Axelor',
"category": "Localisation/Account Charts",
"depends" : [
"account",
"account_chart"
],
"demo_xml" : [],
"update_xml" : [
"account_chart.xml",
"account_wizard.xml",
],
"active": False,
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+587
View File
@@ -0,0 +1,587 @@
<?xml version="1.0"?>
<openerp>
<data>
<!--
#
# Indian Accounts tree
#
-->
<!--
Account Type
-->
<record model="account.account.type" id="account_type_income_view">
<field name="name">Income View</field>
<field name="code">view</field>
<field name="report_type">income</field>
</record>
<record model="account.account.type" id="account_type_expense_view">
<field name="name">Expense View</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
</record>
<record model="account.account.type" id="account_type_asset_view">
<field name="name">Asset View</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="account_type_liability_view">
<field name="name">Liability View</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
</record>
<record model="account.account.type" id="account_type_root_ind1">
<field name="name">View</field>
<field name="code">view</field>
</record>
<record model="account.account.type" id="account_type_asset1">
<field name="name">Asset</field>
<field name="code">asset</field>
<field name="report_type">asset</field>
</record>
<record model="account.account.type" id="account_type_liability1">
<field name="name">Liability</field>
<field name="code">liability</field>
<field name="report_type">liability</field>
</record>
<record model="account.account.type" id="account_type_expense1">
<field name="name">Expense</field>
<field name="code">expense</field>
<field name="report_type">expense</field>
</record>
<record model="account.account.type" id="account_type_income1" >
<field name="name">Income</field>
<field name="code">income</field>
<field name="report_type">income</field>
</record>
<record model="account.account.type" id="account_type_closed1">
<field name="name">Closed</field>
<field name="code">closed</field>
</record>
<!-- ## account chart -->
<record model="account.account.template" id="root">
<field name="name">Indian Chart of Account</field>
<field name="code">0</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_root_ind1"/>
<field name="reconcile" eval="False"/>
</record>
<record model="account.account.template" id="IA_AC0">
<field name="name">Balance Sheet</field>
<field name="code">IA_AC0</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_root_ind1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="root"/>
</record>
<record model="account.account.template" id="IA_AC01">
<field name="name">Assets</field>
<field name="code">IA_AC01</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset_view"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC0"/>
</record>
<record model="account.account.template" id="IA_AC011">
<field name="name">Current Assets</field>
<field name="code">IA_AC011</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC01"/>
</record>
<record model="account.account.template" id="IA_AC0111">
<field name="name">Bank Account</field>
<field name="code">IA_AC0111</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC011"/>
</record>
<record model="account.account.template" id="IA_AC0112">
<field name="name">Cash In Hand Account</field>
<field name="code">IA_AC0112</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC011"/>
</record>
<record model="account.account.template" id="IA_AC01121">
<field name="name">Cash Account</field>
<field name="code">IA_AC01121</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC0112"/>
</record>
<record model="account.account.template" id="IA_AC0113">
<field name="name">Deposit Account</field>
<field name="code">IA_AC0113</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC011"/>
</record>
<record model="account.account.template" id="IA_AC0114">
<field name="name">Loan &amp; Advance(Assets) Account</field>
<field name="code">IA_AC0114</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC011"/>
</record>
<!-- <record model="account.account.template" id="IA_AC0115">-->
<!-- <field name="name">Stock In Hand Account</field>-->
<!-- <field name="code">IA_AC0115</field>-->
<!-- <field name="type">receivable</field>-->
<!-- <field name="user_type" ref="account_type_asset1"/>
-->
<!-- <field name="reconcile" eval="False"/>-->
<!-- -->
<!-- <field name="parent_id" ref="IA_AC011"/>-->
<!-- </record>-->
<record model="account.account.template" id="IA_AC0116">
<field name="name">Total Sundry Debtors Account</field>
<field name="code">IA_AC0116</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC011"/>
</record>
<record model="account.account.template" id="IA_AC01161">
<field name="name">Sundry Debtors Account</field>
<field name="code">IA_AC01161</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC0116"/>
</record>
<record model="account.account.template" id="IA_AC012">
<field name="name">Fixed Assets</field>
<field name="code">IA_AC012</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC01"/>
</record>
<record model="account.account.template" id="IA_AC013">
<field name="name">Investment</field>
<field name="code">IA_AC013</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC01"/>
</record>
<record model="account.account.template" id="IA_AC014">
<field name="name">Misc. Expenses(Asset)</field>
<field name="code">IA_AC014</field>
<field name="type">receivable</field>
<field name="user_type" ref="account_type_asset1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC01"/>
</record>
<record model="account.account.template" id="IA_AC02">
<field name="name">Liabilities</field>
<field name="code">IA_AC02</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability_view"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC0"/>
</record>
<record model="account.account.template" id="IA_AC021">
<field name="name">Current Liabilities</field>
<field name="code">IA_AC021</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC02"/>
</record>
<record model="account.account.template" id="IA_AC0211">
<field name="name">Duties &amp; Taxes</field>
<field name="code">IA_AC0211</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC021"/>
</record>
<record model="account.account.template" id="IA_AC0212">
<field name="name">Provision</field>
<field name="code">IA_AC0212</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC021"/>
</record>
<record model="account.account.template" id="IA_AC0213">
<field name="name">Total Sundry Creditors</field>
<field name="code">IA_AC0213</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC021"/>
</record>
<record model="account.account.template" id="IA_AC02131">
<field name="name">Sundry Creditors</field>
<field name="code">IA_AC02131</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC0213"/>
</record>
<record model="account.account.template" id="IA_AC022">
<field name="name">Branch/Division</field>
<field name="code">IA_AC022</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC02"/>
</record>
<record model="account.account.template" id="IA_AC023">
<field name="name">Share Holder/Owner Fund</field>
<field name="code">IA_AC023</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC02"/>
</record>
<record model="account.account.template" id="IA_AC0231">
<field name="name">Capital Account</field>
<field name="code">IA_AC0231</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC023"/>
</record>
<record model="account.account.template" id="IA_AC0232">
<field name="name">Reserve and Surplus Account</field>
<field name="code">IA_AC0232</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC023"/>
</record>
<record model="account.account.template" id="IA_AC024">
<field name="name">Loan(Liability) Account</field>
<field name="code">IA_AC024</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC02"/>
</record>
<record model="account.account.template" id="IA_AC0241">
<field name="name">Bank OD Account</field>
<field name="code">IA_AC0241</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC024"/>
</record>
<record model="account.account.template" id="IA_AC0242">
<field name="name">Secured Loan Account</field>
<field name="code">IA_AC0242</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC024"/>
</record>
<record model="account.account.template" id="IA_AC0243">
<field name="name">Unsecured Loan Account</field>
<field name="code">IA_AC0243</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC024"/>
</record>
<record model="account.account.template" id="IA_AC025">
<field name="name">Suspense Account</field>
<field name="code">IA_AC025</field>
<field name="type">payable</field>
<field name="user_type" ref="account_type_liability1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC02"/>
</record>
<record model="account.account.template" id="IA_AC1">
<field name="name">Profit And Loss Account</field>
<field name="code">IA_AC1</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_root_ind1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="root"/>
</record>
<record model="account.account.template" id="IA_AC11">
<field name="name">Expense</field>
<field name="code">IA_AC11</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_expense_view"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC1"/>
</record>
<record model="account.account.template" id="IA_AC111">
<field name="name">Direct Expenses</field>
<field name="code">IA_AC111</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC11"/>
</record>
<record model="account.account.template" id="IA_AC112">
<field name="name">Indirect Expenses</field>
<field name="code">IA_AC112</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC11"/>
</record>
<record model="account.account.template" id="IA_AC113">
<field name="name">Purchase</field>
<field name="code">IA_AC113</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC11"/>
</record>
<record model="account.account.template" id="IA_AC114">
<field name="name">Opening Stock</field>
<field name="code">IA_AC114</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_expense1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC11"/>
</record>
<record model="account.account.template" id="IA_AC12">
<field name="name">Income</field>
<field name="code">IA_AC12</field>
<field name="type">view</field>
<field name="user_type" ref="account_type_income_view"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC1"/>
</record>
<record model="account.account.template" id="IA_AC121">
<field name="name">Direct Incomes</field>
<field name="code">IA_AC121</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_income1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC12"/>
</record>
<record model="account.account.template" id="IA_AC122">
<field name="name">Indirect Incomes</field>
<field name="code">IA_AC122</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_income1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC12"/>
</record>
<record model="account.account.template" id="IA_AC123">
<field name="name">Sales Account</field>
<field name="code">IA_AC123</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_income1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC12"/>
</record>
<record model="account.account.template" id="IA_AC124">
<field name="name">Goods Given Account</field>
<field name="code">IA_AC124</field>
<field name="type">other</field>
<field name="user_type" ref="account_type_income1"/>
<field name="reconcile" eval="False"/>
<field name="parent_id" ref="IA_AC12"/>
</record>
<!-- Tax detail -->
<record model="account.tax.code.template" id="vat_code_tax1">
<field name="name">Tax</field>
</record>
<record model="account.tax.code.template" id="vat_code_balance_net">
<field name="name">Tax Balance to Pay</field>
<field name="parent_id" ref="vat_code_tax1"/>
</record>
<record model="account.tax.code.template" id="vat_code_due_tva">
<field name="name">Tax Due (Tax to pay)</field>
<field name="parent_id" ref="vat_code_balance_net"/>
</record>
<record model="account.tax.code.template" id="vat_code_payable">
<field name="name">Tax Payable</field>
<field name="parent_id" ref="vat_code_balance_net"/>
</record>
<record model="account.tax.code.template" id="vat_code_base_net">
<field name="name">Tax Bases</field>
<field name="parent_id" ref="vat_code_tax1"/>
</record>
<record model="account.tax.code.template" id="vat_code_base_due">
<field name="name">Base of Taxed Sales</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
<record model="account.tax.code.template" id="vat_code_receivable_net">
<field name="name">Base of Taxed Purchases</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
<record id="opening_journal" model="account.journal">
<field name="name">Opening Journal</field>
<field name="code">OPJ</field>
<field name="type">situation</field>
<field name="view_id" ref="account.account_journal_view"/>
<field name="sequence_id" ref="account.sequence_journal"/>
<field name="user_id" ref="base.user_root"/>
</record>
<record id="cose_journal_opening" model="account.analytic.journal">
<field name="code">OPJ</field>
<field name="name">Opening Journal</field>
<field name="type">situation</field>
</record>
<!-- Chart template -->
<record id="indian_chart_template" model="account.chart.template">
<field name="name">India - Chart of Accounts </field>
<field name="account_root_id" ref="root"/>
<field name="tax_code_root_id" ref="vat_code_tax1"/>
<field name="bank_account_view_id" ref="IA_AC01121"/>
<field name="property_account_receivable" ref="IA_AC01161"/>
<field name="property_account_payable" ref="IA_AC02131"/>
<field name="property_account_expense_categ" ref="IA_AC112"/>
<field name="property_account_income_categ" ref="IA_AC122"/>
</record>
</data>
</openerp>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data noupdate="1">
<record id="tax1" model="account.tax">
<field name="name">PPn (10%)(10.0%)</field>
<field name="amount">0.100000</field>
<field name="type">percent</field>
<field name="account_collected_id" ref="chart2310"/>
<field name="account_paid_id" ref="chart2310"/>
<field name="base_code_id" ref="vat_code_base_due"/>
<field name="tax_code_id" ref="vat_code_due_tva"/>
<field name="ref_base_code_id" ref="vat_code_receivable_net"/>
<field name="ref_tax_code_id" ref="vat_code_payable"/>
</record>
</data>
</openerp>
+35
View File
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<openerp>
<data noupdate="True">
<record model="account.tax.code" id="vat_code_balance_net">
<field name="name">Tax balance to pay</field>
</record>
<record model="account.tax.code" id="vat_code_due_tva">
<field name="name">Tax Due (Tax to pay)</field>
<field name="parent_id" ref="vat_code_balance_net"/>
</record>
<record model="account.tax.code" id="vat_code_payable">
<field name="name">Tax payable</field>
<field name="parent_id" ref="vat_code_balance_net"/>
</record>
<record model="account.tax.code" id="vat_code_base_net">
<field name="name">Tax bases</field>
</record>
<record model="account.tax.code" id="vat_code_base_due">
<field name="name">Base of taxed sales</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
<record model="account.tax.code" id="vat_code_receivable_net">
<field name="name">Base of taxed purchases</field>
<field name="parent_id" ref="vat_code_base_net"/>
</record>
</data>
</openerp>
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
<record id="config_call_account_template_in_minimal" model="ir.actions.todo">
<field name="name">Generate Chart of Accounts from a Chart Template</field>
<field name="note">Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.
This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template.</field>
<field name="action_id" ref="account.action_wizard_multi_chart"/>
<field name="state">open</field>
</record>
</data>
</openerp>
+80
View File
@@ -0,0 +1,80 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * l10n_chart_in
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-11-25 15:28:53+0000\n"
"PO-Revision-Date: 2009-11-25 15:28:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_chart_in
#: model:ir.module.module,description:l10n_chart_in.module_meta_information
msgid "\n"
" Indian Accounting : chart of Account\n"
" "
msgstr ""
#. module: l10n_chart_in
#: constraint:account.account.template:0
msgid "Error ! You can not create recursive account templates."
msgstr ""
#. module: l10n_chart_in
#: model:account.journal,name:l10n_chart_in.opening_journal
msgid "Opening Journal"
msgstr ""
#. module: l10n_chart_in
#: model:ir.actions.todo,note:l10n_chart_in.config_call_account_template_in_minimal
msgid "Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.\n"
" This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template."
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_liability1
msgid "Liability"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_asset1
msgid "Asset"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_closed1
msgid "Closed"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_income1
msgid "Income"
msgstr ""
#. module: l10n_chart_in
#: constraint:account.tax.code.template:0
msgid "Error ! You can not create recursive Tax Codes."
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_expense1
msgid "Expense"
msgstr ""
#. module: l10n_chart_in
#: model:ir.module.module,shortdesc:l10n_chart_in.module_meta_information
msgid "Indian Chart of Account"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_root_ind1
msgid "View"
msgstr ""
+80
View File
@@ -0,0 +1,80 @@
# Translation of OpenERP Server.
# This file contains the translation of the following modules:
# * l10n_chart_in
#
msgid ""
msgstr ""
"Project-Id-Version: OpenERP Server 5.0.6\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2009-11-25 15:28:53+0000\n"
"PO-Revision-Date: 2009-11-25 15:28:53+0000\n"
"Last-Translator: <>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: \n"
"Plural-Forms: \n"
#. module: l10n_chart_in
#: model:ir.module.module,description:l10n_chart_in.module_meta_information
msgid "\n"
" Indian Accounting : chart of Account\n"
" "
msgstr ""
#. module: l10n_chart_in
#: constraint:account.account.template:0
msgid "Error ! You can not create recursive account templates."
msgstr ""
#. module: l10n_chart_in
#: model:account.journal,name:l10n_chart_in.opening_journal
msgid "Opening Journal"
msgstr ""
#. module: l10n_chart_in
#: model:ir.actions.todo,note:l10n_chart_in.config_call_account_template_in_minimal
msgid "Generate Chart of Accounts from a Chart Template. You will be asked to pass the name of the company, the chart template to follow, the no. of digits to generate the code for your accounts and Bank account, currency to create Journals. Thus,the pure copy of chart Template is generated.\n"
" This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template."
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_liability1
msgid "Liability"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_asset1
msgid "Asset"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_closed1
msgid "Closed"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_income1
msgid "Income"
msgstr ""
#. module: l10n_chart_in
#: constraint:account.tax.code.template:0
msgid "Error ! You can not create recursive Tax Codes."
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_expense1
msgid "Expense"
msgstr ""
#. module: l10n_chart_in
#: model:ir.module.module,shortdesc:l10n_chart_in.module_meta_information
msgid "Indian Chart of Account"
msgstr ""
#. module: l10n_chart_in
#: model:account.account.type,name:l10n_chart_in.account_type_root_ind1
msgid "View"
msgstr ""
+5 -1
View File
@@ -77,7 +77,11 @@
'report/mrp_production_order_view.xml',
],
'demo_xml': ['mrp_demo.xml', 'mrp_order_point.xml'],
# 'test': ['test/mrp_phantom_bom.yml','test/mrp_production_order.yml'],
'test': [
'test/mrp_phantom_bom.yml',
'test/mrp_production_order.yml',
'test/mrp_procurement.yml'
],
'installable': True,
'active': False,
'certificate': '0032052481373',
+13 -12
View File
@@ -166,7 +166,7 @@
<field name="arch" type="xml">
<tree string="Routing Work Centers">
<field name="sequence"/>
<field name="workcenter_id" select="1"/>
<field name="workcenter_id"/>
<field name="cycle_nbr"/>
<field name="hour_nbr"/>
</tree>
@@ -249,7 +249,7 @@
<newline/>
<field name="product_uom"/>
<field name="product_qty"/>
<field name="routing_id" groups="base.group_extended"/>
<field name="routing_id" groups="base.group_extended" select="1"/>
<newline/>
<field name="product_uos" groups="product.group_uos"/>
<field name="product_uos_qty" groups="product.group_uos"/>
@@ -471,10 +471,10 @@
<field name="arch" type="xml">
<form string="Manufacturing Orders">
<group colspan="4" col="6">
<field name="name" select="1" string="Reference"/>
<field name="date_planned" select="1"/>
<field name="origin" select="1"/>
<field name="product_id" on_change="product_id_change(product_id)" select="1"/>
<field name="name" string="Reference"/>
<field name="date_planned"/>
<field name="origin"/>
<field name="product_id" on_change="product_id_change(product_id)"/>
<field name="product_qty"/>
<group colspan="2" col="3">
<field name="product_uom"/>
@@ -493,7 +493,7 @@
<notebook colspan="4">
<page string="Consumed Products">
<field name="bom_id" domain="[('product_id','=',product_id),('bom_id','=',False)]" on_change="bom_id_change(bom_id)"/>
<field name="routing_id" groups="base.group_extended" select="1"/>
<field name="routing_id" groups="base.group_extended"/>
<field name="location_src_id" domain="[('usage','=','internal')]" on_change="location_id_change(location_src_id,location_dest_id)"/>
<field name="location_dest_id" domain="[('usage','=','internal')]"/>
<separator string="" colspan="4"/>
@@ -592,8 +592,8 @@
<page string="Work Orders" groups="base.group_extended">
<field colspan="4" name="workcenter_lines" nolabel="1">
<form string="Production Work Centers">
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="workcenter_id" select="1"/>
<field colspan="4" name="name"/>
<field colspan="4" name="workcenter_id"/>
<field name="sequence"/>
<field name="cycle"/>
<field name="hour"/>
@@ -611,7 +611,7 @@
<field colspan="4" name="product_lines" nolabel="1" widget="one2many_list"/>
</page>
<page string="Extra Information">
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="priority" groups="base.group_extended"/>
<newline/>
<field name="date_start"/>
@@ -636,8 +636,7 @@
<filter icon="terp-mrp" string="Draft"
domain="[('state','=','draft')]"
help="Non confirmed manufacturing orders"/>
<filter icon="terp-mrp" string="Current"
default="1"
<filter icon="terp-mrp" name="current" string="Current"
domain="[('state','in',('confirmed','ready'))]"
help="Manufacturing Orders which are waiting for raw materials"/>
<filter icon="terp-mrp" string="Ready"
@@ -674,6 +673,7 @@
<field name="res_model">mrp.production</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt</field>
<field name="context">{'search_default_current':1}</field>
<field name="view_id" eval="False"/>
<field name="search_view_id" ref="view_mrp_production_filter"/>
</record>
@@ -799,6 +799,7 @@
</xpath>
</field>
</record>
<act_window
id="action_product_bom_structure"
name="Product BoM Structure"
+3 -34
View File
@@ -113,8 +113,9 @@
<field name="act_to" ref="prod_act_cancel"/>
<field name="signal">button_cancel</field>
</record>
<!-- Procurement -->
<record id="act_produce" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce</field>
@@ -122,41 +123,9 @@
<field name="subflow_id" search="[('osv','=','mrp.production')]"/>
<field name="action">action_produce_assign_product()</field>
</record>
<record id="act_produce_check" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce_check</field>
</record>
<record id="act_produce_service" model="workflow.activity">
<field name="wkf_id" ref="mrp_procurement.wkf_procurement"/>
<field name="name">produce_service</field>
<field name="kind">function</field>
<field name="action">action_produce_assign_service()</field>
</record>
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
<field name="act_from" ref="mrp_procurement.act_confirm_mto"/>
<field name="act_to" ref="act_produce_check"/>
<field name="condition">check_produce()</field>
</record>
<record id="trans_product_check_produce_service" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_to" ref="act_produce_service"/>
<field name="condition">not check_product()</field>
</record>
<record id="trans_produce_service_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_service_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
</record>
<record id="trans_product_check_produce" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_from" ref="mrp_procurement.act_produce_check"/>
<field name="act_to" ref="act_produce"/>
<field name="condition">check_product()</field>
</record>
@@ -48,8 +48,8 @@
<field name="arch" type="xml">
<search string="Search">
<group col="16" colspan="6">
<filter string="This Year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]" default="1" />
<filter string="This Month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]" default="1"/>
<filter string="This Year" name="this_year" icon="terp-mrp" domain="[('name','=',time.localtime()[0])]"/>
<filter string="This Month" name="this_month" icon="terp-mrp" domain="[('month','=',time.strftime('%%m'))]"/>
<separator orientation="vertical"/>
<filter string="Current" icon="terp-mrp" domain="[('state','in',('open','draft'))]"/>
<separator orientation="vertical"/>
@@ -101,7 +101,7 @@
<field name="view_mode">tree,graph</field>
<field name="view_id" ref="view_report_mrp_production_order_tree"/>
<field name="search_view_id" ref="view_report_mrp_production_order_filter"/>
<field name="context">{'search_default_Product': 1}</field>
<field name="context">{'search_default_Product': 1,'search_default_this_year':1,'search_default_this_month':1}</field>
</record>
+81 -14
View File
@@ -135,19 +135,36 @@
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<blockTableStyle id="Table7">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
</blockTableStyle>
<blockTableStyle id="Table10">
<blockAlignment value="LEFT"/>
<blockValign value="TOP"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
</blockTableStyle>
<initialize>
<paraStyle name="all" alignment="justify"/>
</initialize>
<paraStyle name="Standard" fontName="Times-Roman"/>
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Standard" fontName="Helvetica"/>
<paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Times-Roman"/>
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Times-Roman"/>
<paraStyle name="Footer" fontName="Times-Roman"/>
<paraStyle name="Horizontal Line" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
<paraStyle name="Table Contents" fontName="Helvetica"/>
<paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER"/>
<paraStyle name="Caption" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
<paraStyle name="Index" fontName="Helvetica"/>
<paraStyle name="Footer" fontName="Helvetica"/>
<paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
<paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
<paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
@@ -172,6 +189,7 @@
</stylesheet>
<images/>
<story>
<section>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]] </para>
<para style="terp_default_8">
<font color="white"> </font>
@@ -313,7 +331,10 @@
<para style="terp_default_8">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_Bold_9">Products to Consume</para>
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table8">
<para> <font color="white"> [[ o.move_lines ==[] and removeParentNode('section')]]</font></para>
<tr>
<td>
<para style="terp_tblheader_Details">Product </para>
@@ -329,9 +350,10 @@
</td>
</tr>
</blockTable>
</section>
<section>
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table9">
<para style="terp_default_8">[[ repeatIn(o.move_lines,'line') ]]</para>
<tr>
<td>
<para style="terp_default_9">[[ line.product_id.code ]] [[ line.product_id.name ]]</para>
@@ -350,9 +372,54 @@
</td>
</tr>
</blockTable>
<para style="terp_default_2">
<font color="white"> </font>
</para>
</section>
<para style="terp_default_space">
<font color="white"> </font>
</para>
<section>
<para style="terp_default_Bold_9">Consumed Products</para>
<blockTable colWidths="235.0,82.0,107.0,104.0" style="Table7">
<para> <font color="white"> [[ o.move_lines2 ==[] and removeParentNode('section')]]</font></para>
<tr>
<td>
<para style="terp_tblheader_Details">Product </para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Quantity</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Source Location</para>
</td>
<td>
<para style="terp_tblheader_Details_Centre">Destination Location</para>
</td>
</tr>
</blockTable>
</section>
<section>
<blockTable colWidths="235.0,47.0,34.0,108.0,104.0" style="Table10">
<para style="terp_default_8">[[ repeatIn(o.move_lines2,'line2') ]]</para>
<tr>
<td>
<para style="terp_default_9">[[ line2.product_id.code ]] [[ line2.product_id.name ]]</para>
</td>
<td>
<para style="terp_default_Right_9">[[ formatLang( line2.product_qty) ]] </para>
</td>
<td>
<para style="terp_default_9">[[line2.product_uom.name]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line2.location_id.name ]]</para>
</td>
<td>
<para style="terp_default_Centre_9">[[ line2.location_dest_id.name ]]</para>
</td>
</tr>
</blockTable>
</section>
</section>
</story>
</document>
</document>
+8 -8
View File
@@ -2,7 +2,7 @@
In order to test the mrp phantom bom type in OpenERP, I will create products
and then I will create Phantom bom structure for those products.
-
I create the products required to produce some orange juices: Oranges, Sugar and Water.
I create the products required to produce some orange juices with Oranges, Sugar and Water.
-
!record {model: product.uom, id: product_uom_litre0}:
category_id: product.product_uom_categ_kgm
@@ -129,7 +129,6 @@
date_planned: '2010-04-16 15:53:36'
location_dest_id: stock.stock_location_output
location_src_id: stock.stock_location_stock
name: MO/00002
product_id: product_product_orangejuice0
product_qty: 100.0
product_uom: product_uom_litre0
@@ -171,7 +170,7 @@
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('origin','=',':MO/00002')])
proc_ids = self.search(cr, uid, [('state','!=','cofirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
@@ -196,7 +195,7 @@
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003'])])
purch_ids = self.search(cr, uid, [('state','=','draft')])
assert purch_ids, _('No Purchase Orders were made!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
@@ -207,7 +206,7 @@
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('origin','in',['SCHEDULER','OP/00002','OP/00003']),('state','=','confirmed')])
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
@@ -217,7 +216,7 @@
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
pick_ids = self.search(cr, uid, [('type','=','in')])
assert pick_ids, _('No Incoming Shipments found!')
-
I receive both the products. My incoming pickings are done.
@@ -229,6 +228,7 @@
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('origin','in',['PO00001:SCHEDULER','PO00002:SCHEDULER','PO00003:OP/00002','PO00004:OP/00003']),('type','=','in')])
self.do_partial(cr, uid, [1],context={'active_ids': picking_ids})
picking_ids = pick_obj.search(cr, uid, [('type','=','in')])
self.view_init(cr, uid, ['date','partner_id','address_id'],context={'active_ids': picking_ids})
self.do_partial(cr, uid, [1], context={'active_ids': picking_ids})
+336
View File
@@ -0,0 +1,336 @@
-
In order to test the flow of procurement orders. I will put some orders with
different procurement methods. I have installed sale, mrp and purchase modules.
-
I am creating products.
-
Creating a product.product record
-
!record {model: product.product, id: product_product_shirt0}:
categ_id: product.cat1
cost_method: standard
list_price: 350.0
mes_type: fixed
name: Shirt
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 300.0
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
-
!record {model: product.product, id: product_product_cloth0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Cloth
procure_method: make_to_order
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_maxtor
qty: 300.0
standard_price: 1.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
Creating a product.product record
-
!record {model: product.product, id: product_product_buttons0}:
categ_id: product.cat1
cost_method: standard
mes_type: fixed
name: Buttons
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 100.0
standard_price: 1.0
supply_method: buy
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
I am creating bills of material for 'Shirt'.
-
Creating a mrp.bom record
-
!record {model: mrp.bom, id: mrp_bom_shirt0}:
bom_lines:
- company_id: base.main_company
name: Cloth
product_efficiency: 1.0
product_id: product_product_cloth0
product_qty: 1.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
- company_id: base.main_company
name: Buttons
product_efficiency: 1.0
product_id: product_product_buttons0
product_qty: 8.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
company_id: base.main_company
name: Shirt
product_efficiency: 1.0
product_id: product_product_shirt0
product_qty: 1.0
product_uom: product.product_uom_unit
product_uos_qty: 0.0
sequence: 0.0
type: normal
-
I create minimum stock rule for product Buttons
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
name: OP/00007
product_id: mrp.product_product_buttons0
product_max_qty: 50.0
product_min_qty: 10.0
product_uom: product.product_uom_unit
qty_multiple: 1
warehouse_id: stock.warehouse0
-
I create a procurement order for product Shirt.
-
!record {model: mrp.procurement, id: mrp_procurement_shirt0}:
name: 'PROC: Shirt'
product_id: product_product_shirt0
product_qty: 5.00
location_id: stock.stock_location_stock
product_uom: product.product_uom_unit
-
I confirm the procurement order.
-
!workflow {model: mrp.procurement, action: button_confirm, ref: mrp_procurement_shirt0}
-
I run the procurement.
-
!workflow {model: mrp.procurement, action: button_check, ref: mrp_procurement_shirt0}
-
I see that there is a manufacturing order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0'))])
assert order_ids, 'No Manufacturing Order.'
-
I also check that there are two more procurement orders for sub products Cloth and Buttons.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('product_id','in',[ref('product_product_cloth0'),ref('product_product_buttons0')])])
assert proc_ids, 'No Procurements.'
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[]"
-
I check that there is one purchase order for Cloth.
-
!python {model: purchase.order}: |
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
assert purch_ids, 'No Purchase Orders.'
-
I confirm purchase order for Cloth.
-
!python {model: purchase.order}: |
import netsvc
purch_ids = self.search(cr, uid, [('partner_id.name','=','Maxtor')])
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
-
I get the approval from the supplier. So I approve my purchase orders.
-
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
-
I confirm purchase order for Buttons.
-
!python {model: purchase.order}: |
import netsvc
purch_ids = self.search(cr, uid, [('partner_id.name','=','ASUStek')])
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_confirm', cr)
-
I get the approval from the supplier. So I approve my purchase orders.
-
!python {model: purchase.order}: |
from tools.translate import _
import netsvc
purch_ids = self.search(cr, uid, [('state','=','confirmed')])
assert purch_ids, _('No Confirmed Purchase Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in purch_ids:
wf_service.trg_validate(uid, 'purchase.order', p_id, 'purchase_approve', cr)
-
I Check incoming shipments for cloth. And receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Wong'),('state','=','assigned')])
partial = self.browse(cr, uid, 1, context)
partial_datas = {
'partner_id' : partial.partner_id and partial.partner_id.id or False,
'address_id' : partial.address_id and partial.address_id.id or False,
'delivery_date' : partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
for m in pick.move_lines:
partial_datas['move%s'%(m.id)] = {
'product_id' : m.product_id.id,
'product_qty' : m.product_qty,
'product_uom' : m.product_uom.id
}
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
partial_datas['move%s'%(m.id)].update({
'product_price' : m.product_price,
'product_currency': m.product_currency
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
I Check incoming shipments for buttons. And receive products.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
assert pick_ids, _('No Incoming Shipments found!')
-
!record {model: stock.partial.picking, id: stock_partial_picking0}:
date: '2010-04-30 16:53:36'
partner_id: base.res_partner_maxtor
address_id: base.res_partner_address_wong
-
!python {model: stock.partial.picking}: |
pick_obj = self.pool.get('stock.picking')
picking_ids = pick_obj.search(cr, uid, [('address_id.name','=','Tang'),('state','=','assigned')])
partial = self.browse(cr, uid, 1, context)
partial_datas = {
'partner_id': partial.partner_id and partial.partner_id.id or False,
'address_id': partial.address_id and partial.address_id.id or False,
'delivery_date': partial.date
}
for pick in pick_obj.browse(cr, uid, picking_ids):
for m in pick.move_lines:
partial_datas['move%s'%(m.id)] = {
'product_id': m.product_id.id,
'product_qty': m.product_qty,
'product_uom': m.product_uom.id
}
if (pick.type == 'in') and (m.product_id.cost_method == 'average'):
partial_datas['move%s'%(m.id)].update({
'product_price': m.product_price,
'product_currency': m.product_currency
})
pick_obj.do_partial(cr, uid, picking_ids, partial_datas, context=context)
-
Run scheduler again.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[]"
-
Check state of manufacturing order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('product_id','=',ref('product_product_shirt0')),('state','=','ready')])
assert order_ids, 'No Manufacturing Order in Ready state.'
-
I start production order for Shirt.
-
!python {model: mrp.production}: |
from tools.translate import _
import netsvc
prod_ids = self.search(cr, uid, [('state','=','ready')])
assert prod_ids, _('No Ready Manufacturing Orders found!')
wf_service = netsvc.LocalService("workflow")
for p_id in prod_ids:
wf_service.trg_validate(uid, 'mrp.production', p_id, 'button_produce', cr)
-
!record {model: mrp.product.produce, id: mrp_product_produce0}:
product_qty: 5.00
mode: 'consume_produce'
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
!record {model: stock.move.consume, id: stock_move_consume0}:
product_id: product_product_buttons0
product_qty: 35.00
product_uom: product.product_uom_unit
location_id: stock.stock_location_stock
-
!python {model: stock.move.consume}: |
from tools.translate import _
stock_obj = self.pool.get('stock.move')
stock_ids = stock_obj.search(cr, uid, [('product_id.name','=','Buttons')])
self.do_move_consume(cr, uid, [1], context={'active_ids': stock_ids})
-
And finally production order is done.
-
!python {model: mrp.product.produce}: |
from tools.translate import _
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('product_id.name','=','Shirt')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
+6 -6
View File
@@ -86,27 +86,27 @@
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('origin','=',':MO/00004')])
proc_ids = self.search(cr, uid, [('state','!=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('origin','=',':MO/00004')]"
search: "[('state','=','confirmed')]"
-
I am checking Internal picking.
-
!python {model: stock.picking}: |
from tools.translate import _
pick_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('type','=','internal')])
pick_ids = self.search(cr, uid, [('state','!=','done'),('type','=','internal')])
assert pick_ids, _('No Internal Pickings!')
-
I see that there is a manufacturing order for the subproduct of PC1 with ready state.
-
!python {model: mrp.production}: |
from tools.translate import _
order_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','ready')])
order_ids = self.search(cr, uid, [('state','=','confirmed')])
assert order_ids, _('No manufacturing order!')
-
I start producing that product first. So I marked it as started.
@@ -117,7 +117,7 @@
-
!python {model: mrp.product.produce}: |
prod_obj = self.pool.get('mrp.production')
prod_ids = prod_obj.search(cr, uid, [('origin','=',':MO/00004')])
prod_ids = prod_obj.search(cr, uid, [('state','=','confirmed')])
self.do_produce(cr, uid, [1], context={'active_ids': prod_ids})
-
Now the manufacturing order for subproduct CPU_GEN is done. And manufacturing
@@ -125,7 +125,7 @@
-
!python {model: mrp.production}: |
from tools.translate import _
prod_ids = self.search(cr, uid, [('origin','=',':MO/00004'),('state','=','done')])
prod_ids = self.search(cr, uid, [('state','!=','done')])
assert prod_ids, _('Manufacturing order is yet not done!')
-
I start producing the product PC1.
+11 -10
View File
@@ -29,20 +29,20 @@
<form string="Procurement">
<group col="2" colspan="2">
<separator colspan="2" string="References"/>
<field name="name" select="1" string="Procurement Reason"/>
<field name="name" string="Procurement Reason"/>
<field name="origin"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<group col="2" colspan="2">
<separator colspan="2" string="Planification"/>
<field name="date_planned" select="1"/>
<field name="date_planned"/>
<field name="procure_method"/>
<field name="priority" groups="base.group_extended"/>
</group>
<notebook colspan="4">
<page string="Procurement Details">
<separator colspan="4" string="Product &amp; Location"/>
<field name="product_id" select="1" on_change="onchange_product_id(product_id)"/>
<field name="product_id" on_change="onchange_product_id(product_id)"/>
<field name="location_id" domain="[('usage','=','internal')]"/>
<field name="product_qty"/>
<field name="product_uom"/>
@@ -85,7 +85,7 @@
<field name="arch" type="xml">
<search string="Search Procurement">
<group col='10' colspan='4'>
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" default="1" help="Procurement Orders in draft or open state."/>
<filter icon="terp-mrp" string="Current" domain="[('state','in',('draft','confirmed'))]" name="current" help="Procurement Orders in draft or open state."/>
<filter icon="terp-mrp" string="Exceptions" domain="[('state','=','exception')]" help="Procurement Orders with exceptions"/>
<filter icon="terp-mrp" string="Late"
domain="['&amp;', ('date_planned::date','&lt;', current_date), ('state', 'in', ('draft', 'confirmed'))]"
@@ -112,6 +112,7 @@
<field name="res_model">mrp.procurement</field>
<field name="view_type">form</field>
<field name="view_id" eval="False"/>
<field name="context">{'search_default_current':1}</field>
<field name="search_view_id" ref="view_mrp_procurement_filter"/>
</record>
@@ -179,11 +180,11 @@
<field name="arch" type="xml">
<search string="Minimum Stock Rules Search">
<group col="10" colspan="4">
<field name="name" select="1" />
<field name="warehouse_id" select="1" widget="selection"/>
<field name="location_id" select="1" />
<field name="company_id" select="1" widget="selection"/>
<field name="product_id" select="1"/>
<field name="name"/>
<field name="warehouse_id" widget="selection"/>
<field name="location_id"/>
<field name="company_id" widget="selection"/>
<field name="product_id"/>
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">
@@ -2,8 +2,6 @@
<openerp>
<data>
<!-- Procurement -->
<record id="wkf_procurement" model="workflow">
<field name="name">mrp.procurement.basic</field>
<field name="osv">mrp.procurement</field>
@@ -48,16 +46,16 @@
<field name="kind">function</field>
<field name="action">action_move_assigned()</field>
</record>
<!-- <record id="act_produce_check" model="workflow.activity">-->
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
<!-- <field name="name">produce_check</field>-->
<!-- </record>-->
<!-- <record id="act_produce_service" model="workflow.activity">-->
<!-- <field name="wkf_id" ref="wkf_procurement"/>-->
<!-- <field name="name">produce_service</field>-->
<!-- <field name="kind">function</field>-->
<!-- <field name="action">action_produce_assign_service()</field>-->
<!-- </record>-->
<record id="act_produce_check" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">produce_check</field>
</record>
<record id="act_produce_service" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">produce_service</field>
<field name="kind">function</field>
<field name="action">action_produce_assign_service()</field>
</record>
<record id="act_make_done" model="workflow.activity">
<field name="wkf_id" ref="wkf_procurement"/>
<field name="name">ready</field>
@@ -155,16 +153,16 @@
<field name="act_to" ref="act_make_to_stock"/>
<field name="condition">check_make_to_stock()</field>
</record>
<!-- <record id="trans_confirm_mto_produce_check" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_confirm_mto"/>-->
<!-- <field name="act_to" ref="act_produce_check"/>-->
<!-- <field name="condition">check_produce()</field>-->
<!-- </record>-->
<!-- <record id="trans_product_check_produce_service" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_check"/>-->
<!-- <field name="act_to" ref="act_produce_service"/>-->
<!-- <field name="condition">not check_product()</field>-->
<!-- </record>-->
<record id="trans_confirm_mto_produce_check" model="workflow.transition">
<field name="act_from" ref="act_confirm_mto"/>
<field name="act_to" ref="act_produce_check"/>
<field name="condition">check_produce()</field>
</record>
<record id="trans_product_check_produce_service" model="workflow.transition">
<field name="act_from" ref="act_produce_check"/>
<field name="act_to" ref="act_produce_service"/>
<field name="condition">not check_product()</field>
</record>
<record id="trans_make_to_stock_make_done" model="workflow.transition">
<field name="act_from" ref="act_make_to_stock"/>
<field name="act_to" ref="act_make_done"/>
@@ -172,15 +170,15 @@
<field name="trigger_model" eval="False"/>
<field name="trigger_expr_id" eval="False"/>
</record>
<!-- <record id="trans_produce_service_cancel" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_service"/>-->
<!-- <field name="act_to" ref="act_cancel"/>-->
<!-- <field name="signal">subflow.cancel</field>-->
<!-- </record>-->
<!-- <record id="trans_produce_service_make_done" model="workflow.transition">-->
<!-- <field name="act_from" ref="act_produce_service"/>-->
<!-- <field name="act_to" ref="act_make_done"/>-->
<!-- </record>-->
<record id="trans_produce_service_cancel" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="act_cancel"/>
<field name="signal">subflow.cancel</field>
</record>
<record id="trans_produce_service_make_done" model="workflow.transition">
<field name="act_from" ref="act_produce_service"/>
<field name="act_to" ref="act_make_done"/>
</record>
<record id="trans_make_done_done" model="workflow.transition">
<field name="act_from" ref="act_make_done"/>
<field name="act_to" ref="act_done"/>
+13 -9
View File
@@ -8,41 +8,45 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
"POT-Creation-Date: 2009-12-08 11:46+0000\n"
"PO-Revision-Date: 2010-01-26 11:01+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"PO-Revision-Date: 2010-05-20 14:21+0000\n"
"Last-Translator: Christophe Chauvet - http://www.syleam.fr/ <Unknown>\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-04-17 04:21+0000\n"
"X-Launchpad-Export-Date: 2010-05-21 03:38+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: multi_company
#: help:multi_company.default,object_id:0
msgid "Object affect by this rules"
msgstr ""
msgstr "Objet affecté par cette règle"
#. module: multi_company
#: constraint:ir.model:0
msgid ""
"The Object name must start with x_ and not contain any special character !"
msgstr ""
"Le nom de l'objet doit commencer par x_ et ne doit pas contenir de "
"caractères spéciaux !"
#. module: multi_company
#: constraint:product.template:0
msgid ""
"Error: The default UOM and the purchase UOM must be in the same category."
msgstr ""
"Erreur: l'unité de mesure par défaut et l'unité de mesure d'achat doivent "
"faire partie de la même catégorie"
#. module: multi_company
#: constraint:res.partner:0
msgid "The VAT doesn't seem to be correct."
msgstr ""
msgstr "La TVA ne semble pas correcte"
#. module: multi_company
#: constraint:ir.actions.act_window:0
msgid "Invalid model name in the action definition."
msgstr ""
msgstr "Nom de l'objet invalide dans l'action défini"
#. module: multi_company
#: model:res.company,overdue_msg:multi_company.res_company_odoo
@@ -59,18 +63,18 @@ msgstr ""
#. module: multi_company
#: field:multi_company.default,company_dest_id:0
msgid "Default Company"
msgstr ""
msgstr "Société par défaut"
#. module: multi_company
#: field:multi_company.default,object_id:0
msgid "Object"
msgstr ""
msgstr "Objet"
#. module: multi_company
#: model:ir.module.module,shortdesc:multi_company.module_meta_information
#: view:multi_company.default:0
msgid "Multi Company"
msgstr ""
msgstr "Multi société"
#. module: multi_company
#: model:ir.module.module,description:multi_company.module_meta_information
+1
View File
@@ -75,6 +75,7 @@ Main features :
'statement_data.xml',
],
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml'],
'test':['test/pos_test.yml',],
'installable': True,
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+16 -13
View File
@@ -235,7 +235,7 @@ class pos_order(osv.osv):
'partner_id': False,
'invoice_id': False,
'account_move': False,
'last_out_picking': False,
'picking_id': False,
'nb_print': 0,
'pickings': []
})
@@ -306,7 +306,7 @@ class pos_order(osv.osv):
'invoice_id': fields.many2one('account.invoice', 'Invoice'),
'account_move': fields.many2one('account.move', 'Account Entry', readonly=True),
'pickings': fields.one2many('stock.picking', 'pos_order', 'Picking', readonly=True),
'last_out_picking': fields.many2one('stock.picking', 'Last Output Picking', readonly=True),
'picking_id': fields.many2one('stock.picking', 'Last Output Picking', readonly=True),
'first_name': fields.char('First Name', size=64),
'state_2': fields.function(_get_v,type='selection',selection=[('to_verify', 'To Verify'), ('accepted', 'Accepted'),
('refused', 'Refused')], string='State', readonly=True, method=True, store=True),
@@ -347,6 +347,7 @@ class pos_order(osv.osv):
return False
_defaults = {
'user_salesman_id':lambda self, cr, uid, context: uid,
'user_id': lambda self, cr, uid, context: uid,
'sale_manager': lambda self, cr, uid, context: uid,
'state': lambda *a: 'draft',
@@ -465,7 +466,7 @@ class pos_order(osv.osv):
orders = self.browse(cr, uid, ids, context)
for order in orders:
if not order.last_out_picking:
if not order.picking_id:
new = True
picking_id = picking_obj.create(cr, uid, {
'origin': order.name,
@@ -477,9 +478,9 @@ class pos_order(osv.osv):
'auto_picking': True,
'pos_order': order.id,
})
self.write(cr, uid, [order.id], {'last_out_picking': picking_id})
self.write(cr, uid, [order.id], {'picking_id': picking_id})
else:
picking_id = order.last_out_picking.id
picking_id = order.picking_id.id
picking_obj.write(cr, uid, [picking_id], {'auto_picking': True})
picking = picking_obj.browse(cr, uid, [picking_id], context)[0]
new = False
@@ -771,7 +772,8 @@ class pos_order(osv.osv):
comp_id=comp_id and comp_id.id or False
to_reconcile = []
group_tax = {}
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context).id
order_account = order.partner_id and order.partner_id.property_account_receivable and order.partner_id.property_account_receivable.id or account_def or curr_c.account_receivable.id
# Create an entry for the sale
@@ -1086,13 +1088,14 @@ class pos_order_line(osv.osv):
'Please set one before choosing a product.'))
p_obj = self.pool.get('product.product').browse(cr,uid,product_id).list_price
price = self.pool.get('product.pricelist').price_get(cr, uid,
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
if price is False:
raise osv.except_osv(_('No valid pricelist line found !'),
_("Couldn't find a pricelist line matching this product" \
" and quantity.\nYou have to change either the product," \
" the quantity or the pricelist."))
return price
[pricelist], product_id, qty or 1.0, partner_id)[pricelist]
# Todo need to check
# if price is False:
# raise osv.except_osv(_('No valid pricelist line found !'),
# _("Couldn't find a pricelist line matching this product" \
# " and quantity.\nYou have to change either the product," \
# " the quantity or the pricelist."))
return price or p_obj
def onchange_product_id(self, cr, uid, ids, pricelist, product_id, qty=0, partner_id=False):
price = self.price_by_product(cr, uid, ids, pricelist, product_id, qty, partner_id)
+1
View File
@@ -46,6 +46,7 @@
<field eval="&quot;&quot;&quot;en_US&quot;&quot;&quot;" name="context_lang"/>
<field eval="&quot;&quot;&quot;Shop 3&quot;&quot;&quot;" name="name"/>
<field name="company_id" ref="res_company_shop0"/>
<field name="company_ids" eval="[(4, ref('res_company_shop0'))]"/>
<field eval="&quot;&quot;&quot;shop3&quot;&quot;&quot;" name="login"/>
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
</record>
+18 -17
View File
@@ -8,18 +8,19 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Sales Order POS">
<notebook >
<page string="Order lines">
<group colspan="4" col="6">
<field name="user_salesman_id" />
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="contract_number" select="1" groups="base.group_extended"/>
</group>
<group col="6" colspan="4">
<field name="user_salesman_id" />
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
<field name="contract_number" groups="base.group_extended"/>
</group>
<notebook colspan="4">
<page string="Sale Order ">
<field name="lines" colspan="4" nolabel="1">
<tree string="Order lines" editable="bottom">
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275" />
<field name="qty" />
<field name="qty_rfd" />
<field name="qty_rfd" groups="base.group_extended"/>
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
<field name="price_unit" readonly="1"/>
@@ -31,7 +32,7 @@
<form string="Order lines" >
<field name="product_id" on_change="onchange_product_id(parent.pricelist_id,product_id,qty,parent.partner_id)" width="275"/>
<field name="qty" />
<field name="qty_rfd" />
<field name="qty_rfd" groups="base.group_extended"/>
<field name="discount" on_change="onchange_discount(discount,price_unit)" />
<field name="price_ded" on_change="onchange_ded(price_ded, price_unit)" />
<field name="price_unit"/>
@@ -60,7 +61,7 @@
</group>
<separator colspan="4" string="Actions"/>
<group colspan="4" col="6">
<field name="state" select="1"/>
<field name="state"/>
<button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" />
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
@@ -69,21 +70,21 @@
</group>
</page>
<page string="Payment">
<page string="Order and Payment">
<group colspan="2" col="2" name="Type">
<separator string="Order Information" colspan="4"/>
<field name="company_id"/>
<field name="shop_id" widget="selection" />
<field name="name" select="1"/>
<field name="name"/>
<field name="user_id" />
<field name="sale_manager" />
<field name="price_type" />
</group>
<group colspan="2" col="2" name="Type">
<separator string="Dates" colspan="4"/>
<field name="date_order" select="1" />
<field name="date_validation" select="1" />
<field name="date_payment" select="1" groups="base.group_extended"/>
<field name="date_order"/>
<field name="date_validation" />
<field name="date_payment" groups="base.group_extended"/>
</group>
<group colspan="4">
<separator string="Invoicing" colspan="4"/>
@@ -135,12 +136,12 @@
<field name="arch" type="xml">
<tree string="POS Orders">
<field name="name"/>
<field name="date_order" select="1"/>
<field name="date_order"/>
<field name="date_validation"/>
<field name="date_payment"/>
<field name="user_id"/>
<field name="invoice_id"/>
<field name="state" select="1"/>
<field name="state" />
<field name="amount_total" sum="Amount total"/>
<field name="company_id"/>
</tree>
+2 -2
View File
@@ -496,8 +496,8 @@
id="stock.next_id_61"
name="Reporting"
parent="stock.menu_stock_root" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_root" sequence="19" groups="res_groups_posuser0"/>
<menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>
<menuitem action="stock.action_picking_tree" id="stock.menu_action_picking_tree" parent="stock.menu_stock_warehouse_mgmt" sequence="19" groups="res_groups_posuser0"/>
<!-- <menuitem id="mrp_procurement.menu_mrp_reordering" name="Automatic Procurements" parent="stock.menu_stock_root" sequence="4" groups="base.group_user"/>-->
<menuitem parent="stock.next_id_61" action="stock.action_stock_line_date" id="stock.menu_report_stock_line_date" groups="base.group_user"/>
</data>
+476
View File
@@ -0,0 +1,476 @@
-
In order to test the POS in module, To gives business owners a convenient way of checking out customers and of recording sales.
-
I configure all details for the customer,Salesman and Product ,Account.
-
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 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 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 partner
-
!record {model: res.partner, id: res_partner_cleartrail0}:
category_id:
- res_partner_category_customers0
name: Cleartrail
-
I create partner address.
-
!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 partner invoice address.
-
!record {model: res.partner.address, id: res_partner_address_2}:
partner_id: res_partner_cleartrail0
type: invoice
-
I create partner delivery address.
-
!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
-
I create product category.
-
!record {model: product.category, id: product_category_allproductssellable0}:
name: Mobile Products Sellable
-
I create partner.
-
!record {model: res.partner, id: res_partner_microlinktechnologies0}:
address:
- street: Kailash Vaibhav, Parksite
name: Micro Link Technologies
property_account_payable: account_account_payable1
property_account_receivable: account_account_receivable0
supplier: true
-
I create partner address .
-
!record {model: res.partner.address, id: res_partner_address_0}:
country_id: base.in
partner_id: res_partner_microlinktechnologies0
street: Ash House, Ash Road
title: Ms.
-
I create product category .
-
!record {model: product.category, id: product_category_services0}:
name: Mobile Services
-
I create 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 create product LG Viewty Smart.
-
!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: account_account_payable1
property_account_income: 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 product category .
-
!record {model: product.category, id: product_category_computer0}:
name: Computer
-
I create product HP Pavilion Desktop PCs
-
!record {model: product.product, id: product_product_hppaviliondesktoppcs0}:
categ_id: product_category_computer0
cost_method: standard
mes_type: fixed
list_price: 1000.0
name: HP Pavilion Desktop PCs
procure_method: make_to_stock
seller_ids:
- delay: 1
name: res_partner_microlinktechnologies0
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
property_account_expense: account_account_payable1
property_account_income: account_account_receivable0
-
I create New Order by adding the details of Salesman and "Product" as LG Viewty Smart Quantity as 10.
-
!record {model: pos.order, id: pos_order_pos0}:
company_id: base.main_company
date_order: '2010-05-13 15:02:48'
date_validity: '2010-11-13'
lines:
- company_id: base.main_company
name: Order Line/01
notice: No Discount
product_id: product_product_lgviewtysmart0
qty: 10.0
qty_rfd: 0.0
partner_id: base.res_partner_agrolait
name: POS/001
price_type: tax_excluded
pricelist_id: product.list0
sale_journal: account.sales_journal
shop_id: sale.shop
user_salesman_id: base.user_root
-
I add discount.
-
!record {model: pos.discount, id: pos_discount_0}:
discount: 5.0
discount_notes: More then 5 product
-
I Apply the discount.
-
!python {model: pos.discount}: |
self.apply_discount(cr, uid, [ref("pos_discount_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id":
ref("pos_order_pos0"), })
-
I open the register.
-
!record {model: pos.open.statement, id: pos_open_statement_0}:
{}
-
I open the statement.
-
!python {model: pos.open.statement}: |
self.open_statement(cr, uid, [ref("pos_open_statement_0")], {"lang": "en_US", "active_model":
"ir.ui.menu", "active_ids": [ref("point_of_sale.menu_open_statement")], "tz":
False, "active_id": ref("point_of_sale.menu_open_statement"), })
-
I click on the "Make Payment" wizard.
-
!record {model: pos.make.payment, id: pos_make_payment_0}:
amount: 1615.0
journal: 5
payment_date: 2010-05-13
payment_name: Payment
product_id: product_product_hppaviliondesktoppcs0
-
I make the payment.
-
!python {model: pos.make.payment}: |
self.check(cr, uid, [ref("pos_make_payment_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
False, "active_id": ref("point_of_sale.pos_order_pos0"), })
-
I check the Statement lines are created automatically when payment is done.
-
!python {model: pos.order}: |
order=self.browse(cr,uid,ref("pos_order_pos0"))
assert(order.statement_ids!=[]), "Statement lines not created"
-
When I click on Return picking button , I get three option.
-
1. Cancel 2.Return Goods and Exchange 3.Return without Refund
-
When I click on Return Goods and Exchange.
-
Then it allows me to define the quantity of products, which will return to the stock.
-
I click on Return Picking button.
-
!record {model: pos.return, id: pos_return_0}:
{}
-
I Return the product.
-
!python {model: pos.return}: |
self.create_returns(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("point_of_sale.pos_order_pos0")], "tz":
False, "active_id": ref("point_of_sale.pos_order_pos0"), })
-
Then it allows me to define the quantity of products, which will return to the stock.
-
I select the HP Pavilion Desktop PCs for exchange.
-
!record {model: pos.add.product, id: pos_add_product_0}:
product_id: product_product_hppaviliondesktoppcs0
quantity: 5.0
-
I click on close button.
-
!python {model: pos.add.product}: |
self.close_action(cr, uid, [ref("pos_add_product_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
})
-
I create payment.
-
!record {model: pos.make.payment, id: pos_make_payment_1}:
amount: 680.0
journal: 5
payment_date: 2010-05-13
payment_name: Payment
product_id: product_product_hppaviliondesktoppcs0
-
For payment, I click on Make Payment.
-
!python {model: pos.make.payment}: |
self.check(cr, uid, [ref("pos_make_payment_1")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
False, "active_id": ref("pos_order_pos0"), })
-
To check the Return without Refund . I click button "Return without Refund ".
-
!record {model: pos.return, id: pos_return_0}:
{}
-
The quantity which is selected in Return lines wizard is refunded.
-
!python {model: pos.return}: |
self.create_returns2(cr, uid, [ref("pos_return_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz":
False, "active_id": ref("pos_order_pos0"), })
-
To Close order, I use the wizard "Sale Confirm".
-
!record {model: pos.confirm, id: pos_confirm_0}:
{}
-
I close this order.
-
!python {model: pos.confirm}: |
self.action_confirm(cr, uid, [ref("pos_confirm_0")], {"lang": "en_US", "active_model":
"pos.order", "active_ids": [ref("pos_order_pos0")], "tz": False, "active_id": ref("pos_order_pos0"),
})
+1 -1
View File
@@ -55,7 +55,7 @@ class pos_get_sale(osv.osv_memory):
for pick in proxy_pick.browse(cr, uid, [this.picking_id.id], context):
proxy_pos.write(cr, uid, record_id, {
'last_out_picking': this.picking_id.id,
'picking_id': this.picking_id.id,
'partner_id': pick.address_id and pick.address_id.partner_id.id
})
+39 -37
View File
@@ -44,48 +44,50 @@ class pos_make_payment(osv.osv_memory):
"""
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
active_id = context and context.get('active_id',False)
j_obj = self.pool.get('account.journal')
company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if journal:
journal = journal[0]
else:
journal = None
wf_service = netsvc.LocalService("workflow")
order_obj=self.pool.get('pos.order')
order = order_obj.browse(cr, uid, active_id, context)
#get amount to pay
amount = order.amount_total - order.amount_paid
if amount <= 0.0:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
elif order.amount_paid > 0.0:
order_obj.write(cr, uid, [active_id], {'state': 'advance'})
invoice_wanted_checked = False
current_date = time.strftime('%Y-%m-%d')
active_id = context and context.get('active_id',False)
if active_id:
j_obj = self.pool.get('account.journal')
company_id = self.pool.get('res.users').browse(cr,uid,uid).company_id.id
journal = j_obj.search(cr, uid, [('type', '=', 'cash'), ('company_id', '=', company_id)])
if 'journal' in fields:
res.update({'journal':journal})
if 'amount' in fields:
res.update({'amount':amount})
if 'invoice_wanted' in fields:
res.update({'invoice_wanted':invoice_wanted_checked})
if 'payment_date' in fields:
res.update({'payment_date':current_date})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
if journal:
journal = journal[0]
else:
journal = None
wf_service = netsvc.LocalService("workflow")
order_obj=self.pool.get('pos.order')
order = order_obj.browse(cr, uid, active_id, context)
#get amount to pay
amount = order.amount_total - order.amount_paid
if amount <= 0.0:
context.update({'flag': True})
order_obj.action_paid(cr, uid, [active_id], context)
elif order.amount_paid > 0.0:
order_obj.write(cr, uid, [active_id], {'state': 'advance'})
invoice_wanted_checked = False
current_date = time.strftime('%Y-%m-%d')
if 'journal' in fields:
res.update({'journal':journal})
if 'amount' in fields:
res.update({'amount':amount})
if 'invoice_wanted' in fields:
res.update({'invoice_wanted':invoice_wanted_checked})
if 'payment_date' in fields:
res.update({'payment_date':current_date})
if 'payment_name' in fields:
res.update({'payment_name':'Payment'})
return res
def view_init(self, cr, uid, fields_list, context=None):
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
active_id = context and context.get('active_id', False) or False
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if not order.lines:
raise osv.except_osv('Error!','No order lines defined for this sale ')
if active_id:
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if not order.lines:
raise osv.except_osv('Error!','No order lines defined for this sale ')
return True
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
@@ -110,7 +112,7 @@ class pos_make_payment(osv.osv_memory):
order = self.pool.get('pos.order').browse(cr, uid, active_id)
if order.amount_total == order.amount_paid:
res['arch'] = """ <form string="Make Payment" colspan="4">
result['arch'] = """ <form string="Make Payment" colspan="4">
<group col="2" colspan="2">
<label string="Do you want to print the Receipt?" colspan="4"/>
<separator colspan="4"/>
+11 -7
View File
@@ -158,19 +158,23 @@ class pos_return(osv.osv_memory):
location_id=res and res[0] or None
stock_dest_id = val.id
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.id, {'name':'%s (return)' % order_id.name,
new_picking=picking_obj.copy(cr, uid, order_id.picking_id.id, {'name':'%s (return)' % order_id.name,
'move_lines':[], 'state':'draft', 'type':'in',
'type':'in',
'date':date_cur})
new_order=order_obj.copy(cr,uid,order_id.id, {'name': 'Refund %s'%order_id.name,
'lines':[],
'statement_ids':[],
'last_out_picking':[]})
'picking_id':[]})
for line in order_id.lines:
if line.id and (data['return%s' %line.id]!=0.0):
if line.id :
try:
qty= data['return%s' %line.id]
except :
qty= line.qty
new_move=stock_move_obj.create(cr, uid,{
'product_qty': data['return%s' %line.id],
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['return%s' %line.id] ,line.product_id.uom_id.id),
'product_qty': qty ,
'product_uos_qty': uom_obj._compute_qty(cr, uid,qty ,line.product_id.uom_id.id),
'picking_id':new_picking,
'product_uom':line.product_id.uom_id.id,
'location_id':location_id,
@@ -179,7 +183,7 @@ class pos_return(osv.osv_memory):
'name':'%s (return)' %order_id.name,
'date':date_cur,
'date_planned':date_cur,})
line_obj.copy(cr,uid,line.id,{'qty':-data['return%s' %line.id],
line_obj.copy(cr,uid,line.id,{'qty':-qty ,
'order_id': new_order,
})
order_obj.write(cr,uid, new_order, {'state':'done'})
@@ -262,7 +266,7 @@ class add_product(osv.osv_memory):
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
picking_obj.force_assign(cr, uid, [new_picking], context)
order_obj.write(cr,uid,active_id,{'last_out_picking':new_picking})
order_obj.write(cr,uid,active_id,{'picking_id':new_picking})
return {
+2 -1
View File
@@ -22,11 +22,12 @@
<field name="name">PCE</field>
<field name="factor">1.0</field>
<field name="factor_inv_data">1.0</field>
<field name="rounding">1.0</field>
</record>
<record id="product_uom_kgm" model="product.uom">
<field name="category_id" ref="product_uom_categ_kgm"/>
<field name="name">KGM</field>
<field name="factor">1.0</field>
<field name="factor">1000.0</field>
<field name="factor_inv_data">1.0</field>
</record>
<record id="uom_hour" model="product.uom">
+10 -11
View File
@@ -14,12 +14,12 @@
<filter string="Can be sold" icon="terp-stock" domain="[('sale_ok','=',1)]"/>
<filter string="Can be Purchased" icon="terp-stock" domain="[('purchase_ok', '=', 1)]" />
<separator orientation="vertical"/>
<field name="default_code" select="1"/>
<field name="name" select="1"/>
<field name="categ_id" select="1" widget="selection" operator="child_of"/>
<field name="default_code"/>
<field name="name"/>
<field name="categ_id" widget="selection" operator="child_of"/>
<newline/>
<group col='8' colspan='14' expand="1" string="Extended options...">
<field name="pricelist_id" select="1" widget="selection" context="{'pricelist': self}" />
<field name="pricelist_id" widget="selection" context="{'pricelist': self}" />
</group>
<newline/>
<group col='8' colspan='15' expand='1' string='Group by...'>
@@ -64,13 +64,12 @@
<form string="Product">
<group colspan="4" col="6">
<group colspan="4" col="2">
<separator string="Product Description" colspan="4"/>
<field name="name" select="1" />
<field name="name"/>
<field groups="product.group_product_variant" name="variants" />
</group>
<group colspan="1" col="2">
<separator string="Codes" colspan="2"/>
<field name="default_code" select="1"/>
<field name="default_code"/>
<field name="ean13" groups="base.group_extended"/>
</group>
<group colspan="1" col="2">
@@ -99,7 +98,7 @@
<group colspan="2" col="2" name="status">
<separator string="Status" colspan="2"/>
<field name="categ_id" select="1"/>
<field name="categ_id"/>
<field name="state"/>
<field groups="base.group_extended" name="product_manager"/>
</group>
@@ -162,10 +161,10 @@
<page groups="base.group_extended" string="Packaging">
<field colspan="4" name="packaging" nolabel="1">
<form string="Packaging">
<field name="ean" select="1"/>
<field name="ean"/>
<field name="sequence" invisible="1"/>
<newline/>
<field name="qty" select="1"/>
<field name="qty"/>
<field name="ul"/>
<field name="weight_ul"/>
<separator colspan="4" string="Palletization"/>
@@ -177,7 +176,7 @@
<field name="width"/>
<field name="length"/>
<separator colspan="4" string="Other Info"/>
<field colspan="4" name="name" select="1"/>
<field colspan="4" name="name"/>
</form>
</field>
</page>
+6 -6
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: 2009-11-18 05:51+0000\n"
"Last-Translator: Fabien (Open ERP) <fp@tinyerp.com>\n"
"PO-Revision-Date: 2010-05-19 09:19+0000\n"
"Last-Translator: Rytis Ūsalis <Unknown>\n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Launchpad-Export-Date: 2010-04-17 03:54+0000\n"
"X-Launchpad-Export-Date: 2010-05-20 05:23+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: project
@@ -206,7 +206,7 @@ msgstr ""
#: view:project.task:0
#: field:project.task,notes:0
msgid "Notes"
msgstr ""
msgstr "Pastabos"
#. module: project
#: selection:res.company,project_time_mode:0
@@ -216,7 +216,7 @@ msgstr ""
#. module: project
#: model:project.task.type,name:project.project_tt_analysis
msgid "Analysis"
msgstr ""
msgstr "Analizė"
#. module: project
#: model:ir.model,name:project.model_project_project
@@ -224,7 +224,7 @@ msgstr ""
#: field:project.task,project_id:0
#: model:res.request.link,name:project.req_link_project
msgid "Project"
msgstr ""
msgstr "Projektas"
#. module: project
#: view:project.task:0
+4 -4
View File
@@ -424,10 +424,10 @@
</group>
<newline/>
<group expand="1" string="Group By..." colspan="4" col="20">
<filter string="Users" name="user_id" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Project" icon="terp-project" domain="[]" context="{'group_by':'project_id'}" default = "1"/>
<filter string="Stage" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
<filter string="State" icon="terp-project" domain="[]" context="{'group_by':'state'}"/>
<filter string="Users" name="group_user_id" icon="terp-project" domain="[]" context="{'group_by':'user_id'}"/>
<filter string="Project" name="group_project_id" icon="terp-project" domain="[]" context="{'group_by':'project_id'}" default = "1"/>
<filter string="Stage" name="group_stage_id" icon="terp-project" domain="[]" context="{'group_by':'type'}"/>
<filter string="State" name="group_state" icon="terp-project" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Deadline" icon="terp-project" domain="[]" context="{'group_by':'date_deadline'}"/>
<filter string="Start Date" icon="terp-project" domain="[]" context="{'group_by':'date_start'}"/>
+3 -1
View File
@@ -49,7 +49,9 @@ automatically created via sale orders.
'website': 'http://www.openerp.com',
'depends': ['project', 'mrp_procurement', 'sale', 'mrp_jit'],
'init_xml': [],
'update_xml': ['project_mrp_workflow.xml', 'process/project_mrp_process.xml'],
'update_xml': ['project_mrp_workflow.xml',
#'process/project_mrp_process.xml',
],
'demo_xml': [],
'installable': True,
'active': False,
+2 -2
View File
@@ -1,8 +1,8 @@
<?xml version="1.0"?>
<openerp>
<data>
<record model="workflow.transition" id="mrp.trans_produce_service_make_done">
<field name="act_from" ref="mrp.act_produce_service"/>
<record model="workflow.transition" id="mrp_procurement.trans_produce_service_make_done">
<field name="act_from" ref="mrp_procurement.act_produce_service"/>
<field name="act_to" ref="mrp_procurement.act_make_done"/>
<field name="signal">subflow.done</field>
</record>
+5
View File
@@ -51,6 +51,11 @@
'process/purchase_process.xml',
'report/purchase_report_view.xml',
],
'test': [
'test/purchase_from_order.yml',
'test/purchase_from_manual.yml',
# 'test/purchase_from_picking.yml',
],
'demo_xml': ['purchase_demo.xml','purchase_unit_test.xml'],
'installable': True,
'active': False,
+1 -1
View File
@@ -700,7 +700,7 @@ purchase_order_line()
class mrp_procurement(osv.osv):
_inherit = 'mrp.procurement'
_columns = {
'purchase_id': fields.many2one('purchase.order', 'Purchase Order'),
'purchase_id': fields.many2one('purchase.order', 'Latest Requisition'),
}
def action_po_assign(self, cr, uid, ids, context={}):
+3 -3
View File
@@ -5,7 +5,7 @@
groups="group_purchase_user"/>-->
<menuitem icon="terp-purchase" id="base.menu_purchase_root" name="Procurement Management"
groups="group_purchase_user" sequence="7"/>
<menuitem id="menu_procurement_management" name="Procurement Management"
<menuitem id="menu_procurement_management" name="Purchase Management"
parent="base.menu_purchase_root" sequence="1"/>
<!--supplier menu-->
@@ -68,7 +68,7 @@
<field name="arch" type="xml">
<form string="Purchase Order">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="name"/>
<field name="date_order"/>
<field name="invoiced"/>
<newline/>
@@ -79,7 +79,7 @@
</group>
<notebook colspan="4">
<page string="Purchase Order">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" select="1" domain="[('supplier','=', 1)]"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" domain="[('supplier','=', 1)]"/>
<field name="partner_address_id"/>
<field domain="[('type','=','purchase')]" name="pricelist_id" groups="base.group_extended"/>
<field name="partner_ref"/>
@@ -0,0 +1,148 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Manual
-
Creating an purchase.order record
-
!record {model: purchase.order, id: purchase_order_po1}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: order
location_id: stock.stock_location_stock
name: PO00010
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po1")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po1}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po1"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po1"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po1")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po1}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po1}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po1"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po1"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created
@@ -0,0 +1,154 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Order
-
Creating a purchase.order record
-
!record {model: purchase.order, id: purchase_order_po0}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: order
location_id: stock.stock_location_stock
name: PO00003
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po0")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po0}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets called
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po0"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po0"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po0")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po0}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po0}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po0"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value
-
!python {model: purchase.order}: |
pur_id2=self.browse(cr, uid, ref("purchase_order_po0"))
assert(pur_id2.invoice_id)
@@ -0,0 +1,174 @@
-
In order to test the purchase flow,I start by creating a new product 'iPod'
-
!record {model: product.product, id: product_product_ipod0}:
categ_id: 'product.product_category_3'
cost_method: standard
mes_type: fixed
name: iPod
price_margin: 2.0
procure_method: make_to_stock
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production
seller_delay: '1'
standard_price: 100.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
-
In order to test the purchase flow,I create a new record where "invoice_method" is From Picking
-
Creating an purchase.order record
-
!record {model: purchase.order, id: purchase_order_po2}:
company_id: base.main_company
date_order: '2010-05-11'
invoice_method: picking
location_id: stock.stock_location_stock
name: PO00008
order_line:
- date_planned: '2010-05-13'
name: iPod
price_unit: 100.0
product_id: 'product_product_ipod0'
product_qty: 10.0
product_uom: product.product_uom_unit
state: draft
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
pricelist_id: purchase.list0
-
Initially purchase order is in the draft state
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'draft'
-
Then an order is confirmed by clicking on the "Confirm Purchase Order" button
-
!python {model: purchase.order}: |
self.wkf_confirm_order(cr, uid, [ref("purchase_order_po2")])
-
Performing a workflow action purchase_confirm on module purchase.order
-
!workflow {model: purchase.order, action: purchase_confirm, ref: purchase_order_po2}
-
I check that the order which was initially in the draft state has transit to confirm state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'confirmed'
-
I check that an entry gets created in the "Lines to Invoice" of Invoice Control on the basis of purchase order line
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name) ])
assert search_ids, _('Purchase order line is not created!')
-
To check that wizard "Create Invoices" gets opened
-
Creating a purchase.order.line_invoice record
-
!record {model: purchase.order.line_invoice, id: purchase_order_line_invoice_0}:
{}
-
Performing an osv_memory action makeInvoices on module purchase.order.line_invoice
-
!python {model: purchase.order.line_invoice}: |
pur_obj=self.pool.get('purchase.order')
ids = []
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
for line in pur_id1.order_line:
ids.append(line.id)
self.makeInvoices(cr, uid, [1], context={'active_ids': ids})
-
I check that invoice gets created
-
!python {model: purchase.order}: |
from tools.translate import _
pur_order_obj=self.browse(cr, uid, ref("purchase_order_po2"))
pur_line=self.pool.get( 'purchase.order.line')
search_ids=pur_line.search(cr, uid, [('order_id', '=', pur_order_obj.name),('invoiced', '=', '1') ])
assert search_ids, _('Invoice is not created!')
-
I check that a record gets created in the Pending Invoices
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
account_obj = self.pool.get('account.invoice')
ids = account_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
assert ids, _('Pending Invoice is not created!')
-
Then an order is approved by clicking on the "Approved by Supplier" button
-
!python {model: purchase.order}: |
self.wkf_approve_order(cr, uid, [ref("purchase_order_po2")])
-
Performing a workflow action purchase_approve on module purchase.order
-
!workflow {model: purchase.order, action: purchase_approve, ref: purchase_order_po2}
-
I check that the order which was initially in the confirmed state has transit to approved state.
-
!assert {model: purchase.order, id: purchase_order_po2}:
- state == 'approved'
-
I check that date_approve field of Delivery&Invoices gets bind with the date on which it has been approved
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id.date_approve)
-
I check that an entry gets created in the stock.picking
-
!python {model: purchase.order}: |
pur_id=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id.picking_ids)
-
I check that an entry gets created in the stock.move
-
!python {model: purchase.order}: |
from tools.translate import _
pur_id1=self.browse(cr, uid, ref("purchase_order_po2"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
pick_id = picking_obj.browse(cr, uid, ids)[0]
move_obj = self.pool.get('stock.move')
search_id = move_obj.search(cr, uid, [('picking_id', '=', pick_id.name)])
assert search_id, _('No Incoming Product!')
-
I check that Traceability moves are created
-
Then I create an invoice from picking by clicking on "Create Invoice" wizard
-
Creating a stock.invoice.onshipping record
-
!record {model: stock.invoice.onshipping, id: stock_invoice_onshipping_0}:
invoice_date: '2010-05-11'
journal_id: account.bank_journal
type: in_invoice
-
Performing an osv_memory action create_invoice on module stock.invoice.onshipping
-
!python {model: stock.invoice.onshipping}: |
pur_obj=self.pool.get('purchase.order')
pur_id1=pur_obj.browse(cr, uid, ref("purchase_order_po2"))
picking_obj = self.pool.get('stock.picking')
ids = picking_obj.search(cr, uid, [('origin', '=', pur_id1.name)])
self.create_invoice(cr, uid, [ref("stock_invoice_onshipping_0")], {"lang": "en_US",
"tz": False, "search_default_approved": 1, "active_model": "stock.picking",
"active_ids": ids, "active_id": ids[0], })
-
I check that an invoice_id field of Delivery&Invoices gets bind with the value
-
!python {model: purchase.order}: |
pur_id2=self.browse(cr, uid, ref("purchase_order_po2"))
assert(pur_id2.invoice_id)
+1 -1
View File
@@ -25,7 +25,7 @@ class purchase_installer(osv.osv_memory):
_inherit = 'res.config.installer'
_columns = {
'purchase_requisition':fields.boolean('Purchase Requisition'),
'purchase_requisition':fields.boolean('Purchase Requisition',help="Manages your Purchase Requisition and allow you to easily keep track and manage all your purchase orders."),
}
purchase_installer()
@@ -5,7 +5,7 @@
<!-- Make the invoice-->
<record id="view_purchase_line_invoice" model="ir.ui.view">
<field name="name">Control invoices</field>
<field name="name">Create invoices</field>
<field name="model">purchase.order.line_invoice</field>
<field name="type">form</field>
<field name="arch" type="xml">
@@ -21,7 +21,7 @@
</field>
</record>
<act_window name="Control invoices"
<act_window name="Create invoices"
res_model="purchase.order.line_invoice"
src_model="purchase.order.line"
view_mode="form"
+3 -1
View File
@@ -34,8 +34,10 @@
"update_xml" : ["wizard/purchase_requisition_partner_view.xml",
"purchase_requisition_view.xml",
"security/ir.model.access.csv","purchase_requisition_sequence.xml"],
"active": False,
"test":[
# 'test/purchase_requisition.yml','test/purchase_requisition_exclusive.yml'
],
"installable": True
}
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -78,7 +78,7 @@ class purchase_requisition_line(osv.osv):
_description="Purchase Requisition Line"
_rec_name = 'product_id'
_columns = {
'product_id': fields.many2one('product.product', 'Product' , domain=[('purchase_requisition', '=', True)]),
'product_id': fields.many2one('product.product', 'Product' ),
'product_uom_id': fields.many2one('product.uom', 'Product UoM'),
'product_qty': fields.float('Quantity', digits=(16,2)),
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade'),
@@ -86,28 +86,24 @@ class purchase_requisition_line(osv.osv):
'requisition_id' : fields.many2one('purchase.requisition','Purchase Requisition', ondelete='cascade')
}
def onchange_product_id(self, cr, uid, ids, product_id, context={}):
def onchange_product_id(self, cr, uid, ids, product_id,product_uom_id, context={}):
""" Changes UoM and name if product_id changes.
@param name: Name of the field
@param product_id: Changed product_id
@return: Dictionary of changed values
"""
value = {}
value = {'product_uom_id': ''}
if product_id:
prod = self.pool.get('product.product').browse(cr, uid, [product_id])[0]
value = {'product_uom_id': prod.uom_id.id}
return {'value': value}
_defaults = {
'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id,
}
purchase_requisition_line()
class purchase_order(osv.osv):
_inherit = "purchase.order"
_columns = {
@@ -33,53 +33,63 @@
<field name="arch" type="xml">
<form string="Purchase Requisition">
<group colspan="4" col="6">
<field name="name" select="1"/>
<field name="user_id" select="1"/>
<field name="exclusive" select="1"/>
<field name="name"/>
<field name="user_id"/>
<field name="exclusive"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="origin"/>
<field name="company_id" select="1" groups="base.group_multi_company" widget="selection"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</group>
<notebook colspan="4">
<page string="Products">
<field name="line_ids" colspan="4" nolabel="1">
<tree string="Products" editable="bottom">
<field name="product_id" on_change="onchange_product_id(product_id)"/>
<field name="product_id" on_change="onchange_product_id(product_id,product_uom_id)"/>
<field name="product_qty"/>
<field name="product_uom_id"/>
</tree>
<form string="Products" editable="bottom">
<field name="product_id"/>
<field name="product_id" />
<field name="product_qty"/>
<field name="product_uom_id"/>
<field name="product_uom_id" />
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
</form>
</field>
</page>
<page string="Notes">
<field name="description" colspan="4" nolabel="1"/>
</page>
<page string="Quotations">
<group col="8" colspan="4">
<button name="%(action_purchase_requisition_partner)d" string="New RfQr" type="action" />
<label colspan="6" string=""/>
</group>
<field name="purchase_ids" nolabel="1" colspan="4"/>
</page>
</notebook>
<separator colspan="4"/>
<separator colspan="4"/>
<group col="8" colspan="4">
<field name="state" select="1" readonly ="1"/>
<button name="tender_in_progress" states="draft" string="Confirm" type="object" icon="gtk-apply" />
<button name="tender_reset" states="done,cancel" string="Reset to Draft" type="object" icon="gtk-convert" />
<button name="tender_done" states="in_progress" string="Done" type="object" icon="gtk-jump-to" />
<button name="tender_cancel" states="draft,in_progress" string="Cancel" type="object" icon="gtk-cancel" />
</group>
</group>
</page>
<page string="Quotations">
<field colspan="4" name="purchase_ids" nolabel="1" mode="tree,form">
<tree string="Purchase Order">
<field name="name" string="Reference"/>
<field name="date_order" string="Order Date"/>
<field name="partner_id"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<field name="location_id"/>
<field name="minimum_planned_date"/>
<field name="origin"/>
<field name="state"/>
</tree>
</field>
<separator colspan="4" string=""/>
<group col="8" colspan="4">
<label colspan="6" string=""/>
<button name="%(action_purchase_requisition_partner)d" string="Requests for Quotation" type="action" icon="gtk-execute" />
</group>
</page>
<page string="Notes">
<field name="description" colspan="4" nolabel="1"/>
</page>
</notebook>
</form>
</field>
</record>
@@ -91,6 +101,7 @@
<tree string="Purchase Requisition">
<field name="name"/>
<field name="user_id"/>
<field name="purchase_ids"/>
<field name="date_start"/>
<field name="date_end"/>
<field name="origin"/>
@@ -106,7 +117,8 @@
<field name="arch" type="xml">
<search string="Search Purchase Requisition">
<group col='10' colspan='4'>
<filter icon="terp-purchase" string=" Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
<filter icon="terp-purchase" string="Current" domain="[('state','=','draft,in_progress')]" separator="1" help="Current Purchaes Requisition"/>
<filter icon="terp-purchase" string="Done" domain="[('state','=','done')]" separator="1" help="Current Purchaes Requisition"/>
<separator orientation="vertical"/>
<field name="name" select="1" string="Requisition Reference"/>
<field name="purchase_ids" select="1"/>
@@ -117,8 +129,11 @@
<newline/>
<group expand="1" string="Group By..." colspan="4" col="10">
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
<separator orientation="vertical"/>
<filter string="Date Start" icon="terp-purchase" domain="[]" context="{'group_by':'date_start'}"/>
<filter string="Date End" icon="terp-purchase" domain="[]" context="{'group_by':'date_end'}"/>
<separator orientation="vertical"/>
<filter string="Origin" icon="terp-purchase" domain="[]" context="{'group_by':'origin'}"/>
</group>
</search>
</field>
@@ -0,0 +1,183 @@
-
In order to test the purchase requisition module, I will do a sale order -> purchase_requisition ->
purchase flow and I will buy the required products at two different suppliers.
-
I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO,
with the generation of purchase requisitions.
-
!record {model: product.product, id: product_product_laptopacer0}:
categ_id: product.product_category_3
cost_method: standard
mes_type: fixed
name: Laptop ACER
procure_method: make_to_order
purchase_requisition: 1
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
volume: 0.0
warranty: 0.0
weight: 0.0
weight_net: 0.0
list_price: 100.0
-
Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0001.
-
!record {model: sale.order, id: sale_order_testtender0}:
date_order: '2010-05-10'
invoice_quantity: order
name: TEST/TENDER/0001
order_line:
- name: Laptop ACER
price_unit: 100.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
delay: 7.0
product_id: product_product_laptopacer0
product_uos_qty: 5.0
th_weight: 0.0
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
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_testtender0}
-
I launch he scheduler to compute all procurements, and specify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
proc_obj._procure_confirm(cr,uid)
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
the button 'New RfQ'. This opens a window to ask me the supplier and I set DistriPC .
-
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}:
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
-
I create a new purchase order.
-
!python {model: purchase.requisition.partner}: |
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang":
'en_US', "active_model": "purchase.requisition", "tz": False, "record_id":
1, "active_ids": ids, "active_id": ids[0], })
-
I check that I have two purchase orders on the purchase tender.
-
!python {model: purchase.order}: |
order_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
ids=len(order_ids)
assert (ids==2), "Purchase order hasn't Created"
-
I set the purchase requisition as 'Not Exclusive'.
-
!python {model: purchase.requisition}: |
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
self.write(cr,uid,ids[0],{'exclusive': 'multiple' })
-
I change the quantities so that the purchase order for DistriPC includes 3 pieces and the
purchase order for Asustek includes 2 pieces.
-
!python {model: purchase.order}: |
line_obj=self.pool.get('purchase.order.line')
partner_obj=self.pool.get('res.partner')
requistion_obj=self.pool.get('purchase.requisition')
requistion_ids =requistion_obj.search(cr, uid, [('origin','=','TEST/TENDER/0001')])
partner_id1=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0]
partner_id2=partner_obj.search(cr,uid,[('name','=','Distrib PC')])[0]
purchase_id1= self.search(cr, uid, [('partner_id','=',partner_id1),('requisition_id','in',requistion_ids)])
purchase_id2= self.search(cr, uid, [('partner_id','=',partner_id2),('requisition_id','in',requistion_ids)])
order_line1=self.browse(cr, uid, purchase_id1, context)[0].order_line[0].id
order_line2=self.browse(cr, uid, purchase_id2, context)[0].order_line[0].id
line_obj.write(cr, uid, order_line1, {'product_qty':2})
line_obj.write(cr, uid, order_line2, {'product_qty':3})
-
I confirm and validate both purchase orders.
-
!python {model: purchase.order}: |
order_ids= self.search(cr, uid, [])
import netsvc
wf_service = netsvc.LocalService("workflow")
for id in order_ids:
wf_service.trg_validate(uid, 'purchase.order',id,'purchase_confirm', cr)
wf_service.trg_validate(uid, 'purchase.order',id,'purchase_approve', cr)
-
I check that the delivery order of the customer is in state 'Waiting Goods'.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','delivery')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert (pick.state) =='confirmed'," Order is not confirm"
assert(pick.move_lines[0].state=='wating'),'Order is not wating"'
-
I receive the order of the supplier Asustek from the Incoming Products menu.
-
!python {model: stock.picking }: |
import time
partner_obj=self.pool.get('res.partner')
order_obj=self.pool.get('purchase.order')
partner_id=partner_obj.search(cr,uid,[('name','=','ASUStek')])[0]
picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id': 2,
'address_id': 6,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I receive the order of the supplier DistriPC from the Incoming Shipments menu.
-
!python {model: stock.picking }: |
import time
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0]
picking_id = self.search(cr, uid, [('address_id.partner_id','=',partner_id),('type','=','in')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
move =pick.move_lines[0]
partial_datas = {
'partner_id':pick.address_id.partner_id.id,
'address_id': pick.address_id.id,
'delivery_date' : time.strftime('%Y-%m-%d'),
}
partial_datas['move%s'%(move.id)]= {
'product_id': move.product_id,
'product_qty': move.product_qty,
'product_uom': move.product_uom.id,
}
self.do_partial(cr, uid, picking_id,partial_datas)
-
I check that the delivery order of the customer is in the state Available.
-
!python {model: stock.picking }: |
picking_id = self.search(cr, uid, [('origin','=','TEST/TENDER/0001'),('type','=','out')])
if picking_id:
pick=self.browse(cr,uid,picking_id[0])
assert (pick.state) =='available'," Order is not available"
@@ -0,0 +1,112 @@
-
In order to test the purchase requisition module, I will do a sale order -> purchase_requisition ->
purchase flow and I will buy the required products at two different suppliers.
-
I start by creating a new product 'Laptop ACER', which is purchased at Asustek, in MTO,
with the generation of purchase requisitions.
-
!record {model: product.product, id: product_product_laptopacer1}:
categ_id: product.product_category_3
cost_method: standard
list_price: 1000.0
mes_type: fixed
name: Laptop ACER1
procure_method: make_to_order
purchase_requisition: 1
seller_ids:
- delay: 1
name: base.res_partner_asus
qty: 5.0
supply_method: buy
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
Then I sell 5 Laptop ACER to the customer Agrolait, sale order TEST/TENDER/0002
-
!record {model: sale.order, id: sale_order_testtender1}:
date_order: '2010-04-20'
invoice_quantity: order
name: TEST/TENDER/0002
order_line:
- name: Laptop ACER1
price_unit: 1000.0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
state: draft
'delay': 7.0
'product_id': product_product_laptopacer1
'type': make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm sale order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_testtender1}
-
I launch he scheduler to compute all procurements, and planify all requisitions orders.
-
!python {model: mrp.procurement.compute.all}: |
proc_obj = self.pool.get('mrp.procurement')
proc_obj._procure_confirm(cr,uid)
-
I should find a purchase requisition with the origin 'TEST/TENDER/0002', that includes a request for
5 Laptop ACER, and a purchase order on the default supplier for this product.
-
!python {model: purchase.requisition}: |
requisition_ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
ids=len(requisition_ids)
assert len(requisition_ids), "Purchase requisition hasn't Created"
-
On the purchase tender, I create a new purchase order for the supplier 'DistriPC' by clicking on
the button 'New Request for Quotation'. This opens a window to ask me the supplier and I set DistriPC .
-
I Create purchase.requisition.partner .
-
!record {model: purchase.requisition.partner, id: purchase_requisition_partner_0}:
partner_address_id: base.res_partner_address_7
partner_id: base.res_partner_4
-
I create a new purchase order for the supplier 'DistriPC'.
-
!python {model: purchase.requisition.partner}: |
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
self.create_order(cr, uid, [ref("purchase_requisition_partner_0")], {"lang":
'en_US', "active_model": "purchase.requisition", "tz": False, "record_id":
1, "active_ids": ids, "active_id": ids[0], })
-
I set the purchase tender as 'Exclusive'
-
!python {model: purchase.requisition}: |
ids =self.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
self.write(cr,uid,ids[0],{'exclusive': 'exclusive' })
-
I confirm and validate the Request for Quotation of ASUStek.
-
!python {model: purchase.order}: |
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','ASUStek')])[0]
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0]
import netsvc
wf_service = netsvc.LocalService("workflow")
if purchase_id:
wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_confirm', cr)
wf_service.trg_validate(uid, 'purchase.order',purchase_id,'purchase_approve', cr)
-
I check that Request for Quotation of DistriPC is cancelled.
-
!python {model: purchase.order}: |
partner_id=self.pool.get('res.partner').search(cr,uid,[('name','=','Distrib PC')])[0]
req_obj = self.pool.get('purchase.requisition')
ids =req_obj.search(cr, uid, [('origin','=','TEST/TENDER/0002')])
purchase_id= self.search(cr, uid, [('partner_id','=',partner_id),('requisition_id','in',ids)])[0]
state=self.browse(cr,uid,purchase_id).state
assert (state=='cancel')
@@ -111,11 +111,11 @@ class purchase_requisition_partner(osv.osv_memory):
})
list_line.append(purchase_order_line)
purchase_id = order_obj.create(cr, uid, {
'origin': tender.name,
'origin': tender.purchase_ids and tender.purchase_ids[0].origin or tender.name,
'partner_id': partner_id,
'partner_address_id': address_id,
'pricelist_id': pricelist_id,
'location_id': line.product_id.product_tmpl_id.property_stock_production.id,
'location_id': tender.purchase_ids and tender.purchase_ids[0].location_id.id or line.product_id.product_tmpl_id.property_stock_production.id,
'company_id': tender.company_id.id,
'fiscal_position': partner.property_account_position and partner.property_account_position.id or False,
'requisition_id':tender.id,
@@ -9,6 +9,7 @@
<form string="Purchase Requisition">
<field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_address_id"/>
<separator string="" colspan="4" />
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="_Cancel"/>
<button icon="gtk-ok" name="create_order" string="Create Orders" type="object"/>
+7
View File
@@ -47,6 +47,7 @@
'update_xml': [
'wizard/sale_make_invoice_advance.xml',
'wizard/sale_line_invoice.xml',
'wizard/sale_make_invoice.xml',
'security/sale_security.xml',
'security/ir.model.access.csv',
'company_view.xml',
@@ -60,6 +61,12 @@
# 'process/sale_process.xml',
],
'demo_xml': ['sale_demo.xml'],
'test': [
'test/shipping_manual_sale_order.yml',
'test/prepaid_sale_order.yml',
'test/advance_invoice.yml',
'test/sale_procurement.yml',
],
'installable': True,
'active': False,
'certificate': '0058103601429',
+19 -19
View File
@@ -97,16 +97,16 @@
<field name="arch" type="xml">
<form string="Sales order">
<group col="6" colspan="4">
<field name="name" select="1"/>
<field name="name"/>
<field name="client_order_ref"/>
<field name="shipped"/>
<field name="date_order" select="1"/>
<field name="date_order"/>
<field name="shop_id" on_change="onchange_shop_id(shop_id)" widget="selection" groups="base.group_extended"/>
<field name="invoiced"/>
</group>
<notebook colspan="4">
<page string="Sale Order">
<field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1" select="1"/>
<field name="partner_id" on_change="onchange_partner_id(partner_id)" required="1"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_order_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_invoice_id"/>
<field domain="[('partner_id','=',partner_id)]" name="partner_shipping_id"/>
@@ -123,12 +123,12 @@
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
name="product_id"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], True, parent.date_order, product_packaging, parent.fiscal_position)"
select="1"/>
/>
<field
context="partner_id=parent.partner_id,quantity=product_uom_qty,pricelist=parent.pricelist_id,shop=parent.shop_id,uom=product_uom"
name="product_uom_qty"
on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position, True)"
select="1"/>
/>
<field name="product_uom"
on_change="product_uom_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order)"
widget="selection"/>
@@ -365,11 +365,11 @@
<notebook>
<page string="Order Lines">
<separator colspan="4" string="General Information"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" readonly="1" select="1" invisible="1"/>
<field name="order_id"/>
<field name="order_partner_id" readonly="1" invisible="1"/>
<field name="product_uom_qty" readonly="1"/>
<field name="product_uom"/>
<field name="product_id" readonly="1" select="1"/>
<field name="product_id" readonly="1"/>
<field name="invoiced"/>
<field name="company_id" groups="base.group_multi_company" widget="selection"/>
<separator colspan="4" string="Manual Designation"/>
@@ -416,16 +416,16 @@
<search string="Search Sales Order">
<filter icon="terp-purchase" string="To Invoice" domain="[('invoiced','&lt;&gt;', 1),('state','=','done')]" separator="1"/>
<separator orientation="vertical"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" select="1"/>
<field name="product_id" select="1"/>
<field name="salesman_id" select="1" widget="selection">
<field name="order_id"/>
<field name="order_partner_id"/>
<field name="product_id"/>
<field name="salesman_id" widget="selection">
<filter icon="terp-sale" domain="[('salesman_id','=',uid)]" help="My Sale Order Lines"/>
<filter icon="terp-sale" domain="[('salesman_id','child_of',[uid])]" help="My Departments Sale Order Lines"/>
</field>
<newline/>
<group expand="context.get('report',False)" string="Group By..." colspan="9" col="8">
<filter string="Product" icon="terp-sale" default="1" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Product" icon="terp-sale" domain="[]" context="{'group_by':'product_id'}"/>
<filter string="Order" icon="terp-sale" domain="[]" context="{'group_by':'order_id'}"/>
<filter string="Salesman" icon="terp-sale" domain="[]" context="{'group_by':'salesman_id'}"/>
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
@@ -444,14 +444,14 @@
domain="[('state','=','done')]"
name="unshipped"
separator="1" />
<filter icon="terp-purchase" string="Uninvoiced"
domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]" default="1"
<filter icon="terp-purchase" string="Uninvoiced" name="uninvoiced"
domain="[('invoiced','&lt;&gt;', 1),('state','&lt;&gt;','draft'),('state','&lt;&gt;','cancel')]"
separator="1" />
<separator orientation="vertical"/>
<field name="order_id" select="1"/>
<field name="order_partner_id" select="1"/>
<field name="product_id" select="1"/>
<field name="state" select="1"/>
<field name="order_id"/>
<field name="order_partner_id"/>
<field name="product_id"/>
<field name="state"/>
<newline />
<group expand="1" string="Group By..." colspan="9" col="8">
<filter string="Product" icon="terp-sale" domain="[]" context="{'group_by':'product_id'}"/>
+301
View File
@@ -0,0 +1,301 @@
-
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
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 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'
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
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 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
-
!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"), })
-
I will 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"
+379
View File
@@ -0,0 +1,379 @@
-
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
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 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_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."
+91
View File
@@ -0,0 +1,91 @@
-
In order to test the sale order working with procurements I will create some
products with different supply method and procurement method.
-
I create two products.
-
!record {model: product.product, id: product_product_table0}:
categ_id: product.cat1
name: Table
procure_method: make_to_order
supply_method: produce
type: product
uom_id: product.product_uom_unit
uom_po_id: product.product_uom_unit
-
!record {model: product.product, id: product_product_wood0}:
categ_id: product.cat1
name: Wood
procure_method: make_to_stock
supply_method: buy
type: product
uom_id: product.product_uom_kgm
uom_po_id: product.product_uom_kgm
-
I define Minimum stock rule for my stockable product wood
-
!record {model: stock.warehouse.orderpoint, id: stock_warehouse_orderpoint_op0}:
company_id: base.main_company
location_id: stock.stock_location_stock
logic: max
product_id: product_product_wood0
product_max_qty: 15.0
product_min_qty: 10.0
product_uom: product.product_uom_kgm
qty_multiple: 1
warehouse_id: stock.warehouse0
-
Now I make a sale order for table.
-
!record {model: sale.order, id: sale_order_so3}:
amount_total: 5.0
amount_untaxed: 5.0
date_order: '2010-04-30'
invoice_quantity: order
order_line:
- company_id: base.main_company
delay: 7.0
name: Table
price_unit: 1.0
product_id: product_product_table0
product_uom: product.product_uom_unit
product_uom_qty: 5.0
product_uos_qty: 5.0
state: draft
type: make_to_order
order_policy: manual
partner_id: base.res_partner_agrolait
partner_invoice_id: base.res_partner_address_8
partner_order_id: base.res_partner_address_8
partner_shipping_id: base.res_partner_address_8
picking_policy: direct
pricelist_id: product.list0
shop_id: sale.shop
-
I confirm the order.
-
!workflow {model: sale.order, action: order_confirm, ref: sale_order_so3}
-
I check that one procurement is generated.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','confirmed')])
assert proc_ids, _('No Procurements!')
-
The scheduler runs.
-
!function {model: mrp.procurement, name: run_scheduler}:
- model: mrp.procurement
search: "[('state','=','confirmed')]"
-
I check that the procurement for the product table is in exception state.
As my product's supply method is produce and mrp module is yet not installed.
-
!python {model: mrp.procurement}: |
from tools.translate import _
proc_ids = self.search(cr, uid, [('state','=','exception')])
assert proc_ids, _('No Procurements are in exception state!')
@@ -0,0 +1,384 @@
-
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
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 LG Viewty Smart product 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 LG Viewty Smart product.
-
!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."
+2 -1
View File
@@ -19,8 +19,9 @@
#
##############################################################################
#remaining make_invoice
import sale_make_invoice
import sale_line_invoice
import sale_make_invoice_advance
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-96
View File
@@ -1,96 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
import wizard
import netsvc
import pooler
invoice_form = """<?xml version="1.0"?>
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="grouped" />
<field name="invoice_date" />
</form>
"""
invoice_fields = {
'grouped' : {'string':'Group the invoices', 'type':'boolean', 'default': lambda x,y,z: False},
'invoice_date': {'string': 'Invoiced date', 'type':'date' }
}
ack_form = """<?xml version="1.0"?>
<form string="Create invoices">
<separator string="Invoices created" />
</form>"""
ack_fields = {}
def _makeInvoices(self, cr, uid, data, context):
pool_obj = pooler.get_pool(cr.dbname)
mod_obj = pool_obj.get('ir.model.data')
order_obj = pool_obj.get('sale.order')
newinv = []
order_obj.action_invoice_create(cr, uid, data['ids'], data['form']['grouped'], date_inv = data['form']['invoice_date'])
for id in data['ids']:
wf_service = netsvc.LocalService("workflow")
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
for o in order_obj.browse(cr, uid, data['ids'], context):
for i in o.invoice_ids:
newinv.append(i.id)
act_obj = pool_obj.get('ir.actions.act_window')
xml_id='action_invoice_tree5'
result = mod_obj._get_id(cr, uid, 'account', xml_id)
id = mod_obj.read(cr, uid, result, ['res_id'])['res_id']
result = act_obj.read(cr, uid, id)
result['domain'] ="[('id','in', ["+','.join(map(str,newinv))+"])]"
return result
#return {
# 'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
# 'name': 'Invoices',
# 'view_type': 'form',
# 'view_mode': 'tree,form',
# 'res_model': 'account.invoice',
# 'view_id': False,
# 'context': "{'type':'out_refund'}",
# 'type': 'ir.actions.act_window'
#}
#return {}
class make_invoice(wizard.interface):
states = {
'init' : {
'actions' : [],
'result' : {'type' : 'form',
'arch' : invoice_form,
'fields' : invoice_fields,
'state' : [('end', 'Cancel'),('invoice', 'Create invoices') ]}
},
'invoice' : {
'actions' : [_makeInvoices],
'result' : {'type': 'state', 'state': 'end'}
},
}
make_invoice("sale.order.make_invoice")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-7
View File
@@ -25,13 +25,6 @@ from tools.translate import _
class sale_order_line_make_invoice(osv.osv_memory):
_name = "sale.order.line.make.invoice"
_description = "Sale OrderLine Make_invoice"
_columns = {
'grouped': fields.boolean('Group the invoices'),
}
_default = {
'grouped' : lambda *a: False
}
def make_invoices(self, cr, uid, ids, context):
"""
To make invoices.
-2
View File
@@ -8,8 +8,6 @@
<field name="arch" type="xml">
<form string="Create invoices">
<separator colspan="4" string="Do you really want to create the invoices ?" />
<field name="grouped" />
<separator string="" colspan="6" />
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
<button name="make_invoices" string="Create Invoices" type="object" icon="gtk-ok"/>
</form>
+74
View File
@@ -0,0 +1,74 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from osv import fields, osv
from service import web_services
from tools.translate import _
import ir
import netsvc
class sale_make_invoice(osv.osv_memory):
_name = "sale.make.invoice"
_description = "Sale Make Invoice"
_columns = {
'grouped': fields.boolean('Group the invoices'),
'invoice_date':fields.date('Invoice Date'),
}
_default = {
'grouped' : lambda *a: False
}
def view_init(self, cr, uid, fields_list, context=None):
record_id = context and context.get('active_id', False)
order = self.pool.get('sale.order').browse(cr, uid, record_id)
if order.state=='draft':
raise osv.except_osv(_('Warning !'),'You can not create invoice when sale order is not confirmed.')
return False
def make_invoices(self, cr, uid, ids, context={}):
order_obj = self.pool.get('sale.order')
newinv = []
data=self.read(cr,uid,ids)[0]
order_obj.action_invoice_create(cr, uid, context.get(('active_ids'),[]), data['grouped'],date_inv = data['invoice_date'])
wf_service = netsvc.LocalService("workflow")
for id in context.get(('active_ids'),[]):
wf_service.trg_validate(uid, 'sale.order', id, 'manual_invoice', cr)
for o in order_obj.browse(cr, uid, context.get(('active_ids'),[]), context):
for i in o.invoice_ids:
newinv.append(i.id)
mod_obj =self.pool.get('ir.model.data')
result = mod_obj._get_id(cr, uid, 'account', 'view_account_invoice_filter')
id = mod_obj.read(cr, uid, result, ['res_id'])
return {
'domain': "[('id','in', ["+','.join(map(str,newinv))+"])]",
'name': 'Invoices',
'view_type': 'form',
'view_mode': 'tree,form',
'res_model': 'account.invoice',
'view_id': False,
'context': "{'type':'out_refund'}",
'type': 'ir.actions.act_window',
'search_view_id': id['id']
}
sale_make_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

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