[MERGE]: Merged with lp:~openerp-dev/openobject-addons/trunk-dev-addons1
bzr revid: uco@tinyerp.co.in-20100429133428-x7a9z3s9ykvc8gs5
This commit is contained in:
commit
f8eb44bfd9
|
@ -238,7 +238,7 @@
|
|||
<tr>
|
||||
<td><para style="P8"><font color="white"> </font></para></td>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -191,7 +191,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]] </para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -195,7 +195,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -31,7 +31,6 @@ If you don't think you need any of these right now, you can easily install them
|
|||
<field name="report_designer"/>
|
||||
<separator string="Vertical Modules" colspan="4"/>
|
||||
<field name="profile_association"/>
|
||||
<field name="profile_training"/>
|
||||
<field name="profile_auction"/>
|
||||
<field name="profile_bookstore"/>
|
||||
</group>
|
||||
|
|
|
@ -78,10 +78,6 @@ class base_setup_installer(osv.osv_memory):
|
|||
help="Installs a preselected set of OpenERP "
|
||||
"applications which will help you manage your association "
|
||||
"more efficiently."),
|
||||
'profile_training':fields.boolean('Training Centers',
|
||||
help="Helps you manage your training sessions and "
|
||||
"centers, from the conception of a training project to the "
|
||||
"gathering of trainee feedback."),
|
||||
'profile_auction':fields.boolean('Auction Houses',
|
||||
help="Installs a preselected set of OpenERP "
|
||||
"applications selected to help you manage your auctions "
|
||||
|
|
|
@ -75,6 +75,7 @@ between mails and Open ERP.""",
|
|||
'wizard/crm_opportunity_to_phonecall_view.xml',
|
||||
'wizard/crm_partner_to_opportunity_view.xml',
|
||||
|
||||
'wizard/crm_forward_to_partner_view.xml',
|
||||
'wizard/crm_send_email_view.xml',
|
||||
'wizard/crm_email_add_cc_view.xml',
|
||||
'crm_view.xml',
|
||||
|
|
|
@ -34,15 +34,15 @@ AVAILABLE_STATES = [
|
|||
('open', 'Open'),
|
||||
('cancel', 'Cancelled'),
|
||||
('done', 'Closed'),
|
||||
('pending', 'Pending')
|
||||
('pending', 'Pending'),
|
||||
]
|
||||
|
||||
AVAILABLE_PRIORITIES = [
|
||||
('5', 'Lowest'),
|
||||
('4', 'Low'),
|
||||
('3', 'Normal'),
|
||||
('1', 'Highest'),
|
||||
('2', 'High'),
|
||||
('1', 'Highest')
|
||||
('3', 'Normal'),
|
||||
('4', 'Low'),
|
||||
('5', 'Lowest'),
|
||||
]
|
||||
|
||||
class crm_case_section(osv.osv):
|
||||
|
|
|
@ -174,15 +174,20 @@
|
|||
icon="gtk-undo" type="action" />
|
||||
</form>
|
||||
<tree string="Communication history">
|
||||
<field name="description"/>
|
||||
<field name="email_to"/>
|
||||
<field name="name" />
|
||||
<field name="date"/>
|
||||
<field name="email_from" />
|
||||
<field name="email_to"/>
|
||||
<field name="description"/>
|
||||
</tree>
|
||||
</field>
|
||||
<button colspan="4" string="Send New Email"
|
||||
<button colspan="2" string="Send New Email"
|
||||
name="%(action_crm_send_mail)d"
|
||||
context="{'mail':'new', 'model': 'crm.lead'}"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
<button colspan="2" string="Forward to Partner"
|
||||
name="%(crm_lead_forward_to_partner_act)d"
|
||||
icon="gtk-go-forward" type="action" />
|
||||
</page>
|
||||
|
||||
</notebook>
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
##############################################################################
|
||||
|
||||
import crm_send_email
|
||||
import crm_forward_to_partner
|
||||
import crm_email_add_cc
|
||||
|
||||
import crm_lead_to_partner
|
||||
|
|
|
@ -0,0 +1,160 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
|
||||
from tools.translate import _
|
||||
import tools
|
||||
|
||||
class crm_lead_forward_to_partner(osv.osv_memory):
|
||||
_name = 'crm.lead.forward.to.partner'
|
||||
|
||||
_columns = {
|
||||
'partner_id' : fields.many2one('res.partner', 'Partner'),
|
||||
'address_id' : fields.many2one('res.partner.address', 'Address'),
|
||||
'email_from' : fields.char('From', required=True, size=128),
|
||||
'email_to' : fields.char('To', required=True, size=128),
|
||||
'subject' : fields.char('Subject', required=True, size=128),
|
||||
'message' : fields.text('Message', required=True),
|
||||
}
|
||||
|
||||
def on_change_partner(self, cr, uid, ids, partner_id):
|
||||
return {
|
||||
'domain' : {
|
||||
'address_id' : partner_id and "[('partner_id', '=', partner_id)]" or "[]",
|
||||
}
|
||||
}
|
||||
|
||||
def on_change_address(self, cr, uid, ids, address_id):
|
||||
email = ''
|
||||
if address_id:
|
||||
email = self.pool.get('res.partner.address').browse(cr, uid, address_id).email
|
||||
|
||||
return {
|
||||
'value' : {
|
||||
'email_to' : email,
|
||||
}
|
||||
}
|
||||
|
||||
def action_cancel(self, cr, uid, ids, context=None):
|
||||
return {'type' : 'ir.actions.act_window_close'}
|
||||
|
||||
def action_forward(self, cr, uid, ids, context=None):
|
||||
"""
|
||||
Forward the lead to a partner
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
res_id = context.get('active_id', False)
|
||||
|
||||
if not res_id:
|
||||
return {}
|
||||
|
||||
this = self.browse(cr, uid, ids[0], context=context)
|
||||
|
||||
hist_obj = self.pool.get('crm.case.history')
|
||||
smtp_pool = self.pool.get('email.smtpclient')
|
||||
case_pool = self.pool.get('crm.lead')
|
||||
case = case_pool.browse(cr, uid, res_id, context=context)
|
||||
|
||||
emails = [this.email_to]
|
||||
body = case_pool.format_body(this.message)
|
||||
email_from = this.email_from or False
|
||||
case_pool._history(cr, uid, [case], _('Forward'), history=True, email=this.email_to, details=body, email_from=email_from)
|
||||
|
||||
flag = False
|
||||
if case.section_id and case.section_id.server_id:
|
||||
flag = smtp_pool.send_email(
|
||||
cr=cr,
|
||||
uid=uid,
|
||||
server_id=case.section_id.server_id.id,
|
||||
emailto=emails,
|
||||
subject=this.subject,
|
||||
body="<pre>%s</pre>" % body,
|
||||
)
|
||||
else:
|
||||
flag = tools.email_send(
|
||||
email_from,
|
||||
emails,
|
||||
this.subject,
|
||||
body,
|
||||
)
|
||||
|
||||
return {}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
This function gets default values
|
||||
"""
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
active_ids = context.get('active_ids')
|
||||
if not active_ids:
|
||||
return {}
|
||||
|
||||
lead_proxy = self.pool.get('crm.lead')
|
||||
|
||||
lead = lead_proxy.browse(cr, uid, active_ids[0], context=context)
|
||||
|
||||
field_names = [
|
||||
'partner_name', 'title', 'function_name', 'street', 'street2',
|
||||
'zip', 'city', 'country_id', 'state_id', 'email_from',
|
||||
'phone', 'fax', 'mobile'
|
||||
]
|
||||
|
||||
message = []
|
||||
|
||||
for field_name in field_names:
|
||||
field_definition = lead_proxy._columns[field_name]
|
||||
value = None
|
||||
|
||||
if field_definition._type == 'selection':
|
||||
if hasattr(field_definition.selection, '__call__'):
|
||||
key = field_definition.selection(lead_proxy, cr, uid, context=context)
|
||||
else:
|
||||
key = field.definition.selection
|
||||
value = dict(key).get(lead[field_name], lead[field_name])
|
||||
elif field_definition._type == 'many2one':
|
||||
if lead[field_name]:
|
||||
value = lead[field_name].name_get()[0][1]
|
||||
else:
|
||||
value = lead[field_name]
|
||||
|
||||
message.append("%s: %s" % (field_definition.string, value or ''))
|
||||
|
||||
user = self.pool.get('res.users').browse(cr, uid, uid, context=context)
|
||||
email_from = ''
|
||||
if user.address_id and user.address_id.email:
|
||||
email_from = "%s <%s>" % (user.name, user.address_id.email)
|
||||
|
||||
res = {
|
||||
'email_from' : email_from,
|
||||
'subject' : '[Lead-Forward:%06d] %s' % (lead.id, lead.name),
|
||||
'message' : "\n".join(message + ['---']),
|
||||
}
|
||||
|
||||
return res
|
||||
|
||||
crm_lead_forward_to_partner()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record model="ir.ui.view" id="crm_lead_forward_to_partner_form">
|
||||
<field name="name">crm_lead_forward_to_partner</field>
|
||||
<field name="model">crm.lead.forward.to.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Forward to Partner">
|
||||
<separator string="User" colspan="4" />
|
||||
<field name="email_from" colspan="4" />
|
||||
|
||||
<separator string="Destination" colspan="4" />
|
||||
<field name="partner_id" on_change="on_change_partner(partner_id)" colspan="4" />
|
||||
<field name="address_id" string="Contact" on_change="on_change_address(address_id)" colspan="4" />
|
||||
<field name="email_to" colspan="4" />
|
||||
|
||||
<separator string="Email" colspan="4" />
|
||||
<field name="subject" colspan="4" />
|
||||
<field name="message" colspan="4" />
|
||||
<separator string="" colspan="4" />
|
||||
<group colspan="4" col="2">
|
||||
<button name="action_cancel" special="cancel" string="Cancel" icon="gtk-cancel" type="object" />
|
||||
<button name="action_forward" string="Forward" icon="gtk-go-forward" type="object" />
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="crm_lead_forward_to_partner_act">
|
||||
<field name="name">Forward to Partner</field>
|
||||
<field name="res_model">crm.lead.forward.to.partner</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
|
@ -76,7 +76,8 @@ class crm_send_new_email(osv.osv_memory):
|
|||
|
||||
case = case_pool.browse(cr, uid, res_id)
|
||||
if context.get('mail', 'new') == 'new':
|
||||
message_id = case.history_line[0].message_id
|
||||
if len(case.history_line):
|
||||
message_id = case.history_line[0].message_id
|
||||
else:
|
||||
hist = hist_obj.browse(cr, uid, res_id)
|
||||
message_id = hist.message_id
|
||||
|
@ -92,9 +93,11 @@ class crm_send_new_email(osv.osv_memory):
|
|||
case_pool._history(cr, uid, [case], _('Send'), history=True, email=data['email_to'], details=body, email_from=email_from, message_id=message_id)
|
||||
|
||||
x_headers = {
|
||||
'References':"%s" % (message_id),
|
||||
'Reply-To':"%s" % case.section_id.reply_to,
|
||||
}
|
||||
if message_id:
|
||||
x_headers['References'] = "%s" % (message_id)
|
||||
|
||||
flag = False
|
||||
if case.section_id and case.section_id.server_id:
|
||||
flag = smtp_pool.send_email(
|
||||
|
@ -159,13 +162,15 @@ class crm_send_new_email(osv.osv_memory):
|
|||
if 'email_from' in fields:
|
||||
res.update({'email_from': (case.section_id and case.section_id.reply_to) or \
|
||||
(case.user_id and case.user_id.address_id and \
|
||||
case.user_id.address_id.email) or tools.config.get('email_from',False)})
|
||||
case.user_id.address_id.email and \
|
||||
"%s <%s>" % (case.user_id.name, case.user_id.address_id.email)) or \
|
||||
tools.config.get('email_from',False)})
|
||||
if 'subject' in fields:
|
||||
res.update({'subject': '[%s] %s' %(str(case.id), case.name or '')})
|
||||
if 'email_cc' in fields:
|
||||
res.update({'email_cc': case.email_cc or ''})
|
||||
if 'text' in fields:
|
||||
res.update({'text': '\n\n'+(case.user_id.signature or '') + '\n\n' + (case.description or '')})
|
||||
res.update({'text': '\n\n'+(case.user_id.signature or '')})
|
||||
if 'state' in fields:
|
||||
res.update({'state': 'pending'})
|
||||
return res
|
||||
|
|
|
@ -20,11 +20,11 @@
|
|||
</page>
|
||||
<page string="Attachments">
|
||||
<field name="doc1" filename="doc1_fname"/>
|
||||
<field name="doc1_fname"/>
|
||||
<field name="doc1_fname" invisible="1" />
|
||||
<field name="doc2" filename="doc2_fname" />
|
||||
<field name="doc2_fname"/>
|
||||
<field name="doc2_fname" invisible="1" />
|
||||
<field name="doc3" filename="doc3_fname" />
|
||||
<field name="doc3_fname"/>
|
||||
<field name="doc3_fname" invisible="1" />
|
||||
</page>
|
||||
</notebook>
|
||||
<group colspan="2" col="4" >
|
||||
|
|
|
@ -339,10 +339,6 @@ class email_server(osv.osv):
|
|||
|
||||
def fetch_mail(self, cr, uid, ids, context={}):
|
||||
|
||||
fp = os.popen('ping www.google.com -c 1 -w 5',"r")
|
||||
if not fp.read():
|
||||
logger.notifyChannel('imap', netsvc.LOG_WARNING, 'lost internet connection !')
|
||||
|
||||
for server in self.browse(cr, uid, ids, context):
|
||||
logger.notifyChannel('imap', netsvc.LOG_INFO, 'fetchmail start checking for new emails on %s' % (server.name))
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P10">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="P10">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="P10">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="P10">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="P10">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
@ -164,4 +164,4 @@
|
|||
<drawRightString x="195mm" y="15mm">[[mod10r('01'+str('%.2f' % o.amount_total).replace('.','').rjust(10,'0'))]]>[[ _get_ref(o) ]]+ [[o.partner_bank.bvr_number.split('-')[0]+(str(o.partner_bank.bvr_number.split('-')[1])).rjust(6,'0')+o.partner_bank.bvr_number.split('-')[2] ]]></drawRightString>
|
||||
</illustration>
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P18">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="P18">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="P18">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="P18">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="P18">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
@ -380,4 +380,4 @@
|
|||
</illustration>
|
||||
|
||||
</story>
|
||||
</document>
|
||||
</document>
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
# Spanish 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-11-26 05:29+0000\n"
|
||||
"PO-Revision-Date: 2010-04-28 19:27+0000\n"
|
||||
"Last-Translator: Shay <Unknown>\n"
|
||||
"Language-Team: Spanish <es@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-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,description:olap_sale.module_meta_information
|
||||
msgid ""
|
||||
"\n"
|
||||
" Sale module will load the data in olap tables\n"
|
||||
" "
|
||||
msgstr ""
|
||||
"\n"
|
||||
" El módulo de ventas cargará los datos en una tabla olap\n"
|
||||
" "
|
||||
|
||||
#. module: olap_sale
|
||||
#: model:ir.module.module,shortdesc:olap_sale.module_meta_information
|
||||
msgid "olap_sale"
|
||||
msgstr ""
|
|
@ -21,11 +21,13 @@
|
|||
##############################################################################
|
||||
|
||||
import pos
|
||||
import account_bank_statement
|
||||
import pos_account_bank_statement
|
||||
import stock
|
||||
import wizard
|
||||
import report
|
||||
import pos_account_bank_statement
|
||||
import account_bank_statement
|
||||
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -37,7 +37,6 @@ Main features :
|
|||
""",
|
||||
'author': 'Tiny',
|
||||
'depends': ['sale', 'delivery'],
|
||||
# 'depends': ['sale', 'purchase', 'account', 'account_tax_include','board','mrp','board_manufacturing','delivery','profile_manufacturing','account','multi_company'],
|
||||
'init_xml': [],
|
||||
|
||||
'update_xml': [
|
||||
|
@ -63,8 +62,9 @@ Main features :
|
|||
'wizard/pos_payment_report.xml',
|
||||
'wizard/pos_payment.xml',
|
||||
'wizard/pos_scan_product_view.xml',
|
||||
'wizard/pos_return_view.xml',
|
||||
'pos_report.xml',
|
||||
'pos_wizard.xml',
|
||||
# 'pos_wizard.xml',
|
||||
'pos_view.xml',
|
||||
'pos_sequence.xml',
|
||||
'posrule_data.xml',
|
||||
|
@ -73,7 +73,6 @@ Main features :
|
|||
'statement_view.xml',
|
||||
'statement_report.xml',
|
||||
'statement_data.xml',
|
||||
'statement_wizard.xml',
|
||||
],
|
||||
'demo_xml': ['pos_demo.xml','singer_statement_demo.xml','multi_company_stock_data.xml'],
|
||||
'installable': True,
|
||||
|
|
|
@ -2,11 +2,10 @@
|
|||
<openerp>
|
||||
<data noupdate="0">
|
||||
<record id="second_partner" model="res.partner">
|
||||
<field name="name">Tiny Editor</field>
|
||||
<field name="name">OpenERP Editor</field>
|
||||
</record>
|
||||
|
||||
<record id="second_company" model="res.company">
|
||||
<field name="name">Tiny Editor</field>
|
||||
<field name="name">OpenERP Editor</field>
|
||||
<field name="partner_id" ref="base.main_partner"/>
|
||||
<field name="parent_id" ref="base.main_company"/>
|
||||
<field name="rml_header1">Free Business Solutions</field>
|
||||
|
@ -15,24 +14,19 @@
|
|||
<field name="currency_id" ref="base.EUR"/>
|
||||
|
||||
</record>
|
||||
|
||||
<record id="ter_partner" model="res.partner">
|
||||
<field name="name">Tiny Integrator</field>
|
||||
<field name="name">OpenERP Integrator</field>
|
||||
</record>
|
||||
|
||||
<record id="ter_company" model="res.company">
|
||||
<field name="name">Tiny Integrator</field>
|
||||
<field name="name">OpenERP Integrator</field>
|
||||
<field name="partner_id" ref="base.main_partner"/>
|
||||
<field name="parent_id" ref="base.main_company"/>
|
||||
<field name="rml_header1">Free Business Solutions</field>
|
||||
<field name="rml_footer1">Web: http://tiny.be - Tel: (+32).81.81.37.00 - Bank: CPH 126-2013269-07</field>
|
||||
<field name="rml_footer2">IBAN: BE74 1262 0132 6907 - SWIFT: GKCCBEBB - VAT: BE0477.472.701</field>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
|
||||
</record>
|
||||
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
||||
|
|
|
@ -2,104 +2,6 @@
|
|||
<openerp>
|
||||
|
||||
<data>
|
||||
<!-- <record id="res_partner_tinyshop0" model="res.partner">
|
||||
<field eval="0" name="customer"/>
|
||||
<field eval="0" name="supplier"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Tiny Shop 1"""" name="name"/>
|
||||
</record>
|
||||
<record id="res_partner_address_fabien0" model="res.partner.address">
|
||||
<field eval=""""Fabien"""" name="name"/>
|
||||
<field eval=""""92000"""" name="zip"/>
|
||||
<field eval=""""M."""" name="title"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop0"/>
|
||||
<field name="country_id" ref="base.fr"/>
|
||||
<field eval=""""Avenue de Paris"""" name="street"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""default"""" name="type"/>
|
||||
</record>
|
||||
<record id="res_company_shop0" model="res.company">
|
||||
<field eval="5.0" name="security_lead"/>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field eval="1.0" name="po_lead"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop0"/>
|
||||
<field eval="1.0" name="manufacturing_lead"/>
|
||||
<field name="parent_id" ref="base.main_company"/>
|
||||
<field eval="80.0" name="schedule_range"/>
|
||||
<field eval=""""Shop 1"""" name="name"/>
|
||||
|
||||
</record>
|
||||
<record id="res_partner_tinyshop1" model="res.partner">
|
||||
<field eval="1" name="customer"/>
|
||||
<field eval="0" name="supplier"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Tiny Shop 2"""" name="name"/>
|
||||
</record>
|
||||
<record id="res_partner_address_eric0" model="res.partner.address">
|
||||
<field eval=""""Eric"""" name="name"/>
|
||||
<field eval=""""1500"""" name="zip"/>
|
||||
<field eval=""""M."""" name="title"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop1"/>
|
||||
<field name="country_id" ref="base.fr"/>
|
||||
<field eval=""""Avenue de la Resistance"""" name="street"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""default"""" name="type"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop1"/>
|
||||
<field eval="1" name="active"/>
|
||||
</record>
|
||||
<record id="res_company_tinyshop0" model="res.company">
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field eval="1.0" name="po_lead"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop1"/>
|
||||
<field eval="1.0" name="manufacturing_lead"/>
|
||||
<field name="parent_id" ref="base.main_company"/>
|
||||
<field eval="80.0" name="schedule_range"/>
|
||||
<field eval=""""Shop 2"""" name="name"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="res_users_shopuser0" model="res.users">
|
||||
<field model="ir.actions.actions" name="menu_id" search="[('name','=','Menu')]"/>
|
||||
<field eval="[(6,0,[ref('base.group_partner_manager')])]" name="groups_id"/>
|
||||
<field model="res.partner.address" name="address_id" search="[('name','=','Fabien')]"/>
|
||||
<field eval="[(6,0,[ref('purchase.res_roles_purchase0'),ref('sale.res_roles_salesman0')])]" name="roles_id"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""shop1"""" name="password"/>
|
||||
<field eval=""""en_US"""" name="context_lang"/>
|
||||
<field eval=""""Shop 1 User"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
<field eval=""""shop1"""" name="login"/>
|
||||
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
|
||||
</record>
|
||||
<record id="res_users_shopuser1" model="res.users">
|
||||
<field model="ir.actions.actions" name="menu_id" search="[('name','=','Menu')]"/>
|
||||
<field eval="[(6,0,[ref('base.group_partner_manager')])]" name="groups_id"/>
|
||||
<field model="res.partner.address" name="address_id" search="[('name','=','Eric')]"/>
|
||||
<field eval=""""shop2"""" name="password"/>
|
||||
<field eval=""""Shop 2 User"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_tinyshop0"/>
|
||||
<field eval=""""shop2"""" name="login"/>
|
||||
<field model="ir.actions.actions" name="action_id" search="[('name','=','Menu')]"/>
|
||||
</record>
|
||||
|
||||
<record id="res_groups_posuserposline0" model="res.groups">
|
||||
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
|
||||
<field eval=""""POS_user_pos_line"""" name="name"/>
|
||||
</record>
|
||||
|
||||
<record id="res_groups_posuser0" model="res.groups">
|
||||
<field eval="[(6,0,[ref('res_users_shopuser0'),ref('res_users_shopuser1')])]" name="users"/>
|
||||
<field eval=""""POS_user"""" name="name"/>
|
||||
</record>-->
|
||||
|
||||
<record forcecreate="True" id="property_product_pricelist_multi" model="ir.property">
|
||||
<field name="name">property_product_pricelist</field>
|
||||
<field name="fields_id" search="[('model','=','res.partner'),('name','=','property_product_pricelist')]"/>
|
||||
<field eval="'product.pricelist,'+str(ref('product.list0'))" name="value"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record forcecreate="True" id="property_stock_account_output_prd_multi" model="ir.property">
|
||||
<field name="name">property_stock_account_output</field>
|
||||
<field name="fields_id" search="[('model','=','product.template'),('name','=','property_stock_account_output')]"/>
|
||||
|
|
|
@ -28,7 +28,7 @@ from tools.translate import _
|
|||
from decimal import Decimal
|
||||
import tools
|
||||
import re
|
||||
|
||||
import decimal_precision as dp
|
||||
|
||||
class pos_config_journal(osv.osv):
|
||||
|
||||
|
@ -43,40 +43,14 @@ class pos_config_journal(osv.osv):
|
|||
}
|
||||
|
||||
pos_config_journal()
|
||||
|
||||
class res_mode_contact(osv.osv):
|
||||
|
||||
""" Contact mode for Partner """
|
||||
|
||||
_name = "res.mode.contact"
|
||||
_description = "Contact mode"
|
||||
|
||||
_columns={
|
||||
'name': fields.char('Mode', size=64, select=1),
|
||||
'active': fields.boolean('Active', select=2),
|
||||
}
|
||||
res_mode_contact()
|
||||
|
||||
class contact_mode_partner(osv.osv):
|
||||
|
||||
|
||||
_inherit = 'res.partner'
|
||||
_columns = {
|
||||
'contact_mode_id': fields.many2one('res.mode.contact','Contact Mode'),
|
||||
}
|
||||
contact_mode_partner()
|
||||
|
||||
|
||||
class pos_company_discount(osv.osv):
|
||||
|
||||
""" Company Discount and Cashboxes """
|
||||
|
||||
_inherit = 'res.company'
|
||||
_columns = {
|
||||
'company_discount': fields.float('Max Discount(%)', digits=(16,2)),
|
||||
'max_diff': fields.float('Max Difference for Cashboxes', digits=(16,2)),
|
||||
'account_receivable': fields.many2one('account.account',
|
||||
'Default Receivable', states={'draft': [('readonly', False)]}),
|
||||
'company_discount': fields.float('Max Discount(%)', digits_compute= dp.get_precision('Point Of Sale')),
|
||||
'max_diff': fields.float('Max Difference for Cashboxes', digits_compute= dp.get_precision('Point Of Sale Discount')),
|
||||
}
|
||||
|
||||
pos_company_discount()
|
||||
|
@ -149,7 +123,7 @@ class pos_order(osv.osv):
|
|||
tot =0.0
|
||||
val=None
|
||||
for order in self.browse(cr, uid, ids):
|
||||
cr.execute("select date_payment2 from pos_order where id=%d"%(order.id))
|
||||
cr.execute("select date_payment from pos_order where id=%d"%(order.id))
|
||||
date_p=cr.fetchone()
|
||||
date_p=date_p and date_p[0] or None
|
||||
if date_p:
|
||||
|
@ -176,7 +150,7 @@ class pos_order(osv.osv):
|
|||
tot =0.0
|
||||
val=None
|
||||
for order in self.browse(cr, uid, ids):
|
||||
cr.execute("select date_payment from pos_order where id=%d"%(order.id))
|
||||
cr.execute("select date_validation from pos_order where id=%d"%(order.id))
|
||||
date_p=cr.fetchone()
|
||||
date_p=date_p and date_p[0] or None
|
||||
if date_p:
|
||||
|
@ -199,65 +173,35 @@ class pos_order(osv.osv):
|
|||
res[order.id]=val
|
||||
return res
|
||||
|
||||
def _amount_tax(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Taxes of order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
def _amount_all(self, cr, uid, ids, name, args, context=None):
|
||||
tax_obj = self.pool.get('account.tax')
|
||||
res={}
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = 0.0
|
||||
res[order.id] = {
|
||||
'amount_paid': 0.0,
|
||||
'amount_return':0.0,
|
||||
'amount_tax':0.0,
|
||||
}
|
||||
for payment in order.statement_ids:
|
||||
res[order.id]['amount_paid'] += payment.amount
|
||||
for payment in order.payments:
|
||||
res[order.id]['amount_return'] += (payment.amount < 0 and payment.amount or 0)
|
||||
for line in order.lines:
|
||||
if order.price_type!='tax_excluded':
|
||||
val = reduce(lambda x, y: x+round(y['amount'], 2),
|
||||
res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2),
|
||||
tax_obj.compute_inv(cr, uid, line.product_id.taxes_id,
|
||||
line.price_unit * \
|
||||
(1-(line.discount or 0.0)/100.0), line.qty),
|
||||
val)
|
||||
res[order.id]['amount_tax'])
|
||||
else:
|
||||
val = reduce(lambda x, y: x+round(y['amount'], 2),
|
||||
res[order.id]['amount_tax'] = reduce(lambda x, y: x+round(y['amount'], 2),
|
||||
tax_obj.compute(cr, uid, line.product_id.taxes_id,
|
||||
line.price_unit * \
|
||||
(1-(line.discount or 0.0)/100.0), line.qty),
|
||||
val)
|
||||
|
||||
res[order.id] = val
|
||||
res[order.id]['amount_tax'])
|
||||
return res
|
||||
|
||||
def _total_payment(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Total payment of order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
i=0
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = 0.0
|
||||
for payment in order.statement_ids:
|
||||
val += payment.amount
|
||||
res[order.id] = val
|
||||
return res
|
||||
return {order.id:val}
|
||||
|
||||
def _total_return(self, cr, uid, ids, field_name, arg, context):
|
||||
|
||||
""" Calculates Total Returned from the order
|
||||
@return: Dictionary of values """
|
||||
|
||||
res = {}
|
||||
for order in self.browse(cr, uid, ids):
|
||||
val = 0.0
|
||||
for payment in order.payments:
|
||||
val += (payment.amount < 0 and payment.amount or 0)
|
||||
res[order.id] = val
|
||||
return res
|
||||
|
||||
# def payment_get(self, cr, uid, ids, context=None):
|
||||
# """ Calculates Total Returned from the order
|
||||
# @return: Dictionary of values """
|
||||
# cr.execute("select id from pos_payment where order_id =ANY(%s)",(ids,))
|
||||
# return [i[0] for i in cr.fetchall()]
|
||||
|
||||
def _sale_journal_get(self, cr, uid, context):
|
||||
|
||||
|
@ -279,13 +223,10 @@ class pos_order(osv.osv):
|
|||
|
||||
company = self.pool.get('res.users').browse(cr, uid, uid, context).company_id
|
||||
res = self.pool.get('sale.shop').search(cr, uid, [])
|
||||
# res = self.pool.get('sale.shop').search(cr, uid, [('company_id', '=', company.id)])
|
||||
if res:
|
||||
return res[0]
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
def copy(self, cr, uid, id, default=None, context={}):
|
||||
|
||||
if not default:
|
||||
|
@ -342,16 +283,16 @@ class pos_order(osv.osv):
|
|||
'shop_id': fields.many2one('sale.shop', 'Shop', required=True,
|
||||
states={'draft': [('readonly', False)]}, readonly=True),
|
||||
'date_order': fields.datetime('Date Ordered', readonly=True),
|
||||
'date_payment': fields.function(_get_date_payment, method=True, string='Validation Date', type='date', store=True),
|
||||
'date_payment2': fields.function(_get_date_payment2, method=True, string='Payment Date', type='date', store=True),
|
||||
'date_validation': fields.function(_get_date_payment, method=True, string='Validation Date', type='date', store=True),
|
||||
'date_payment': fields.function(_get_date_payment2, method=True, string='Payment Date', type='date', store=True),
|
||||
'date_validity': fields.date('Validity Date', required=True),
|
||||
'user_id': fields.many2one('res.users', 'Connected Salesman', readonly=True),
|
||||
'user_id1': fields.many2one('res.users', 'Salesman', required=True),
|
||||
'user_id2': fields.many2one('res.users', 'Salesman Manager'),
|
||||
'amount_tax': fields.function(_amount_tax, method=True, string='Taxes'),
|
||||
'user_saleman': fields.many2one('res.users', 'Salesman', required=True),
|
||||
'sale_manager': fields.many2one('res.users', 'Salesman Manager'),
|
||||
'amount_tax': fields.function(_amount_all, method=True, string='Taxes',digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
|
||||
'amount_total': fields.function(_amount_total, method=True, string='Total'),
|
||||
'amount_paid': fields.function(_total_payment, 'Paid', states={'draft': [('readonly', False)]}, readonly=True, method=True),
|
||||
'amount_return': fields.function(_total_return, 'Returned', method=True),
|
||||
'amount_paid': fields.function(_amount_all, 'Paid', states={'draft': [('readonly', False)]}, readonly=True, method=True,digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
|
||||
'amount_return': fields.function(_amount_all, 'Returned', method=True,digits_compute=dp.get_precision('Point Of Sale'), multi='all'),
|
||||
'lines': fields.one2many('pos.order.line', 'order_id', 'Order Lines', states={'draft': [('readonly', False)]}, readonly=True),
|
||||
'price_type': fields.selection([
|
||||
('tax_excluded','Tax excluded')
|
||||
|
@ -371,19 +312,9 @@ class pos_order(osv.osv):
|
|||
'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),
|
||||
|
||||
# 'last_name': fields.char('Last Name', size=64),
|
||||
# 'street': fields.char('Street', size=64),
|
||||
# 'zip2': fields.char('Zip', size=64),
|
||||
# 'city': fields.char('City', size=64),
|
||||
# 'mobile': fields.char('Mobile', size=64),
|
||||
# 'email': fields.char('Email', size=64),
|
||||
'note': fields.text('Internal Notes'),
|
||||
'nb_print': fields.integer('Number of Print', readonly=True),
|
||||
'sale_journal': fields.many2one('account.journal', 'Journal', required=True, states={'draft': [('readonly', False)]}, readonly=True, ),
|
||||
# 'account_receivable': fields.many2one('account.account',
|
||||
# 'Default Receivable', required=True, states={'draft': [('readonly', False)]},
|
||||
# readonly=True, ),
|
||||
'invoice_wanted': fields.boolean('Create Invoice'),
|
||||
'note_2': fields.char('Customer Note',size=64),
|
||||
'type_rec': fields.char('Type of Receipt',size=64),
|
||||
|
@ -419,7 +350,7 @@ class pos_order(osv.osv):
|
|||
|
||||
_defaults = {
|
||||
'user_id': lambda self, cr, uid, context: uid,
|
||||
'user_id2': lambda self, cr, uid, context: uid,
|
||||
'sale_manager': lambda self, cr, uid, context: uid,
|
||||
'state': lambda *a: 'draft',
|
||||
'price_type': lambda *a: 'tax_excluded',
|
||||
'state_2': lambda *a: 'to_verify',
|
||||
|
@ -626,7 +557,7 @@ class pos_order(osv.osv):
|
|||
|
||||
def button_validate(self, cr, uid, ids, *args):
|
||||
|
||||
""" Check the access for the sale order and update the date_payment
|
||||
""" Check the access for the sale order and update the date_validation
|
||||
@return: True
|
||||
"""
|
||||
res_obj = self.pool.get('res.company')
|
||||
|
@ -637,12 +568,12 @@ class pos_order(osv.osv):
|
|||
if part_company:
|
||||
raise osv.except_osv(_('Error'), _('You don\'t have enough access to validate this sale!'))
|
||||
for order in self.browse(cr, uid, ids):
|
||||
if not order.date_payment:
|
||||
if not order.date_validation:
|
||||
cr.execute("select max(date) from account_bank_statement_line where pos_statement_id=%d"%(order.id))
|
||||
val=cr.fetchone()
|
||||
val=val and val[0] or None
|
||||
if val:
|
||||
cr.execute("Update pos_order set date_payment='%s' where id = %d"%(val, order.id))
|
||||
cr.execute("Update pos_order set date_validation='%s' where id = %d"%(val, order.id))
|
||||
return True
|
||||
|
||||
|
||||
|
@ -772,7 +703,7 @@ class pos_order(osv.osv):
|
|||
inv_ids = []
|
||||
|
||||
for order in self.browse(cr, uid, ids, context):
|
||||
curr_c = order.user_id1.company_id
|
||||
curr_c = order.user_saleman.company_id
|
||||
if order.invoice_id:
|
||||
inv_ids.append(order.invoice_id.id)
|
||||
continue
|
||||
|
@ -780,9 +711,7 @@ class pos_order(osv.osv):
|
|||
if not order.partner_id:
|
||||
raise osv.except_osv(_('Error'), _('Please provide a partner for the sale.'))
|
||||
|
||||
cr.execute('select a.id from account_account a, res_company p where p.account_receivable=a.id and p.id=%s', (curr_c.id, ))
|
||||
res=cr.fetchone()
|
||||
acc=res and res[0] or None
|
||||
acc= order.partner_id.property_account_receivable.id
|
||||
inv = {
|
||||
'name': 'Invoice from POS: '+order.name,
|
||||
'origin': order.name,
|
||||
|
@ -834,15 +763,17 @@ class pos_order(osv.osv):
|
|||
account_move_line_obj = self.pool.get('account.move.line')
|
||||
account_period_obj = self.pool.get('account.period')
|
||||
account_tax_obj = self.pool.get('account.tax')
|
||||
res_obj=self.pool.get('res.users')
|
||||
property_obj=self.pool.get('ir.property')
|
||||
period = account_period_obj.find(cr, uid, context=context)[0]
|
||||
|
||||
for order in self.browse(cr, uid, ids, context=context):
|
||||
curr_c = self.pool.get('res.users').browse(cr, uid, uid).company_id
|
||||
comp_id = self.pool.get('res.users').browse(cr, order.user_id.id, order.user_id.id).company_id
|
||||
curr_c =res_obj.browse(cr, uid, uid).company_id
|
||||
comp_id = res_obj.browse(cr, order.user_id.id, order.user_id.id).company_id
|
||||
comp_id=comp_id and comp_id.id or False
|
||||
to_reconcile = []
|
||||
group_tax = {}
|
||||
account_def = self.pool.get('ir.property').get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
|
||||
account_def = property_obj.get(cr, uid, 'property_account_receivable', 'res.partner', context=context)
|
||||
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
|
||||
|
@ -1028,9 +959,8 @@ class pos_order(osv.osv):
|
|||
'statement_id': False,
|
||||
'account_id':order_account
|
||||
})
|
||||
# account_move_obj.button_validate(cr, uid, [move_id, payment_move_id], context=context)
|
||||
|
||||
self.write(cr,uid,order.id,{'state':'done'})
|
||||
# account_move_line_obj.reconcile(cr, uid, to_reconcile, type='manual', context=context)
|
||||
return True
|
||||
|
||||
def cancel_picking(self, cr, uid, ids, context=None):
|
||||
|
@ -1042,6 +972,7 @@ class pos_order(osv.osv):
|
|||
|
||||
def action_payment(self, cr, uid, ids, context=None):
|
||||
vals = {'state': 'payment'}
|
||||
sequence_obj=self.pool.get('ir.sequence')
|
||||
for pos in self.browse(cr, uid, ids):
|
||||
create_contract_nb = False
|
||||
for line in pos.lines:
|
||||
|
@ -1049,8 +980,8 @@ class pos_order(osv.osv):
|
|||
create_contract_nb = True
|
||||
break
|
||||
if create_contract_nb:
|
||||
seq = self.pool.get('ir.sequence').get(cr, uid, 'pos.user_%s' % pos.user_id1.login)
|
||||
vals['contract_number'] ='%s-%s' % (pos.user_id1.login, seq)
|
||||
seq = sequence_obj.get(cr, uid, 'pos.user_%s' % pos.user_saleman.login)
|
||||
vals['contract_number'] ='%s-%s' % (pos.user_saleman.login, seq)
|
||||
self.write(cr, uid, ids, vals)
|
||||
|
||||
def action_paid(self, cr, uid, ids, context=None):
|
||||
|
@ -1071,7 +1002,6 @@ class pos_order(osv.osv):
|
|||
for order in self.browse(cr, uid, ids, context=context):
|
||||
if not order.journal_entry:
|
||||
self.create_account_move(cr, uid, ids, context={})
|
||||
#self.write(cr, uid, ids, {'state': 'done'})
|
||||
return True
|
||||
|
||||
def compute_state(self, cr, uid, id):
|
||||
|
@ -1145,7 +1075,6 @@ class pos_order_line(osv.osv):
|
|||
price = self.price_by_product(cr, uid, ids, line.order_id.pricelist_id.id, line.product_id.id, line.qty, line.order_id.partner_id.id)
|
||||
if line.discount!=0.0:
|
||||
res[line.id] = line.price_unit * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
# res[line.id] = price * line.qty * (1 - (line.discount or 0.0) / 100.0)
|
||||
else:
|
||||
res[line.id]=line.price_unit*line.qty
|
||||
return res
|
||||
|
@ -1181,7 +1110,7 @@ class pos_order_line(osv.osv):
|
|||
disc=0.0
|
||||
if (disc != 0.0 or prod_id) and price_f>0:
|
||||
disc=100-(price/price_f*100)
|
||||
return {'value':{'discount':disc, 'price_unit':price_f}}#,'notice':''}}#, 'price_subtotal':(price_f*qty*(1-disc))}}
|
||||
return {'value':{'discount':disc, 'price_unit':price_f}}
|
||||
return {}
|
||||
|
||||
def onchange_ded(self, cr, uid,ids, val_ded,price_u,*a):
|
||||
|
@ -1218,11 +1147,9 @@ class pos_order_line(osv.osv):
|
|||
'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||
'notice': fields.char('Discount Notice', size=128, required=True),
|
||||
'serial_number': fields.char('Serial Number', size=128),
|
||||
# 'contract_number': fields.char('Contract Number', size=512),
|
||||
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], required=True, change_default=True),
|
||||
# 'price_unit': fields.float('Unit Price'),
|
||||
'price_unit': fields.function(_get_amount, method=True, string='Unit Price', store=True),
|
||||
'price_ded': fields.float('Discount(Amount)'),
|
||||
'price_ded': fields.float('Discount(Amount)',digits_compute=dp.get_precision('Point Of Sale')),
|
||||
'qty': fields.float('Quantity'),
|
||||
'qty_rfd': fields.float('Refunded Quantity'),
|
||||
'price_subtotal': fields.function(_amount_line, method=True, string='Subtotal w/o Tax'),
|
||||
|
@ -1283,7 +1210,7 @@ class pos_order_line(osv.osv):
|
|||
}
|
||||
line_id = self.create(cr, uid, vals)
|
||||
if not line_id:
|
||||
raise wizard.except_wizard(_('Error'), _('Create line failed !'))
|
||||
raise osv.except_osv(_('Error'), _('Create line failed !'))
|
||||
else:
|
||||
vals = {
|
||||
'qty': qty,
|
||||
|
@ -1348,226 +1275,8 @@ class pos_payment(osv.osv):
|
|||
|
||||
pos_payment()
|
||||
|
||||
|
||||
class report_transaction_pos(osv.osv):
|
||||
_name = "report.transaction.pos"
|
||||
_description = "transaction for the pos"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_create': fields.char('Date', size=16, readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Sales Journal', readonly=True),
|
||||
'jl_id': fields.many2one('account.journal', 'Cash Journals', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'no_trans': fields.float('Number of Transaction', readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True),
|
||||
'invoice_id': fields.float('Nbr Invoice', readonly=True),
|
||||
'invoice_am': fields.float('Invoice Amount', readonly=True),
|
||||
'product_nb': fields.float('Product Nb.', readonly=True),
|
||||
'disc': fields.float('Disc.', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_transaction_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_transaction_pos as (
|
||||
select
|
||||
min(absl.id) as id,
|
||||
count(absl.id) as no_trans,
|
||||
sum(absl.amount) as amount,
|
||||
sum(line.price_ded) as disc,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
po.user_id as user_id,
|
||||
po.sale_journal as journal_id,
|
||||
abs.journal_id as jl_id,
|
||||
count(po.invoice_id) as invoice_id,
|
||||
count(p.id) as product_nb
|
||||
from
|
||||
account_bank_statement_line as absl,
|
||||
account_bank_statement as abs,
|
||||
product_product as p,
|
||||
pos_order_line as line,
|
||||
pos_order as po
|
||||
where
|
||||
absl.pos_statement_id = po.id and
|
||||
line.order_id=po.id and
|
||||
line.product_id=p.id and
|
||||
absl.statement_id=abs.id
|
||||
|
||||
group by
|
||||
po.user_id,po.sale_journal, abs.journal_id,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text
|
||||
)
|
||||
""")
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
report_transaction_pos()
|
||||
|
||||
class report_sales_by_user_pos(osv.osv):
|
||||
_name = "report.sales.by.user.pos"
|
||||
_description = "Sales by user"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos()
|
||||
|
||||
class report_sales_by_user_pos_month(osv.osv):
|
||||
_name = "report.sales.by.user.pos.month"
|
||||
_description = "Sales by user monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos_month as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos_month()
|
||||
|
||||
class report_sales_by_margin_pos(osv.osv):
|
||||
_name = "report.sales.by.margin.pos"
|
||||
_description = "Sales by margin"
|
||||
_auto = False
|
||||
_columns = {
|
||||
# 'pos_name': fields.char('POS Order', size=64, readonly=True),
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
# 'amount': fields.float('Total', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos()
|
||||
|
||||
class report_sales_by_margin_pos_month(osv.osv):
|
||||
_name = "report.sales.by.margin.pos.month"
|
||||
_description = "Sales by margin monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
# 'pos_name': fields.char('POS Order', size=64, readonly=True),
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
#'amount': fields.float('Total', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos_month as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos_month()
|
||||
|
||||
|
||||
class account_move_line(osv.osv):
|
||||
|
||||
_inherit = 'account.move.line'
|
||||
def create(self, cr, user, vals, context={}):
|
||||
pos_obj = self.pool.get('pos.order')
|
||||
|
@ -1587,7 +1296,9 @@ account_move_line()
|
|||
|
||||
|
||||
class account_move(osv.osv):
|
||||
|
||||
_inherit = 'account.move'
|
||||
|
||||
def create(self, cr, user, vals, context={}):
|
||||
pos_obj = self.pool.get('pos.order')
|
||||
val_name = vals.get('name', '')
|
||||
|
@ -1617,4 +1328,4 @@ class product_product(osv.osv):
|
|||
'disc_controle': lambda *a: True,
|
||||
}
|
||||
product_product()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -65,4 +65,3 @@ class account_bank_statement_line(osv.osv):
|
|||
account_bank_statement_line()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
<field name="list_price">0.0</field>
|
||||
<field name="standard_price">0.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<!-- <field name="company_id" ref="base.main_company"/> -->
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
</record>
|
||||
|
||||
|
@ -22,7 +21,6 @@
|
|||
<field name="list_price">100.0</field>
|
||||
<field name="standard_price">100.0</field>
|
||||
<field name="uom_id" ref="product.product_uom_unit"/>
|
||||
<!-- <field name="company_id" ref="multi_company_stock.res_company_tinyshop0"/> -->
|
||||
<field name="uom_po_id" ref="product.product_uom_unit"/>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -57,8 +57,8 @@
|
|||
<field name="shop_id" ref="sale.shop"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_5"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="user_id1" ref="base.user_root"/>
|
||||
<field name="user_saleman" ref="base.user_root"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/001"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_tinyshop0"/>
|
||||
<field eval="0" name="invoice_wanted"/>
|
||||
|
@ -93,8 +93,8 @@
|
|||
<field name="shop_id" ref="sale.shop"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="user_id" ref="res_users_sofia0"/>
|
||||
<field name="user_id1" ref="base.user_root"/>
|
||||
<field name="user_saleman" ref="res_users_sofia0"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/002"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
<field eval=""""tax_excluded"""" name="price_type"/>
|
||||
|
@ -135,8 +135,8 @@
|
|||
<field eval=""""2009-11-29"""" name="date_validity"/>
|
||||
<field eval=""""2009-05-29"""" name="date_order"/>
|
||||
<field name="partner_id" ref="base.res_partner_3"/>
|
||||
<field name="user_id" ref="res_users_sofia0"/>
|
||||
<field name="user_id1" ref="base.user_root"/>
|
||||
<field name="user_saleman" ref="res_users_sofia0"/>
|
||||
<field name="sale_manager" ref="base.user_root"/>
|
||||
<field eval=""""POS/0012"""" name="name"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
<field eval="0" name="invoice_wanted"/>
|
||||
|
@ -144,16 +144,6 @@
|
|||
<field name="pricelist_id" ref="product.list0"/>
|
||||
<field name="shop_id" ref="sale.shop"/>
|
||||
</record>
|
||||
|
||||
<!-- <record id="pos_order_line_orderlineadv" model="pos.order.line">
|
||||
<field eval="0.0" name="discount"/>
|
||||
<field name="product_id" ref="advance_product_pos"/>
|
||||
<field eval=""""Order Line/Advance"""" name="name"/>
|
||||
<field name="order_id" ref="pos_order_posadvance"/>
|
||||
<field eval="50.0" name="price_unit"/>
|
||||
<field name="company_id" ref="res_company_shop0"/>
|
||||
<field eval="-1.0" name="qty"/>
|
||||
</record-->
|
||||
<record id="data_fiscalyear" model="account.fiscalyear">
|
||||
<field eval="'Fiscal Year Shop '+time.strftime('%Y')" name="name"/>
|
||||
<field eval="'FY'+time.strftime('%Y')" name="code"/>
|
||||
|
@ -194,12 +184,6 @@ do black box testing on entries on this chart of account, without modifying
|
|||
your own chart of account.
|
||||
</field>
|
||||
</record>
|
||||
<!-- <record id="stock_location.product_pulled_flow_d1" model="product.pulled.flow">
|
||||
<field name="partner_addr_id" ref="multi_company_stock.res_partner_address_fabien0"/>
|
||||
</record>
|
||||
|
||||
<record id="stock_location.product_pulled_flow_d2" model="product.pulled.flow">
|
||||
<field name="partner_addr_id" ref="multi_company_stock.res_partner_address_eric0"/>
|
||||
</record-->
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -1,39 +1,6 @@
|
|||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!--report
|
||||
id="pos_receipt"
|
||||
string="Receipt"
|
||||
model="pos.order"
|
||||
name="pos.receipt"
|
||||
rml="point_of_sale/report/pos_receipt.rml"
|
||||
auto="False"
|
||||
header="False"
|
||||
multi="True"
|
||||
/-->
|
||||
|
||||
|
||||
<!--
|
||||
<report
|
||||
id="pos_receipt_with_remboursment"
|
||||
string="Refund Receipt"
|
||||
model="pos.order"
|
||||
name="pos.receipt.with.remboursment"
|
||||
rml="point_of_sale/report/pos_receipt_with_remboursment.rml"
|
||||
auto="False"
|
||||
header="False"
|
||||
multi="True"
|
||||
/>
|
||||
<report
|
||||
id="pos_receipt_without_remboursment"
|
||||
string="Voucher Receipt"
|
||||
model="pos.order"
|
||||
name="pos.receipt.without.remboursment"
|
||||
rml="point_of_sale/report/pos_receipt_without_remboursment.rml"
|
||||
auto="False"
|
||||
header="False"
|
||||
multi="True"
|
||||
/-->
|
||||
|
||||
<report
|
||||
id="pos_invoice_report"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<notebook >
|
||||
<page string="Order lines">
|
||||
<group colspan="4" col="6">
|
||||
<field name="user_id1" />
|
||||
<field name="user_saleman" />
|
||||
<field name="partner_id" on_change="onchange_partner_pricelist(partner_id)"/>
|
||||
<field name="contract_number" select="1" groups="base.group_extended"/>
|
||||
</group>
|
||||
|
@ -58,28 +58,14 @@
|
|||
states="paid, draft"
|
||||
attrs="{'invisible':[('state_2','=','accepted')]}"/>
|
||||
</group>
|
||||
|
||||
<separator colspan="4" string="Actions"/>
|
||||
<group colspan="4" col="6">
|
||||
|
||||
<field name="state" select="1"/>
|
||||
|
||||
<!--
|
||||
<button name="%(pos_add_product)d" string="_Add product" type="action" states="draft"/>
|
||||
-->
|
||||
|
||||
<button name="%(action_pos_payment)d" string="Ma_ke Payment" icon="gtk-ok" type="action" states="draft,advance" context="{'record_id':'active_id'}" />
|
||||
<button name="%(action_report_pos_receipt)d" string="_Reprint" icon="gtk-print" type="action" states="paid,done,invoiced"/>
|
||||
|
||||
|
||||
<!--
|
||||
<button name="action_cancel" string="Cancel" type="object" states="paid" />
|
||||
-->
|
||||
<button name="set_to_draft" string="Set to draft" states="paid" icon="gtk-execute" type="object" />
|
||||
|
||||
<button name="%(pos_return_picking)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
|
||||
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}"/>
|
||||
|
||||
<button name="%(action_view_pos_return)d" string="Return Picking" type="action" icon="gtk-ok" states="paid"
|
||||
attrs="{'invisible':[('state','!=','paid'),('state','!=','invoiced')]}" context="{'record_id':'active_id'}" />
|
||||
</group>
|
||||
</page>
|
||||
|
||||
|
@ -90,14 +76,14 @@
|
|||
<field name="shop_id" widget="selection" />
|
||||
<field name="name" select="1"/>
|
||||
<field name="user_id" />
|
||||
<field name="user_id2" />
|
||||
<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_payment" select="1" />
|
||||
<field name="date_payment2" select="1" groups="base.group_extended"/>
|
||||
<field name="date_validation" select="1" />
|
||||
<field name="date_payment" select="1" groups="base.group_extended"/>
|
||||
</group>
|
||||
<group colspan="4">
|
||||
<separator string="Invoicing" colspan="4"/>
|
||||
|
@ -122,7 +108,6 @@
|
|||
</form>
|
||||
</field>
|
||||
</page>
|
||||
|
||||
<page string="Notes" >
|
||||
<separator string="Notes" colspan="4" />
|
||||
<group colspan="4">
|
||||
|
@ -135,8 +120,6 @@
|
|||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_pos_form">
|
||||
<field name="name">Point of Sale</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
|
@ -145,8 +128,6 @@
|
|||
<field name="view_id" ref="view_pos_pos_form"/>
|
||||
<field name="domain">[['date_order','>=',time.strftime('%Y-%m-%d')]]</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_order_tree">
|
||||
<field name="name">Sales</field>
|
||||
<field name="model">pos.order</field>
|
||||
|
@ -155,8 +136,8 @@
|
|||
<tree string="POS Orders">
|
||||
<field name="name"/>
|
||||
<field name="date_order" select="1"/>
|
||||
<field name="date_validation"/>
|
||||
<field name="date_payment"/>
|
||||
<field name="date_payment2"/>
|
||||
<field name="user_id"/>
|
||||
<field name="invoice_id"/>
|
||||
<field name="state" select="1"/>
|
||||
|
@ -165,6 +146,32 @@
|
|||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
<record id="view_pos_order_filter" model="ir.ui.view">
|
||||
<field name="name">pos.order.list.select</field>
|
||||
<field name="model">pos.order</field>
|
||||
<field name="type">search</field>
|
||||
<field name="arch" type="xml">
|
||||
<search string="Search Sales Order">
|
||||
<filter icon="terp-sale" string="Quotations" domain="[('state','=','draft')]"/>
|
||||
<filter icon="terp-sale" string="Running" domain="[('state','in',('payment','advance'))]"/>
|
||||
<separator orientation="vertical"/>
|
||||
<field name="name" select="1"/>
|
||||
<field name="partner_id" select="1"/>
|
||||
<field name="user_id" select="1" widget="selection">
|
||||
<filter icon="terp-partner" string="My Sale" domain="[('user_id','=',uid)]" help="My Sale Orders" />
|
||||
</field>
|
||||
<field name="date_order" select="1" string="Order date" />
|
||||
<newline/>
|
||||
<group expand="1" string="Group By..." colspan="11" col="11">
|
||||
<filter string="Customer" icon="terp-sale" domain="[]" context="{'group_by':'partner_id'}"/>
|
||||
<filter string="State" icon="terp-sale" domain="[]" context="{'group_by':'state'}"/>
|
||||
<filter string="Order Date" icon="terp-sale" domain="[]" context="{'group_by':'date_order'}"/>
|
||||
<filter string="Salesman" icon="terp-sale" domain="[]" context="{'group_by':'user_id'}"/>
|
||||
</group>
|
||||
</search>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Point of Sale" id="menu_point_root" sequence="10"/>
|
||||
<menuitem name="Point of Sale" id="menu_point_of_sale" parent="menu_point_root" sequence="1" />
|
||||
<menuitem name="Sales Order" parent="menu_point_of_sale" id="menu_point_ofsale" action="action_pos_pos_form" sequence="1"/>
|
||||
|
@ -176,10 +183,12 @@
|
|||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="domain">['|',('state_2','=','to_verify'),('state','=','advance')]</field>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
|
||||
</record>
|
||||
invoiced
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_order_tobinvoiced">
|
||||
<field name="name">Sales to Invoice</field>
|
||||
|
@ -189,6 +198,8 @@ invoiced
|
|||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="domain">[('state','!=', 'invoiced')]</field>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
|
||||
</record>
|
||||
<menuitem name="Invoicing" id="menu_point_of_sale_invoicing" parent="menu_point_root" sequence="4" />
|
||||
<menuitem name="Sales to Invoice" action="action_pos_order_tobinvoiced" id="menu_point_of_sale_tobinvoiced" parent="menu_point_of_sale_invoicing"/>
|
||||
|
@ -198,8 +209,8 @@ invoiced
|
|||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="domain">[('state','=', 'paid')]</field>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
</record>
|
||||
<record model="ir.actions.act_window" id="action_pos_order_tree2">
|
||||
<field name="name">Point of Sale</field>
|
||||
|
@ -207,29 +218,25 @@ invoiced
|
|||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="domain">[('date_order','<=', time.strftime('%Y-%m-%d 23:59:59'))]</field>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
</record>
|
||||
|
||||
<!-- <menuitem name="Orders of the day" parent="menu_point_ofsale" id="menu_action_pos_order_tree2" action="action_pos_order_tree2"/-->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_order_tree3">
|
||||
<field name="name">Point of Sale</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree"/>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
</record>
|
||||
<!-- <menuitem name="All orders" parent="menu_point_ofsale" id="menu_action_pos_order_tree3" action="action_pos_order_tree3"/-->
|
||||
|
||||
<record model="ir.actions.act_window" id="action_pos_order_tree_open">
|
||||
<field name="name">Opened Sales</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">pos.order</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form,tree</field>
|
||||
<field name="view_id" ref="view_pos_pos_form"/>
|
||||
<field name="search_view_id" ref="view_pos_order_filter"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_order_line">
|
||||
|
@ -663,59 +670,11 @@ invoiced
|
|||
<page string="Other">
|
||||
<field name="company_discount" colspan="4"/>
|
||||
<field name="max_diff" colspan="4"/>
|
||||
<field name="account_receivable" required="1" colspan="4"/>
|
||||
</page>
|
||||
</notebook>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="form_mode_p_contact">
|
||||
<field name="name">Contact Mode</field>
|
||||
<field name="model">res.mode.contact</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Contact Mode">
|
||||
<field name="name" select="1"/>
|
||||
<field name="active"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.ui.view" id="tree_mode_p_contact">
|
||||
<field name="name">Contact Mode</field>
|
||||
<field name="model">res.mode.contact</field>
|
||||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Contact Mode">
|
||||
<field name="name"/>
|
||||
<field name="active"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record model="ir.actions.act_window" id="action_mode_p">
|
||||
<field name="name">Contact Mode</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">res.mode.contact</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Contact Mode" parent="base.menu_base_config" action="action_mode_p" id="menu_mode_po"/>
|
||||
|
||||
<record model="ir.ui.view" id="view_partner_contact">
|
||||
<field name="name">view.partner.contact</field>
|
||||
<field name="model">res.partner</field>
|
||||
<field name="type">form</field>
|
||||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="website" position="after">
|
||||
<field name="contact_mode_id"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="product_normal_form_view" model="ir.ui.view">
|
||||
<field name="name">product.normal.form.inherit</field>
|
||||
<field name="model">product.product</field>
|
||||
|
@ -748,7 +707,6 @@ invoiced
|
|||
<field name="default_code" select="1"/>
|
||||
<field groups="base.group_extended" name="ean13"/>
|
||||
</group>
|
||||
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Information">
|
||||
|
@ -829,13 +787,6 @@ invoiced
|
|||
parent="menu_point_config_product"
|
||||
action="action_product_output"
|
||||
id="products_for_output_operations"/>
|
||||
|
||||
<!-- <wizard
|
||||
string="Refloat Box entries"
|
||||
model="account.bank.statement"
|
||||
name="pos.entry"
|
||||
menu="False"
|
||||
id="pos_entries"/>-->
|
||||
|
||||
<menuitem name="Register Management" parent="menu_point_root"
|
||||
id="menu_point_config" sequence="3"/>
|
||||
|
@ -845,22 +796,12 @@ invoiced
|
|||
action="action_box_entries"
|
||||
id="menu_wizard_enter_jrnl" sequence="3" />
|
||||
|
||||
<!-- <wizard
|
||||
string="Enter negative operations"
|
||||
model="account.bank.statement"
|
||||
name="pos.out"
|
||||
menu="False"
|
||||
id="pos_entries2"/>-->
|
||||
<menuitem
|
||||
name="Output Operations" parent="menu_point_config"
|
||||
string="Refloat"
|
||||
action="action_box_out"
|
||||
id="menu_wizard_enter_jrnl2" sequence="3" />
|
||||
|
||||
<!-- <menuitem name="Sales Waiting Validation" parent="menu_point_config" id="menu_point_ofsale_date_payment"-->
|
||||
<!-- action="action_pos_pos_form_user" sequence="4"/>-->
|
||||
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_order_tree_all_sales">
|
||||
<field name="name">POS Sales</field>
|
||||
<field name="model">pos.order</field>
|
||||
|
@ -870,8 +811,8 @@ invoiced
|
|||
<field name="name"/>
|
||||
<field name="date_order" select="1"/>
|
||||
<field name="partner_id" />
|
||||
<field name="date_validation"/>
|
||||
<field name="date_payment"/>
|
||||
<field name="date_payment2"/>
|
||||
<field name="user_id"/>
|
||||
<field name="invoice_id"/>
|
||||
<field name="note" select="1" />
|
||||
|
@ -888,8 +829,6 @@ invoiced
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree_all_sales" />
|
||||
</record>
|
||||
<!-- <menuitem name="All Sales" parent="menu_point_of_sale" id="menu_pos_all_sales" action="action_pos_all_sales" sequence="5" />-->
|
||||
|
||||
<record model="ir.ui.view" id="view_pos_order_tree_all_sales_lines">
|
||||
<field name="name">POS Sales Lines</field>
|
||||
<field name="model">pos.order.line</field>
|
||||
|
@ -912,7 +851,6 @@ invoiced
|
|||
<field name="view_type">form</field>
|
||||
<field name="view_id" ref="view_pos_order_tree_all_sales_lines" />
|
||||
</record>
|
||||
<!-- <menuitem name="Toutes les lignes de ventes" parent="menu_point_root" id="menu_pos_all_sales_lines" action="action_pos_all_sales_lines" sequence="5" />-->
|
||||
|
||||
<!-- Miscelleanous Operations/Reporting -->
|
||||
<menuitem name="Reporting" parent="menu_point_root" id="menu_point_rep" sequence="5"/>
|
||||
|
@ -926,8 +864,6 @@ invoiced
|
|||
id="menu_action_sale_of_day_tree2" action="action_trans_pos_tree_today"/>
|
||||
<menuitem name="Accepted Sales" parent="menu_action_all_sales_tree3"
|
||||
id="menu_action_sale_of_day_accept" action="action_pos_order_accepted"/>
|
||||
<!-- <menuitem name="Open Sales" parent="menu_action_all_sales_tree3"
|
||||
id="menu_action_open_sales_treeop" action="action_pos_order_tree_open"/-->
|
||||
|
||||
<menuitem name="Sales Reports" parent="menu_point_report_sale" id="menu_sales_report" sequence="2"/>
|
||||
|
||||
|
@ -975,11 +911,6 @@ invoiced
|
|||
<menuitem name="Sales Lines of the day" parent="menu_action_pos_order_line"
|
||||
id="menu_action_pos_order_line_day" action="action_pos_order_line_day"/>
|
||||
|
||||
<!-- <menuitem name="Open Sales Line" parent="menu_action_pos_order_line"
|
||||
id="menu_action_open_sales_line" action="action_pos_order_line_form"/-->
|
||||
|
||||
<!-- <menuitem icon="STOCK_PRINT" action="wizard_pos_payment_report"
|
||||
id="menu_pos_payment_report" parent="menu_cashboxes_by_day" type="wizard" sequence="4"/-->
|
||||
|
||||
<menuitem icon="STOCK_PRINT" action="action_report_pos_sale_user"
|
||||
id="menu_pos_sales_user" parent="menu_trans_pos_tree" sequence="3" groups="base.group_extended" />
|
||||
|
|
|
@ -1,74 +1,3 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
id="pos_return_picking"
|
||||
model="pos.order"
|
||||
menu="False"
|
||||
name="pos.return.picking"
|
||||
string="Return Goods"/>
|
||||
|
||||
|
||||
|
||||
<!-- <wizard string="Box Entries" model="account.bank.statement"
|
||||
name="pos.entry" id="pos_entry" menu="False"/>-->
|
||||
|
||||
<!-- <wizard string="Payment" model="pos.order"
|
||||
name="pos.payment" id="pos_payment" menu="False"/>-->
|
||||
|
||||
<!--<wizard string="Create Invoices" model="pos.order"
|
||||
name="pos.create_invoice" id="pos_invoice" multi="True"/>-->
|
||||
|
||||
<wizard string="Add products" model="pos.order"
|
||||
name="pos.add_product" id="pos_add_product" menu="False"/>
|
||||
|
||||
<!--<wizard string="Cancel" model="pos.order"
|
||||
name="pos.cancel" id="pos_cancel" multi="True"/>-->
|
||||
|
||||
<!--
|
||||
<wizard string="Discount" model="pos.order"
|
||||
name="pos.discount" id="pos_discount" menu="False"/>-->
|
||||
|
||||
<!-- <wizard id="wizard_pos_payment_report" menu="False"
|
||||
model="pos.order" name="pos.payment.report" string="All paid lines for the current User"/-->
|
||||
<!--
|
||||
<wizard id="wizard_pos_sales_user" menu="False"
|
||||
model="pos.order" name="pos.sales.user" string="Sales Report"/>-->
|
||||
|
||||
<!--
|
||||
<wizard id="wizard_pos_payment_report_date" menu="False"
|
||||
model="pos.order" name="pos.payment.report.date" string="Sales lines Report"/>
|
||||
|
||||
<wizard id="wizard_pos_payment_report_user" menu="False"
|
||||
model="pos.order" name="pos.payment.report.user" string="Sales lines by Users"/>
|
||||
-->
|
||||
|
||||
<wizard id="wizard_pos_sales_user_today_current_user" menu="False"
|
||||
model="pos.order" name="pos.sales.user.today.current.user" string="Sales for Current User"/>
|
||||
|
||||
<!-- <wizard id="wizard_pos_details" menu="False"
|
||||
model="pos.order" name="pos.details" string="Sales Details"/>-->
|
||||
|
||||
<!-- <wizard string="Get From Order" model="pos.order"
|
||||
name="pos.sale.get" id="pos_sale_get"/>
|
||||
|
||||
<wizard string="Scan Product" model="pos.order"
|
||||
name="pos.scan_product" id="pos_scan_product"/-->
|
||||
<!-- <wizard
|
||||
id="close_statement"
|
||||
model="account.bank.statement"
|
||||
menu="True"
|
||||
name="statement.close"
|
||||
string="Close Statements"/>-->
|
||||
|
||||
|
||||
<wizard
|
||||
id="wizard_all_closed_cashbox_of_the_day"
|
||||
model="account.bank.statement"
|
||||
menu="False"
|
||||
name="all.closed.cashbox.of.the.day"
|
||||
string="All Cashboxes Of the day"/>
|
||||
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -66,7 +66,6 @@
|
|||
<field name="act_from" ref="act_paid"/>
|
||||
<field name="act_to" ref="act_done"/>
|
||||
<field name="signal">done</field>
|
||||
<!-- <field name="role_id" ref="role_pos"/-->
|
||||
</record>
|
||||
|
||||
<record model="workflow.transition" id="trans_paid_invoice">
|
||||
|
|
|
@ -1,61 +1,6 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<!-- <record id="res_partner_tinyshop0" model="res.partner">
|
||||
<field eval="0" name="customer"/>
|
||||
<field eval="0" name="supplier"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Tiny Shop 1"""" name="name"/>
|
||||
</record>
|
||||
<record id="res_partner_address_fabien0" model="res.partner.address">
|
||||
<field eval=""""Fabien"""" name="name"/>
|
||||
<field eval=""""92000"""" name="zip"/>
|
||||
<field eval=""""M."""" name="title"/>
|
||||
<field name="partner_id" ref="stock.res_partner_tinyshop0"/>
|
||||
<field name="country_id" ref="base.fr"/>
|
||||
<field eval=""""Avenue de Paris"""" name="street"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""default"""" name="type"/>
|
||||
</record>
|
||||
<record id="res_company_shop0" model="res.company">
|
||||
<field eval="5.0" name="security_lead"/>
|
||||
<field name="currency_id" ref="base.EUR"/>
|
||||
<field eval="1.0" name="po_lead"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop0"/>
|
||||
<field eval="1.0" name="manufacturing_lead"/>
|
||||
<field name="parent_id" ref="base.main_company"/>
|
||||
<field eval="80.0" name="schedule_range"/>
|
||||
<field eval=""""Shop 1"""" name="name"/>
|
||||
|
||||
</record>
|
||||
<record id="res_partner_tinyshop1" model="res.partner">
|
||||
<field eval="1" name="customer"/>
|
||||
<field eval="0" name="supplier"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""Tiny Shop 2"""" name="name"/>
|
||||
</record>
|
||||
<record id="res_partner_address_eric0" model="res.partner.address">
|
||||
<field eval=""""Eric"""" name="name"/>
|
||||
<field eval=""""1500"""" name="zip"/>
|
||||
<field eval=""""M."""" name="title"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop1"/>
|
||||
<field name="country_id" ref="base.fr"/>
|
||||
<field eval=""""Avenue de la Resistance"""" name="street"/>
|
||||
<field eval="1" name="active"/>
|
||||
<field eval=""""default"""" name="type"/>
|
||||
<field name="partner_id" ref="res_partner_tinyshop1"/>
|
||||
<field eval="1" name="active"/>
|
||||
</record>-->
|
||||
<!-- <record id="res_company_tinyshop0" model="res.company">-->
|
||||
<!-- <field name="currency_id" ref="base.EUR"/>-->
|
||||
<!-- <field eval="1.0" name="po_lead"/>-->
|
||||
<!-- <field name="partner_id" ref="res_partner_tinyshop1"/>-->
|
||||
<!-- <field eval="1.0" name="manufacturing_lead"/>-->
|
||||
<!-- <field name="parent_id" ref="base.main_company"/>-->
|
||||
<!-- <field eval="80.0" name="schedule_range"/>-->
|
||||
<!-- <field eval=""""Shop 2"""" name="name"/>-->
|
||||
<!-- </record>-->
|
||||
|
||||
|
||||
<record id="res_users_shopuser0" model="res.users">
|
||||
<field model="ir.actions.actions" name="menu_id" search="[('name','=','Menu')]"/>
|
||||
|
@ -575,11 +520,6 @@
|
|||
id="stock.next_id_61"
|
||||
name="Reporting"
|
||||
parent="stock.menu_stock_root" groups="base.group_user"/>
|
||||
<!-- <menuitem-->
|
||||
<!-- id="stock.next_id_62"-->
|
||||
<!-- name="Traceability"-->
|
||||
<!-- parent="stock.next_id_61" groups="base.group_user"/>-->
|
||||
<!-- <menuitem id="stock.menu_traceability_low" name="Low Level" parent="stock.menu_traceability" 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.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"/>
|
||||
|
|
|
@ -36,5 +36,6 @@ import pos_payment_report_user
|
|||
import pos_sales_user_today_current_user
|
||||
import pos_receipt_with_remboursment
|
||||
import pos_receipt_without_remboursment
|
||||
import point_of_sale_report
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,242 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
import time
|
||||
import netsvc
|
||||
import tools
|
||||
|
||||
class report_transaction_pos(osv.osv):
|
||||
_name = "report.transaction.pos"
|
||||
_description = "transaction for the pos"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_create': fields.char('Date', size=16, readonly=True),
|
||||
'journal_id': fields.many2one('account.journal', 'Sales Journal', readonly=True),
|
||||
'jl_id': fields.many2one('account.journal', 'Cash Journals', readonly=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True),
|
||||
'no_trans': fields.float('Number of Transaction', readonly=True),
|
||||
'amount': fields.float('Amount', readonly=True),
|
||||
'invoice_id': fields.float('Nbr Invoice', readonly=True),
|
||||
'invoice_am': fields.float('Invoice Amount', readonly=True),
|
||||
'product_nb': fields.float('Product Nb.', readonly=True),
|
||||
'disc': fields.float('Disc.', readonly=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_transaction_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_transaction_pos as (
|
||||
select
|
||||
min(absl.id) as id,
|
||||
count(absl.id) as no_trans,
|
||||
sum(absl.amount) as amount,
|
||||
sum(line.price_ded) as disc,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
po.user_id as user_id,
|
||||
po.sale_journal as journal_id,
|
||||
abs.journal_id as jl_id,
|
||||
count(po.invoice_id) as invoice_id,
|
||||
count(p.id) as product_nb
|
||||
from
|
||||
account_bank_statement_line as absl,
|
||||
account_bank_statement as abs,
|
||||
product_product as p,
|
||||
pos_order_line as line,
|
||||
pos_order as po
|
||||
where
|
||||
absl.pos_statement_id = po.id and
|
||||
line.order_id=po.id and
|
||||
line.product_id=p.id and
|
||||
absl.statement_id=abs.id
|
||||
|
||||
group by
|
||||
po.user_id,po.sale_journal, abs.journal_id,
|
||||
to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text
|
||||
)
|
||||
""")
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')
|
||||
#to_char(date_trunc('day',absl.create_date),'YYYY-MM-DD')::text as date_create,
|
||||
report_transaction_pos()
|
||||
|
||||
class report_sales_by_user_pos(osv.osv):
|
||||
_name = "report.sales.by.user.pos"
|
||||
_description = "Sales by user"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos()
|
||||
|
||||
class report_sales_by_user_pos_month(osv.osv):
|
||||
_name = "report.sales.by.user.pos.month"
|
||||
_description = "Sales by user monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'amount': fields.float('Total', readonly=True, select=True),
|
||||
'qty': fields.float('Quantity', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_user_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_user_pos_month as (
|
||||
select
|
||||
min(po.id) as id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
po.user_id as user_id,
|
||||
sum(pol.qty)as qty,
|
||||
sum((pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))) as amount
|
||||
from
|
||||
pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt
|
||||
where
|
||||
pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id
|
||||
group by
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text,
|
||||
po.user_id
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_user_pos_month()
|
||||
|
||||
class report_sales_by_margin_pos(osv.osv):
|
||||
_name = "report.sales.by.margin.pos"
|
||||
_description = "Sales by margin"
|
||||
_auto = False
|
||||
_columns = {
|
||||
# 'pos_name': fields.char('POS Order', size=64, readonly=True),
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
# 'amount': fields.float('Total', readonly=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos()
|
||||
|
||||
class report_sales_by_margin_pos_month(osv.osv):
|
||||
_name = "report.sales.by.margin.pos.month"
|
||||
_description = "Sales by margin monthly"
|
||||
_auto = False
|
||||
_columns = {
|
||||
|
||||
'product_name':fields.char('Product Name', size=64, readonly=True),
|
||||
'date_order': fields.date('Order Date',required=True, select=True),
|
||||
'user_id': fields.many2one('res.users', 'User', readonly=True, select=True),
|
||||
'qty': fields.float('Qty', readonly=True, select=True),
|
||||
'net_margin_per_qty':fields.float('Net margin per Qty', readonly=True, select=True),
|
||||
'total':fields.float('Margin', readonly=True, select=True),
|
||||
|
||||
}
|
||||
|
||||
def init(self, cr):
|
||||
tools.drop_view_if_exists(cr, 'report_sales_by_margin_pos_month')
|
||||
cr.execute("""
|
||||
create or replace view report_sales_by_margin_pos_month as (
|
||||
select
|
||||
min(pol.id) as id,
|
||||
po.user_id as user_id,
|
||||
pt.name as product_name,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text as date_order,
|
||||
sum(pol.qty) as qty,
|
||||
pt.list_price-pt.standard_price as net_margin_per_qty,
|
||||
(pt.list_price-pt.standard_price) *sum(pol.qty) as total
|
||||
from
|
||||
product_template as pt,
|
||||
product_product as pp,
|
||||
pos_order_line as pol,
|
||||
pos_order as po
|
||||
where
|
||||
pol.product_id = pp.product_tmpl_id and
|
||||
pp.product_tmpl_id = pt.id and
|
||||
po.id = pol.order_id
|
||||
|
||||
group by
|
||||
pt.name,
|
||||
pt.list_price,
|
||||
pt.standard_price,
|
||||
po.user_id,
|
||||
to_char(date_trunc('month',po.date_order),'YYYY-MM-DD')::text
|
||||
|
||||
)
|
||||
""")
|
||||
report_sales_by_margin_pos_month()
|
||||
|
|
@ -103,7 +103,7 @@
|
|||
<para style="terp_default_Centre_9">Tel : [[ address and address.phone ]]</para>
|
||||
<para style="terp_default_Centre_9">E-mail : [[ address and address.email ]]</para>
|
||||
<para style="terp_default_Centre_9">Shop : [[ o.shop_id.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Vendeur : [[ o.user_id1.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Vendeur : [[ o.user_saleman.name ]]</para>
|
||||
<para style="terp_default_Centre_9">Date : [[ formatLang(o.date_order,date = True) ]]</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard string="Pos payment" model="sale.order" name="sale.pos_payment" id="pos_payment" />
|
||||
</data>
|
||||
</openerp>
|
|
@ -13,7 +13,6 @@
|
|||
"access_sale_shop_pos_user","sale.shop pos_user","sale.model_sale_shop","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_pos_order_stock_worker","pos.order stock_worker","model_pos_order","stock.group_stock_user",1,0,0,0
|
||||
"access_stock_move_pos_user","stock.move pos_user","stock.model_stock_move","point_of_sale.group_pos_user",1,1,1,1
|
||||
"access_res_mode_contact","res.mode.contact","model_res_mode_contact","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_report_sales_by_user_pos","report.sales.by.user.pos","model_report_sales_by_user_pos","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_report_sales_by_user_pos_month","report.sales.by.user.pos.month","model_report_sales_by_user_pos_month","point_of_sale.group_pos_user",1,0,0,0
|
||||
"access_report_sales_by_margin_pos","report.sales.by.margin.pos","model_report_sales_by_margin_pos","point_of_sale.group_pos_user",1,0,0,0
|
||||
|
|
|
|
@ -316,17 +316,6 @@
|
|||
<field name="company_id" ref="base.main_company"/>
|
||||
</record>
|
||||
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="account_receivable" ref="account.a_recv"/>
|
||||
</record>
|
||||
<record id="point_of_sale.pos_order_posadvance" model="pos.order">
|
||||
<field name="sale_journal" ref="sales_journal_comp2"/>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="base.main_company" model="res.company">
|
||||
<field name="account_receivable" ref="account.a_recv"/>
|
||||
</record>
|
||||
<record id="point_of_sale.pos_order_posadvance" model="pos.order">
|
||||
<field name="sale_journal" ref="sales_journal_comp2"/>
|
||||
</record>
|
||||
|
|
|
@ -434,7 +434,11 @@
|
|||
string="Close Register"
|
||||
action="action_pos_close_statement"
|
||||
id="menu_close_statement" sequence="2" />
|
||||
|
||||
|
||||
<menuitem icon="STOCK_PRINT"
|
||||
action="action_report_all_closed_cashbox_of_the_day"
|
||||
id="menu_all_closed_cashbox_of_the_day"
|
||||
parent="menu_point_report_register"/>
|
||||
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -30,7 +30,6 @@ class stock_picking(osv.osv):
|
|||
_inherit = 'stock.picking'
|
||||
_columns = {
|
||||
'pos_order': fields.many2one('pos.order', 'Pos order'),
|
||||
# 'company_id':fields.many2one('res.company', 'Company', required=True),
|
||||
}
|
||||
stock_picking()
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import wizard_return
|
||||
|
||||
import pos_add_product
|
||||
import pos_confirm
|
||||
import pos_discount
|
||||
|
@ -39,6 +39,7 @@ import pos_payment_report_date
|
|||
import pos_payment_report
|
||||
import pos_payment
|
||||
import pos_scan_product
|
||||
import pos_return
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -61,7 +61,27 @@ class add_product(osv.osv_memory):
|
|||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
def close_action(self, cr, uid, ids, context):
|
||||
|
||||
record_id = context and context.get('record_id', False)
|
||||
order_obj= self.pool.get('pos.order')
|
||||
order_line_obj= self.pool.get('pos.order.line')
|
||||
obj=order_obj.browse(cr,uid, record_id)
|
||||
order_obj.write(cr,uid,[record_id],{'state':'done'})
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context ':context and context.get('record_id', False),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.make.payment',
|
||||
'view_id': False,
|
||||
'target': 'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
|
||||
}
|
||||
return {}
|
||||
add_product()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
<group col="2" colspan="4">
|
||||
<field name="product_id"/>
|
||||
<field name="quantity"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button icon='gtk-cancel' name="close_action"
|
||||
string="Close" type="object" />
|
||||
<button name="select_product" string="Contiue"
|
||||
colspan="1" type="object" icon="gtk-ok" />
|
||||
</group>
|
||||
|
|
|
@ -43,7 +43,7 @@ class pos_make_payment(osv.osv_memory):
|
|||
@return: A dictionary which of fields with values.
|
||||
"""
|
||||
res = super(pos_make_payment, self).default_get(cr, uid, fields, context=context)
|
||||
record_id = context and context.get('active_id',False)
|
||||
record_id = context and context.get('record_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)])
|
||||
|
@ -81,7 +81,7 @@ class pos_make_payment(osv.osv_memory):
|
|||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(pos_make_payment, self).view_init(cr, uid, fields_list, context=context)
|
||||
record_id = context and context.get('active_id', False) or False
|
||||
record_id = context and context.get('record_id', False) or False
|
||||
order = self.pool.get('pos.order').browse(cr, uid, record_id)
|
||||
if not order.lines:
|
||||
raise osv.except_osv('Error!','No order lines defined for this sale ')
|
||||
|
@ -103,8 +103,7 @@ class pos_make_payment(osv.osv_memory):
|
|||
res = super(pos_make_payment, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar,submenu=False)
|
||||
if record_id:
|
||||
order = self.pool.get('pos.order').browse(cr, uid, record_id)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
if amount==0.0:
|
||||
if order.amount_total == order.amount_paid:
|
||||
res['arch'] = """ <form string="Make Payment" colspan="4">
|
||||
<group col="2" colspan="2">
|
||||
<label string="Do you want to print the Receipt?" colspan="4"/>
|
||||
|
@ -122,13 +121,13 @@ class pos_make_payment(osv.osv_memory):
|
|||
if the order is not paid: continue payment,
|
||||
if the order is paid print invoice (if wanted) or ticket.
|
||||
"""
|
||||
record_id = context and context.get('active_id',False)
|
||||
record_id = context and context.get('record_id',False)
|
||||
order_obj = self.pool.get('pos.order')
|
||||
jrnl_obj = self.pool.get('account.journal')
|
||||
order = order_obj.browse(cr, uid, record_id, context)
|
||||
amount = order.amount_total - order.amount_paid
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
|
||||
# Todo need to check ...
|
||||
if amount !=0.0:
|
||||
invoice_wanted = data['invoice_wanted']
|
||||
|
@ -145,6 +144,7 @@ class pos_make_payment(osv.osv_memory):
|
|||
if order.partner_id and order.invoice_wanted:
|
||||
return self.create_invoice(cr,uid,ids,context)
|
||||
else:
|
||||
context.update({'flag': True})
|
||||
order_obj.action_paid(cr,uid,[record_id],context)
|
||||
order_obj.write(cr, uid, [record_id],{'state':'paid'})
|
||||
return self.print_report(cr, uid, ids, context)
|
||||
|
@ -159,10 +159,10 @@ class pos_make_payment(osv.osv_memory):
|
|||
|
||||
def create_invoice(self, cr, uid, ids, context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
record_ids = context and context.get('active_ids',False)
|
||||
record_ids = [context and context.get('record_id',False)]
|
||||
for i in record_ids:
|
||||
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
|
||||
datas = {'ids' : context.get('active_ids', [])}
|
||||
datas = {'ids' : context.get('record_id', [])}
|
||||
return {
|
||||
'type' : 'ir.actions.report.xml',
|
||||
'report_name':'pos.invoice',
|
||||
|
@ -180,7 +180,8 @@ class pos_make_payment(osv.osv_memory):
|
|||
@param context: A standard dictionary
|
||||
@return : retrun report
|
||||
"""
|
||||
datas = {'ids' : context.get('active_ids',[])}
|
||||
record_id=context.get('record_id',[])
|
||||
datas = {'ids' : [record_id]}
|
||||
res = {}
|
||||
datas['form'] = res
|
||||
|
||||
|
|
|
@ -0,0 +1,347 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import netsvc
|
||||
from osv import osv,fields
|
||||
from tools.translate import _
|
||||
from mx import DateTime
|
||||
import time
|
||||
import pos_box_entries
|
||||
import pos_add_product
|
||||
import pos_payment
|
||||
|
||||
class pos_return(osv.osv_memory):
|
||||
_name = 'pos.return'
|
||||
_description = 'Point of sale return'
|
||||
|
||||
_columns = {
|
||||
|
||||
}
|
||||
|
||||
def default_get(self, cr, uid, fields, context=None):
|
||||
"""
|
||||
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(pos_return, self).default_get(cr, uid, fields, context=context)
|
||||
order_obj=self.pool.get('pos.order')
|
||||
record_id=context.get('record_id')
|
||||
if not context:
|
||||
context={}
|
||||
for order in order_obj.browse(cr, uid,[record_id]):
|
||||
for line in order.lines:
|
||||
if 'return%s'%(line.id) in fields:
|
||||
res['return%s'%(line.id)] = line.qty
|
||||
return res
|
||||
|
||||
def view_init(self, cr, uid, fields_list, context=None):
|
||||
res = super(pos_return, self).view_init(cr, uid, fields_list, context=context)
|
||||
order_obj=self.pool.get('pos.order')
|
||||
if not context:
|
||||
context={}
|
||||
record_id=context.get('record_id')
|
||||
for order in order_obj.browse(cr, uid,[record_id]):
|
||||
for line in order.lines:
|
||||
if 'return%s'%(line.id) not in self._columns:
|
||||
self._columns['return%s'%(line.id)] = fields.float("Quantity")
|
||||
|
||||
return res
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False,submenu=False):
|
||||
result = super(pos_return, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar,submenu)
|
||||
if not context:
|
||||
context={}
|
||||
order_obj=self.pool.get('pos.order')
|
||||
record_id = context.get('record_id', False)
|
||||
if record_id:
|
||||
_moves_arch_lst="""<?xml version="1.0"?>
|
||||
<form string="Return lines">
|
||||
<label string="Quantities you enter, match to products that will return to the stock." colspan="4"/>"""
|
||||
_line_fields = result['fields']
|
||||
order=order_obj.browse(cr, uid, record_id)
|
||||
for line in order.lines:
|
||||
quantity=line.qty
|
||||
_line_fields.update({
|
||||
'return%s'%(line.id) : {
|
||||
'string': line.product_id.name,
|
||||
'type' : 'float',
|
||||
'required': True,
|
||||
'default':quantity
|
||||
},
|
||||
})
|
||||
_moves_arch_lst += """
|
||||
<field name="return%s"/>
|
||||
<newline/>
|
||||
"""%(line.id)
|
||||
|
||||
_moves_arch_lst+="""
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Cancel" />
|
||||
<button icon='gtk-ok' name= "create_returns"
|
||||
string="Return goods and Exchange" type="object"/>
|
||||
<button icon='gtk-ok' name="create_returns2"
|
||||
string="Return without Refund" type="object"/>
|
||||
</form>"""
|
||||
|
||||
result['arch'] = _moves_arch_lst
|
||||
result['fields'] = _line_fields
|
||||
return result
|
||||
|
||||
|
||||
def create_returns(self, cr, uid, data, context):
|
||||
return {
|
||||
'name': _('Add Product'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.add.product',
|
||||
'view_id': False,
|
||||
'target':'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
def create_returns2(self, cr, uid, ids, context):
|
||||
record_id = context.get('record_id', False)
|
||||
order_obj =self.pool.get('pos.order')
|
||||
line_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
uom_obj =self. pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
#Todo :Need to clean the code
|
||||
if record_id:
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
|
||||
data=self.read(cr,uid,ids)[0]
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prop_ids = property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.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':[]})
|
||||
for line in order_id.lines:
|
||||
if line.id and (data['return%s' %line.id]!=0.0):
|
||||
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),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'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],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
return act
|
||||
|
||||
pos_return()
|
||||
class add_product(osv.osv_memory):
|
||||
_inherit = 'pos.add.product'
|
||||
def select_product(self, cr, uid, ids, context):
|
||||
"""
|
||||
To get the product and quantity and add in order .
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : Retrun the add product form again for adding more product
|
||||
"""
|
||||
|
||||
if not context.get('record_id', False):
|
||||
super(add_product).select_product(cr,uid,ids)
|
||||
else:
|
||||
record_id=context.get('record_id', False)
|
||||
data = self.read(cr, uid, ids)[0]
|
||||
|
||||
order_obj = self.pool.get('pos.order')
|
||||
lines_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
invoice_obj= self.pool.get('account.invoice')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in',[record_id]), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
prod_obj=self.pool.get('product.product')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
return_boj=self.pool.get('pos.return')
|
||||
order_obj.add_product(cr, uid, record_id,data['product_id'],data['quantity'], context=context)
|
||||
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prod=data['product_id']
|
||||
qty=data['quantity']
|
||||
prop_ids = property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
prod_id=prod_obj.browse(cr,uid,prod)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (Added)' %order_id.name,
|
||||
'move_lines':[],
|
||||
'state':'draft',
|
||||
'type':'out',
|
||||
'date':date_cur, })
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': qty,
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,prod_id.uom_id.id, qty, prod_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':prod_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':prod_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
|
||||
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,record_id,{'last_out_picking':new_picking})
|
||||
|
||||
|
||||
return {
|
||||
'name': _('Add Product'),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.add.product',
|
||||
'view_id': False,
|
||||
'target':'new',
|
||||
'context':context,
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
|
||||
def close_action(self, cr, uid, ids, context):
|
||||
|
||||
record_id=context.get('record_id', False)
|
||||
order_obj = self.pool.get('pos.order')
|
||||
lines_obj = self.pool.get('pos.order.line')
|
||||
picking_obj = self.pool.get('stock.picking')
|
||||
stock_move_obj = self.pool.get('stock.move')
|
||||
move_obj = self.pool.get('stock.move')
|
||||
property_obj= self.pool.get("ir.property")
|
||||
invoice_obj=self.pool.get('account.invoice')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', [record_id]), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = self.pool.get('product.uom')
|
||||
return_boj=self.pool.get('pos.return')
|
||||
return_id=return_boj.search(cr,uid,[])
|
||||
data=return_boj.read(cr,uid,return_id,[])[0]
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, [record_id], context=context):
|
||||
prop_ids =property_obj.search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = property_obj.browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
order_obj.write(cr,uid,[order_id.id],{'type_rec':'Exchange'})
|
||||
if order_id.invoice_id:
|
||||
invoice_obj.refund(cr, uid, [order_id.invoice_id.id],time.strftime('%Y-%m-%d'), False, order_id.name)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'move_lines':[], 'state':'draft',
|
||||
'type':'in',
|
||||
'date':date_cur})
|
||||
for line in order_id.lines:
|
||||
key=('return%s') %line.id
|
||||
if line.id and data.has_key(key):
|
||||
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),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
lines_obj.write(cr,uid,[line.id],{'qty_rfd':(line.qty or 0.0) + data['return%s' %line.id],
|
||||
'qty':line.qty-(data['return%s' %line.id] or 0.0)
|
||||
})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
obj=order_obj.browse(cr,uid, record_id)
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return {
|
||||
'name': _('Make Payment'),
|
||||
'context ':context and context.get('record_id', False),
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form',
|
||||
'res_model': 'pos.make.payment',
|
||||
'view_id': False,
|
||||
'target': 'new',
|
||||
'views': False,
|
||||
'type': 'ir.actions.act_window',
|
||||
|
||||
}
|
||||
|
||||
add_product()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
<record id="action_view_pos_return" model="ir.actions.act_window">
|
||||
<field name="name">Return lines</field>
|
||||
<field name="res_model">pos.return</field>
|
||||
<field name="view_type">form</field>
|
||||
<field name="view_mode">form</field>
|
||||
<field name="target">new</field>
|
||||
</record>
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,550 +0,0 @@
|
|||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
|
||||
# $Id$
|
||||
#
|
||||
# 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 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import wizard
|
||||
import pooler
|
||||
from tools.misc import UpdateableStr
|
||||
|
||||
import netsvc
|
||||
import time
|
||||
|
||||
from tools.translate import _
|
||||
from decimal import Decimal
|
||||
|
||||
|
||||
arch=UpdateableStr()
|
||||
fields={}
|
||||
|
||||
|
||||
def _get_journal(self, cr, uid, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
obj = pool.get('account.journal')
|
||||
c=pool.get('res.users').browse(cr,uid,uid).company_id.id
|
||||
ids = obj.search(cr, uid, [('type', '=', 'cash'), ('company_id','=',c)])
|
||||
res = obj.read(cr, uid, ids, ['id', 'name'], context)
|
||||
res = [(r['id'], r['name']) for r in res]
|
||||
return res
|
||||
|
||||
|
||||
payment_form = """<?xml version="1.0"?>
|
||||
<form string="Add payment :">
|
||||
<field name="amount" />
|
||||
<field name="journal"/>
|
||||
<field name="payment_date" />
|
||||
<field name="payment_name" />
|
||||
<field name="invoice_wanted" />
|
||||
<field name="num_sale" />
|
||||
</form>
|
||||
"""
|
||||
|
||||
payment_fields = {
|
||||
'amount': {'string': 'Amount', 'type': 'float', 'required': True},
|
||||
'invoice_wanted': {'string': 'Invoice', 'type': 'boolean'},
|
||||
'journal': {'string': 'Journal',
|
||||
'type': 'selection',
|
||||
'selection': _get_journal,
|
||||
'required': True,
|
||||
},
|
||||
'payment_date': {'string': 'Payment date', 'type': 'date', 'required': True},
|
||||
'payment_name': {'string': 'Payment name', 'type': 'char', 'size': '32', 'required':True, 'default':'Payment'},
|
||||
'num_sale': {'string': 'Num.Cof', 'type': 'char', 'size': '32'},
|
||||
}
|
||||
|
||||
|
||||
def _pre_init(self, cr, uid, data, context):
|
||||
def _get_journal(pool, order):
|
||||
j_obj = pool.get('account.journal')
|
||||
|
||||
journal_to_fetch = 'DEFAULT'
|
||||
if order.amount_total < 0:
|
||||
journal_to_fetch = 'GIFT'
|
||||
else:
|
||||
if order.amount_paid > 0:
|
||||
journal_to_fetch = 'REBATE'
|
||||
|
||||
pos_config_journal = pool.get('pos.config.journal')
|
||||
ids = pos_config_journal.search(cr, uid, [('code', '=', journal_to_fetch)])
|
||||
objs = pos_config_journal.browse(cr, uid, ids)
|
||||
journal=''
|
||||
if objs:
|
||||
journal = objs[0].journal_id.id
|
||||
else:
|
||||
existing = [payment.journal_id.id for payment in order.payments]
|
||||
ids = j_obj.search(cr, uid, [('type', '=', 'cash')])
|
||||
for i in ids:
|
||||
if i not in existing:
|
||||
journal = i
|
||||
break
|
||||
if not journal:
|
||||
journal = ids and ids[0]
|
||||
return journal
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order = pool.get('pos.order').browse(cr, uid, data['id'], context)
|
||||
# get amount to pay:
|
||||
# amount = Decimal(str(order.amount_total)) - Decimal(str(order.amount_paid))
|
||||
amount = order.amount_total - order.amount_paid
|
||||
if amount <= 0:
|
||||
pool.get('pos.order').action_paid(cr, uid, data['ids'], context)
|
||||
|
||||
# get journal:
|
||||
journal = _get_journal(pool, order)
|
||||
|
||||
# check if an invoice is wanted:
|
||||
#invoice_wanted_checked = not not order.partner_id # not not -> boolean
|
||||
invoice_wanted_checked = False
|
||||
|
||||
# select the current date
|
||||
current_date = time.strftime('%Y-%m-%d')
|
||||
|
||||
return {'journal': journal, 'amount': amount, 'invoice_wanted': invoice_wanted_checked, 'payment_date': current_date}
|
||||
|
||||
|
||||
def _add_pay(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
jrnl_obj = pool.get('account.journal')
|
||||
result = data['form']
|
||||
invoice_wanted = data['form']['invoice_wanted']
|
||||
jrnl_used=False
|
||||
if data['form'] and data['form'].get('journal',False):
|
||||
jrnl_used=jrnl_obj.browse(cr,uid,data['form']['journal'])
|
||||
|
||||
# add 'invoice_wanted' in 'pos.order'
|
||||
order_obj.write(cr, uid, [data['id']], {'invoice_wanted': invoice_wanted})
|
||||
|
||||
order_obj.add_payment(cr, uid, data['id'], result, context=context)
|
||||
return {}
|
||||
|
||||
|
||||
def _check(self, cr, uid, data, context):
|
||||
"""Check the order:
|
||||
if the order is not paid: continue payment,
|
||||
if the order is paid print invoice (if wanted) or ticket.
|
||||
"""
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
order = order_obj.browse(cr, uid, data['id'], context)
|
||||
order_obj.test_order_lines(cr, uid, order, context=context)
|
||||
|
||||
action = 'ask_pay'
|
||||
if order.state == 'paid':
|
||||
if order.partner_id:
|
||||
if order.invoice_wanted:
|
||||
action = 'invoice'
|
||||
else:
|
||||
action = 'paid'
|
||||
elif order.date_payment:
|
||||
action = 'receipt'
|
||||
else:
|
||||
action='paid'
|
||||
|
||||
if order.amount_total == order.amount_paid:
|
||||
order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
action = 'receipt'
|
||||
|
||||
return action
|
||||
|
||||
|
||||
def create_invoice(self, cr, uid, data, context):
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for i in data['ids']:
|
||||
wf_service.trg_validate(uid, 'pos.order', i, 'invoice', cr)
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
_form = """<?xml version="1.0"?>
|
||||
<form string="Add product :">
|
||||
<field name="product"/>
|
||||
<field name="quantity"/>
|
||||
</form>
|
||||
"""
|
||||
_fields = {
|
||||
'product': {
|
||||
'string': 'Product',
|
||||
'type': 'many2one',
|
||||
'relation': 'product.product',
|
||||
'required': True,
|
||||
'default': False
|
||||
},
|
||||
|
||||
'quantity': {
|
||||
'string': 'Quantity',
|
||||
'type': 'integer',
|
||||
'required': True,
|
||||
'default': 1},
|
||||
}
|
||||
|
||||
def make_default(val):
|
||||
def fct(obj, cr, uid):
|
||||
return val
|
||||
return fct
|
||||
|
||||
def _get_returns(self, cr, uid, data, context):
|
||||
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj=pool.get('pos.order')
|
||||
order=order_obj.browse(cr, uid, [data['id']])[0]
|
||||
res={}
|
||||
fields.clear()
|
||||
arch_lst=['<?xml version="1.0"?>', '<form string="%s">' % _('Return lines'), '<label string="%s" colspan="4"/>' % _('Quantities you enter, match to products that will return to the stock.')]
|
||||
for m in [line for line in order.lines]:
|
||||
quantity=m.qty
|
||||
arch_lst.append('<field name="return%s"/>\n<newline/>' % (m.id,))
|
||||
fields['return%s' % m.id]={'string':m.product_id.name, 'type':'float', 'required':True, 'default':quantity}
|
||||
res.setdefault('returns', []).append(m.id)
|
||||
arch_lst.append('</form>')
|
||||
arch.string='\n'.join(arch_lst)
|
||||
return res
|
||||
|
||||
def _create_returns(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
lines_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
move_obj = pool.get('stock.move')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', data['ids']), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
order_obj.write(cr,uid,[order_id.id],{'type_rec':'Exchange'})
|
||||
if order_id.invoice_id:
|
||||
pool.get('account.invoice').refund(cr, uid, [order_id.invoice_id.id],time.strftime('%Y-%m-%d'), False, order_id.name)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'move_lines':[], 'state':'draft',
|
||||
'type':'in',
|
||||
'date':date_cur, })
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
lines_obj.write(cr,uid,[line.id],{'qty_rfd':(line.qty or 0.0) + data['form']['return%s' %r],
|
||||
'qty':line.qty-(data['form']['return%s' %r] or 0.0)
|
||||
})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
return res
|
||||
|
||||
def _create_returns2(self, cr, uid, data, context):
|
||||
act={}
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
line_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
picking_ids = picking_obj.search(cr, uid, [('pos_order', 'in', data['ids']), ('state', '=', 'done')])
|
||||
clone_list = []
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
uom_obj = pool.get('product.uom')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
if order_id.last_out_picking.id:
|
||||
new_picking=picking_obj.copy(cr, uid, order_id.last_out_picking.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':[]})
|
||||
for line in order_id.lines:
|
||||
for r in data['form'].get('returns',[]):
|
||||
if line.id==r and (data['form']['return%s' %r]!=0.0):
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': data['form']['return%s' %r],
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,data['form']['return%s' %r] ,line.product_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':line.product_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':line.product_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
line_obj.copy(cr,uid,line.id,{'qty':-data['form']['return%s' %r],
|
||||
'order_id': new_order,
|
||||
})
|
||||
order_obj.write(cr,uid, new_order, {'state':'done'})
|
||||
wf_service.trg_validate(uid, 'stock.picking',new_picking,'button_confirm', cr)
|
||||
picking_obj.force_assign(cr, uid, [new_picking], context)
|
||||
act = {
|
||||
'domain': "[('id', 'in', ["+str(new_order)+"])]",
|
||||
'name': 'Refunded Orders',
|
||||
'view_type': 'form',
|
||||
'view_mode': 'form,tree',
|
||||
'res_model': 'pos.order',
|
||||
'auto_refresh':0,
|
||||
'res_id':new_order,
|
||||
'view_id': False,
|
||||
'type': 'ir.actions.act_window'
|
||||
}
|
||||
else:
|
||||
raise wizard.except_wizard(_('Error'), _('Last out picking No find!'))
|
||||
|
||||
return act
|
||||
def test(self,cr,uid,data,context={}):
|
||||
# import pdb; pdb.set_trace()
|
||||
data['id']=data['res_id']
|
||||
return {'id':data['res_id']}
|
||||
|
||||
#def _raise(self,cr,uid,data,context={}):
|
||||
# return datas
|
||||
# raise wizard.except_wizard(_('Message'),_('You can not exchange products more than total paid amount.'))
|
||||
|
||||
|
||||
#def _test_exist1(self,cr,uid,data,context={}):
|
||||
# return 'choice'
|
||||
|
||||
def _test_exist(self,cr,uid,data,context={}):
|
||||
# order_obj= pooler.get_pool(cr.dbname).get('pos.order')
|
||||
# order_line_obj= pooler.get_pool(cr.dbname).get('pos.order.line')
|
||||
# obj=order_obj.browse(cr,uid, data['ids'])[0]
|
||||
# am_tot=obj._amount_total(cr, uid, data['ids'])
|
||||
# order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
# if obj.amount_total == obj.amount_paid:
|
||||
# return 'receipt'
|
||||
# elif obj.amount_total > obj.amount_paid:
|
||||
# sql = """select max(id) from pos_order_line where order_id = %d """%(obj.id)
|
||||
# cr.execute(sql)
|
||||
# res = cr.fetchone()
|
||||
# cr.execute("delete from pos_order_line where id = %d"%(res[0]))
|
||||
# cr.commit()
|
||||
# return 'choice_raise'
|
||||
# else:
|
||||
return 'add_p'
|
||||
|
||||
def _close(self,cr,uid,data,context={}):
|
||||
order_obj= pooler.get_pool(cr.dbname).get('pos.order')
|
||||
order_line_obj= pooler.get_pool(cr.dbname).get('pos.order.line')
|
||||
obj=order_obj.browse(cr,uid, data['ids'])[0]
|
||||
order_obj.write(cr,uid,data['ids'],{'state':'done'})
|
||||
if obj.amount_total != obj.amount_paid:
|
||||
return 'ask_pay'
|
||||
else :
|
||||
return 'receipt'
|
||||
|
||||
|
||||
|
||||
|
||||
def _add_pdct(self, cr, uid, data, context):
|
||||
pool = pooler.get_pool(cr.dbname)
|
||||
order_obj = pool.get('pos.order')
|
||||
line_obj = pool.get('pos.order.line')
|
||||
picking_obj = pool.get('stock.picking')
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
prod_obj = pool.get('product.product')
|
||||
stock_move_obj = pool.get('stock.move')
|
||||
uom_obj = pool.get('product.uom')
|
||||
date_cur=time.strftime('%Y-%m-%d')
|
||||
order_obj.add_product(cr, uid, data['id'], data['form']['product'],
|
||||
data['form']['quantity'], context=context)
|
||||
cr.commit()
|
||||
for order_id in order_obj.browse(cr, uid, data['ids'], context=context):
|
||||
prod=data['form']['product']
|
||||
qty=data['form']['quantity']
|
||||
prop_ids = pool.get("ir.property").search(cr, uid,[('name', '=', 'property_stock_customer')])
|
||||
val = pool.get("ir.property").browse(cr, uid,prop_ids[0]).value
|
||||
cr.execute("select s.id from stock_location s, stock_warehouse w where w.lot_stock_id=s.id and w.id= %d "%(order_id.shop_id.warehouse_id.id))
|
||||
res=cr.fetchone()
|
||||
location_id=res and res[0] or None
|
||||
stock_dest_id = int(val.split(',')[1])
|
||||
|
||||
prod_id=prod_obj.browse(cr,uid,prod)
|
||||
new_picking=picking_obj.create(cr,uid,{
|
||||
'name':'%s (Added)' %order_id.name,
|
||||
'move_lines':[],
|
||||
'state':'draft',
|
||||
'type':'out',
|
||||
'date':date_cur, })
|
||||
new_move=stock_move_obj.create(cr, uid,{
|
||||
'product_qty': qty,
|
||||
'product_uos_qty': uom_obj._compute_qty(cr, uid,prod_id.uom_id.id, qty, prod_id.uom_id.id),
|
||||
'picking_id':new_picking,
|
||||
'product_uom':prod_id.uom_id.id,
|
||||
'location_id':location_id,
|
||||
'product_id':prod_id.id,
|
||||
'location_dest_id':stock_dest_id,
|
||||
'name':'%s (return)' %order_id.name,
|
||||
'date':date_cur,
|
||||
'date_planned':date_cur,})
|
||||
|
||||
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,data['id'],{'state':'done','last_out_picking':new_picking})
|
||||
order_obj.write(cr,uid,data['id'],{'last_out_picking':new_picking})
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
|
||||
class wizard_return_picking(wizard.interface):
|
||||
states={
|
||||
'init':{
|
||||
'actions':[_get_returns],
|
||||
'result':{'type':'form',
|
||||
'arch':arch,
|
||||
'fields':fields,
|
||||
'state':[('end','Cancel', 'gtk-cancel'),('return','Return goods and Exchange', 'gtk-ok'),('return_w','Return without Refund','gtk-ok')]
|
||||
}
|
||||
},
|
||||
'return':{
|
||||
'actions':[],
|
||||
'result':{ 'type': 'action',
|
||||
'action' : _create_returns,
|
||||
'state':'prod'}
|
||||
},
|
||||
'prod':{
|
||||
'actions':[],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': _form,
|
||||
'fields':_fields,
|
||||
'state': [('close','Close'),('choice','Continue')]
|
||||
}
|
||||
},
|
||||
# 'choice1' : {
|
||||
# 'actions' : [_add_pdct],
|
||||
# 'result' : {'type' : 'choice', 'next_state': _test_exist1 }
|
||||
# },
|
||||
'choice' : {
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'choice', 'next_state': _test_exist }
|
||||
},
|
||||
# 'choice_raise':{
|
||||
# 'actions':[],
|
||||
# 'result':{ 'type': 'action',
|
||||
# 'action' : _raise,
|
||||
# 'state':'end'}
|
||||
# },
|
||||
'add_p' :{
|
||||
'actions':[],
|
||||
'result':{
|
||||
'type':'action',
|
||||
'action': _add_pdct,
|
||||
'state': 'prod'}
|
||||
},
|
||||
# 'add_pp' :{
|
||||
# 'actions':[],
|
||||
# 'result':{
|
||||
# 'type':'action',
|
||||
# 'action': _add_pdct,
|
||||
# 'state': 'end'}
|
||||
# },
|
||||
'receipt':{
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.receipt',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'return_w':{
|
||||
'actions':[],
|
||||
'result':{'type':'action', 'action':_create_returns2, 'state':'end'}
|
||||
},
|
||||
|
||||
'close':{
|
||||
'actions' : [],
|
||||
'result' : {'type' : 'choice', 'next_state': _close }
|
||||
},
|
||||
|
||||
'check': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'choice',
|
||||
'next_state': _check,
|
||||
}
|
||||
},
|
||||
|
||||
'ask_pay': {
|
||||
'actions': [_pre_init],
|
||||
'result': {
|
||||
'type': 'form',
|
||||
'arch': payment_form,
|
||||
'fields': payment_fields,
|
||||
'state': (('end', 'Cancel'), ('add_pay', 'Ma_ke payment', 'gtk-ok', True)
|
||||
)
|
||||
}
|
||||
},
|
||||
'add_pay': {
|
||||
'actions': [_add_pay],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': "check",
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
'invoice': {
|
||||
'actions': [create_invoice],
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.invoice',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'receipt': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'print',
|
||||
'report': 'pos.receipt',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
'paid': {
|
||||
'actions': [],
|
||||
'result': {
|
||||
'type': 'state',
|
||||
'state': 'end'
|
||||
}
|
||||
},
|
||||
|
||||
}
|
||||
wizard_return_picking('pos.return.picking')
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -49,13 +49,13 @@
|
|||
'update_xml': [
|
||||
'security/product_security.xml',
|
||||
'security/ir.model.access.csv',
|
||||
'wizard/product_price_view.xml',
|
||||
'product_data.xml',
|
||||
'product_report.xml',
|
||||
'product_view.xml',
|
||||
'pricelist_view.xml',
|
||||
'partner_view.xml',
|
||||
'company_view.xml',
|
||||
'product_wizard.xml',
|
||||
'process/product_process.xml'
|
||||
],
|
||||
'installable': True,
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" ?>
|
||||
<openerp>
|
||||
<data>
|
||||
<wizard
|
||||
id="report_wizard_price"
|
||||
string="Price List"
|
||||
model="product.product"
|
||||
name="product.price_list"
|
||||
keyword="client_print_multi"/>
|
||||
</data>
|
||||
</openerp>
|
|
@ -18,7 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import wizard_price
|
||||
import product_price
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU Affero General Public License as
|
||||
# published by the Free Software Foundation, either version 3 of the
|
||||
# License, or (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
|
||||
class product_price_list(osv.osv_memory):
|
||||
_name = 'product.price_list'
|
||||
_description = 'Product Price List'
|
||||
|
||||
_columns = {
|
||||
'price_list': fields.many2one('product.pricelist', 'PriceList', required=True),
|
||||
'qty1': fields.integer('Quantity-1'),
|
||||
'qty2': fields.integer('Quantity-2'),
|
||||
'qty3': fields.integer('Quantity-3'),
|
||||
'qty4': fields.integer('Quantity-4'),
|
||||
'qty5': fields.integer('Quantity-5'),
|
||||
}
|
||||
_defaults = {
|
||||
'qty1': lambda *a: 0,
|
||||
'qty2': lambda *a: 0,
|
||||
'qty3': lambda *a: 0,
|
||||
'qty4': lambda *a: 0,
|
||||
'qty5': lambda *a: 0,
|
||||
}
|
||||
|
||||
def print_report(self, cr, uid, ids, context=None):
|
||||
|
||||
"""
|
||||
To get the date and print the report
|
||||
@param self: The object pointer.
|
||||
@param cr: A database cursor
|
||||
@param uid: ID of the user currently logged in
|
||||
@param context: A standard dictionary
|
||||
@return : return report
|
||||
"""
|
||||
datas = {'ids': context.get('active_ids', [])}
|
||||
res = self.read(cr, uid, ids, ['price_list','qty1', 'qty2','qty3','qty4','qty5'], context)
|
||||
res = res and res[0] or {}
|
||||
datas['form'] = res
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
'report_name': 'product.pricelist',
|
||||
'datas': datas,
|
||||
}
|
||||
product_price_list()
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<!-- Product Price List -->
|
||||
|
||||
<record id="view_product_price_list" model="ir.ui.view">
|
||||
<field name="name">Price List</field>
|
||||
<field name="model">product.price_list</field>
|
||||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Price list">
|
||||
<field name="price_list" />
|
||||
<field name="qty1" colspan="2" />
|
||||
<field name="qty2" colspan="2" />
|
||||
<field name="qty3" colspan="2" />
|
||||
<field name="qty4" colspan="2" />
|
||||
<field name="qty5" colspan="2" />
|
||||
<button icon='gtk-cancel' special="cancel"
|
||||
string="Close" />
|
||||
<button name="print_report" string="Print Report"
|
||||
colspan="1" type="object" icon="gtk-print" />
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<act_window id="action_product_price_list"
|
||||
key2="client_action_multi" name="Price List"
|
||||
res_model="product.price_list" src_model="product.product"
|
||||
view_mode="form" target="new" view_type="form" />
|
||||
|
||||
</data>
|
||||
</openerp>
|
|
@ -1,59 +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
|
||||
|
||||
qty1_form = '''<?xml version="1.0"?>
|
||||
<form string="Price list">
|
||||
<field name="price_list" />
|
||||
<field name="qty1" colspan="2" />
|
||||
<field name="qty2" colspan="2" />
|
||||
<field name="qty3" colspan="2" />
|
||||
<field name="qty4" colspan="2" />
|
||||
<field name="qty5" colspan="2" />
|
||||
|
||||
</form>'''
|
||||
qty1_fields = {
|
||||
'price_list' : {'string' : 'PriceList', 'type' : 'many2one', 'relation' : 'product.pricelist', 'required':True },
|
||||
'qty1': {'string':'Quantity-1', 'type':'integer', 'default':0},
|
||||
'qty2': {'string':'Quantity-2', 'type':'integer', 'default':0},
|
||||
'qty3': {'string':'Quantity-3', 'type':'integer', 'default':0},
|
||||
'qty4': {'string':'Quantity-4', 'type':'integer', 'default':0},
|
||||
'qty5': {'string':'Quantity-5', 'type':'integer', 'default':0},
|
||||
}
|
||||
|
||||
|
||||
class wizard_qty(wizard.interface):
|
||||
|
||||
states = {
|
||||
'init': {
|
||||
'actions': [],
|
||||
'result': {'type':'form', 'arch':qty1_form, 'fields':qty1_fields, 'state':[('end','Cancel'),('price','Print')]}
|
||||
},
|
||||
'price': {
|
||||
'actions': [],
|
||||
'result': {'type':'print', 'report':'product.pricelist', 'state':'end'}
|
||||
}
|
||||
|
||||
}
|
||||
wizard_qty('product.price_list')
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
@ -8,14 +8,12 @@
|
|||
<field name="inherit_id" ref="base.view_partner_form"/>
|
||||
<field name="priority">36</field>
|
||||
<field name="arch" type="xml">
|
||||
<page string="Sales & Purchases" position="inside">
|
||||
<group groups="base.group_extended">
|
||||
<group colspan="2" col="2" groups="base.group_extended">
|
||||
<separator string="Purchases Properties" colspan="2"/>
|
||||
<field name="property_product_pricelist_purchase"/>
|
||||
</group>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Sales & Purchases" position="inside">
|
||||
<group colspan="4" col="2" groups="base.group_extended">
|
||||
<separator string="Purchases Properties" colspan="2"/>
|
||||
<field name="property_product_pricelist_purchase" />
|
||||
</group>
|
||||
</page>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
|
|
@ -155,7 +155,7 @@
|
|||
<td>
|
||||
<para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para>
|
||||
<para style="terp_default_Bold_9">Shipping address :</para>
|
||||
<para style="P1">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="P1">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="P1">[[ addr.title or '' ]] [[ addr.name ]]</para>
|
||||
<para style="P1">[[ addr.street ]]</para>
|
||||
<para style="P1">[[ addr.street2 or '' ]]</para>
|
||||
|
@ -175,7 +175,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_address_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -88,7 +88,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ (order.partner_id and order.partner_id.title) or '' ]] [[ order.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ order.partner_id.name ]] [[ order.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_9">[[ (order.partner_address_id and order.partner_address_id.title) or '' ]] [[ order.partner_address_id.name ]] </para>
|
||||
<para style="terp_default_9">[[ (order.partner_address_id and order.partner_address_id.street) or '']] [[ order.partner_address_id.street2 ]]</para>
|
||||
<para style="terp_default_9">[[ (order.partner_address_id and order.partner_address_id.zip) or '' ]] [[ (order.partner_address_id and order.partner_address_id.city) or '' ]]</para>
|
||||
|
|
|
@ -122,7 +122,7 @@ class purchase_order(osv.osv):
|
|||
if order.id<>po.id:
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
wf_service.trg_validate(uid, 'purchase.order', order.id, 'purchase_cancel', cr)
|
||||
self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'close','date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
self.pool.get('purchase.requisition').write(cr, uid, [po.requisition_id.id], {'state':'done','date_end':time.strftime('%Y-%m-%d %H:%M:%S')})
|
||||
|
||||
return res
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_8">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street ]]</para>
|
||||
<para style="terp_default_8">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -134,7 +134,7 @@
|
|||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">Shipping address :</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_shipping_id.title or '' ]] [[ o.partner_shipping_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_shipping_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_shipping_id.street2 or '' ]]</para>
|
||||
|
@ -155,7 +155,7 @@
|
|||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_9">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_id.name ]] [[ o.partner_id.title or '' ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_order_id.title or '' ]] [[ o.partner_order_id.name ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_order_id.street ]]</para>
|
||||
<para style="terp_default_9">[[ o.partner_order_id.street2 or '' ]]</para>
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * smtpclient
|
||||
# Catalan 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: OpenERP Server 5.0.0-rc1\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-11-26 06:00+0000\n"
|
||||
"PO-Revision-Date: 2010-01-19 05:22+0000\n"
|
||||
"Last-Translator: Jordi Esteve - http://www.zikzakmedia.com "
|
||||
"<jesteve@zikzakmedia.com>\n"
|
||||
"Language-Team: \n"
|
||||
"PO-Revision-Date: 2010-04-28 15:19+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Catalan <ca@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-02-25 05:00+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: smtpclient
|
||||
|
@ -854,15 +854,3 @@ msgstr "res.company.address"
|
|||
#: field:email.smtpclient.queue,state:0
|
||||
msgid "Message Status"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "The Email is sent successfully to corresponding address"
|
||||
#~ msgstr "El correu ha estat enviat correctament a la direcció corresponent"
|
||||
|
||||
#~ msgid "Servers"
|
||||
#~ msgstr "Servidors"
|
||||
|
||||
#~ msgid "Verification Information"
|
||||
#~ msgstr "Informació de verificació"
|
||||
|
||||
#~ msgid "Report name and Resources ids are required!"
|
||||
#~ msgstr "Nom d'informe i ids de registres són necessaris!"
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
# Translation of OpenERP Server.
|
||||
# This file containt the translation of the following modules:
|
||||
# * smtpclient
|
||||
# Spanish 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: OpenERP Server 5.0.0-rc1\n"
|
||||
"Report-Msgid-Bugs-To: support@openerp.com\n"
|
||||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-11-26 06:00+0000\n"
|
||||
"PO-Revision-Date: 2010-01-19 05:21+0000\n"
|
||||
"Last-Translator: Jordi Esteve - http://www.zikzakmedia.com "
|
||||
"<jesteve@zikzakmedia.com>\n"
|
||||
"Language-Team: \n"
|
||||
"PO-Revision-Date: 2010-04-28 15:19+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: Spanish <es@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-02-25 05:00+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: smtpclient
|
||||
|
@ -855,16 +855,3 @@ msgstr "res.company.address"
|
|||
#: field:email.smtpclient.queue,state:0
|
||||
msgid "Message Status"
|
||||
msgstr ""
|
||||
|
||||
#~ msgid "The Email is sent successfully to corresponding address"
|
||||
#~ msgstr ""
|
||||
#~ "El correo ha sido enviado correctamente a la dirección correspondiente"
|
||||
|
||||
#~ msgid "Servers"
|
||||
#~ msgstr "Servidores"
|
||||
|
||||
#~ msgid "Verification Information"
|
||||
#~ msgstr "Información de verificación"
|
||||
|
||||
#~ msgid "Report name and Resources ids are required!"
|
||||
#~ msgstr "¡Nombre de informe y ids de registros son necesarios!"
|
||||
|
|
|
@ -8,13 +8,13 @@ msgstr ""
|
|||
"Project-Id-Version: openobject-addons\n"
|
||||
"Report-Msgid-Bugs-To: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"POT-Creation-Date: 2009-11-26 06:00+0000\n"
|
||||
"PO-Revision-Date: 2010-04-07 13:57+0000\n"
|
||||
"PO-Revision-Date: 2010-04-28 15:19+0000\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: French <fr@li.org>\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
"Content-Transfer-Encoding: 8bit\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-13 03:42+0000\n"
|
||||
"X-Launchpad-Export-Date: 2010-04-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: smtpclient
|
||||
|
|
|
@ -27,6 +27,7 @@ import picking
|
|||
import lot_overview
|
||||
import lot_overview_all
|
||||
import report_stock
|
||||
import report_stock_move
|
||||
import report_stock_picking
|
||||
import report_stock_move
|
||||
|
||||
|
|
|
@ -1214,7 +1214,7 @@ class stock_move(osv.osv):
|
|||
'origin': fields.related('picking_id','origin',type='char', size=64, relation="stock.picking", string="Origin"),
|
||||
'move_stock_return_history': fields.many2many('stock.move', 'stock_move_return_history', 'move_id', 'return_move_id', 'Move Return History',readonly=True),
|
||||
'delivered_id': fields.many2one('stock.delivery', 'Product delivered'),
|
||||
'scraped': fields.related('location_dest_id','scraped',type='boolean',relation='stock.location',string='Scraped'),
|
||||
'scraped': fields.boolean('Scraped'),
|
||||
}
|
||||
_constraints = [
|
||||
(_check_tracking,
|
||||
|
@ -1252,6 +1252,7 @@ class stock_move(osv.osv):
|
|||
'state': lambda *a: 'draft',
|
||||
'priority': lambda *a: '1',
|
||||
'product_qty': lambda *a: 1.0,
|
||||
'scraped' : lambda *a: False,
|
||||
'date_planned': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
|
||||
'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.move', context=c)
|
||||
|
|
|
@ -87,8 +87,7 @@ class stock_move_consume(osv.osv_memory):
|
|||
res.update({'product_uom': move.product_uom.id})
|
||||
if 'product_qty' in fields:
|
||||
res.update({'product_qty': move.product_qty})
|
||||
if 'location_id' in fields:
|
||||
res.update({'location_id': move.location_id.id})
|
||||
|
||||
return res
|
||||
|
||||
def do_move_consume(self, cr, uid, ids, context={}):
|
||||
|
|
|
@ -0,0 +1,86 @@
|
|||
# English (United Kingdom) 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-11-26 06:05+0000\n"
|
||||
"PO-Revision-Date: 2010-04-28 19:32+0000\n"
|
||||
"Last-Translator: Shay <Unknown>\n"
|
||||
"Language-Team: English (United Kingdom) <en_GB@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-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,copy_to:0
|
||||
msgid "Copy To"
|
||||
msgstr "Copy To"
|
||||
|
||||
#. module: thunderbird
|
||||
#: constraint:ir.model:0
|
||||
msgid ""
|
||||
"The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
"The Object name must start with x_ and not contain any special characters!"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,description:0
|
||||
msgid "Description"
|
||||
msgstr "Description"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,reference:0
|
||||
msgid "Reference"
|
||||
msgstr "Reference"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.model,name:thunderbird.model_tinythunderbird_partner
|
||||
msgid "Thunderbid mails"
|
||||
msgstr "Thunderbid mails"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,attachments:0
|
||||
msgid "Attached Files"
|
||||
msgstr "Attached Files"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,res_user_id:0
|
||||
msgid "User"
|
||||
msgstr "User"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,receiver:0
|
||||
msgid "Receiver"
|
||||
msgstr "Receiver"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,date:0
|
||||
msgid "Date"
|
||||
msgstr "Date"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,title:0
|
||||
msgid "Subject"
|
||||
msgstr "Subject"
|
||||
|
||||
#. module: thunderbird
|
||||
#: code:addons/thunderbird/partner/partner.py:0
|
||||
#, python-format
|
||||
msgid "Archive"
|
||||
msgstr "Archive"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.module.module,shortdesc:thunderbird.module_meta_information
|
||||
msgid "Thunderbird Interface"
|
||||
msgstr "Thunderbird Interface"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,sender:0
|
||||
msgid "Sender"
|
||||
msgstr "Sender"
|
|
@ -0,0 +1,86 @@
|
|||
# Spanish 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-11-26 06:05+0000\n"
|
||||
"PO-Revision-Date: 2010-04-28 19:31+0000\n"
|
||||
"Last-Translator: Shay <Unknown>\n"
|
||||
"Language-Team: Spanish <es@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-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,copy_to:0
|
||||
msgid "Copy To"
|
||||
msgstr "Copiar a"
|
||||
|
||||
#. module: thunderbird
|
||||
#: constraint:ir.model:0
|
||||
msgid ""
|
||||
"The Object name must start with x_ and not contain any special character !"
|
||||
msgstr ""
|
||||
"¡El objeto debe empezar con x_ y no puede contener ningún carácter especial!"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,description:0
|
||||
msgid "Description"
|
||||
msgstr "Descripción"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,reference:0
|
||||
msgid "Reference"
|
||||
msgstr "Referencia"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.model,name:thunderbird.model_tinythunderbird_partner
|
||||
msgid "Thunderbid mails"
|
||||
msgstr "Correo Thunderbid"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,attachments:0
|
||||
msgid "Attached Files"
|
||||
msgstr "Archivos Adjuntos"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,res_user_id:0
|
||||
msgid "User"
|
||||
msgstr "Usuario"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,receiver:0
|
||||
msgid "Receiver"
|
||||
msgstr "Destinatario"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,date:0
|
||||
msgid "Date"
|
||||
msgstr "Fecha"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,title:0
|
||||
msgid "Subject"
|
||||
msgstr "Asunto"
|
||||
|
||||
#. module: thunderbird
|
||||
#: code:addons/thunderbird/partner/partner.py:0
|
||||
#, python-format
|
||||
msgid "Archive"
|
||||
msgstr "Archivar"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.module.module,shortdesc:thunderbird.module_meta_information
|
||||
msgid "Thunderbird Interface"
|
||||
msgstr "Interfaz Thunderbird"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,sender:0
|
||||
msgid "Sender"
|
||||
msgstr "Remitente"
|
|
@ -0,0 +1,85 @@
|
|||
# Chinese (Simplified) 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-11-26 06:05+0000\n"
|
||||
"PO-Revision-Date: 2010-04-28 19:35+0000\n"
|
||||
"Last-Translator: Shay <Unknown>\n"
|
||||
"Language-Team: Chinese (Simplified) <zh_CN@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-29 03:52+0000\n"
|
||||
"X-Generator: Launchpad (build Unknown)\n"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,copy_to:0
|
||||
msgid "Copy To"
|
||||
msgstr "复制到"
|
||||
|
||||
#. module: thunderbird
|
||||
#: constraint:ir.model:0
|
||||
msgid ""
|
||||
"The Object name must start with x_ and not contain any special character !"
|
||||
msgstr "对象名必须是以x_开头并且不能含有特殊字符"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,description:0
|
||||
msgid "Description"
|
||||
msgstr "描述"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,reference:0
|
||||
msgid "Reference"
|
||||
msgstr "参考"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.model,name:thunderbird.model_tinythunderbird_partner
|
||||
msgid "Thunderbid mails"
|
||||
msgstr "Thunderbid邮件"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,attachments:0
|
||||
msgid "Attached Files"
|
||||
msgstr "添加附件"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,res_user_id:0
|
||||
msgid "User"
|
||||
msgstr "用户"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,receiver:0
|
||||
msgid "Receiver"
|
||||
msgstr "收件人"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,date:0
|
||||
msgid "Date"
|
||||
msgstr "日期"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,title:0
|
||||
msgid "Subject"
|
||||
msgstr "主题"
|
||||
|
||||
#. module: thunderbird
|
||||
#: code:addons/thunderbird/partner/partner.py:0
|
||||
#, python-format
|
||||
msgid "Archive"
|
||||
msgstr "存档"
|
||||
|
||||
#. module: thunderbird
|
||||
#: model:ir.module.module,shortdesc:thunderbird.module_meta_information
|
||||
msgid "Thunderbird Interface"
|
||||
msgstr "Thunderbird接口"
|
||||
|
||||
#. module: thunderbird
|
||||
#: field:tinythunderbird.partner,sender:0
|
||||
msgid "Sender"
|
||||
msgstr "发件人"
|
Loading…
Reference in New Issue