bzr revid: nel@silver-20080926134630-dh0wovt4joaaib98
This commit is contained in:
Najlaa 2008-09-26 15:46:30 +02:00
commit 37b263382e
20 changed files with 177 additions and 68 deletions

View File

@ -126,7 +126,7 @@ class general_ledger(rml_parse.rml_parse):
# #
self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx) self.query = self.pool.get('account.move.line')._query_get(self.cr, self.uid, context=ctx)
for child_id in account.search(self.cr, self.uid, for child_id in self.pool.get('account.account').search(self.cr, self.uid,
[('parent_id', 'child_of', [account.id])]): [('parent_id', 'child_of', [account.id])]):
child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id) child_account = self.pool.get('account.account').browse(self.cr, self.uid, child_id)
sold_account = self._sum_solde_account(child_account,form) sold_account = self._sum_solde_account(child_account,form)
@ -349,14 +349,19 @@ class general_ledger(rml_parse.rml_parse):
def _sum_currency_amount_account(self, account, form): def _sum_currency_amount_account(self, account, form):
self._set_get_account_currency_code(account.id) self._set_get_account_currency_code(account.id)
self.cr.execute("select sum(aml.amount_currency) from account_move_line as aml "\
"LEFT JOIN account_account aa on aml.account_id=%d "\
"AND aml.currency_id = aa.currency_id"%account.id)
total = self.cr.fetchone()
if self.account_currency: if self.account_currency:
return_field = str(self.tot_currency) + self.account_currency return_field = str(total[0]) + self.account_currency
self.tot_currency = 0.0
return return_field return return_field
else: else:
self.tot_currency = 0.0 currency_total = self.tot_currency = 0.0
return ' ' return currency_total
report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header=False) report_sxw.report_sxw('report.account.general.ledger', 'account.account', 'addons/account/report/general_ledger.rml', parser=general_ledger, header=False)

View File

@ -138,6 +138,7 @@
<td> <td>
<para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para> <para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>
</td> </td>
@ -242,7 +243,7 @@
<blockTable colWidths="54.0,125.0,66.0,20.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content" > <blockTable colWidths="54.0,125.0,66.0,20.0,100.0,50.0,50.0,50.0,40.0" style="tbl_content" >
<tr> <tr>
<td> <td>
<blockTable colWidths="259.00,100.0,50.0,50.0,49.0" style="Table5"> <blockTable colWidths="259.00,100.0,50.0,50.0,49.0,41.00" style="Table5">
<tr> <tr>
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td> <td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"></para></td> <td><para style="Standard"></para></td>
@ -250,10 +251,13 @@
<para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0' ]]</u></para> <para style="P9b"><u>[[ sum_debit_account(o, data['form']) or '0.0' ]]</u></para>
</td> </td>
<td alignment="right"> <td alignment="right">
<para style="P9b"><u>[[sum_credit_account(o, data['form']) or '0.0' ]]</u></para> <para style="P9b"><u>[[ sum_credit_account(o, data['form']) or '0.0' ]]</u></para>
</td> </td>
<td> <td>
<para style="P9b"><u>[[sum_solde_account(o, data['form']) or '0.0' ]]</u></para> <para style="P9b"><u>[[ sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
</td>
<td>
<para style="P9b"><u>[[ sum_currency_amount_account(o, data['form']) or '0.0' ]]</u></para>
</td> </td>
</tr> </tr>
</blockTable> </blockTable>

View File

@ -261,7 +261,8 @@ class general_ledger_landscape(rml_parse.rml_parse):
# #
if l['amount_currency'] != None: if l['amount_currency'] != None:
self.tot_currency = self.tot_currency + l['amount_currency'] self.tot_currency = self.tot_currency + l['amount_currency']
return res return res
def _sum_debit_account(self, account, form): def _sum_debit_account(self, account, form):
@ -336,10 +337,12 @@ class general_ledger_landscape(rml_parse.rml_parse):
return sum_solde return sum_solde
def _set_get_account_currency_code(self, account_id): def _set_get_account_currency_code(self, account_id):
print"====account_id=====",account_id
self.cr.execute("SELECT c.code as code "\ self.cr.execute("SELECT c.code as code "\
"FROM res_currency c,account_account as ac "\ "FROM res_currency c,account_account as ac "\
"WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id)) "WHERE ac.id = %s AND ac.currency_id = c.id"%(account_id))
result = self.cr.fetchone() result = self.cr.fetchone()
print"====result====",result
if result: if result:
self.account_currency = result[0] self.account_currency = result[0]
else: else:
@ -347,13 +350,18 @@ class general_ledger_landscape(rml_parse.rml_parse):
def _sum_currency_amount_account(self, account, form): def _sum_currency_amount_account(self, account, form):
self._set_get_account_currency_code(account.id) self._set_get_account_currency_code(account.id)
self.cr.execute("select sum(aml.amount_currency) from account_move_line as aml "\
"LEFT JOIN account_account aa on aml.account_id=%d "\
"AND aml.currency_id = aa.currency_id"%account.id)
total = self.cr.fetchone()
if self.account_currency: if self.account_currency:
return_field = str(self.tot_currency) + self.account_currency return_field = str(total[0]) + self.account_currency
self.tot_currency = 0.0
return return_field return return_field
else: else:
self.tot_currency = 0.0 currency_total = self.tot_currency = 0.0
return ' ' return currency_total
report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger_landscape, header=False) report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger_landscape, header=False)

View File

@ -145,12 +145,13 @@
<tr> <tr>
<para>[[ repeatIn(objects, 'a') ]]</para> <para>[[ repeatIn(objects, 'a') ]]</para>
<para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para> <para>[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]</para>
<td> <td>
<blockTable colWidths="50.0,35.0,180.0, 90.0,30.0,345.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content" > <blockTable colWidths="50.0,35.0,180.0, 90.0,30.0,345.0,50.0,69.0,72.0,64.0,58.0" style="tbl_content" >
<tr> <tr>
<td> <td>
<blockTable colWidths="400.0,374.0,69.0,72.0,64.0" style="Table5"> <blockTable colWidths="400.0,374.0,69.0,72.0,64.0,59.00" style="Table5">
<tr> <tr>
<td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td> <td><para style="Standard">[[ o.code ]] [[ o.name ]]</para></td>
<td><para style="Standard"></para></td> <td><para style="Standard"></para></td>
@ -163,6 +164,10 @@
<td> <td>
<para style="P9b"><u>[[ sum_solde_account(o, data['form']) or '0.0' ]]</u></para> <para style="P9b"><u>[[ sum_solde_account(o, data['form']) or '0.0' ]]</u></para>
</td> </td>
<td>
<para style="P9b"><u> [[ sum_currency_amount_account(o, data['form']) or '0.0' ]]</u></para>
</td>
</tr> </tr>
</blockTable> </blockTable>
</td> </td>

View File

@ -42,6 +42,7 @@ class Overdue(report_sxw.rml_parse):
'time' : time, 'time' : time,
'adr_get' : self._adr_get, 'adr_get' : self._adr_get,
'getLines' : self._lines_get, 'getLines' : self._lines_get,
'tel_get' : self._tel_get,
}) })
def _adr_get(self, partner, type): def _adr_get(self, partner, type):
@ -51,6 +52,20 @@ class Overdue(report_sxw.rml_parse):
adr_id = addresses and addresses[type] or False adr_id = addresses and addresses[type] or False
return adr_id and res_partner_address.read(self.cr, self.uid, [adr_id])[0] or False return adr_id and res_partner_address.read(self.cr, self.uid, [adr_id])[0] or False
def _tel_get(self,partner):
if not partner:
return False
res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
addresses = res_partner.address_get(self.cr, self.uid, [partner.id], ['invoice'])
adr_id = addresses and addresses['invoice'] or False
if adr_id:
adr=res_partner_address.read(self.cr, self.uid, [adr_id])[0]
return adr['phone']
else:
return partner.address and partner.address[0].phone or False
return False
def _lines_get(self, partner): def _lines_get(self, partner):
moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line') moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
movelines = moveline_obj.search(self.cr, self.uid, movelines = moveline_obj.search(self.cr, self.uid,

View File

@ -110,7 +110,7 @@
<para style="P16"> <para style="P16">
<font color="white"> </font> <font color="white"> </font>
</para> </para>
<para style="P16">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at +32 81 81 37 00.</para> <para style="P16">Would your payment have been carried out after this mail was sent, please consider the present one as void. Do not hesitate to contact our accounting departement at [[ tel_get(company.partner_id) ]].</para>
<para style="P16"> <para style="P16">
<font color="white"> </font> <font color="white"> </font>
</para> </para>

View File

@ -1,13 +1,13 @@
# -*- encoding: utf-8 -*- # -*- encoding: utf-8 -*-
{ {
"name" : "Crossovered Budget Management", "name" : "Budget Management",
"version" : "1.0", "version" : "1.0",
"author" : "Tiny", "author" : "Tiny",
"website" : "http://tinyerp.com/module_crossovered_budget.html", "website" : "http://tinyerp.com/module_crossovered_budget.html",
"category" : "Generic Modules/Accounting", "category" : "Generic Modules/Accounting",
"description": """This module allow accountants to manage analytic and crossovered budgets. "description": """This module allow accountants to manage analytic and crossovered budgets.
Once the Master Budgets and the Budgets defined (in Financial Management/Configuration/Budgets/), the Project Managers can set the planned amount on each Analytic Account. Once the Master Budgets and the Budgets defined (in Financial Management/Budgets/), the Project Managers can set the planned amount on each Analytic Account.
The accountant has the possibility to see the total of amount planned for each Budget and Master Budget in order to ensure the total planned is not greater/lower than what he planned for this Budget/Master Budget. Each list of record can also be switched to a graphical view of it. The accountant has the possibility to see the total of amount planned for each Budget and Master Budget in order to ensure the total planned is not greater/lower than what he planned for this Budget/Master Budget. Each list of record can also be switched to a graphical view of it.

View File

@ -76,7 +76,7 @@
<field name="view_type">form</field> <field name="view_type">form</field>
<field name="view_id" ref="view_budget_post_tree"/> <field name="view_id" ref="view_budget_post_tree"/>
</record> </record>
<menuitem id="next_id_31" name="Budgets" parent="account.menu_finance_accounting"/><menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/> <menuitem id="next_id_31" name="Budgets" parent="account.menu_finance"/><menuitem action="open_budget_post_form" id="menu_budget_post_form" parent="next_id_31"/>
<!-- ******************************************************************************************************** --> <!-- ******************************************************************************************************** -->
<!--<record model="ir.ui.view" id="view_budget_post_dotation_form_inherit"> <!--<record model="ir.ui.view" id="view_budget_post_dotation_form_inherit">

View File

@ -82,6 +82,25 @@ class stock_picking(osv.osv):
if not account_id: if not account_id:
account_id = picking.carrier_id.product_id.categ_id\ account_id = picking.carrier_id.product_id.categ_id\
.property_account_income_categ.id .property_account_income_categ.id
taxes = self.pool.get('account.tax').browse(cursor, user,
[x.id for x in picking.carrier_id.product_id.taxes_id])
taxep = None
partner_id=picking.address_id.partner_id and picking.address_id.partner_id.id or False
if partner_id:
taxep_id = self.pool.get('res.partner').property_get(cursor, user,partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
if taxep_id:
taxep=self.pool.get('account.tax').browse(cursor, user,taxep_id)
if not taxep or not taxep.id:
taxes_ids = [x.id for x in picking.carrier_id.product_id.taxes_id]
else:
res5 = [taxep.id]
for t in taxes:
if not t.tax_group==taxep.tax_group:
res5.append(t.id)
taxes_ids = res5
invoice_line_obj.create(cursor, user, { invoice_line_obj.create(cursor, user, {
'name': picking.carrier_id.name, 'name': picking.carrier_id.name,
'invoice_id': invoice.id, 'invoice_id': invoice.id,
@ -90,9 +109,7 @@ class stock_picking(osv.osv):
'account_id': account_id, 'account_id': account_id,
'price_unit': price, 'price_unit': price,
'quantity': 1, 'quantity': 1,
'invoice_line_tax_id': [(6, 0, 'invoice_line_tax_id': [(6, 0,taxes_ids)],
[x.id for x in (picking.carrier_id.product_id.taxes_id
or [])])],
}) })
return result return result

View File

@ -65,16 +65,34 @@ def _delivery_set(self, cr, uid, data, context):
grid_id = pooler.get_pool(cr.dbname).get('delivery.carrier').grid_get(cr, uid, [data['form']['carrier_id']],order.partner_shipping_id.id) grid_id = pooler.get_pool(cr.dbname).get('delivery.carrier').grid_get(cr, uid, [data['form']['carrier_id']],order.partner_shipping_id.id)
if not grid_id: if not grid_id:
raise wizard.except_wizard(_('No grid avaible !'), _('No grid matching for this carrier !')) raise wizard.except_wizard(_('No grid avaible !'), _('No grid matching for this carrier !'))
grid = pooler.get_pool(cr.dbname).get('delivery.grid').browse(cr, uid, [grid_id])[0] grid_obj=pooler.get_pool(cr.dbname).get('delivery.grid')
grid = grid_obj.browse(cr, uid, [grid_id])[0]
taxes = pooler.get_pool(cr.dbname).get('account.tax').browse(cr, uid,
[x.id for x in grid.carrier_id.product_id.taxes_id])
taxep = None
partner_id=order.partner_id and order.partner_id.id or False
if partner_id:
taxep_id = pooler.get_pool(cr.dbname).get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
if taxep_id:
taxep=pooler.get_pool(cr.dbname).get('account.tax').browse(cr, uid,taxep_id)
if not taxep or not taxep.id:
taxes_ids = [x.id for x in grid.carrier_id.product_id.taxes_id]
else:
res5 = [taxep.id]
for t in taxes:
if not t.tax_group==taxep.tax_group:
res5.append(t.id)
taxes_ids = res5
line_obj.create(cr, uid, { line_obj.create(cr, uid, {
'order_id': order.id, 'order_id': order.id,
'name': grid.carrier_id.name, 'name': grid.carrier_id.name,
'product_uom_qty': 1, 'product_uom_qty': 1,
'product_uom': grid.carrier_id.product_id.uom_id.id, 'product_uom': grid.carrier_id.product_id.uom_id.id,
'product_id': grid.carrier_id.product_id.id, 'product_id': grid.carrier_id.product_id.id,
'price_unit': grid.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context), 'price_unit': grid_obj.get_price(cr, uid, grid.id, order, time.strftime('%Y-%m-%d'), context),
'tax_id': [(6,0,[ x.id for x in grid.carrier_id.product_id.taxes_id])], 'tax_id': [(6,0,taxes_ids)],
'type': 'make_to_stock' 'type': 'make_to_stock'
}) })

View File

@ -947,17 +947,41 @@ class mrp_procurement(osv.osv):
newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - DateTime.RelativeDateTime(days=procurement.product_id.product_tmpl_id.seller_delay or 0.0) newdate = DateTime.strptime(procurement.date_planned, '%Y-%m-%d %H:%M:%S') - DateTime.RelativeDateTime(days=procurement.product_id.product_tmpl_id.seller_delay or 0.0)
newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead) newdate = newdate - DateTime.RelativeDateTime(days=company.po_lead)
context.update({'lang':partner.lang})
product=self.pool.get('product.product').browse(cr,uid,procurement.product_id.id,context=context)
line = { line = {
'name': procurement.product_id.name, 'name': product.name,
'product_qty': qty, 'product_qty': qty,
'product_id': procurement.product_id.id, 'product_id': procurement.product_id.id,
'product_uom': uom_id, 'product_uom': uom_id,
'price_unit': price, 'price_unit': price,
'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'), 'date_planned': newdate.strftime('%Y-%m-%d %H:%M:%S'),
'taxes_id': [(6, 0, [x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id])],
'move_dest_id': res_id, 'move_dest_id': res_id,
'notes':product.description_purchase,
} }
taxes = self.pool.get('account.tax').browse(cr, uid,
[x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id])
taxep = None
if partner_id:
taxep_id = self.pool.get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_supplier_tax']).get('property_account_supplier_tax',False)
if taxep_id:
taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
if not taxep or not taxep.id:
taxes_ids = [x.id for x in procurement.product_id.product_tmpl_id.supplier_taxes_id]
else:
res5 = [taxep.id]
for t in taxes:
if not t.tax_group==taxep.tax_group:
res5.append(t.id)
taxes_ids = res5
line.update({
'taxes_id':[(6,0,taxes_ids)]
})
purchase_id = self.pool.get('purchase.order').create(cr, uid, { purchase_id = self.pool.get('purchase.order').create(cr, uid, {
'origin': procurement.origin, 'origin': procurement.origin,
'partner_id': partner_id, 'partner_id': partner_id,

View File

@ -132,7 +132,7 @@ class mrp_procurement(osv.osv):
cr.close() cr.close()
return {} return {}
def create_automatic_op(cr, uid, context=None): def create_automatic_op(self,cr, uid, context=None):
if not context: if not context:
context={} context={}
product_obj = self.pool.get('product.product') product_obj = self.pool.get('product.product')
@ -192,7 +192,7 @@ class mrp_procurement(osv.osv):
offset = 0 offset = 0
ids = [1] ids = [1]
if automatic: if automatic:
create_automatic_op(cr, uid, context=context) self.create_automatic_op(cr, uid, context=context)
while ids: while ids:
ids=orderpoint_obj.search(cr,uid,[],offset=offset,limit=100) ids=orderpoint_obj.search(cr,uid,[],offset=offset,limit=100)
for op in orderpoint_obj.browse(cr, uid, ids): for op in orderpoint_obj.browse(cr, uid, ids):

View File

@ -242,9 +242,9 @@ class product_template(osv.osv):
_columns = { _columns = {
'name': fields.char('Name', size=64, required=True, translate=True, select=True), 'name': fields.char('Name', size=64, required=True, translate=True, select=True),
'product_manager': fields.many2one('res.users','Product Manager'), 'product_manager': fields.many2one('res.users','Product Manager'),
'description': fields.text('Description'), 'description': fields.text('Description',translate=True),
'description_purchase': fields.text('Purchase Description'), 'description_purchase': fields.text('Purchase Description',translate=True),
'description_sale': fields.text('Sale Description'), 'description_sale': fields.text('Sale Description',translate=True),
'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way procurements are processed, consumable are stockable products with infinite stock, or without a stock management in the system."), 'type': fields.selection([('product','Stockable Product'),('consu', 'Consumable'),('service','Service')], 'Product Type', required=True, help="Will change the way procurements are processed, consumable are stockable products with infinite stock, or without a stock management in the system."),
'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True, help="Produce will generate production order or tasks, according to the product type. Purchase will trigger purchase orders when requested."), 'supply_method': fields.selection([('produce','Produce'),('buy','Buy')], 'Supply method', required=True, help="Produce will generate production order or tasks, according to the product type. Purchase will trigger purchase orders when requested."),
'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."), 'sale_delay': fields.float('Customer Lead Time', help="This is the average time between the confirmation of the customer order and the delivery of the finnished products. It's the time you promise to your customers."),

View File

@ -227,7 +227,8 @@ class purchase_order(osv.osv):
if not part: if not part:
return {'value':{'partner_address_id': False}} return {'value':{'partner_address_id': False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default']) addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['default'])
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist_purchase.id pricelist = self.pool.get('res.partner').property_get(cr, uid,
part,property_pref=['property_product_pricelist_purchase']).get('property_product_pricelist_purchase',False)
return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}} return {'value':{'partner_address_id': addr['default'], 'pricelist_id': pricelist}}
def wkf_approve_order(self, cr, uid, ids): def wkf_approve_order(self, cr, uid, ids):
@ -425,10 +426,10 @@ class purchase_order_line(osv.osv):
return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}} return {'value': {'price_unit': 0.0, 'name':'','notes':'', 'product_uom' : False}, 'domain':{'product_uom':[]}}
lang=False lang=False
if partner_id: if partner_id:
lang=self.pool.get('res.partner').read(cr, uid, [partner_id])[0]['lang'] lang=self.pool.get('res.partner').read(cr, uid, partner_id)['lang']
context={'lang':lang} context={'lang':lang}
prod = self.pool.get('product.product').read(cr, uid, [product], ['supplier_taxes_id','name','seller_delay','uom_po_id','description_purchase'])[0] prod = self.pool.get('product.product').read(cr, uid, product, ['supplier_taxes_id','name','seller_delay','uom_po_id','description_purchase'],context=context)
prod_uom_po = prod['uom_po_id'][0] prod_uom_po = prod['uom_po_id'][0]
if not uom: if not uom:
uom = prod_uom_po uom = prod_uom_po
@ -445,21 +446,21 @@ class purchase_order_line(osv.osv):
res = {'value': {'price_unit': price, 'name':prod_name, 'taxes_id':prod['supplier_taxes_id'], 'date_planned': dt,'notes':prod['description_purchase'], 'product_uom': uom}} res = {'value': {'price_unit': price, 'name':prod_name, 'taxes_id':prod['supplier_taxes_id'], 'date_planned': dt,'notes':prod['description_purchase'], 'product_uom': uom}}
domain = {} domain = {}
if res['value']['taxes_id']:
taxes = self.pool.get('account.tax').browse(cr, uid, taxes = self.pool.get('account.tax').browse(cr, uid,prod['supplier_taxes_id'])
[x.id for x in prod.supplier_taxes_id]) taxep = None
taxep = None if partner_id:
if partner_id: taxep_id = self.pool.get('res.partner').property_get(cr, uid,partner_id,property_pref=['property_account_supplier_tax']).get('property_account_supplier_tax',False)
taxep = self.pool.get('res.partner').browse(cr, uid, if taxep_id:
partner_id).property_account_supplier_tax taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
if not taxep or not taxep.id: if not taxep or not taxep.id:
res['value']['taxes_id'] = [x.id for x in prod.taxes_id] res['value']['taxes_id'] = [x.id for x in product.taxes_id]
else: else:
res5 = [taxep.id] res5 = [taxep.id]
for t in taxes: for t in taxes:
if not t.tax_group==taxep.tax_group: if not t.tax_group==taxep.tax_group:
res5.append(t.id) res5.append(t.id)
res['value']['taxes_id'] = res5 res['value']['taxes_id'] = res5
res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id']) res2 = self.pool.get('product.uom').read(cr, uid, [uom], ['category_id'])
res3 = self.pool.get('product.uom').read(cr, uid, [prod_uom_po], ['category_id']) res3 = self.pool.get('product.uom').read(cr, uid, [prod_uom_po], ['category_id'])

View File

@ -141,8 +141,8 @@
<td> <td>
<para style="terp_default_9">[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]</para> <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="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">[[ addr.partner_id.title or '' ]][[ addr.partner_id.name ]]</para>
<para style="terp_default_9">[[ addr.title or '' ]] [[ addr.name ]]</para> <para style="terp_default_9">[[ addr.title or '' ]][[ addr.name ]]</para>
<para style="terp_default_9">[[ addr.street ]]</para> <para style="terp_default_9">[[ addr.street ]]</para>
<para style="terp_default_9">[[ addr.street2 or '' ]]</para> <para style="terp_default_9">[[ addr.street2 or '' ]]</para>
<para style="terp_default_9"><font face="Times-Roman">[[ addr.zip or '' ]]</font> [[ addr.city or '' ]]</para> <para style="terp_default_9"><font face="Times-Roman">[[ addr.zip or '' ]]</font> [[ addr.city or '' ]]</para>

View File

@ -134,7 +134,8 @@
</stylesheet> </stylesheet>
<images/> <images/>
<story> <story>
<para style="terp_default_8">[[ repeatIn(objects,'o') ]] [[ setLang(o.partner_id.lang) ]]</para> <para style="terp_default_8">[[ repeatIn(objects,'o') ]]</para>
<para style="terp_default_8">[[ setLang(o.partner_id.lang) ]]</para>
<blockTable colWidths="265.0,51.0,225.0" style="AddressTable"> <blockTable colWidths="265.0,51.0,225.0" style="AddressTable">
<tr> <tr>
<td> <td>

View File

@ -288,8 +288,10 @@ class sale_order(osv.osv):
if not part: if not part:
return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}} return {'value':{'partner_invoice_id': False, 'partner_shipping_id':False, 'partner_order_id':False, 'payment_term' : False}}
addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact']) addr = self.pool.get('res.partner').address_get(cr, uid, [part], ['delivery','invoice','contact'])
pricelist = self.pool.get('res.partner').browse(cr, uid, part).property_product_pricelist.id pricelist = self.pool.get('res.partner').property_get(cr, uid,
payment_term = self.pool.get('res.partner').browse(cr, uid, part).property_payment_term.id part,property_pref=['property_product_pricelist']).get('property_product_pricelist',False)
payment_term = self.pool.get('res.partner').property_get(cr, uid,
part,property_pref=['property_payment_term']).get('property_payment_term',False)
return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}} return {'value':{'partner_invoice_id': addr['invoice'], 'partner_order_id':addr['contact'], 'partner_shipping_id':addr['delivery'], 'pricelist_id': pricelist, 'payment_term' : payment_term}}
def button_dummy(self, cr, uid, ids, context={}): def button_dummy(self, cr, uid, ids, context={}):
@ -357,18 +359,22 @@ class sale_order(osv.osv):
for i in o.invoice_ids: for i in o.invoice_ids:
if i.state == 'draft': if i.state == 'draft':
return i.id return i.id
picking_obj=self.pool.get('stock.picking')
for val in invoices.values(): for val in invoices.values():
if grouped: if grouped:
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], [])) res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []))
for o,l in val: for o,l in val:
self.write(cr, uid, [o.id], {'state' : 'progress'}) self.write(cr, uid, [o.id], {'state' : 'progress'})
if o.order_policy=='picking':
picking_obj.write(cr,uid,map(lambda x:x.id,o.picking_ids),{'invoice_state':'invoiced'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (o.id, res)) cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (o.id, res))
else: else:
for order, il in val: for order, il in val:
res = self._make_invoice(cr, uid, order, il) res = self._make_invoice(cr, uid, order, il)
invoice_ids.append(res) invoice_ids.append(res)
self.write(cr, uid, [order.id], {'state' : 'progress'}) self.write(cr, uid, [order.id], {'state' : 'progress'})
if order.order_policy=='picking':
picking_obj.write(cr,uid,map(lambda x:x.id,order.picking_ids),{'invoice_state':'invoiced'})
cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (order.id, res)) cr.execute('insert into sale_order_invoice_rel (order_id,invoice_id) values (%d,%d)', (order.id, res))
return res return res
@ -515,7 +521,8 @@ class sale_order(osv.osv):
'location_dest_id': output_id, 'location_dest_id': output_id,
'sale_line_id': line.id, 'sale_line_id': line.id,
'tracking_id': False, 'tracking_id': False,
'state': 'waiting', 'state': 'draft',
#'state': 'waiting',
'note': line.notes, 'note': line.notes,
}) })
proc_id = self.pool.get('mrp.procurement').create(cr, uid, { proc_id = self.pool.get('mrp.procurement').create(cr, uid, {
@ -829,8 +836,10 @@ class sale_order_line(osv.osv):
[x.id for x in product_obj.taxes_id]) [x.id for x in product_obj.taxes_id])
taxep = None taxep = None
if partner_id: if partner_id:
taxep = self.pool.get('res.partner').browse(cr, uid, taxep_id = self.pool.get('res.partner').property_get(cr, uid,
partner_id).property_account_tax partner_id,property_pref=['property_account_tax']).get('property_account_tax',False)
if taxep_id:
taxep=self.pool.get('account.tax').browse(cr, uid,taxep_id)
if not taxep or not taxep.id: if not taxep or not taxep.id:
result['tax_id'] = [x.id for x in product_obj.taxes_id] result['tax_id'] = [x.id for x in product_obj.taxes_id]
else: else:

View File

@ -41,8 +41,7 @@ class product_product(osv.osv):
def get_product_available(self,cr,uid,ids,context=None): def get_product_available(self,cr,uid,ids,context=None):
if not context: if not context:
context = {} context = {}
print 'CONTEXT', context
states=context.get('states',[]) states=context.get('states',[])
what=context.get('what',()) what=context.get('what',())
if not ids: if not ids:
@ -132,7 +131,9 @@ class product_product(osv.osv):
return res return res
def _get_product_available_func(states, what): def _get_product_available_func(states, what):
def _product_available(self, cr, uid, ids, field_names=False, arg=False, context={}): def _product_available(self, cr, uid, ids, field_names=None, arg=False, context={}):
if not field_names:
field_names=[]
context.update({ context.update({
'states':states, 'states':states,
'what':what 'what':what

View File

@ -102,7 +102,8 @@ class stock_location(osv.osv):
'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'), 'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'),
'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'), 'chained_location_id': fields.many2one('stock.location', 'Chained Location If Fixed'),
'chained_location_type': fields.selection([('','None'),('customer', 'Customer'),('fixed','Fixed Location')], 'Chained Location Type'), 'chained_location_type': fields.selection([('','None'),('customer', 'Customer'),('fixed','Fixed Location')],
'Chained Location Type', required=True),
'chained_auto_packing': fields.selection( 'chained_auto_packing': fields.selection(
[('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')], [('auto','Automatic Move'), ('manual','Manual Operation'),('transparent','Automatic No Step Added')],
'Automatic Move', 'Automatic Move',
@ -422,7 +423,7 @@ class stock_picking(osv.osv):
todo.append(r) todo.append(r)
todo = self.action_explode(cr, uid, todo, context) todo = self.action_explode(cr, uid, todo, context)
if len(todo): if len(todo):
self.pool.get('stock.move').action_confirm(cr,uid, todo, context) self.pool.get('stock.move').action_confirm(cr, uid, todo, context)
return True return True
def test_auto_picking(self, cr, uid, ids): def test_auto_picking(self, cr, uid, ids):
@ -580,11 +581,11 @@ class stock_picking(osv.osv):
res = {} res = {}
sale_line_obj = self.pool.get('sale.order.line') sale_line_obj = self.pool.get('sale.order.line')
for picking in self.browse(cursor, user, ids, context=context): for picking in self.browse(cursor, user, ids, context=context):
if picking.invoice_state != '2binvoiced': if picking.invoice_state != '2binvoiced':
continue continue
payment_term_id = False payment_term_id = False
partner = picking.address_id.partner_id partner = picking.address_id and picking.address_id.partner_id
if type in ('out_invoice', 'out_refund'): if type in ('out_invoice', 'out_refund'):
account_id = partner.property_account_receivable.id account_id = partner.property_account_receivable.id
payment_term_id= picking.sale_id.payment_term.id payment_term_id= picking.sale_id.payment_term.id
@ -711,6 +712,7 @@ class stock_picking(osv.osv):
self.write(cursor, user, res.keys(), { self.write(cursor, user, res.keys(), {
'invoice_state': 'invoiced', 'invoice_state': 'invoiced',
}, context=context) }, context=context)
print res
return res return res
stock_picking() stock_picking()
@ -909,14 +911,12 @@ class stock_move(osv.osv):
cursor.commit() cursor.commit()
def onchange_lot_id(self, cr, uid, context, prodlot_id=False,product_qty=False, loc_id=False): def onchange_lot_id(self, cr, uid, context, prodlot_id=False,product_qty=False, loc_id=False):
print uid, prodlot_id, product_qty, loc_id
if not prodlot_id or not loc_id: if not prodlot_id or not loc_id:
return {} return {}
prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id) prodlot = self.pool.get('stock.production.lot').browse(cr, uid, prodlot_id)
location=self.pool.get('stock.location').browse(cr,uid,loc_id) location=self.pool.get('stock.location').browse(cr,uid,loc_id)
warning={} warning={}
if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)): if (location.usage == 'internal') and (product_qty > (prodlot.stock_available or 0.0)):
print 'Warning'
warning={ warning={
'title':'Bad Lot Assignation !', 'title':'Bad Lot Assignation !',
'message':'You are moving %.2f products but only %.2f available in this lot.' % (product_qty,prodlot.stock_available or 0.0) 'message':'You are moving %.2f products but only %.2f available in this lot.' % (product_qty,prodlot.stock_available or 0.0)

View File

@ -794,6 +794,7 @@
<field name="address_id" select="2"/> <field name="address_id" select="2"/>
<field name="name" select="1" readonly="1"/> <field name="name" select="1" readonly="1"/>
<field name="min_date" select="2"/> <field name="min_date" select="2"/>
<field name="invoice_state"/>
<field name="backorder_id" select="2" readonly="1"/> <field name="backorder_id" select="2" readonly="1"/>
</group> </group>
<notebook colspan="4"> <notebook colspan="4">