bzr revid: hda@tinyerp.com-20091009100304-ypn2f3ivhfg8s8pq
This commit is contained in:
HDA (OpenERP) 2009-10-09 15:33:04 +05:30
commit f13487932a
22 changed files with 223 additions and 42 deletions

View File

@ -1713,6 +1713,7 @@
<field name="arch" type="xml">
<form string="Fiscal Position Template">
<field name="name" select="1"/>
<field name="chart_template_id"/>
<newline/>
<field name="tax_ids" colspan="4">
<tree string="Taxes Mapping" editable="bottom">

View File

@ -233,7 +233,6 @@
<images/>
<story>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<para style="terp_default_8">[[ o.partner_id.name ]]</para>
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]] </para>
<blockTable colWidths="297.0,233.0" style="Table_Partner_Address">
<tr>

View File

@ -152,10 +152,10 @@ class wiz_refund(wizard.interface):
invoice = invoice[0]
del invoice['id']
invoice_lines = pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'])
invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(invoice_lines)
invoice_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, invoice_lines)
tax_lines = pool.get('account.invoice.tax').read(
cr, uid, invoice['tax_line'])
tax_lines = pool.get('account.invoice')._refund_cleanup_lines(tax_lines)
tax_lines = pool.get('account.invoice')._refund_cleanup_lines(cr, uid, tax_lines)
invoice.update({
'type': inv.type,

View File

@ -162,7 +162,7 @@ class followup_all_print(wizard.interface):
if (not dest) and adr.type=='default':
if adr.email:
dest = [adr.email]
src = tools.config.options['smtp_user']
src = tools.config.options['email_from']
if not data['form']['partner_lang']:
body = data['form']['email_body']
else:

View File

@ -2,3 +2,6 @@
"access_audittrail_rule_group_system","audittrail rule system","model_audittrail_rule","base.group_system",1,1,1,1
"access_audittrail_log_group_system","audittrail log system","model_audittrail_log","base.group_system",1,1,1,1
"access_audittrail_logline_group_system","audittrail log line system","model_audittrail_log_line","base.group_system",1,1,1,1
"access_audittrail_rule_all_users","audittrail rule all","model_audittrail_rule","base.group_user",1,0,0,0
"access_audittrail_log_all_users","audittrail log all","model_audittrail_log","base.group_user",1,0,1,0
"access_audittrail_log_line_all_users","audittrail log line all","model_audittrail_log_line","base.group_user",1,0,1,0

1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
2 access_audittrail_rule_group_system audittrail rule system model_audittrail_rule base.group_system 1 1 1 1
3 access_audittrail_log_group_system audittrail log system model_audittrail_log base.group_system 1 1 1 1
4 access_audittrail_logline_group_system audittrail log line system model_audittrail_log_line base.group_system 1 1 1 1
5 access_audittrail_rule_all_users audittrail rule all model_audittrail_rule base.group_user 1 0 0 0
6 access_audittrail_log_all_users audittrail log all model_audittrail_log base.group_user 1 0 1 0
7 access_audittrail_log_line_all_users audittrail log line all model_audittrail_log_line base.group_user 1 0 1 0

View File

@ -107,7 +107,16 @@ class report_creator(osv.osv):
else:
temp_list.append('''<field name="%(name)s" select="1"/>''' % {'name':'field'+str(i)})
i+=1
arch += '''<%(view_type)s string="%(string)s" date_start="%(date_start)s" date_delay="%(date_delay)s" color="%(color)s">''' %set_dict
arch += '''<%(view_type)s string="%(string)s" date_start="%(date_start)s" ''' %set_dict
if set_dict.get('date_delay',False):
arch +=''' date_delay="%(date_delay)s" '''%set_dict
if set_dict.get('date_stop',False):
arch +=''' date_stop="%(date_stop)s" '''%set_dict
if set_dict.get('color',False):
arch +=''' color="%(color)s"'''%set_dict
arch += '''>'''
arch += ''.join(temp_list)
else:
arch += '<%s string="%s">\n' % (view_type, report.name)
@ -375,7 +384,7 @@ class report_creator_field(osv.osv):
'report_id': fields.many2one('base_report_creator.report','Report', on_delete='cascade'),
'group_method': fields.selection([('group','Grouped'),('sum','Sum'),('min','Minimum'),('count','Count'),('max','Maximum'),('avg','Average')], 'Grouping Method', required=True),
'graph_mode': fields.selection([('','/'),('x','X Axis'),('y','Y Axis')], 'Graph Mode'),
'calendar_mode': fields.selection([('','/'),('date_start','Starting Date'),('date_end','Ending Date'),('date_delay','Delay'),('color','Uniq Colors')], 'Calendar Mode'),
'calendar_mode': fields.selection([('','/'),('date_start','Starting Date'),('date_end','Ending Date'),('date_delay','Delay'),('date_stop','End Date'),('color','Unique Colors')], 'Calendar Mode'),
}
_defaults = {
'group_method': lambda *args: 'group',

View File

@ -378,10 +378,10 @@ class res_partner(osv.osv):
22: 'K',
23: 'E',
}
if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'):
#Legal persons with profit aim
if vat[0] in ('A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'U', 'V'):
try:
int(vat[1:])
int(vat[1:8])
except:
return False
sum = mult_add(2, int(vat[1])) + int(vat[2]) + \
@ -391,10 +391,11 @@ class res_partner(osv.osv):
check = 10 - (sum % 10)
if check == 10:
check = 0
if check != int(vat[8]):
return False
# if check != int(vat[8]):
# return False
return True
elif vat[0] in ('N', 'P', 'Q', 'S'):
#Legal persons with non-profit aim
elif vat[0] in ('N', 'P', 'Q', 'R', 'S', 'W'):
try:
int(vat[1:8])
except:
@ -408,17 +409,26 @@ class res_partner(osv.osv):
if check != vat[8]:
return False
return True
elif vat[0] in ('K', 'L', 'M', 'X'):
#Foreign natural persons, under age 14 or non-residents
elif vat[0] in ('K', 'L', 'M', 'X', 'Y', 'Z'):
if vat[0] == 'Y':
check_value = '1' + vat[1:8]
elif vat[0] == 'Z':
check_value = '2' + vat[1:8]
else:
check_value = vat[1:8]
try:
int(vat[1:8])
int(check_value)
except:
return False
check = 1 + (int(vat[1:8]) % 23)
check = 1 + (int(check_value) % 23)
check = conv[check]
if check != vat[8]:
return False
return True
#Spanish natural persons
else:
try:
int(vat[:8])

View File

@ -62,8 +62,8 @@ class rpc_proxy(object):
return self.rpc.execute(self.dbname, self.user_id, self.passwd, *request)
class email_parser(object):
def __init__(self, uid, password, section, email, email_default, dbname):
self.rpc = rpc_proxy(uid, password, dbname=dbname)
def __init__(self, uid, password, section, email, email_default, dbname, host):
self.rpc = rpc_proxy(uid, password, host=host, dbname=dbname)
try:
self.section_id = int(section)
except:
@ -318,9 +318,11 @@ if __name__ == '__main__':
parser.add_option("-s", "--section", dest="section", help="ID or code of the case section", default="support")
parser.add_option("-m", "--default", dest="default", help="Default eMail in case of any trouble.", default=None)
parser.add_option("-d", "--dbname", dest="dbname", help="Database name (default: terp)", default='terp')
parser.add_option("--host", dest="host", help="Hostname of the Open ERP Server", default="localhost")
(options, args) = parser.parse_args()
parser = email_parser(options.userid, options.password, options.section, options.email, options.default, dbname=options.dbname)
parser = email_parser(options.userid, options.password, options.section, options.email, options.default, dbname=options.dbname, host=options.host)
msg_txt = email.message_from_file(sys.stdin)

View File

@ -16,6 +16,7 @@
<field name="product_uom_id" on_change="on_change_unit_amount(product_id, unit_amount, product_uom_id)"/>
<field name="amount" sum="Total cost"/>
<field name="general_account_id"/>
<field name="journal_id"/>
</tree>
</field>
</record>

View File

@ -27,6 +27,13 @@
name="product.product.procurement"
keyword="client_action_multi"
id="product_procurement_wizard"/>
<wizard
id="stock.track_line"
model="stock.move"
multi="True"
name="mrp.stock.move.track"
string="Track line"/>
</data>
</openerp>

View File

@ -28,6 +28,7 @@ import wizard_workcenter_load
import wizard_track_prod
import wizard_change_production_qty
import make_procurement
import wizard_track_line
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -0,0 +1,131 @@
# -*- 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 netsvc
import pooler
import time
from osv import osv
from tools.translate import _
track_form = '''<?xml version="1.0"?>
<form string="Tracking a move">
<field name="tracking_prefix"/>
<newline/>
<field name="quantity"/>
</form>
'''
fields = {
'tracking_prefix': {
'string': 'Tracking prefix',
'type': 'char',
'size': 64,
},
'quantity': {
'string': 'Quantity per lot',
'type': 'float',
'default': 1,
}
}
def _track_lines(self, cr, uid, data, context):
move_id = data['id']
pool = pooler.get_pool(cr.dbname)
prodlot_obj = pool.get('stock.production.lot')
move_obj = pool.get('stock.move')
production_obj = pool.get('mrp.production')
ir_sequence_obj = pool.get('ir.sequence')
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
if not sequence:
raise wizard.except_wizard(_('Error!'), _('No production sequence defined'))
if data['form']['tracking_prefix']:
sequence=data['form']['tracking_prefix']+'/'+(sequence or '')
move = move_obj.browse(cr, uid, [move_id])[0]
quantity=data['form']['quantity']
if quantity <= 0 or move.product_qty == 0:
return {}
uos_qty=quantity/move.product_qty*move.product_uos_qty
quantity_rest = move.product_qty%quantity
uos_qty_rest = quantity_rest/move.product_qty*move.product_uos_qty
update_val = {
'product_qty': quantity,
'product_uos_qty': uos_qty,
}
new_move = []
production_ids = []
for idx in range(int(move.product_qty//quantity)):
if idx:
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
new_move.append(current_move)
else:
current_move = move.id
new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
if quantity_rest > 0:
idx = int(move.product_qty//quantity)
update_val['product_qty']=quantity_rest
update_val['product_uos_qty']=uos_qty_rest
if idx:
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
new_move.append(current_move)
else:
current_move = move.id
new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
products = production_obj.read(cr, uid, production_ids, ['move_lines'])
for p in products:
for new in new_move:
if new not in p['move_lines']:
p['move_lines'].append(new)
production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
return {}
class wizard_track_move(wizard.interface):
states = {
'init': {
'actions': [],
'result': {'type': 'form', 'arch': track_form, 'fields': fields, 'state': [('end', 'Cancel', 'gtk-cancel'), ('track', 'Ok', 'gtk-ok')]},
},
'track': {
'actions': [_track_lines],
'result': {'type':'state', 'state':'end'}
}
}
wizard_track_move('mrp.stock.move.track')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -68,9 +68,9 @@ class mrp_production(osv.osv):
qty2 = production.product_uos and production.product_uos_qty or False
if sub_product.subproduct_type=='variable':
if production.product_qty:
qty1 *= production.product_qty / (sub_product.product_qty or 1.0)
qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
if production.product_uos_qty:
qty2 *= production.product_uos_qty / (sub_product.product_qty or 1.0)
qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
data = {
'name':'PROD:'+production.name,
'date_planned': production.date_planned,

View File

@ -81,8 +81,18 @@ product_pricelist_type()
class product_pricelist(osv.osv):
def _pricelist_type_get(self, cr, uid, context={}):
cr.execute('select key,name from product_pricelist_type order by name')
return cr.fetchall()
pricelist_type_obj = self.pool.get('product.pricelist.type')
pricelist_type_ids = pricelist_type_obj.search(cr, uid, [], order='name')
pricelist_types = pricelist_type_obj.read(cr, uid, pricelist_type_ids, ['key','name'], context=context)
res = []
for type in pricelist_types:
res.append((type['key'],type['name']))
return res
# cr.execute('select key,name from product_pricelist_type order by name')
# return cr.fetchall()
_name = "product.pricelist"
_description = "Pricelist"
_columns = {

View File

@ -671,9 +671,9 @@
<field name="res_model">project.task</field>
<field name="view_type">form</field>
<field name="view_mode">tree,form,calendar,graph,gantt</field>
<field name="domain">[('state', '=', 'progress')]</field>
<field name="filter" eval="True"/>
<field name="search_view_id" ref="view_task_search_form"/>
<field name="domain">[('state','=','open')]</field>
</record>
<menuitem action="action_view_task6_prog" id="menu_action_view_task6_prog" parent="project.menu_action_view_task" groups="base.group_extended_menu"/>

View File

@ -329,7 +329,8 @@ class purchase_order(osv.osv):
'journal_id': len(journal_ids) and journal_ids[0] or False,
'origin': o.name,
'invoice_line': il,
'fiscal_position': o.partner_id.property_account_position.id
'fiscal_position': o.partner_id.property_account_position.id,
'payment_term':o.partner_id.property_payment_term and o.partner_id.property_payment_term.id or False,
}
inv_id = self.pool.get('account.invoice').create(cr, uid, inv, {'type':'in_invoice'})
self.pool.get('account.invoice').button_compute(cr, uid, [inv_id], {'type':'in_invoice'}, set_total=True)

View File

@ -242,10 +242,8 @@
<field name="type">tree</field>
<field name="arch" type="xml">
<tree colors="red:date_planned&lt;=current_date" string="Purchase Order Lines">
<field name="order_id"/>
<field name="date_order"/>
<field name="name"/>
<field name="date_planned"/>
<field name="partner_id"/>
<field name="product_id"/>
<field name="product_qty"/>
<field name="product_uom"/>

View File

@ -37,6 +37,7 @@ merge_form = """<?xml version="1.0"?>
* their status is draft
* they belong to the same partner
* are going to the same location
* have the same pricelist
- lines will only be merged if:
* they are exactly the same except for the quantity and unit</label>
</form>
@ -80,7 +81,7 @@ def _merge_orders(self, cr, uid, data, context):
# compute what the new orders should contain
new_orders = {}
for porder in [order for order in order_obj.browse(cr, uid, data['ids']) if order.state == 'draft']:
order_key = make_key(porder, ('partner_id', 'location_id'))
order_key = make_key(porder, ('partner_id', 'location_id', 'pricelist_id'))
new_order = new_orders.setdefault(order_key, ({}, []))
new_order[1].append(porder.id)

View File

@ -742,7 +742,7 @@ class sale_order_line(osv.osv):
'order_id': fields.many2one('sale.order', 'Order Ref', required=True, ondelete='cascade', select=True),
'name': fields.char('Description', size=256, required=True, select=True),
'sequence': fields.integer('Sequence'),
'delay': fields.float('Delivery Delay', required=True),
'delay': fields.float('Delivery Lead Time', required=True, help="Number of days between the order confirmation the the shipping of the products to the customer"),
'product_id': fields.many2one('product.product', 'Product', domain=[('sale_ok', '=', True)], change_default=True),
'invoice_lines': fields.many2many('account.invoice.line', 'sale_order_line_invoice_rel', 'order_line_id', 'invoice_id', 'Invoice Lines', readonly=True),
'invoiced': fields.boolean('Invoiced', readonly=True),

View File

@ -132,7 +132,9 @@
</td>
<td>
<para style="terp_default_9">[[ (picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.title) or '' ]] [[ picking.address_id and picking.address_id.partner_id and picking.address_id.partner_id.name ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.street or '' ]][[ picking.address_id and picking.address_id.zip or '' ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.street or '' ]]</para>
<para style="terp_default_9">[[ picking.address_id and picking.address_id.zip or '' ]] [[ picking.address_id and picking.address_id.city or '']]</para>
<para style="terp_default_2">
<font color="white"> </font>
</para>
@ -190,7 +192,7 @@
<para style="terp_tblheader_General_Centre">Expected Shipping Date </para>
</td>
<td>
<para style="terp_tblheader_General_Centre">weight</para>
<para style="terp_tblheader_General_Centre">Weight</para>
</td>
</tr>
</blockTable>

View File

@ -625,6 +625,7 @@
<form string="Packing list">
<group col="6" colspan="4">
<field name="address_id" select="1"/>
<field name="type"/>
<field name="name" select="1" readonly="1"/>
<field name="min_date" select="1"/>
<field name="backorder_id" select="2" readonly="1"/>
@ -839,6 +840,7 @@
<form string="Packing list">
<group col="6" colspan="4">
<field name="address_id" select="2"/>
<field name="type"/>
<field name="min_date" select="2"/>
<field name="name" select="1" readonly="1"/>
<field name="invoice_state"/>
@ -1025,6 +1027,7 @@
<form string="Input Packing List">
<group colspan="4" col="6">
<field name="address_id" on_change="onchange_partner_in(address_id)" select="2" context="{'contact_display':'partner'}"/>
<field name="type"/>
<field name="origin" select="2"/>
<field name="invoice_state" select="2" string="Invoice Control"/>
<field name="name" readonly="1" select="1"/>

View File

@ -54,7 +54,7 @@ def _track_lines(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
prodlot_obj = pool.get('stock.production.lot')
move_obj = pool.get('stock.move')
production_obj = pool.get('mrp.production')
# production_obj = pool.get('mrp.production')
ir_sequence_obj = pool.get('ir.sequence')
sequence = ir_sequence_obj.get(cr, uid, 'stock.lot.serial')
@ -77,24 +77,26 @@ def _track_lines(self, cr, uid, data, context):
'product_uos_qty': uos_qty,
}
new_move = []
production_ids = []
# production_ids = []
for idx in range(int(move.product_qty//quantity)):
if idx:
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
new_move.append(current_move)
else:
current_move = move.id
new_prodlot = prodlot_obj.create(cr, uid, {'name': sequence, 'ref': '%d'%idx}, {'product_id': move.product_id.id})
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
# production_ids = production_obj.search(cr, uid, [('move_lines', 'in', [move.id])])
if quantity_rest > 0:
idx = int(move.product_qty//quantity)
update_val['product_qty']=quantity_rest
update_val['product_uos_qty']=uos_qty_rest
if idx:
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
# current_move = move_obj.copy(cr, uid, move.id, {'state': move.state, 'production_id': move.production_id.id})
current_move = move_obj.copy(cr, uid, move.id, {'state': move.state})
new_move.append(current_move)
else:
current_move = move.id
@ -102,12 +104,12 @@ def _track_lines(self, cr, uid, data, context):
update_val['prodlot_id'] = new_prodlot
move_obj.write(cr, uid, [current_move], update_val)
products = production_obj.read(cr, uid, production_ids, ['move_lines'])
for p in products:
for new in new_move:
if new not in p['move_lines']:
p['move_lines'].append(new)
production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
# products = production_obj.read(cr, uid, production_ids, ['move_lines'])
# for p in products:
# for new in new_move:
# if new not in p['move_lines']:
# p['move_lines'].append(new)
# production_obj.write(cr, uid, [p['id']], {'move_lines': [(6, 0, p['move_lines'])]})
return {}