parent
8cb88b6054
commit
6c73581318
|
@ -78,7 +78,7 @@ class account_payment_term_line(osv.osv):
|
|||
'value': fields.selection([('procent','Percent'),('balance','Balance'),('fixed','Fixed Amount')], 'Value',required=True),
|
||||
'value_amount': fields.float('Value Amount'),
|
||||
'days': fields.integer('Number of Days',required=True, help="Number of days to add before computation of the day of month."),
|
||||
'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the end of the month)."),
|
||||
'days2': fields.integer('Day of the Month',required=True, help="Day of the month, set -1 for the last day of the current month. If it's positive, it gives the day of the next month. Set 0 for net days (otherwise it's based on the beginning of the month)."),
|
||||
'payment_id': fields.many2one('account.payment.term','Payment Term', required=True, select=True),
|
||||
}
|
||||
_defaults = {
|
||||
|
@ -681,6 +681,7 @@ account_fiscalyear()
|
|||
class account_move(osv.osv):
|
||||
_name = "account.move"
|
||||
_description = "Account Entry"
|
||||
_order = 'id desc'
|
||||
|
||||
def name_get(self, cursor, user, ids, context=None):
|
||||
if not len(ids):
|
||||
|
@ -712,15 +713,15 @@ class account_move(osv.osv):
|
|||
return result
|
||||
|
||||
_columns = {
|
||||
'name': fields.char('Entry Number', size=64, required=True),
|
||||
'name': fields.char('Number', size=64, required=True),
|
||||
'ref': fields.char('Ref', size=64),
|
||||
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
|
||||
'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'posted':[('readonly',True)]}),
|
||||
'state': fields.selection([('draft','Draft'), ('posted','Posted')], 'Status', required=True, readonly=True),
|
||||
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
||||
'to_check': fields.boolean('To Be Verified'),
|
||||
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", store=True),
|
||||
'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2), store=True),
|
||||
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner"),
|
||||
'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2)),
|
||||
'type': fields.selection([
|
||||
('pay_voucher','Cash Payment'),
|
||||
('bank_pay_voucher','Bank Payment'),
|
||||
|
|
|
@ -137,24 +137,26 @@
|
|||
<field name="priority">2</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Supplier invoice">
|
||||
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
|
||||
<field name="type" readonly="1" select="2"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank)" select="1"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<group col="6" colspan="4">
|
||||
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
|
||||
<field name="type" readonly="1" select="2"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
|
||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank)" select="1"/>
|
||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
|
||||
</group>
|
||||
<notebook colspan="4">
|
||||
<page string="Invoice">
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', company_id),('journal_id','=',journal_id)]" name="account_id"/>
|
||||
<field name="date_due" select="1"/>
|
||||
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank" on_change="onchange_partner_bank(partner_bank)" select="2"/>
|
||||
<field name="reference_type" nolabel="1" select="2" size="0"/>
|
||||
<field name="reference" nolabel="1" select="1"/>
|
||||
<field name="check_total" required="2"/>
|
||||
<field name="currency_id" on_change="onchange_currency_id(currency_id)" select="2"/>
|
||||
<field colspan="4" default_get="{'check_total': check_total, 'invoice_line': invoice_line, 'address_invoice_id': address_invoice_id, 'partner_id': partner_id, 'price_type': 'price_type' in dir() and price_type or False}" name="invoice_line" nolabel="1">
|
||||
<tree string="Invoice lines" editable="top">
|
||||
<field name="product_id" on_change="product_id_change(product_id, uos_id, quantity, name, parent.type, parent.partner_id, price_unit, parent.address_invoice_id)"/>
|
||||
<field domain="[('company_id', '=', parent.company_id), ('journal_id', '=', parent.journal_id), ('type', '<>', 'view')]" name="account_id" on_change="onchange_account_id(parent.partner_id,account_id)"/>
|
||||
<field name="invoice_line_tax_id" view_mode="2"/>
|
||||
<field name="invoice_line_tax_id" view_mode="2" domain="[('parent_id','=',False)]"/>
|
||||
<field domain="[('type','<>','view'), ('company_id', '=', parent.company_id)]" name="account_analytic_id"/>
|
||||
<field name="quantity"/>
|
||||
<field name="price_unit"/>
|
||||
|
|
|
@ -110,7 +110,11 @@ class account_move_line(osv.osv):
|
|||
account = journal_obj.default_credit_account_id
|
||||
else:
|
||||
account = journal_obj.default_debit_account_id
|
||||
data['account_id'] = account.id
|
||||
|
||||
|
||||
if account and ((not fields) or ('debit' in fields) or ('credit' in fields)):
|
||||
data['account_id'] = account.id
|
||||
|
||||
s = -total_new
|
||||
data['debit'] = s>0 and s or 0.0
|
||||
data['credit'] = s<0 and -s or 0.0
|
||||
|
@ -122,7 +126,6 @@ class account_move_line(osv.osv):
|
|||
return data
|
||||
|
||||
period_obj = self.pool.get('account.period')
|
||||
tax_obj=self.pool.get('account.tax')
|
||||
|
||||
# Compute the current move
|
||||
move_id = False
|
||||
|
@ -190,7 +193,13 @@ class account_move_line(osv.osv):
|
|||
else:
|
||||
account = move.journal_id.default_debit_account_id
|
||||
|
||||
data['account_id'] = account.id
|
||||
if account and ((not fields) or ('debit' in fields) or ('credit' in fields)):
|
||||
data['account_id'] = account.id
|
||||
# Propose the price VAT excluded, the VAT will be added when confirming line
|
||||
if account.tax_ids:
|
||||
tax = account.tax_ids
|
||||
for t in self.pool.get('account.tax').compute_inv(cr, uid, tax, total, 1):
|
||||
total -= t['amount']
|
||||
|
||||
s = -total
|
||||
data['debit'] = s>0 and s or 0.0
|
||||
|
@ -339,7 +348,7 @@ class account_move_line(osv.osv):
|
|||
#TODO: remove this
|
||||
'amount_taxed':fields.float("Taxed Amount",digits=(16,2)),
|
||||
'parent_move_lines':fields.many2many('account.move.line', 'account_move_line_rel', 'child_id', 'parent_id', 'Parent'),
|
||||
'reconcile_implicit':fields.boolean('Implicit Reconciliaiton')
|
||||
'reconcile_implicit':fields.boolean('Implicit Reconciliation')
|
||||
}
|
||||
|
||||
def _get_date(self, cr, uid, context):
|
||||
|
@ -778,9 +787,8 @@ class account_move_line(osv.osv):
|
|||
|
||||
if not vals.get('move_id', False):
|
||||
if journal.sequence_id:
|
||||
name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
#name = self.pool.get('ir.sequence').get_id(cr, uid, journal.sequence_id.id)
|
||||
v = {
|
||||
'name': name,
|
||||
'period_id': context['period_id'],
|
||||
'journal_id': context['journal_id']
|
||||
}
|
||||
|
|
|
@ -665,14 +665,13 @@
|
|||
<field name="journal_id"/>
|
||||
<field name="debit" sum="Total debit"/>
|
||||
<field name="credit" sum="Total credit"/>
|
||||
<field name="account_tax_id"/>
|
||||
<field name="account_tax_id" groups="base.group_extended"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="amount_currency"/>
|
||||
<field name="currency_id"/>
|
||||
<field name="amount_currency" groups="base.group_extended"/>
|
||||
<field name="currency_id" groups="base.group_extended"/>
|
||||
<field name="state"/>
|
||||
<field name="reconcile_id"/>
|
||||
<field name="reconcile_partial_id"/>
|
||||
<field colspan="4" name="reconcile_implicit"/>
|
||||
<field name="reconcile_partial_id" groups="base.group_extended"/>
|
||||
</tree>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -724,10 +723,10 @@
|
|||
<page string="Analytic Lines">
|
||||
<field colspan="4" name="analytic_lines" nolabel="1"/>
|
||||
</page>
|
||||
<!--<page string="Move Lines">
|
||||
<page string="Linked Lines" groups="base.group_extended">
|
||||
<field colspan="4" name="reconcile_implicit"/>
|
||||
<field colspan="4" name="parent_move_lines" nolabel="0"/>
|
||||
</page>-->
|
||||
</page>
|
||||
</notebook>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -800,13 +799,14 @@
|
|||
<field name="type">tree</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="Account Entry">
|
||||
<field name="ref"/>
|
||||
<field name="name"/>
|
||||
<field name="period_id"/>
|
||||
<field name="ref"/>
|
||||
<field name="journal_id"/>
|
||||
<field name="period_id"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="amount"/>
|
||||
<field name="line_id"/>
|
||||
<field name="to_check" groups="base.group_extended"/>
|
||||
<field name="amount"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -824,8 +824,10 @@
|
|||
<field name="journal_id" select="1"/>
|
||||
<field name="ref" select="1" groups="base.group_extended"/>
|
||||
<field name="to_check" select="2" groups="base.group_extended"/>
|
||||
<field name="type" select="1" groups="base.group_extended"/>
|
||||
<field name="type" select="2" groups="base.group_extended"/>
|
||||
</group>
|
||||
<field name="partner_id" invisible="1" select="1"/>
|
||||
<field name="amount" invisible="1" select="1"/>
|
||||
|
||||
<field colspan="4" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
|
||||
<form string="Account Entry Line">
|
||||
|
@ -862,6 +864,8 @@
|
|||
<field name="debit" sum="Total Debit"/>
|
||||
<field name="credit" sum="Total Credit"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field name="tax_code_id"/>
|
||||
<field name="tax_amount"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
@ -1330,7 +1334,6 @@
|
|||
<field name="credit" sum="Total credit"/>
|
||||
<field name="account_tax_id"/>
|
||||
<field name="analytic_account_id"/>
|
||||
<field colspan="4" name="reconcile_implicit"/>
|
||||
<field name="state"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
|
|
@ -187,23 +187,23 @@ class account_invoice(osv.osv):
|
|||
'move_id': fields.many2one('account.move', 'Invoice Movement', readonly=True, help="Link to the automatically generated account moves."),
|
||||
'amount_untaxed': fields.function(_amount_all, method=True, digits=(16,2),string='Untaxed',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||
},
|
||||
multi='all'),
|
||||
'amount_tax': fields.function(_amount_all, method=True, digits=(16,2), string='Tax',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||
},
|
||||
multi='all'),
|
||||
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||
},
|
||||
multi='all'),
|
||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
||||
|
@ -217,8 +217,9 @@ class account_invoice(osv.osv):
|
|||
'move_lines':fields.function(_get_lines , method=True,type='many2many' , relation='account.move.line',string='Move Lines'),
|
||||
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual',
|
||||
store={
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 12),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 12),
|
||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50),
|
||||
'account.invoice.tax': (_get_invoice_tax, None, 50),
|
||||
'account.invoice.line': (_get_invoice_line, None, 50),
|
||||
},
|
||||
help="Remaining amount due."),
|
||||
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
|
||||
|
|
|
@ -107,9 +107,9 @@ class account_invoice_line(osv.osv):
|
|||
return result.keys()
|
||||
_columns = {
|
||||
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type']), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
|
||||
'price_subtotal_incl': fields.function(_amount_line2, method=True, string='Subtotal', multi='amount',
|
||||
store={'account.invoice':(_get_invoice,['price_type']), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None)}),
|
||||
store={'account.invoice':(_get_invoice,['price_type'],10), 'account.invoice.line': (lambda self,cr,uid,ids,c={}: ids, None,10)}),
|
||||
}
|
||||
|
||||
_defaults = {
|
||||
|
|
|
@ -38,7 +38,10 @@ class delivery_carrier(osv.osv):
|
|||
if order_id:
|
||||
order = sale_obj.browse(cr, uid, [order_id])[0]
|
||||
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
|
||||
price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
|
||||
if carrier_grid:
|
||||
price=grid_obj.get_price(cr, uid, carrier_grid, order, time.strftime('%Y-%m-%d'), context)
|
||||
else:
|
||||
price = 0.0
|
||||
res[carrier.id]=price
|
||||
return res
|
||||
_columns = {
|
||||
|
|
|
@ -70,6 +70,7 @@ class abstracted_fs:
|
|||
|
||||
# Ok
|
||||
def db_list(self):
|
||||
return pooler.pool_dic.keys()
|
||||
s = netsvc.LocalService('db')
|
||||
result = s.list()
|
||||
self.db_name_list = []
|
||||
|
@ -89,8 +90,9 @@ class abstracted_fs:
|
|||
finally:
|
||||
if cr is not None:
|
||||
cr.close()
|
||||
if db is not None:
|
||||
pooler.close_db(db_name)
|
||||
#if db is not None:
|
||||
# pooler.close_db(db_name)
|
||||
print 'Return', self.db_name_list
|
||||
return self.db_name_list
|
||||
|
||||
# Ok
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
##############################################################################
|
||||
{
|
||||
"name" : "Attendances Of Employees",
|
||||
"version" : "1.0",
|
||||
"version" : "1.1",
|
||||
"author" : "Tiny",
|
||||
"category" : "Generic Modules/Human Resources",
|
||||
"description": "This module aims to manage employee's attendances.",
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
|
||||
<data noupdate="True">
|
||||
|
||||
<record id="attendance1" model="hr.attendance">
|
||||
<record id="attendance1" model="hr.attendance">
|
||||
<field eval="time.strftime('%Y-%m-01 08:21')" name="name"/>
|
||||
<field name="action">sign_in</field>
|
||||
<field name="employee_id" ref="hr.employee1"/>
|
||||
|
|
|
@ -776,7 +776,15 @@ class mrp_procurement(osv.osv):
|
|||
'property_ids': fields.many2many('mrp.property', 'mrp_procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||
|
||||
'message': fields.char('Latest error', size=64),
|
||||
'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('exception','Exception'),('running','Running'),('cancel','Cancel'),('done','Done'),('waiting','Waiting')], 'Status')
|
||||
'state': fields.selection([
|
||||
('draft','Draft'),
|
||||
('confirmed','Confirmed'),
|
||||
('exception','Exception'),
|
||||
('running','Running'),
|
||||
('cancel','Cancel'),
|
||||
('ready','Ready'),
|
||||
('done','Done'),
|
||||
('waiting','Waiting')], 'Status')
|
||||
}
|
||||
_defaults = {
|
||||
'state': lambda *a: 'draft',
|
||||
|
@ -1072,7 +1080,7 @@ class mrp_procurement(osv.osv):
|
|||
return True
|
||||
|
||||
def action_check_finnished(self, cr, uid, ids):
|
||||
return True
|
||||
return self.check_move_done(cr, uid, ids)
|
||||
|
||||
def action_check(self, cr, uid, ids):
|
||||
ok = False
|
||||
|
@ -1082,17 +1090,21 @@ class mrp_procurement(osv.osv):
|
|||
ok = True
|
||||
return ok
|
||||
|
||||
def action_ready(self, cr, uid, ids):
|
||||
res = self.write(cr, uid, ids, {'state':'ready'})
|
||||
return res
|
||||
|
||||
def action_done(self, cr, uid, ids):
|
||||
for procurement in self.browse(cr, uid, ids):
|
||||
if procurement.move_id:
|
||||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||
self.pool.get('stock.move').action_done(cr, uid, [procurement.move_id.id])
|
||||
res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
|
||||
|
||||
wf_service = netsvc.LocalService("workflow")
|
||||
for id in ids:
|
||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||
return res
|
||||
|
||||
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
|
||||
'''
|
||||
use_new_cursor: False or the dbname
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','MB1')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Stock')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
<record id="stock_warehouse_orderpoint_1" model="stock.warehouse.orderpoint">
|
||||
<field name="product_max_qty">50.0</field>
|
||||
|
@ -18,7 +18,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','CPU1')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Output')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
<record id="stock_warehouse_orderpoint_2" model="stock.warehouse.orderpoint">
|
||||
<field name="product_max_qty">20.0</field>
|
||||
|
@ -26,7 +26,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','HDD1')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Workshop')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
<record id="stock_warehouse_orderpoint_3" model="stock.warehouse.orderpoint">
|
||||
<field name="product_max_qty">50.0</field>
|
||||
|
@ -34,7 +34,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','FAN')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Stock')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
<record id="stock_warehouse_orderpoint_4" model="stock.warehouse.orderpoint">
|
||||
<field name="product_max_qty">5.0</field>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','PC1')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Output')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
<record id="stock_warehouse_orderpoint_5" model="stock.warehouse.orderpoint">
|
||||
<field name="product_max_qty">50.0</field>
|
||||
|
@ -50,7 +50,7 @@
|
|||
<field model="product.uom" name="product_uom" search="[]"/>
|
||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||
<field model="product.product" name="product_id" search="[('default_code','=','TOW1')]"/>
|
||||
<field model="stock.location" name="location_id" search="[('name','=','Workshop')]"/>
|
||||
<field name="location_id" ref="stock.stock_location_stock"/>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -185,7 +185,9 @@
|
|||
</record>
|
||||
<record id="act_make_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
<field name="name">done</field>
|
||||
<field name="name">ready</field>
|
||||
<field name="kind">function</field>
|
||||
<field name="action">action_ready()</field>
|
||||
</record>
|
||||
<record id="act_wait_done" model="workflow.activity">
|
||||
<field name="wkf_id" ref="wkf"/>
|
||||
|
@ -301,14 +303,9 @@
|
|||
<record id="trans_make_to_stock_make_done" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_to_stock"/>
|
||||
<field name="act_to" ref="act_make_done"/>
|
||||
<field name="condition">check_move_done()</field>
|
||||
<field name="trigger_model">stock.move</field>
|
||||
<field name="trigger_expr_id">[move_id.id]</field>
|
||||
</record>
|
||||
<record id="trans_make_to_stock_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_to_stock"/>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="condition">check_move_cancel()</field>
|
||||
<field name="condition">True</field>
|
||||
<field name="trigger_model" eval="False"/>
|
||||
<field name="trigger_expr_id" eval="False"/>
|
||||
</record>
|
||||
<record id="trans_produce_cancel" model="workflow.transition">
|
||||
<field name="act_from" ref="act_produce"/>
|
||||
|
@ -348,8 +345,8 @@
|
|||
</record>
|
||||
<record id="trans_make_done_confirm" model="workflow.transition">
|
||||
<field name="act_from" ref="act_make_done"/>
|
||||
<field name="act_to" ref="act_confirm"/>
|
||||
<field name="condition">not action_check_finnished()</field>
|
||||
<field name="act_to" ref="act_cancel"/>
|
||||
<field name="condition">check_move_cancel()</field>
|
||||
</record>
|
||||
</data>
|
||||
</openerp>
|
||||
|
|
|
@ -337,7 +337,10 @@ class product_product(osv.osv):
|
|||
pricelist = context.get('pricelist', False)
|
||||
if pricelist:
|
||||
for id in ids:
|
||||
price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, context=context)[pricelist]
|
||||
try:
|
||||
price = self.pool.get('product.pricelist').price_get(cr,uid,[pricelist], id, quantity, context=context)[pricelist]
|
||||
except:
|
||||
price = 0.0
|
||||
res[id] = price
|
||||
for id in ids:
|
||||
res.setdefault(id, 0.0)
|
||||
|
|
|
@ -249,8 +249,8 @@
|
|||
on_change="onchange_planned(planned_hours,effective_hours)"/>
|
||||
<field name="delay_hours" widget="float_time"/>
|
||||
<group col="3" colspan="2">
|
||||
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="2"/>
|
||||
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" attrs="{'invisible':[('state','=','draft')]}"/>
|
||||
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" colspan="2"/>
|
||||
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" states="open,pending"/>
|
||||
</group>
|
||||
<field name="effective_hours" widget="float_time"/>
|
||||
|
||||
|
|
|
@ -20,18 +20,18 @@
|
|||
#
|
||||
##############################################################################
|
||||
{
|
||||
"name" : "Project Management - MRP Link",
|
||||
"name" : "Project Management - MRP and Sale Integration",
|
||||
"version": "1.0",
|
||||
"author" : "Tiny",
|
||||
"website" : "http://www.openerp.com",
|
||||
"category" : "Generic Modules/Projects & Services",
|
||||
"depends" : ["project", 'mrp', "sale", "mrp_jit"],
|
||||
"description": """
|
||||
This module is used to automatically create tasks base on different
|
||||
This module is used to automatically create tasks based on different
|
||||
procurements: sales order, manufacturing order, ...
|
||||
|
||||
It is mainly used to invoices services based on tasks by doing sales
|
||||
order on services products.
|
||||
It is mainly used to invoices services based on tasks automatically
|
||||
created by sales orders.
|
||||
""",
|
||||
"init_xml" : [],
|
||||
"demo_xml" : [],
|
||||
|
|
|
@ -31,7 +31,6 @@ class product_product(osv.osv):
|
|||
|
||||
def _pricelist_calculate(self, cr, uid, ids, name, arg, context=None):
|
||||
result = {}
|
||||
format=""
|
||||
pricelist_obj=self.pool.get('product.pricelist')
|
||||
if name=='pricelist_purchase':
|
||||
pricelist_ids=pricelist_obj.search(cr,uid,[('type','=','purchase')])
|
||||
|
@ -39,17 +38,18 @@ class product_product(osv.osv):
|
|||
pricelist_ids=pricelist_obj.search(cr,uid,[('type','=','sale')])
|
||||
pricelist_browse=pricelist_obj.browse(cr,uid,pricelist_ids)
|
||||
for product in self.browse(cr, uid, ids, context):
|
||||
result[product.id] = ""
|
||||
for pricelist in pricelist_browse:
|
||||
for version in pricelist.version_id:
|
||||
for items in version.items_id:
|
||||
qty=items.min_quantity
|
||||
price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
|
||||
if name=='pricelist_purchase':
|
||||
format+=pricelist.name + "\t" +str(qty) +" \t\t" + str(price[pricelist.id]) + "\n"
|
||||
else:
|
||||
format+=pricelist.name + "\t\t\t" +str(qty) +" \t\t\t" + str(price[pricelist.id]) + "\n"
|
||||
result[product.id]=format
|
||||
format=""
|
||||
try:
|
||||
price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
|
||||
except:
|
||||
price = 0.0
|
||||
result[product.id]+= ("%s (%.2f) : %.2f" % (pricelist.name,qty or 0.0,price[pricelist.id] or 0.0)) + "\n"
|
||||
break
|
||||
break
|
||||
return result
|
||||
|
||||
_columns = {
|
||||
|
|
|
@ -10,8 +10,8 @@
|
|||
<field name="arch" type="xml">
|
||||
<field colspan="4" name="seller_ids" nolabel="1" position="after">
|
||||
<group colspan="4" groups="base.group_extended">
|
||||
<separator string="Sale Pricelists Min.Qty Price" colspan="2"/>
|
||||
<separator string="Purchase Pricelists Min.Qty Price" colspan="2"/>
|
||||
<separator string="Sale Pricelists (Min.Qty) : Price" colspan="2"/>
|
||||
<separator string="Purchase Pricelists (Min.Qty) : Price" colspan="2"/>
|
||||
<field nolabel="1" name="pricelist_sale" colspan="2"/>
|
||||
<field nolabel="1" name="pricelist_purchase" colspan="2"/>
|
||||
</group>
|
||||
|
|
|
@ -382,7 +382,7 @@ class sale_order(osv.osv):
|
|||
return inv_id
|
||||
|
||||
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done']):
|
||||
def action_invoice_create(self, cr, uid, ids, grouped=False, states=['confirmed','done','exception']):
|
||||
res = False
|
||||
invoices = {}
|
||||
invoice_ids = []
|
||||
|
@ -401,7 +401,7 @@ class sale_order(osv.osv):
|
|||
for i in o.invoice_ids:
|
||||
if i.state == 'draft':
|
||||
return i.id
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
picking_obj=self.pool.get('stock.picking')
|
||||
for val in invoices.values():
|
||||
if grouped:
|
||||
res = self._make_invoice(cr, uid, val[0][0], reduce(lambda x,y: x + y, [l for o,l in val], []))
|
||||
|
@ -409,7 +409,7 @@ class sale_order(osv.osv):
|
|||
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 (%s,%s)', (o.id, res))
|
||||
else:
|
||||
for order, il in val:
|
||||
res = self._make_invoice(cr, uid, order, il)
|
||||
|
@ -417,7 +417,7 @@ class sale_order(osv.osv):
|
|||
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 (%s,%s)', (order.id, res))
|
||||
return res
|
||||
|
||||
def action_invoice_cancel(self, cr, uid, ids, context={}):
|
||||
|
@ -499,26 +499,24 @@ class sale_order(osv.osv):
|
|||
write_cancel_ids = []
|
||||
for order in self.browse(cr, uid, ids, context={}):
|
||||
for line in order.order_line:
|
||||
if (not line.procurement_id) or (line.procurement_id.state=='done') or (line.procurement_id.move_id and line.procurement_id.move_id.state=='done'):
|
||||
if (not line.procurement_id) or (line.procurement_id.state=='done'):
|
||||
finished = True
|
||||
if line.state != 'done':
|
||||
write_done_ids.append(line.id)
|
||||
else:
|
||||
finished = False
|
||||
if line.procurement_id:
|
||||
if (line.procurement_id.state == 'cancel') or (line.procurement_id.move_id and line.procurement_id.move_id.state=='cancel'):
|
||||
if (line.procurement_id.state == 'cancel'):
|
||||
canceled = True
|
||||
if line.state != 'cancel':
|
||||
if line.state != 'exception':
|
||||
write_cancel_ids.append(line.id)
|
||||
else:
|
||||
notcanceled = True
|
||||
# if a line is finished (ie its procuremnt is done or it has not procuremernt and it
|
||||
# is not already marked as done, mark it as being so...
|
||||
if ((not line.procurement_id) or line.procurement_id.state == 'done') and line.state != 'done':
|
||||
write_done_ids.append(line.id)
|
||||
|
||||
if write_done_ids:
|
||||
self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
|
||||
if write_cancel_ids:
|
||||
self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'cancel'})
|
||||
self.pool.get('sale.order.line').write(cr, uid, write_cancel_ids, {'state': 'exception'})
|
||||
|
||||
if mode=='finished':
|
||||
return finished
|
||||
|
@ -622,8 +620,12 @@ class sale_order(osv.osv):
|
|||
|
||||
if order.state=='shipping_except':
|
||||
val['state'] = 'progress'
|
||||
if (order.order_policy == 'manual') and order.invoice_ids:
|
||||
val['state'] = 'manual'
|
||||
|
||||
if (order.order_policy == 'manual'):
|
||||
for line in order.order_line:
|
||||
if (not line.invoiced) and (line.state not in ('cancel','draft')):
|
||||
val['state'] = 'manual'
|
||||
break
|
||||
self.write(cr, uid, [order.id], val)
|
||||
|
||||
return True
|
||||
|
@ -632,10 +634,18 @@ class sale_order(osv.osv):
|
|||
for order in self.browse(cr, uid, ids):
|
||||
val = {'shipped':True}
|
||||
if order.state=='shipping_except':
|
||||
if (order.order_policy=='manual') and not order.invoice_ids:
|
||||
val['state'] = 'manual'
|
||||
else:
|
||||
val['state'] = 'progress'
|
||||
val['state'] = 'progress'
|
||||
if (order.order_policy == 'manual'):
|
||||
for line in order.order_line:
|
||||
if (not line.invoiced) and (line.state not in ('cancel','draft')):
|
||||
val['state'] = 'manual'
|
||||
break
|
||||
for line in order.order_line:
|
||||
towrite = []
|
||||
if line.state=='exception':
|
||||
towrite.append(line.id)
|
||||
if towrite:
|
||||
self.pool.get('sale.order.line').write(cr, uid, towrite, {'state':'done'},context=context)
|
||||
self.write(cr, uid, [order.id], val)
|
||||
return True
|
||||
|
||||
|
@ -717,7 +727,7 @@ class sale_order_line(osv.osv):
|
|||
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number packages'),
|
||||
'notes': fields.text('Notes'),
|
||||
'th_weight' : fields.float('Weight'),
|
||||
'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('done','Done'),('cancel','Canceled')], 'Status', required=True, readonly=True),
|
||||
'state': fields.selection([('draft','Draft'),('confirmed','Confirmed'),('done','Done'),('cancel','Canceled'),('exception','Exception')], 'Status', required=True, readonly=True),
|
||||
'order_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer')
|
||||
}
|
||||
_order = 'sequence, id'
|
||||
|
@ -787,11 +797,17 @@ class sale_order_line(osv.osv):
|
|||
'note': line.notes,
|
||||
'account_analytic_id': line.order_id.project_id.id,
|
||||
})
|
||||
cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%d,%d)', (line.id, inv_id))
|
||||
cr.execute('insert into sale_order_line_invoice_rel (order_line_id,invoice_id) values (%s,%s)', (line.id, inv_id))
|
||||
self.write(cr, uid, [line.id], {'invoiced':True})
|
||||
create_ids.append(inv_id)
|
||||
return create_ids
|
||||
|
||||
def button_cancel(self, cr, uid, ids, context={}):
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.invoiced:
|
||||
raise osv.except_osv(_('Invalid action !'), _('You can not cancel a sale order line that has already been invoiced !'))
|
||||
return self.write(cr, uid, ids, {'state':'cancel'})
|
||||
|
||||
def button_confirm(self, cr, uid, ids, context={}):
|
||||
return self.write(cr, uid, ids, {'state':'confirmed'})
|
||||
|
||||
|
|
|
@ -384,11 +384,11 @@
|
|||
<page string="Order Lines">
|
||||
<separator colspan="4" string="Automatic Declaration"/>
|
||||
<field name="order_id" select="1"/>
|
||||
<field name="invoiced" select="2"/>
|
||||
<field name="order_partner_id" readonly="1" select="1" invisible="1"/>
|
||||
<field name="product_uom_qty" readonly="1" select="2"/>
|
||||
<field name="product_uom" readonly="2"/>
|
||||
<field name="product_id" readonly="1" select="1"/>
|
||||
<field name="order_partner_id" readonly="1" select="1" invisible="1"/>
|
||||
<field name="invoiced" select="2"/>
|
||||
|
||||
<separator colspan="4" string="Manual Designation"/>
|
||||
<field colspan="4" name="name" select="2"/>
|
||||
|
@ -401,7 +401,8 @@
|
|||
<separator colspan="4" string="States"/>
|
||||
<field name="state" select="2"/>
|
||||
<group col="2" colspan="2">
|
||||
<button name="button_done" states="confirmed" string="Done" type="object"/>
|
||||
<button name="button_done" states="confirmed,exception" string="Done" type="object"/>
|
||||
<button name="button_cancel" states="confirmed,exception" string="Cancel" type="object"/>
|
||||
</group>
|
||||
</page>
|
||||
<page string="Properties">
|
||||
|
|
|
@ -66,7 +66,7 @@ def _makeInvoices(self, cr, uid, data, context):
|
|||
return inv_id
|
||||
|
||||
for line in pool.get('sale.order.line').browse(cr,uid,data['ids']):
|
||||
if not line.invoiced:
|
||||
if (not line.invoiced) and (line.state not in ('draft','cancel')):
|
||||
if not line.order_id.id in invoices:
|
||||
invoices[line.order_id.id] = []
|
||||
line_id = pool.get('sale.order.line').invoice_line_create(cr, uid,
|
||||
|
@ -91,7 +91,7 @@ def _makeInvoices(self, cr, uid, data, context):
|
|||
il = map(lambda x: x[1], result)
|
||||
res = make_invoice(order, il)
|
||||
cr.execute('INSERT INTO sale_order_invoice_rel \
|
||||
(order_id,invoice_id) values (%d,%d)', (order.id, res))
|
||||
(order_id,invoice_id) values (%s,%s)', (order.id, res))
|
||||
return {}
|
||||
|
||||
|
||||
|
|
|
@ -234,9 +234,9 @@ class stock_location(osv.osv):
|
|||
result = []
|
||||
amount = 0.0
|
||||
for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
|
||||
cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and product_id=%s and state='done' group by product_uom", (id,product_id))
|
||||
cr.execute("select product_uom,sum(product_qty) as product_qty from stock_move where location_dest_id=%s and location_id<>%s and product_id=%s and state='done' group by product_uom", (id,id,product_id))
|
||||
results = cr.dictfetchall()
|
||||
cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id,product_id))
|
||||
cr.execute("select product_uom,-sum(product_qty) as product_qty from stock_move where location_id=%s and location_dest_id<>%s and product_id=%s and state in ('done', 'assigned') group by product_uom", (id,id,product_id))
|
||||
results += cr.dictfetchall()
|
||||
|
||||
total = 0.0
|
||||
|
|
|
@ -540,7 +540,10 @@
|
|||
<field name="date_planned"/>
|
||||
<field name="address_id" select="1" context="{'context_display':'partner'}"/>
|
||||
<field groups="base.group_extended" name="product_packaging"/>
|
||||
<field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="prodlot_id" select="2"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field groups="base.group_extended" name="tracking_id" select="2"/>
|
||||
<newline/>
|
||||
<label/>
|
||||
|
@ -633,7 +636,10 @@
|
|||
<field invisible="1" name="date"/>
|
||||
<field name="date_planned"/>
|
||||
<field groups="base.group_extended" name="product_packaging"/>
|
||||
<field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="prodlot_id" select="2"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
<field name="state" select="1"/>
|
||||
|
@ -821,7 +827,10 @@
|
|||
<field invisible="1" name="date"/>
|
||||
<field name="date_planned"/>
|
||||
<field groups="base.group_extended" name="product_packaging"/>
|
||||
<field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="prodlot_id" select="1"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||
<button name="%(track_line)d" string="Split in production lots" type="action"/>
|
||||
<separator colspan="4" string="Move State"/>
|
||||
|
@ -1005,7 +1014,10 @@
|
|||
<newline/>
|
||||
<field groups="base.group_extended" name="product_packaging"/>
|
||||
<newline/>
|
||||
<field name="prodlot_id" select="1" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="prodlot_id" select="1"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||
<newline/>
|
||||
<label/>
|
||||
|
@ -1220,7 +1232,10 @@
|
|||
<field name="priority"/>
|
||||
<field name="address_id" select="2" context="{'context_display':'partner'}"/>
|
||||
<newline/>
|
||||
<field name="prodlot_id" select="2" context="{'location_id':location_id, 'product_id':product_id}" domain="[('product_id','=',product_id)]" on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="prodlot_id" select="2"
|
||||
context="{'location_id':location_id, 'product_id':product_id}"
|
||||
domain="[('product_id','=',product_id)]"
|
||||
on_change="onchange_lot_id(prodlot_id,product_qty, location_id)"/>
|
||||
<field name="tracking_id" select="2"/>
|
||||
<newline/>
|
||||
<label/>
|
||||
|
|
Loading…
Reference in New Issue