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': fields.selection([('procent','Percent'),('balance','Balance'),('fixed','Fixed Amount')], 'Value',required=True),
|
||||||
'value_amount': fields.float('Value Amount'),
|
'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."),
|
'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),
|
'payment_id': fields.many2one('account.payment.term','Payment Term', required=True, select=True),
|
||||||
}
|
}
|
||||||
_defaults = {
|
_defaults = {
|
||||||
|
@ -681,6 +681,7 @@ account_fiscalyear()
|
||||||
class account_move(osv.osv):
|
class account_move(osv.osv):
|
||||||
_name = "account.move"
|
_name = "account.move"
|
||||||
_description = "Account Entry"
|
_description = "Account Entry"
|
||||||
|
_order = 'id desc'
|
||||||
|
|
||||||
def name_get(self, cursor, user, ids, context=None):
|
def name_get(self, cursor, user, ids, context=None):
|
||||||
if not len(ids):
|
if not len(ids):
|
||||||
|
@ -712,15 +713,15 @@ class account_move(osv.osv):
|
||||||
return result
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
'name': fields.char('Entry Number', size=64, required=True),
|
'name': fields.char('Number', size=64, required=True),
|
||||||
'ref': fields.char('Ref', size=64),
|
'ref': fields.char('Ref', size=64),
|
||||||
'period_id': fields.many2one('account.period', 'Period', required=True, states={'posted':[('readonly',True)]}),
|
'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)]}),
|
'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),
|
'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)]}),
|
'line_id': fields.one2many('account.move.line', 'move_id', 'Entries', states={'posted':[('readonly',True)]}),
|
||||||
'to_check': fields.boolean('To Be Verified'),
|
'to_check': fields.boolean('To Be Verified'),
|
||||||
'partner_id': fields.related('line_id', 'partner_id', type="many2one", relation="res.partner", string="Partner", 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), store=True),
|
'amount': fields.function(_amount_compute, method=True, string='Amount', digits=(16,2)),
|
||||||
'type': fields.selection([
|
'type': fields.selection([
|
||||||
('pay_voucher','Cash Payment'),
|
('pay_voucher','Cash Payment'),
|
||||||
('bank_pay_voucher','Bank Payment'),
|
('bank_pay_voucher','Bank Payment'),
|
||||||
|
|
|
@ -137,24 +137,26 @@
|
||||||
<field name="priority">2</field>
|
<field name="priority">2</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<form string="Supplier invoice">
|
<form string="Supplier invoice">
|
||||||
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
|
<group col="6" colspan="4">
|
||||||
<field name="type" readonly="1" select="2"/>
|
<field domain="[('type', '=', 'purchase')]" name="journal_id" select="2"/>
|
||||||
<field name="partner_id" on_change="onchange_partner_id(type,partner_id,date_invoice,payment_term, partner_bank)" select="1"/>
|
<field name="type" readonly="1" select="2"/>
|
||||||
<field domain="[('partner_id','=',partner_id)]" name="address_invoice_id"/>
|
<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">
|
<notebook colspan="4">
|
||||||
<page string="Invoice">
|
<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 name="date_due" select="1"/>
|
||||||
<field domain="[('partner_id', '=', partner_id)]" name="partner_bank" on_change="onchange_partner_bank(partner_bank)" select="2"/>
|
<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_type" nolabel="1" select="2" size="0"/>
|
||||||
<field name="reference" nolabel="1" select="1"/>
|
<field name="reference" nolabel="1" select="1"/>
|
||||||
<field name="check_total" required="2"/>
|
<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">
|
<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">
|
<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 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 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 domain="[('type','<>','view'), ('company_id', '=', parent.company_id)]" name="account_analytic_id"/>
|
||||||
<field name="quantity"/>
|
<field name="quantity"/>
|
||||||
<field name="price_unit"/>
|
<field name="price_unit"/>
|
||||||
|
|
|
@ -110,7 +110,11 @@ class account_move_line(osv.osv):
|
||||||
account = journal_obj.default_credit_account_id
|
account = journal_obj.default_credit_account_id
|
||||||
else:
|
else:
|
||||||
account = journal_obj.default_debit_account_id
|
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
|
s = -total_new
|
||||||
data['debit'] = s>0 and s or 0.0
|
data['debit'] = s>0 and s or 0.0
|
||||||
data['credit'] = 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
|
return data
|
||||||
|
|
||||||
period_obj = self.pool.get('account.period')
|
period_obj = self.pool.get('account.period')
|
||||||
tax_obj=self.pool.get('account.tax')
|
|
||||||
|
|
||||||
# Compute the current move
|
# Compute the current move
|
||||||
move_id = False
|
move_id = False
|
||||||
|
@ -190,7 +193,13 @@ class account_move_line(osv.osv):
|
||||||
else:
|
else:
|
||||||
account = move.journal_id.default_debit_account_id
|
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
|
s = -total
|
||||||
data['debit'] = s>0 and s or 0.0
|
data['debit'] = s>0 and s or 0.0
|
||||||
|
@ -339,7 +348,7 @@ class account_move_line(osv.osv):
|
||||||
#TODO: remove this
|
#TODO: remove this
|
||||||
'amount_taxed':fields.float("Taxed Amount",digits=(16,2)),
|
'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'),
|
'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):
|
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 not vals.get('move_id', False):
|
||||||
if journal.sequence_id:
|
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 = {
|
v = {
|
||||||
'name': name,
|
|
||||||
'period_id': context['period_id'],
|
'period_id': context['period_id'],
|
||||||
'journal_id': context['journal_id']
|
'journal_id': context['journal_id']
|
||||||
}
|
}
|
||||||
|
|
|
@ -665,14 +665,13 @@
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
<field name="debit" sum="Total debit"/>
|
<field name="debit" sum="Total debit"/>
|
||||||
<field name="credit" sum="Total credit"/>
|
<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="analytic_account_id"/>
|
||||||
<field name="amount_currency"/>
|
<field name="amount_currency" groups="base.group_extended"/>
|
||||||
<field name="currency_id"/>
|
<field name="currency_id" groups="base.group_extended"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
<field name="reconcile_id"/>
|
<field name="reconcile_id"/>
|
||||||
<field name="reconcile_partial_id"/>
|
<field name="reconcile_partial_id" groups="base.group_extended"/>
|
||||||
<field colspan="4" name="reconcile_implicit"/>
|
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
@ -724,10 +723,10 @@
|
||||||
<page string="Analytic Lines">
|
<page string="Analytic Lines">
|
||||||
<field colspan="4" name="analytic_lines" nolabel="1"/>
|
<field colspan="4" name="analytic_lines" nolabel="1"/>
|
||||||
</page>
|
</page>
|
||||||
<!--<page string="Move Lines">
|
<page string="Linked Lines" groups="base.group_extended">
|
||||||
<field colspan="4" name="reconcile_implicit"/>
|
<field colspan="4" name="reconcile_implicit"/>
|
||||||
<field colspan="4" name="parent_move_lines" nolabel="0"/>
|
<field colspan="4" name="parent_move_lines" nolabel="0"/>
|
||||||
</page>-->
|
</page>
|
||||||
</notebook>
|
</notebook>
|
||||||
</form>
|
</form>
|
||||||
</field>
|
</field>
|
||||||
|
@ -800,13 +799,14 @@
|
||||||
<field name="type">tree</field>
|
<field name="type">tree</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="Account Entry">
|
<tree string="Account Entry">
|
||||||
<field name="ref"/>
|
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="period_id"/>
|
<field name="ref"/>
|
||||||
<field name="journal_id"/>
|
<field name="journal_id"/>
|
||||||
|
<field name="period_id"/>
|
||||||
<field name="partner_id"/>
|
<field name="partner_id"/>
|
||||||
<field name="amount"/>
|
|
||||||
<field name="line_id"/>
|
<field name="line_id"/>
|
||||||
|
<field name="to_check" groups="base.group_extended"/>
|
||||||
|
<field name="amount"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
@ -824,8 +824,10 @@
|
||||||
<field name="journal_id" select="1"/>
|
<field name="journal_id" select="1"/>
|
||||||
<field name="ref" select="1" groups="base.group_extended"/>
|
<field name="ref" select="1" groups="base.group_extended"/>
|
||||||
<field name="to_check" select="2" 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>
|
</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 }">
|
<field colspan="4" name="line_id" nolabel="1" widget="one2many_list" default_get="{'lines':line_id ,'journal':journal_id }">
|
||||||
<form string="Account Entry Line">
|
<form string="Account Entry Line">
|
||||||
|
@ -862,6 +864,8 @@
|
||||||
<field name="debit" sum="Total Debit"/>
|
<field name="debit" sum="Total Debit"/>
|
||||||
<field name="credit" sum="Total Credit"/>
|
<field name="credit" sum="Total Credit"/>
|
||||||
<field name="analytic_account_id"/>
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="tax_code_id"/>
|
||||||
|
<field name="tax_amount"/>
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</field>
|
||||||
|
@ -1330,7 +1334,6 @@
|
||||||
<field name="credit" sum="Total credit"/>
|
<field name="credit" sum="Total credit"/>
|
||||||
<field name="account_tax_id"/>
|
<field name="account_tax_id"/>
|
||||||
<field name="analytic_account_id"/>
|
<field name="analytic_account_id"/>
|
||||||
<field colspan="4" name="reconcile_implicit"/>
|
|
||||||
<field name="state"/>
|
<field name="state"/>
|
||||||
</tree>
|
</tree>
|
||||||
</field>
|
</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."),
|
'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',
|
'amount_untaxed': fields.function(_amount_all, method=True, digits=(16,2),string='Untaxed',
|
||||||
store={
|
store={
|
||||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||||
},
|
},
|
||||||
multi='all'),
|
multi='all'),
|
||||||
'amount_tax': fields.function(_amount_all, method=True, digits=(16,2), string='Tax',
|
'amount_tax': fields.function(_amount_all, method=True, digits=(16,2), string='Tax',
|
||||||
store={
|
store={
|
||||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||||
},
|
},
|
||||||
multi='all'),
|
multi='all'),
|
||||||
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',
|
'amount_total': fields.function(_amount_all, method=True, digits=(16,2), string='Total',
|
||||||
store={
|
store={
|
||||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 10),
|
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 20),
|
||||||
'account.invoice.tax': (_get_invoice_tax, None, 10),
|
'account.invoice.tax': (_get_invoice_tax, None, 20),
|
||||||
'account.invoice.line': (_get_invoice_line, None, 10),
|
'account.invoice.line': (_get_invoice_line, None, 20),
|
||||||
},
|
},
|
||||||
multi='all'),
|
multi='all'),
|
||||||
'currency_id': fields.many2one('res.currency', 'Currency', required=True, readonly=True, states={'draft':[('readonly',False)]}),
|
'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'),
|
'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',
|
'residual': fields.function(_amount_residual, method=True, digits=(16,2),string='Residual',
|
||||||
store={
|
store={
|
||||||
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 12),
|
'account.invoice': (lambda self, cr, uid, ids, c={}: ids, None, 50),
|
||||||
'account.invoice.tax': (_get_invoice_tax, None, 12),
|
'account.invoice.tax': (_get_invoice_tax, None, 50),
|
||||||
|
'account.invoice.line': (_get_invoice_line, None, 50),
|
||||||
},
|
},
|
||||||
help="Remaining amount due."),
|
help="Remaining amount due."),
|
||||||
'payment_ids': fields.function(_compute_lines, method=True, relation='account.move.line', type="many2many", string='Payments'),
|
'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()
|
return result.keys()
|
||||||
_columns = {
|
_columns = {
|
||||||
'price_subtotal': fields.function(_amount_line2, method=True, string='Subtotal w/o tax', multi='amount',
|
'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',
|
'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 = {
|
_defaults = {
|
||||||
|
|
|
@ -38,7 +38,10 @@ class delivery_carrier(osv.osv):
|
||||||
if order_id:
|
if order_id:
|
||||||
order = sale_obj.browse(cr, uid, [order_id])[0]
|
order = sale_obj.browse(cr, uid, [order_id])[0]
|
||||||
carrier_grid=self.grid_get(cr,uid,[carrier.id],order.partner_shipping_id.id,context)
|
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
|
res[carrier.id]=price
|
||||||
return res
|
return res
|
||||||
_columns = {
|
_columns = {
|
||||||
|
|
|
@ -70,6 +70,7 @@ class abstracted_fs:
|
||||||
|
|
||||||
# Ok
|
# Ok
|
||||||
def db_list(self):
|
def db_list(self):
|
||||||
|
return pooler.pool_dic.keys()
|
||||||
s = netsvc.LocalService('db')
|
s = netsvc.LocalService('db')
|
||||||
result = s.list()
|
result = s.list()
|
||||||
self.db_name_list = []
|
self.db_name_list = []
|
||||||
|
@ -89,8 +90,9 @@ class abstracted_fs:
|
||||||
finally:
|
finally:
|
||||||
if cr is not None:
|
if cr is not None:
|
||||||
cr.close()
|
cr.close()
|
||||||
if db is not None:
|
#if db is not None:
|
||||||
pooler.close_db(db_name)
|
# pooler.close_db(db_name)
|
||||||
|
print 'Return', self.db_name_list
|
||||||
return self.db_name_list
|
return self.db_name_list
|
||||||
|
|
||||||
# Ok
|
# Ok
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
##############################################################################
|
##############################################################################
|
||||||
{
|
{
|
||||||
"name" : "Attendances Of Employees",
|
"name" : "Attendances Of Employees",
|
||||||
"version" : "1.0",
|
"version" : "1.1",
|
||||||
"author" : "Tiny",
|
"author" : "Tiny",
|
||||||
"category" : "Generic Modules/Human Resources",
|
"category" : "Generic Modules/Human Resources",
|
||||||
"description": "This module aims to manage employee's attendances.",
|
"description": "This module aims to manage employee's attendances.",
|
||||||
|
|
|
@ -1,10 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<openerp>
|
<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 eval="time.strftime('%Y-%m-01 08:21')" name="name"/>
|
||||||
<field name="action">sign_in</field>
|
<field name="action">sign_in</field>
|
||||||
<field name="employee_id" ref="hr.employee1"/>
|
<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'),
|
'property_ids': fields.many2many('mrp.property', 'mrp_procurement_property_rel', 'procurement_id','property_id', 'Properties'),
|
||||||
|
|
||||||
'message': fields.char('Latest error', size=64),
|
'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 = {
|
_defaults = {
|
||||||
'state': lambda *a: 'draft',
|
'state': lambda *a: 'draft',
|
||||||
|
@ -1072,7 +1080,7 @@ class mrp_procurement(osv.osv):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def action_check_finnished(self, cr, uid, ids):
|
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):
|
def action_check(self, cr, uid, ids):
|
||||||
ok = False
|
ok = False
|
||||||
|
@ -1082,17 +1090,21 @@ class mrp_procurement(osv.osv):
|
||||||
ok = True
|
ok = True
|
||||||
return ok
|
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):
|
def action_done(self, cr, uid, ids):
|
||||||
for procurement in self.browse(cr, uid, ids):
|
for procurement in self.browse(cr, uid, ids):
|
||||||
if procurement.move_id:
|
if procurement.move_id:
|
||||||
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
if procurement.close_move and (procurement.move_id.state <> 'done'):
|
||||||
self.pool.get('stock.move').action_done(cr, uid, [procurement.move_id.id])
|
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')})
|
res = self.write(cr, uid, ids, {'state':'done', 'date_close':time.strftime('%Y-%m-%d')})
|
||||||
|
|
||||||
wf_service = netsvc.LocalService("workflow")
|
wf_service = netsvc.LocalService("workflow")
|
||||||
for id in ids:
|
for id in ids:
|
||||||
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
wf_service.trg_trigger(uid, 'mrp.procurement', id, cr)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
|
def run_scheduler(self, cr, uid, automatic=False, use_new_cursor=False, context=None):
|
||||||
'''
|
'''
|
||||||
use_new_cursor: False or the dbname
|
use_new_cursor: False or the dbname
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','MB1')]"/>
|
<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>
|
||||||
<record id="stock_warehouse_orderpoint_1" model="stock.warehouse.orderpoint">
|
<record id="stock_warehouse_orderpoint_1" model="stock.warehouse.orderpoint">
|
||||||
<field name="product_max_qty">50.0</field>
|
<field name="product_max_qty">50.0</field>
|
||||||
|
@ -18,7 +18,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','CPU1')]"/>
|
<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>
|
||||||
<record id="stock_warehouse_orderpoint_2" model="stock.warehouse.orderpoint">
|
<record id="stock_warehouse_orderpoint_2" model="stock.warehouse.orderpoint">
|
||||||
<field name="product_max_qty">20.0</field>
|
<field name="product_max_qty">20.0</field>
|
||||||
|
@ -26,7 +26,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','HDD1')]"/>
|
<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>
|
||||||
<record id="stock_warehouse_orderpoint_3" model="stock.warehouse.orderpoint">
|
<record id="stock_warehouse_orderpoint_3" model="stock.warehouse.orderpoint">
|
||||||
<field name="product_max_qty">50.0</field>
|
<field name="product_max_qty">50.0</field>
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','FAN')]"/>
|
<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>
|
||||||
<record id="stock_warehouse_orderpoint_4" model="stock.warehouse.orderpoint">
|
<record id="stock_warehouse_orderpoint_4" model="stock.warehouse.orderpoint">
|
||||||
<field name="product_max_qty">5.0</field>
|
<field name="product_max_qty">5.0</field>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','PC1')]"/>
|
<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>
|
||||||
<record id="stock_warehouse_orderpoint_5" model="stock.warehouse.orderpoint">
|
<record id="stock_warehouse_orderpoint_5" model="stock.warehouse.orderpoint">
|
||||||
<field name="product_max_qty">50.0</field>
|
<field name="product_max_qty">50.0</field>
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
<field model="product.uom" name="product_uom" search="[]"/>
|
<field model="product.uom" name="product_uom" search="[]"/>
|
||||||
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
<field model="stock.warehouse" name="warehouse_id" search="[]"/>
|
||||||
<field model="product.product" name="product_id" search="[('default_code','=','TOW1')]"/>
|
<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>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -185,7 +185,9 @@
|
||||||
</record>
|
</record>
|
||||||
<record id="act_make_done" model="workflow.activity">
|
<record id="act_make_done" model="workflow.activity">
|
||||||
<field name="wkf_id" ref="wkf"/>
|
<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>
|
||||||
<record id="act_wait_done" model="workflow.activity">
|
<record id="act_wait_done" model="workflow.activity">
|
||||||
<field name="wkf_id" ref="wkf"/>
|
<field name="wkf_id" ref="wkf"/>
|
||||||
|
@ -301,14 +303,9 @@
|
||||||
<record id="trans_make_to_stock_make_done" model="workflow.transition">
|
<record id="trans_make_to_stock_make_done" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_make_to_stock"/>
|
<field name="act_from" ref="act_make_to_stock"/>
|
||||||
<field name="act_to" ref="act_make_done"/>
|
<field name="act_to" ref="act_make_done"/>
|
||||||
<field name="condition">check_move_done()</field>
|
<field name="condition">True</field>
|
||||||
<field name="trigger_model">stock.move</field>
|
<field name="trigger_model" eval="False"/>
|
||||||
<field name="trigger_expr_id">[move_id.id]</field>
|
<field name="trigger_expr_id" eval="False"/>
|
||||||
</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>
|
|
||||||
</record>
|
</record>
|
||||||
<record id="trans_produce_cancel" model="workflow.transition">
|
<record id="trans_produce_cancel" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_produce"/>
|
<field name="act_from" ref="act_produce"/>
|
||||||
|
@ -348,8 +345,8 @@
|
||||||
</record>
|
</record>
|
||||||
<record id="trans_make_done_confirm" model="workflow.transition">
|
<record id="trans_make_done_confirm" model="workflow.transition">
|
||||||
<field name="act_from" ref="act_make_done"/>
|
<field name="act_from" ref="act_make_done"/>
|
||||||
<field name="act_to" ref="act_confirm"/>
|
<field name="act_to" ref="act_cancel"/>
|
||||||
<field name="condition">not action_check_finnished()</field>
|
<field name="condition">check_move_cancel()</field>
|
||||||
</record>
|
</record>
|
||||||
</data>
|
</data>
|
||||||
</openerp>
|
</openerp>
|
||||||
|
|
|
@ -337,7 +337,10 @@ class product_product(osv.osv):
|
||||||
pricelist = context.get('pricelist', False)
|
pricelist = context.get('pricelist', False)
|
||||||
if pricelist:
|
if pricelist:
|
||||||
for id in ids:
|
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
|
res[id] = price
|
||||||
for id in ids:
|
for id in ids:
|
||||||
res.setdefault(id, 0.0)
|
res.setdefault(id, 0.0)
|
||||||
|
|
|
@ -249,8 +249,8 @@
|
||||||
on_change="onchange_planned(planned_hours,effective_hours)"/>
|
on_change="onchange_planned(planned_hours,effective_hours)"/>
|
||||||
<field name="delay_hours" widget="float_time"/>
|
<field name="delay_hours" widget="float_time"/>
|
||||||
<group col="3" colspan="2">
|
<group col="3" colspan="2">
|
||||||
<field name="remaining_hours" select="2" widget="float_time" attrs="{'readonly':[('state','!=','draft')]}" 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')]}"/>
|
<button name="%(action_config_compute_remaining)d" string="Review" type="action" colspan="1" target="new" states="open,pending"/>
|
||||||
</group>
|
</group>
|
||||||
<field name="effective_hours" widget="float_time"/>
|
<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",
|
"version": "1.0",
|
||||||
"author" : "Tiny",
|
"author" : "Tiny",
|
||||||
"website" : "http://www.openerp.com",
|
"website" : "http://www.openerp.com",
|
||||||
"category" : "Generic Modules/Projects & Services",
|
"category" : "Generic Modules/Projects & Services",
|
||||||
"depends" : ["project", 'mrp', "sale", "mrp_jit"],
|
"depends" : ["project", 'mrp', "sale", "mrp_jit"],
|
||||||
"description": """
|
"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, ...
|
procurements: sales order, manufacturing order, ...
|
||||||
|
|
||||||
It is mainly used to invoices services based on tasks by doing sales
|
It is mainly used to invoices services based on tasks automatically
|
||||||
order on services products.
|
created by sales orders.
|
||||||
""",
|
""",
|
||||||
"init_xml" : [],
|
"init_xml" : [],
|
||||||
"demo_xml" : [],
|
"demo_xml" : [],
|
||||||
|
|
|
@ -31,7 +31,6 @@ class product_product(osv.osv):
|
||||||
|
|
||||||
def _pricelist_calculate(self, cr, uid, ids, name, arg, context=None):
|
def _pricelist_calculate(self, cr, uid, ids, name, arg, context=None):
|
||||||
result = {}
|
result = {}
|
||||||
format=""
|
|
||||||
pricelist_obj=self.pool.get('product.pricelist')
|
pricelist_obj=self.pool.get('product.pricelist')
|
||||||
if name=='pricelist_purchase':
|
if name=='pricelist_purchase':
|
||||||
pricelist_ids=pricelist_obj.search(cr,uid,[('type','=','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_ids=pricelist_obj.search(cr,uid,[('type','=','sale')])
|
||||||
pricelist_browse=pricelist_obj.browse(cr,uid,pricelist_ids)
|
pricelist_browse=pricelist_obj.browse(cr,uid,pricelist_ids)
|
||||||
for product in self.browse(cr, uid, ids, context):
|
for product in self.browse(cr, uid, ids, context):
|
||||||
|
result[product.id] = ""
|
||||||
for pricelist in pricelist_browse:
|
for pricelist in pricelist_browse:
|
||||||
for version in pricelist.version_id:
|
for version in pricelist.version_id:
|
||||||
for items in version.items_id:
|
for items in version.items_id:
|
||||||
qty=items.min_quantity
|
qty=items.min_quantity
|
||||||
price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
|
try:
|
||||||
if name=='pricelist_purchase':
|
price=pricelist_obj.price_get(cr, uid,[pricelist.id],product.id,qty,partner=None, context=None)
|
||||||
format+=pricelist.name + "\t" +str(qty) +" \t\t" + str(price[pricelist.id]) + "\n"
|
except:
|
||||||
else:
|
price = 0.0
|
||||||
format+=pricelist.name + "\t\t\t" +str(qty) +" \t\t\t" + str(price[pricelist.id]) + "\n"
|
result[product.id]+= ("%s (%.2f) : %.2f" % (pricelist.name,qty or 0.0,price[pricelist.id] or 0.0)) + "\n"
|
||||||
result[product.id]=format
|
break
|
||||||
format=""
|
break
|
||||||
return result
|
return result
|
||||||
|
|
||||||
_columns = {
|
_columns = {
|
||||||
|
|
|
@ -10,8 +10,8 @@
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<field colspan="4" name="seller_ids" nolabel="1" position="after">
|
<field colspan="4" name="seller_ids" nolabel="1" position="after">
|
||||||
<group colspan="4" groups="base.group_extended">
|
<group colspan="4" groups="base.group_extended">
|
||||||
<separator string="Sale Pricelists Min.Qty Price" colspan="2"/>
|
<separator string="Sale Pricelists (Min.Qty) : Price" colspan="2"/>
|
||||||
<separator string="Purchase 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_sale" colspan="2"/>
|
||||||
<field nolabel="1" name="pricelist_purchase" colspan="2"/>
|
<field nolabel="1" name="pricelist_purchase" colspan="2"/>
|
||||||
</group>
|
</group>
|
||||||
|
|
|
@ -382,7 +382,7 @@ class sale_order(osv.osv):
|
||||||
return inv_id
|
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
|
res = False
|
||||||
invoices = {}
|
invoices = {}
|
||||||
invoice_ids = []
|
invoice_ids = []
|
||||||
|
@ -401,7 +401,7 @@ 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')
|
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], []))
|
||||||
|
@ -409,7 +409,7 @@ class sale_order(osv.osv):
|
||||||
self.write(cr, uid, [o.id], {'state' : 'progress'})
|
self.write(cr, uid, [o.id], {'state' : 'progress'})
|
||||||
if o.order_policy=='picking':
|
if o.order_policy=='picking':
|
||||||
picking_obj.write(cr,uid,map(lambda x:x.id,o.picking_ids),{'invoice_state':'invoiced'})
|
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:
|
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)
|
||||||
|
@ -417,7 +417,7 @@ class sale_order(osv.osv):
|
||||||
self.write(cr, uid, [order.id], {'state' : 'progress'})
|
self.write(cr, uid, [order.id], {'state' : 'progress'})
|
||||||
if order.order_policy=='picking':
|
if order.order_policy=='picking':
|
||||||
picking_obj.write(cr,uid,map(lambda x:x.id,order.picking_ids),{'invoice_state':'invoiced'})
|
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
|
return res
|
||||||
|
|
||||||
def action_invoice_cancel(self, cr, uid, ids, context={}):
|
def action_invoice_cancel(self, cr, uid, ids, context={}):
|
||||||
|
@ -499,26 +499,24 @@ class sale_order(osv.osv):
|
||||||
write_cancel_ids = []
|
write_cancel_ids = []
|
||||||
for order in self.browse(cr, uid, ids, context={}):
|
for order in self.browse(cr, uid, ids, context={}):
|
||||||
for line in order.order_line:
|
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
|
finished = True
|
||||||
|
if line.state != 'done':
|
||||||
|
write_done_ids.append(line.id)
|
||||||
else:
|
else:
|
||||||
finished = False
|
finished = False
|
||||||
if line.procurement_id:
|
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
|
canceled = True
|
||||||
if line.state != 'cancel':
|
if line.state != 'exception':
|
||||||
write_cancel_ids.append(line.id)
|
write_cancel_ids.append(line.id)
|
||||||
else:
|
else:
|
||||||
notcanceled = True
|
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:
|
if write_done_ids:
|
||||||
self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
|
self.pool.get('sale.order.line').write(cr, uid, write_done_ids, {'state': 'done'})
|
||||||
if write_cancel_ids:
|
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':
|
if mode=='finished':
|
||||||
return finished
|
return finished
|
||||||
|
@ -622,8 +620,12 @@ class sale_order(osv.osv):
|
||||||
|
|
||||||
if order.state=='shipping_except':
|
if order.state=='shipping_except':
|
||||||
val['state'] = 'progress'
|
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)
|
self.write(cr, uid, [order.id], val)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
@ -632,10 +634,18 @@ class sale_order(osv.osv):
|
||||||
for order in self.browse(cr, uid, ids):
|
for order in self.browse(cr, uid, ids):
|
||||||
val = {'shipped':True}
|
val = {'shipped':True}
|
||||||
if order.state=='shipping_except':
|
if order.state=='shipping_except':
|
||||||
if (order.order_policy=='manual') and not order.invoice_ids:
|
val['state'] = 'progress'
|
||||||
val['state'] = 'manual'
|
if (order.order_policy == 'manual'):
|
||||||
else:
|
for line in order.order_line:
|
||||||
val['state'] = 'progress'
|
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)
|
self.write(cr, uid, [order.id], val)
|
||||||
return True
|
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'),
|
'number_packages': fields.function(_number_packages, method=True, type='integer', string='Number packages'),
|
||||||
'notes': fields.text('Notes'),
|
'notes': fields.text('Notes'),
|
||||||
'th_weight' : fields.float('Weight'),
|
'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_partner_id': fields.related('order_id', 'partner_id', type='many2one', relation='res.partner', string='Customer')
|
||||||
}
|
}
|
||||||
_order = 'sequence, id'
|
_order = 'sequence, id'
|
||||||
|
@ -787,11 +797,17 @@ class sale_order_line(osv.osv):
|
||||||
'note': line.notes,
|
'note': line.notes,
|
||||||
'account_analytic_id': line.order_id.project_id.id,
|
'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})
|
self.write(cr, uid, [line.id], {'invoiced':True})
|
||||||
create_ids.append(inv_id)
|
create_ids.append(inv_id)
|
||||||
return create_ids
|
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={}):
|
def button_confirm(self, cr, uid, ids, context={}):
|
||||||
return self.write(cr, uid, ids, {'state':'confirmed'})
|
return self.write(cr, uid, ids, {'state':'confirmed'})
|
||||||
|
|
||||||
|
|
|
@ -384,11 +384,11 @@
|
||||||
<page string="Order Lines">
|
<page string="Order Lines">
|
||||||
<separator colspan="4" string="Automatic Declaration"/>
|
<separator colspan="4" string="Automatic Declaration"/>
|
||||||
<field name="order_id" select="1"/>
|
<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_qty" readonly="1" select="2"/>
|
||||||
<field name="product_uom" readonly="2"/>
|
<field name="product_uom" readonly="2"/>
|
||||||
<field name="product_id" readonly="1" select="1"/>
|
<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"/>
|
<separator colspan="4" string="Manual Designation"/>
|
||||||
<field colspan="4" name="name" select="2"/>
|
<field colspan="4" name="name" select="2"/>
|
||||||
|
@ -401,7 +401,8 @@
|
||||||
<separator colspan="4" string="States"/>
|
<separator colspan="4" string="States"/>
|
||||||
<field name="state" select="2"/>
|
<field name="state" select="2"/>
|
||||||
<group col="2" colspan="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>
|
</group>
|
||||||
</page>
|
</page>
|
||||||
<page string="Properties">
|
<page string="Properties">
|
||||||
|
|
|
@ -66,7 +66,7 @@ def _makeInvoices(self, cr, uid, data, context):
|
||||||
return inv_id
|
return inv_id
|
||||||
|
|
||||||
for line in pool.get('sale.order.line').browse(cr,uid,data['ids']):
|
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:
|
if not line.order_id.id in invoices:
|
||||||
invoices[line.order_id.id] = []
|
invoices[line.order_id.id] = []
|
||||||
line_id = pool.get('sale.order.line').invoice_line_create(cr, uid,
|
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)
|
il = map(lambda x: x[1], result)
|
||||||
res = make_invoice(order, il)
|
res = make_invoice(order, il)
|
||||||
cr.execute('INSERT INTO sale_order_invoice_rel \
|
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 {}
|
return {}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -234,9 +234,9 @@ class stock_location(osv.osv):
|
||||||
result = []
|
result = []
|
||||||
amount = 0.0
|
amount = 0.0
|
||||||
for id in self.search(cr, uid, [('location_id', 'child_of', ids)]):
|
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()
|
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()
|
results += cr.dictfetchall()
|
||||||
|
|
||||||
total = 0.0
|
total = 0.0
|
||||||
|
|
|
@ -540,7 +540,10 @@
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
<field name="address_id" select="1" context="{'context_display':'partner'}"/>
|
<field name="address_id" select="1" context="{'context_display':'partner'}"/>
|
||||||
<field groups="base.group_extended" name="product_packaging"/>
|
<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"/>
|
<field groups="base.group_extended" name="tracking_id" select="2"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label/>
|
<label/>
|
||||||
|
@ -633,7 +636,10 @@
|
||||||
<field invisible="1" name="date"/>
|
<field invisible="1" name="date"/>
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
<field groups="base.group_extended" name="product_packaging"/>
|
<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"/>
|
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||||
<separator colspan="4" string="Move State"/>
|
<separator colspan="4" string="Move State"/>
|
||||||
<field name="state" select="1"/>
|
<field name="state" select="1"/>
|
||||||
|
@ -821,7 +827,10 @@
|
||||||
<field invisible="1" name="date"/>
|
<field invisible="1" name="date"/>
|
||||||
<field name="date_planned"/>
|
<field name="date_planned"/>
|
||||||
<field groups="base.group_extended" name="product_packaging"/>
|
<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"/>
|
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||||
<button name="%(track_line)d" string="Split in production lots" type="action"/>
|
<button name="%(track_line)d" string="Split in production lots" type="action"/>
|
||||||
<separator colspan="4" string="Move State"/>
|
<separator colspan="4" string="Move State"/>
|
||||||
|
@ -1005,7 +1014,10 @@
|
||||||
<newline/>
|
<newline/>
|
||||||
<field groups="base.group_extended" name="product_packaging"/>
|
<field groups="base.group_extended" name="product_packaging"/>
|
||||||
<newline/>
|
<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"/>
|
<field groups="base.group_extended" name="tracking_id" select="1"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label/>
|
<label/>
|
||||||
|
@ -1220,7 +1232,10 @@
|
||||||
<field name="priority"/>
|
<field name="priority"/>
|
||||||
<field name="address_id" select="2" context="{'context_display':'partner'}"/>
|
<field name="address_id" select="2" context="{'context_display':'partner'}"/>
|
||||||
<newline/>
|
<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"/>
|
<field name="tracking_id" select="2"/>
|
||||||
<newline/>
|
<newline/>
|
||||||
<label/>
|
<label/>
|
||||||
|
|
Loading…
Reference in New Issue